Преглед на файлове

Made global variables in header files extern and implement them in their respective source file. (#2318)

Jittapan Pluemsumran преди 7 години
родител
ревизия
71421a4268
променени са 19 файла, в които са добавени 71 реда и са изтрити 34 реда
  1. 2 0
      src/map/atcommand.c
  2. 1 1
      src/map/atcommand.h
  3. 4 4
      src/map/chrif.h
  4. 2 0
      src/map/clif.c
  5. 1 1
      src/map/clif.h
  6. 2 0
      src/map/itemdb.c
  7. 1 1
      src/map/itemdb.h
  8. 10 0
      src/map/map.cpp
  9. 9 9
      src/map/map.h
  10. 1 0
      src/map/mapreg.c
  11. 1 1
      src/map/mapreg.h
  12. 2 0
      src/map/npc.c
  13. 1 1
      src/map/npc.h
  14. 4 0
      src/map/pc.c
  15. 3 3
      src/map/pc.h
  16. 6 0
      src/map/script.c
  17. 6 6
      src/map/script.h
  18. 8 0
      src/map/status.c
  19. 7 7
      src/map/status.h

+ 2 - 0
src/map/atcommand.c

@@ -80,6 +80,8 @@ static char atcmd_output[CHAT_SIZE_MAX];
 static char atcmd_player_name[NAME_LENGTH];
 static char atcmd_player_name[NAME_LENGTH];
 const char *parent_cmd;
 const char *parent_cmd;
 
 
+struct atcmd_binding_data** atcmd_binding;
+
 static AtCommandInfo* get_atcommandinfo_byname(const char *name); // @help
 static AtCommandInfo* get_atcommandinfo_byname(const char *name); // @help
 static const char* atcommand_checkalias(const char *aliasname); // @help
 static const char* atcommand_checkalias(const char *aliasname); // @help
 static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool atcommand); // @help
 static void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool atcommand); // @help

+ 1 - 1
src/map/atcommand.h

@@ -45,7 +45,7 @@ struct atcmd_binding_data {
 	int level;
 	int level;
 	int level2;
 	int level2;
 };
 };
-struct atcmd_binding_data** atcmd_binding;
+extern struct atcmd_binding_data** atcmd_binding;
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);
 struct atcmd_binding_data* get_atcommandbind_byname(const char* name);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus

+ 4 - 4
src/map/chrif.h

@@ -4,14 +4,14 @@
 #ifndef _CHRIF_H_
 #ifndef _CHRIF_H_
 #define _CHRIF_H_
 #define _CHRIF_H_
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "../common/cbasetypes.h"
 #include "../common/cbasetypes.h"
 #include "../common/socket.h" // enum chrif_req_op
 #include "../common/socket.h" // enum chrif_req_op
 #include <time.h>
 #include <time.h>
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
 enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
 
 
 enum e_chrif_save_opt {
 enum e_chrif_save_opt {

+ 2 - 0
src/map/clif.c

@@ -58,6 +58,8 @@ static struct eri *delay_clearunit_ers;
 
 
 struct s_packet_db packet_db[MAX_PACKET_DB + 1];
 struct s_packet_db packet_db[MAX_PACKET_DB + 1];
 int packet_db_ack[MAX_ACK_FUNC + 1];
 int packet_db_ack[MAX_ACK_FUNC + 1];
+unsigned long color_table[COLOR_MAX];
+
 #include "clif_obfuscation.h"
 #include "clif_obfuscation.h"
 static bool clif_session_isValid(struct map_session_data *sd);
 static bool clif_session_isValid(struct map_session_data *sd);
 
 

+ 1 - 1
src/map/clif.h

@@ -1027,7 +1027,7 @@ enum clif_colors {
 	COLOR_LIGHT_GREEN,
 	COLOR_LIGHT_GREEN,
 	COLOR_MAX
 	COLOR_MAX
 };
 };
-unsigned long color_table[COLOR_MAX];
+extern unsigned long color_table[COLOR_MAX];
 
 
 void clif_channel_msg(struct Channel *channel, const char *msg, unsigned long color);
 void clif_channel_msg(struct Channel *channel, const char *msg, unsigned long color);
 
 

+ 2 - 0
src/map/itemdb.c

@@ -22,6 +22,8 @@ static DBMap *itemdb_randomopt_group; /// Random option group DB
 
 
 struct item_data *dummy_item; /// This is the default dummy item used for non-existant items. [Skotlex]
 struct item_data *dummy_item; /// This is the default dummy item used for non-existant items. [Skotlex]
 
 
+struct s_roulette_db rd;
+
 /**
 /**
 * Check if combo exists
 * Check if combo exists
 * @param combo_id
 * @param combo_id

+ 1 - 1
src/map/itemdb.h

@@ -769,7 +769,7 @@ struct s_item_group_db
 };
 };
 
 
 /// Struct of Roulette db
 /// Struct of Roulette db
-struct s_roulette_db {
+extern struct s_roulette_db {
 	unsigned short *nameid[MAX_ROULETTE_LEVEL], /// Item ID
 	unsigned short *nameid[MAX_ROULETTE_LEVEL], /// Item ID
 		           *qty[MAX_ROULETTE_LEVEL]; /// Amount of Item ID
 		           *qty[MAX_ROULETTE_LEVEL]; /// Amount of Item ID
 	int *flag[MAX_ROULETTE_LEVEL]; /// Whether the item is for loss or win
 	int *flag[MAX_ROULETTE_LEVEL]; /// Whether the item is for loss or win

+ 10 - 0
src/map/map.cpp

@@ -162,6 +162,16 @@ char help2_txt[256] = "conf/help2.txt";
 char charhelp_txt[256] = "conf/charhelp.txt";
 char charhelp_txt[256] = "conf/charhelp.txt";
 char channel_conf[256] = "conf/channels.conf";
 char channel_conf[256] = "conf/channels.conf";
 
 
+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;
+
 char wisp_server_name[NAME_LENGTH] = "Server"; // can be modified in char-server configuration file
 char wisp_server_name[NAME_LENGTH] = "Server"; // can be modified in char-server configuration file
 
 
 struct s_map_default map_default;
 struct s_map_default map_default;

+ 9 - 9
src/map/map.h

@@ -940,15 +940,15 @@ extern const char*SCRIPT_CONF_NAME;
 extern const char*MSG_CONF_NAME_EN;
 extern const char*MSG_CONF_NAME_EN;
 extern const char*GRF_PATH_FILENAME;
 extern const char*GRF_PATH_FILENAME;
 //Other languages supported
 //Other languages supported
-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;
+extern const char*MSG_CONF_NAME_RUS;
+extern const char*MSG_CONF_NAME_SPN;
+extern const char*MSG_CONF_NAME_GRM;
+extern const char*MSG_CONF_NAME_CHN;
+extern const char*MSG_CONF_NAME_MAL;
+extern const char*MSG_CONF_NAME_IDN;
+extern const char*MSG_CONF_NAME_FRN;
+extern const char*MSG_CONF_NAME_POR;
+extern const char*MSG_CONF_NAME_THA;
 
 
 //Useful typedefs from jA [Skotlex]
 //Useful typedefs from jA [Skotlex]
 typedef struct map_session_data TBL_PC;
 typedef struct map_session_data TBL_PC;

+ 1 - 0
src/map/mapreg.c

@@ -22,6 +22,7 @@ bool skip_insert = false;
 
 
 static char mapreg_table[32] = "mapreg";
 static char mapreg_table[32] = "mapreg";
 static bool mapreg_dirty = false; // Whether there are modified regs to be saved
 static bool mapreg_dirty = false; // Whether there are modified regs to be saved
+struct reg_db regs;
 
 
 #define MAPREG_AUTOSAVE_INTERVAL (300*1000)
 #define MAPREG_AUTOSAVE_INTERVAL (300*1000)
 
 

+ 1 - 1
src/map/mapreg.h

@@ -20,7 +20,7 @@ struct mapreg_save {
 	bool save;         ///< Whether a save operation is pending
 	bool save;         ///< Whether a save operation is pending
 };
 };
 
 
-struct reg_db regs;
+extern struct reg_db regs;
 extern bool skip_insert;
 extern bool skip_insert;
 
 
 void mapreg_reload(void);
 void mapreg_reload(void);

+ 2 - 0
src/map/npc.c

@@ -42,6 +42,8 @@ static int npc_mob=0;
 static int npc_delay_mob=0;
 static int npc_delay_mob=0;
 static int npc_cache_mob=0;
 static int npc_cache_mob=0;
 
 
+struct eri *npc_sc_display_ers;
+
 // Market Shop
 // Market Shop
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 struct s_npc_market {
 struct s_npc_market {

+ 1 - 1
src/map/npc.h

@@ -106,7 +106,7 @@ struct npc_data {
 	} progressbar;
 	} progressbar;
 };
 };
 
 
-struct eri *npc_sc_display_ers;
+extern struct eri *npc_sc_display_ers;
 
 
 #define START_NPC_NUM 110000000
 #define START_NPC_NUM 110000000
 
 

+ 4 - 0
src/map/pc.c

@@ -58,12 +58,16 @@ int night_timer_tid = INVALID_TIMER;
 
 
 struct eri *pc_sc_display_ers = NULL;
 struct eri *pc_sc_display_ers = NULL;
 struct eri *pc_itemgrouphealrate_ers = NULL;
 struct eri *pc_itemgrouphealrate_ers = NULL;
+struct eri *num_reg_ers;
+struct eri *str_reg_ers;
 int pc_expiration_tid = INVALID_TIMER;
 int pc_expiration_tid = INVALID_TIMER;
 
 
 struct fame_list smith_fame_list[MAX_FAME_LIST];
 struct fame_list smith_fame_list[MAX_FAME_LIST];
 struct fame_list chemist_fame_list[MAX_FAME_LIST];
 struct fame_list chemist_fame_list[MAX_FAME_LIST];
 struct fame_list taekwon_fame_list[MAX_FAME_LIST];
 struct fame_list taekwon_fame_list[MAX_FAME_LIST];
 
 
+struct s_job_info job_info[CLASS_COUNT];
+
 #define MOTD_LINE_SIZE 128
 #define MOTD_LINE_SIZE 128
 static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris]
 static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris]
 
 

+ 3 - 3
src/map/pc.h

@@ -744,8 +744,8 @@ extern struct eri *pc_itemgrouphealrate_ers; /// Player's Item Group Heal Rate t
 /**
 /**
  * ERS for the bulk of pc vars
  * ERS for the bulk of pc vars
  **/
  **/
-struct eri *num_reg_ers;
-struct eri *str_reg_ers;
+extern struct eri *num_reg_ers;
+extern struct eri *str_reg_ers;
 
 
 /* Global Expiration Timer ID */
 /* Global Expiration Timer ID */
 extern int pc_expiration_tid;
 extern int pc_expiration_tid;
@@ -832,7 +832,7 @@ enum item_check {
 	ITMCHK_ALL       = ITMCHK_INVENTORY|ITMCHK_CART|ITMCHK_STORAGE,
 	ITMCHK_ALL       = ITMCHK_INVENTORY|ITMCHK_CART|ITMCHK_STORAGE,
 };
 };
 
 
-struct {
+extern struct s_job_info {
 	unsigned int base_hp[MAX_LEVEL], base_sp[MAX_LEVEL]; //Storage for the first calculation with hp/sp factor and multiplicator
 	unsigned int base_hp[MAX_LEVEL], base_sp[MAX_LEVEL]; //Storage for the first calculation with hp/sp factor and multiplicator
 	int hp_factor, hp_multiplicator, sp_factor;
 	int hp_factor, hp_multiplicator, sp_factor;
 	int max_weight_base;
 	int max_weight_base;

+ 6 - 0
src/map/script.c

@@ -58,6 +58,12 @@
 #include <errno.h>
 #include <errno.h>
 
 
 
 
+struct eri *array_ers;
+DBMap *st_db;
+unsigned int active_scripts;
+unsigned int next_id;
+struct eri *st_ers;
+struct eri *stack_ers;
 
 
 static bool script_rid2sd_( struct script_state *st, struct map_session_data** sd, const char *func );
 static bool script_rid2sd_( struct script_state *st, struct map_session_data** sd, const char *func );
 
 

+ 6 - 6
src/map/script.h

@@ -706,12 +706,12 @@ enum vip_status_type {
 /**
 /**
  * used to generate quick script_array entries
  * used to generate quick script_array entries
  **/
  **/
-struct eri *array_ers;
-DBMap *st_db;
-unsigned int active_scripts;
-unsigned int next_id;
-struct eri *st_ers;
-struct eri *stack_ers;
+extern struct eri *array_ers;
+extern DBMap *st_db;
+extern unsigned int active_scripts;
+extern unsigned int next_id;
+extern struct eri *st_ers;
+extern struct eri *stack_ers;
 
 
 const char* skip_space(const char* p);
 const char* skip_space(const char* p);
 void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos);
 void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos);

+ 8 - 0
src/map/status.c

@@ -55,6 +55,14 @@ short current_equip_opt_index; /// Contains random option index of an equipped i
 
 
 unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh]
 
 
+sc_type SkillStatusChangeTable[MAX_SKILL];
+int StatusIconChangeTable[SC_MAX];
+unsigned int StatusChangeFlagTable[SC_MAX];
+int StatusSkillChangeTable[SC_MAX];
+int StatusRelevantBLTypes[SI_MAX];
+unsigned int StatusChangeStateTable[SC_MAX];
+unsigned int StatusDisplayType[SC_MAX];
+
 static unsigned short status_calc_str(struct block_list *,struct status_change *,int);
 static unsigned short status_calc_str(struct block_list *,struct status_change *,int);
 static unsigned short status_calc_agi(struct block_list *,struct status_change *,int);
 static unsigned short status_calc_agi(struct block_list *,struct status_change *,int);
 static unsigned short status_calc_vit(struct block_list *,struct status_change *,int);
 static unsigned short status_calc_vit(struct block_list *,struct status_change *,int);

+ 7 - 7
src/map/status.h

@@ -2082,13 +2082,13 @@ struct weapon_atk {
 #endif
 #endif
 };
 };
 
 
-sc_type SkillStatusChangeTable[MAX_SKILL];   /// skill  -> status
-int StatusIconChangeTable[SC_MAX];           /// status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated)
-unsigned int StatusChangeFlagTable[SC_MAX];  /// status -> flags
-int StatusSkillChangeTable[SC_MAX];          /// status -> skill
-int StatusRelevantBLTypes[SI_MAX];           /// "icon" -> enum bl_type (for clif->status_change to identify for which bl types to send packets)
-unsigned int StatusChangeStateTable[SC_MAX]; /// status -> flags
-unsigned int StatusDisplayType[SC_MAX];
+extern sc_type SkillStatusChangeTable[MAX_SKILL];   /// skill  -> status
+extern int StatusIconChangeTable[SC_MAX];           /// status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated)
+extern unsigned int StatusChangeFlagTable[SC_MAX];  /// status -> flags
+extern int StatusSkillChangeTable[SC_MAX];          /// status -> skill
+extern int StatusRelevantBLTypes[SI_MAX];           /// "icon" -> enum bl_type (for clif->status_change to identify for which bl types to send packets)
+extern unsigned int StatusChangeStateTable[SC_MAX]; /// status -> flags
+extern unsigned int StatusDisplayType[SC_MAX];
 
 
 ///For holding basic status (which can be modified by status changes)
 ///For holding basic status (which can be modified by status changes)
 struct status_data {
 struct status_data {