diff --git a/.gitignore b/.gitignore index 8c02e49a83..80825adbf2 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,9 @@ Thumbs.db /3rdparty/mt19937ar/Makefile /3rdparty/mt19937ar/*.o +# /3rdparty/yaml-cpp/ +/3rdparty/yaml-cpp/Makefile + # /db/ /db/import diff --git a/src/char/char.cpp b/src/char/char.cpp index 97149267db..0758d23a98 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -3020,7 +3020,7 @@ static void char_config_adjust() { /* * Message conf function */ -int char_msg_config_read(char *cfgName){ +int char_msg_config_read(const char *cfgName){ return _msg_config_read(cfgName,CHAR_MAX_MSG,msg_table); } const char* char_msg_txt(int msg_number){ diff --git a/src/common/cli.c b/src/common/cli.c index 2c9318ad1b..91b361f41b 100644 --- a/src/common/cli.c +++ b/src/common/cli.c @@ -22,21 +22,21 @@ #include "cli.h" //map confs -char* MAP_CONF_NAME; -char* INTER_CONF_NAME; -char* LOG_CONF_NAME; -char* BATTLE_CONF_FILENAME; -char* ATCOMMAND_CONF_FILENAME; -char* SCRIPT_CONF_NAME; -char* GRF_PATH_FILENAME; +const char* MAP_CONF_NAME; +const char* INTER_CONF_NAME; +const char* LOG_CONF_NAME; +const char* BATTLE_CONF_FILENAME; +const char* ATCOMMAND_CONF_FILENAME; +const char* SCRIPT_CONF_NAME; +const char* GRF_PATH_FILENAME; //char confs -char* CHAR_CONF_NAME; -char* SQL_CONF_NAME; +const char* CHAR_CONF_NAME; +const char* SQL_CONF_NAME; //login confs -char* LOGIN_CONF_NAME; +const char* LOGIN_CONF_NAME; //common conf (used by multiple serv) -char* LAN_CONF_NAME; //char-login -char* MSG_CONF_NAME_EN; //all +const char* LAN_CONF_NAME; //char-login +const char* MSG_CONF_NAME_EN; //all /** * Function to check if the specified option has an argument following it. diff --git a/src/common/cli.h b/src/common/cli.h index 4819dfa494..dac3cc5a8f 100644 --- a/src/common/cli.h +++ b/src/common/cli.h @@ -17,21 +17,21 @@ extern "C" { #define MAX_CONSOLE_IN 200 //max is map... #define MIN_CONSOLE_IN 4 //min is help //map - extern char* MAP_CONF_NAME; - extern char* INTER_CONF_NAME; - extern char* LOG_CONF_NAME; - extern char* BATTLE_CONF_FILENAME; - extern char* ATCOMMAND_CONF_FILENAME; - extern char* SCRIPT_CONF_NAME; - extern char* GRF_PATH_FILENAME; + extern const char* MAP_CONF_NAME; + extern const char* INTER_CONF_NAME; + extern const char* LOG_CONF_NAME; + extern const char* BATTLE_CONF_FILENAME; + extern const char* ATCOMMAND_CONF_FILENAME; + extern const char* SCRIPT_CONF_NAME; + extern const char* GRF_PATH_FILENAME; //char - extern char* CHAR_CONF_NAME; - extern char* SQL_CONF_NAME; + extern const char* CHAR_CONF_NAME; + extern const char* SQL_CONF_NAME; //login - extern char* LOGIN_CONF_NAME; + extern const char* LOGIN_CONF_NAME; //common - extern char* LAN_CONF_NAME; //char-login - extern char* MSG_CONF_NAME_EN; //all + extern const char* LAN_CONF_NAME; //char-login + extern const char* MSG_CONF_NAME_EN; //all extern void display_helpscreen(bool exit); bool cli_hasevent(); diff --git a/src/common/timer.c b/src/common/timer.c index 99c20884c3..32a368fe92 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -61,7 +61,7 @@ struct timer_func_list { } *tfl_root = NULL; /// Sets the name of a timer function. -int add_timer_func_list(TimerFunc func, char* name) +int add_timer_func_list(TimerFunc func, const char* name) { struct timer_func_list* tfl; diff --git a/src/common/timer.h b/src/common/timer.h index 8e3b2be76e..06aef8f721 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -51,7 +51,7 @@ int delete_timer(int tid, TimerFunc func); int addtick_timer(int tid, unsigned int tick); int settick_timer(int tid, unsigned int tick); -int add_timer_func_list(TimerFunc func, char* name); +int add_timer_func_list(TimerFunc func, const char* name); unsigned long get_uptime(void); diff --git a/src/map/map.cpp b/src/map/map.cpp index 1c370d5952..6dec394ce5 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -3581,7 +3581,7 @@ int map_readallmaps (void) if( enable_grf ) ShowStatus("Loading maps (using GRF files)...\n"); else { - char* mapcachefilepath[] = { + const char* mapcachefilepath[] = { "db/" DBPATH "map_cache.dat", "db/import/map_cache.dat" }; @@ -3772,7 +3772,7 @@ int parse_console(const char* buf){ /*========================================== * Read map server configuration files (conf/map_athena.conf...) *------------------------------------------*/ -int map_config_read(char *cfgName) +int map_config_read(const char *cfgName) { char line[1024], w1[32], w2[1024]; FILE *fp; @@ -3878,7 +3878,7 @@ int map_config_read(char *cfgName) return 0; } -void map_reloadnpc_sub(char *cfgName) +void map_reloadnpc_sub(const char *cfgName) { char line[1024], w1[1024], w2[1024]; FILE *fp; @@ -3932,7 +3932,7 @@ void map_reloadnpc(bool clear) #endif } -int inter_config_read(char *cfgName) +int inter_config_read(const char *cfgName) { char line[1024],w1[1024],w2[1024]; FILE *fp; @@ -4523,7 +4523,7 @@ struct msg_data *map_lang2msgdb(uint8 lang){ void map_do_init_msg(void){ int test=0, i=0, size; - char * listelang[] = { + const char * listelang[] = { MSG_CONF_NAME_EN, //default MSG_CONF_NAME_RUS, MSG_CONF_NAME_SPN, @@ -4559,7 +4559,7 @@ void map_msg_reload(void){ map_do_final_msg(); //clear data map_do_init_msg(); } -int map_msg_config_read(char *cfgName, int lang){ +int map_msg_config_read(const char *cfgName, int lang){ struct msg_data *mdb; if( (mdb = map_lang2msgdb(lang)) == NULL ) diff --git a/src/map/map.h b/src/map/map.h index 0ac4e72ee9..1509c260f4 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -33,7 +33,7 @@ enum E_MAPSERVER_ST { #define msg_config_read(cfgName,isnew) map_msg_config_read(cfgName,isnew) #define msg_txt(sd,msg_number) map_msg_txt(sd,msg_number) #define do_final_msg() map_do_final_msg() -int map_msg_config_read(char *cfgName,int lang); +int map_msg_config_read(const char *cfgName,int lang); const char* map_msg_txt(struct map_session_data *sd,int msg_number); void map_do_final_msg(void); void map_msg_reload(void); @@ -931,24 +931,24 @@ void map_skill_damage_add(struct map_data *m, uint16 skill_id, int pc, int mob, #define CHK_CLASS(class_) ((class_) > CLASS_NONE && (class_) < CLASS_MAX) /// Check valid Class //Options read in cli -extern char *INTER_CONF_NAME; -extern char *LOG_CONF_NAME; -extern char *MAP_CONF_NAME; -extern char *BATTLE_CONF_FILENAME; -extern char *ATCOMMAND_CONF_FILENAME; -extern char *SCRIPT_CONF_NAME; -extern char *MSG_CONF_NAME_EN; -extern char *GRF_PATH_FILENAME; +extern const char*INTER_CONF_NAME; +extern const char*LOG_CONF_NAME; +extern const char*MAP_CONF_NAME; +extern const char*BATTLE_CONF_FILENAME; +extern const char*ATCOMMAND_CONF_FILENAME; +extern const char*SCRIPT_CONF_NAME; +extern const char*MSG_CONF_NAME_EN; +extern const char*GRF_PATH_FILENAME; //Other languages supported -char *MSG_CONF_NAME_RUS; -char *MSG_CONF_NAME_SPN; -char *MSG_CONF_NAME_GRM; -char *MSG_CONF_NAME_CHN; -char *MSG_CONF_NAME_MAL; -char *MSG_CONF_NAME_IDN; -char *MSG_CONF_NAME_FRN; -char *MSG_CONF_NAME_POR; -char *MSG_CONF_NAME_THA; +const char*MSG_CONF_NAME_RUS; +const char*MSG_CONF_NAME_SPN; +const char*MSG_CONF_NAME_GRM; +const char*MSG_CONF_NAME_CHN; +const char*MSG_CONF_NAME_MAL; +const char*MSG_CONF_NAME_IDN; +const char*MSG_CONF_NAME_FRN; +const char*MSG_CONF_NAME_POR; +const char*MSG_CONF_NAME_THA; //Useful typedefs from jA [Skotlex] typedef struct map_session_data TBL_PC; diff --git a/src/map/script.c b/src/map/script.c index e4ad5328e0..ad6eb18d6c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4370,7 +4370,7 @@ void run_script_main(struct script_state *st) } } -int script_config_read(char *cfgName) +int script_config_read(const char *cfgName) { int i; char line[1024],w1[1024],w2[1024]; diff --git a/src/map/script.h b/src/map/script.h index 6888eea2a4..f42de4071c 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -747,7 +747,7 @@ void script_hardcoded_constants(void); void script_cleararray_pc(struct map_session_data* sd, const char* varname, void* value); void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 idx, void* value, int* refcache); -int script_config_read(char *cfgName); +int script_config_read(const char *cfgName); void do_init_script(void); void do_final_script(void); int add_str(const char* p);