فهرست منبع

Follow up to 4a2574c.\r\nThanks to @Jeybla!

Jey 8 سال پیش
والد
کامیت
809fc35b0e
10فایلهای تغییر یافته به همراه56 افزوده شده و 53 حذف شده
  1. 3 0
      .gitignore
  2. 1 1
      src/char/char.cpp
  3. 12 12
      src/common/cli.c
  4. 12 12
      src/common/cli.h
  5. 1 1
      src/common/timer.c
  6. 1 1
      src/common/timer.h
  7. 6 6
      src/map/map.cpp
  8. 18 18
      src/map/map.h
  9. 1 1
      src/map/script.c
  10. 1 1
      src/map/script.h

+ 3 - 0
.gitignore

@@ -50,6 +50,9 @@ Thumbs.db
 /3rdparty/mt19937ar/Makefile
 /3rdparty/mt19937ar/*.o
 
+# /3rdparty/yaml-cpp/
+/3rdparty/yaml-cpp/Makefile
+
 # /db/
 /db/import
 

+ 1 - 1
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){

+ 12 - 12
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.

+ 12 - 12
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();

+ 1 - 1
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;
 

+ 1 - 1
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);
 

+ 6 - 6
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 )

+ 18 - 18
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;

+ 1 - 1
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];

+ 1 - 1
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);