From 057c2048fd32f5a627778b08325af99c3b4c0c0d Mon Sep 17 00:00:00 2001 From: Michal Zima Date: Sun, 23 Aug 2009 23:39:20 +0200 Subject: Modification of code according to the code style --- src/client/config.c | 30 ++++++++++++++---------------- src/client/config.h | 5 ++--- src/client/control.c | 2 +- src/client/control.h | 2 +- 4 files changed, 18 insertions(+), 21 deletions(-) (limited to 'src/client') diff --git a/src/client/config.c b/src/client/config.c index be95fb0..92c0776 100644 --- a/src/client/config.c +++ b/src/client/config.c @@ -1,4 +1,3 @@ - #include #include #include @@ -11,14 +10,13 @@ #include "configFile.h" #include "config.h" -typedef struct setting_int_struct -{ - int key; /* identifikacny kluc */ - char *param; /* parameter programu */ - char *var; /* premenna v config subore */ - int type; /* typ udaju - retazec/cislo */ - int value_int; /* hodnota cele cislo */ - char *value_str; /* hodnota retazec */ +typedef struct setting_int_struct { + int key; /* identification key */ + char *param; /* parameter of the program */ + char *var; /* variable in the config file */ + int type; /* type of the data - string/number */ + int value_int; /* numeric data */ + char *value_str; /* textual data */ } config_t; #define CONFIG_TYPE_INT 1 @@ -55,7 +53,7 @@ static config_t config_list[] = static textFile_t *config_file; -static config_t* find_config(int key) +static config_t *find_config(int key) { int i; @@ -165,11 +163,11 @@ int config_get_int_value(int key) assert(tmp != NULL); assert(tmp->type == CONFIG_TYPE_INT); - + return tmp->value_int; } -char* config_get_str_value(int key) +char *config_get_str_value(int key) { config_t *tmp; @@ -177,7 +175,7 @@ char* config_get_str_value(int key) assert(tmp != NULL); assert(tmp->type == CONFIG_TYPE_STR); - + return tmp->value_str; } @@ -189,7 +187,7 @@ void config_set_int_value(int key, int n) assert(tmp != NULL); assert(tmp->type == CONFIG_TYPE_INT); - + tmp->value_int = n; } @@ -201,9 +199,9 @@ void config_set_str_value(int key, char *str) assert(tmp != NULL); assert(tmp->type == CONFIG_TYPE_STR); - + if (tmp->value_str != NULL) { - free(tmp->value_str); // musi to byt alokovane + free(tmp->value_str); /* has to be allocated */ } tmp->value_str = strdup(str); diff --git a/src/client/config.h b/src/client/config.h index ae84a76..46e0da5 100644 --- a/src/client/config.h +++ b/src/client/config.h @@ -28,16 +28,15 @@ #define CFG_NET_IP 21 #define CFG_NET_PORT 22 -#define CONFIG_LIST_COUNT 22 +#define CONFIG_LIST_COUNT 22 extern int config_init(); extern void config_load(); extern void config_save(); extern int config_get_int_value(int key); -extern char* config_get_str_value(int key); +extern char *config_get_str_value(int key); extern void config_set_int_value(int key, int n); extern void config_set_str_value(int key, char *str); extern int config_quit(); #endif /* CONFIG_H */ - diff --git a/src/client/control.c b/src/client/control.c index 737762c..8075692 100644 --- a/src/client/control.c +++ b/src/client/control.c @@ -5,7 +5,7 @@ #include "main.h" #include "control.h" -control_t* control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, +control_t *control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, SDLKey arg_down, SDLKey arg_shot, SDLKey arg_switch) { control_t *tmp; diff --git a/src/client/control.h b/src/client/control.h index 4103f33..6b08189 100644 --- a/src/client/control.h +++ b/src/client/control.h @@ -17,7 +17,7 @@ typedef struct control_struct { int count[CONTROL_KEY_COUNT]; } control_t; -extern control_t* control_new(SDLKey arg_up, SDLKey arg_right, +extern control_t *control_new(SDLKey arg_up, SDLKey arg_right, SDLKey arg_left, SDLKey arg_down, SDLKey arg_shot, SDLKey arg_switch); extern int control_get_key_route(control_t *my_control); -- cgit v1.2.3