summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/conf.h14
-rw-r--r--src/common/console.c72
-rw-r--r--src/common/mapindex.c2
-rw-r--r--src/common/mapindex.h2
4 files changed, 45 insertions, 45 deletions
diff --git a/src/common/conf.h b/src/common/conf.h
index 1889aeb3a..49257835d 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -74,13 +74,13 @@ struct libconfig_interface {
int (*setting_remove_elem) (config_setting_t *parent, unsigned int idx);
void (*setting_set_hook) (config_setting_t *setting, void *hook);
- config_setting_t * (*lookup) (const config_t *config, const char *path);
- config_setting_t * (*lookup_from) (config_setting_t *setting, const char *path);
- int (*lookup_int) (const config_t *config, const char *path, int *value);
- int (*lookup_int64) (const config_t *config, const char *path, long long *value);
- int (*lookup_float) (const config_t *config, const char *path, double *value);
- int (*lookup_bool) (const config_t *config, const char *path, int *value);
- int (*lookup_string) (const config_t *config, const char *path, const char **value);
+ config_setting_t * (*lookup) (const config_t *config, const char *filepath);
+ config_setting_t * (*lookup_from) (config_setting_t *setting, const char *filepath);
+ int (*lookup_int) (const config_t *config, const char *filepath, int *value);
+ int (*lookup_int64) (const config_t *config, const char *filepath, long long *value);
+ int (*lookup_float) (const config_t *config, const char *filepath, double *value);
+ int (*lookup_bool) (const config_t *config, const char *filepath, int *value);
+ int (*lookup_string) (const config_t *config, const char *filepath, const char **value);
/* those are custom and are from src/common/conf.c */
/* Functions to copy settings from libconfig/contrib */
diff --git a/src/common/console.c b/src/common/console.c
index 95d1e69fe..3b49204f6 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -74,12 +74,11 @@ void display_title(void) {
ShowInfo("Compile Flags: %s\n", sysinfo->cflags());
}
#ifdef CONSOLE_INPUT
-#if defined(WIN32)
-int console_parse_key_pressed(void) {
+int console_parse_key_pressed(void)
+{
+#ifdef WIN32
return _kbhit();
-}
-#else /* WIN32 */
-int console_parse_key_pressed(void) {
+#else // ! WIN32
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
@@ -91,8 +90,8 @@ int console_parse_key_pressed(void) {
select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &fds);
+#endif // WIN32
}
-#endif /* _WIN32 */
/*======================================
* CORE: Console commands
@@ -158,41 +157,41 @@ CPCMD_C(skip,update) {
}
/**
- * Defines a main category.
- *
- * Categories can't be used as commands!
- * E.G.
- * - sql update skip
- * 'sql' is the main category
- * CP_DEF_C(category)
+ * Loads console commands list
**/
+void console_load_defaults(void)
+{
+ /**
+ * Defines a main category.
+ *
+ * Categories can't be used as commands!
+ * E.G.
+ * - sql update skip
+ * 'sql' is the main category
+ * CP_DEF_C(category)
+ **/
#define CP_DEF_C(x) { #x , NULL , NULL, NULL }
-/**
- * Defines a sub-category.
- *
- * Sub-categories can't be used as commands!
- * E.G.
- * - sql update skip
- * 'update' is a sub-category
- * CP_DEF_C2(command, category)
- **/
+ /**
+ * Defines a sub-category.
+ *
+ * Sub-categories can't be used as commands!
+ * E.G.
+ * - sql update skip
+ * 'update' is a sub-category
+ * CP_DEF_C2(command, category)
+ **/
#define CP_DEF_C2(x,y) { #x , NULL , #y, NULL }
-/**
- * Defines a command that is inside a category or sub-category
- * CP_DEF_S(command, category/sub-category)
- **/
+ /**
+ * Defines a command that is inside a category or sub-category
+ * CP_DEF_S(command, category/sub-category)
+ **/
#define CP_DEF_S(x,y) { #x, CPCMD_C_A(x,y), #y, NULL }
-/**
- * Defines a command that is _not_ inside any category
- * CP_DEF_S(command)
- **/
+ /**
+ * Defines a command that is _not_ inside any category
+ * CP_DEF_S(command)
+ **/
#define CP_DEF(x) { #x , CPCMD_A(x), NULL, NULL }
-/**
- * Loads console commands list
- * See CP_DEF_C, CP_DEF_C2, CP_DEF_S, CP_DEF
- **/
-void console_load_defaults(void) {
struct {
char *name;
CParseFunc func;
@@ -254,11 +253,12 @@ void console_load_defaults(void) {
}
}
}
-}
#undef CP_DEF_C
#undef CP_DEF_C2
#undef CP_DEF_S
#undef CP_DEF
+}
+
void console_parse_create(char *name, CParseFunc func) {
unsigned int i;
char *tok;
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 18aa413cc..3d3ef52f1 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -124,7 +124,7 @@ unsigned short mapindex_name2id(const char* name) {
return 0;
}
-const char* mapindex_id2name_sub(unsigned short id,const char *file, int line, const char *func) {
+const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const char *func) {
if (id >= MAX_MAPINDEX || !mapindex_exists(id)) {
ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line);
return mapindex->list[0].name; // dummy empty string so that the callee doesn't crash
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index c334e7cca..74eea0aef 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -91,7 +91,7 @@ struct mapindex_interface {
const char* (*getmapname_ext) (const char* string, char* output);
/* TODO: Hello World! make up your mind, this thing is int on some places and unsigned short on others */
unsigned short (*name2id) (const char*);
- const char* (*id2name) (unsigned short,const char *file, int line, const char *func);
+ const char * (*id2name) (uint16 id, const char *file, int line, const char *func);
bool (*check_default) (void);
};