From 8de3c1118a6a7a235cc7a3e77f24b0c4c5c397ae Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 1 Jul 2013 17:03:58 -0300 Subject: Fixed Bug #7216 Special Thanks to Shikazu, wouldn't have been able to identify this issue without his help! http://hercules.ws/board/index.php?app=tracker&showissue=7216 Signed-off-by: shennetsind --- src/map/atcommand.c | 2 ++ src/map/atcommand.h | 2 +- src/map/battle.c | 1 + src/map/battle.h | 2 +- src/map/battleground.c | 1 + src/map/battleground.h | 2 +- src/map/buyingstore.c | 2 +- src/map/buyingstore.h | 2 +- src/map/chrif.c | 2 ++ src/map/chrif.h | 2 +- src/map/clif.c | 2 ++ src/map/clif.h | 2 +- src/map/guild.c | 1 + src/map/guild.h | 2 +- src/map/homunculus.c | 2 ++ src/map/homunculus.h | 2 +- src/map/instance.c | 2 ++ src/map/instance.h | 2 +- src/map/irc-bot.c | 2 ++ src/map/irc-bot.h | 2 +- src/map/itemdb.c | 2 ++ src/map/itemdb.h | 2 +- src/map/log.c | 1 + src/map/log.h | 2 +- src/map/mail.c | 2 ++ src/map/mail.h | 2 +- src/map/map.c | 2 ++ src/map/map.h | 2 +- src/map/party.c | 2 ++ src/map/party.h | 2 +- src/map/pc.c | 2 ++ src/map/pc.h | 2 +- src/map/script.c | 2 ++ src/map/script.h | 2 +- src/map/searchstore.c | 1 + src/map/searchstore.h | 2 +- src/map/skill.c | 3 +++ src/map/skill.h | 2 +- src/map/storage.c | 3 +++ src/map/storage.h | 4 ++-- src/map/trade.c | 2 ++ src/map/trade.h | 2 +- src/map/vending.c | 2 ++ src/map/vending.h | 2 +- 44 files changed, 63 insertions(+), 24 deletions(-) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b778aab6c..f35bf8a12 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -51,6 +51,8 @@ #include #include +struct atcommand_interface atcommand_s; + static char* msg_table[MAX_MSG]; // Server messages (0-499 reserved for GM commands, 500-999 reserved for others) static char atcmd_output[CHAT_SIZE_MAX]; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index f09b1f2b8..12439ab32 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -86,7 +86,7 @@ struct atcommand_interface { void (*final_msg) (void); /* atcommand binding */ struct atcmd_binding_data* (*get_bind_byname) (const char* name); -} atcommand_s; +}; struct atcommand_interface *atcommand; diff --git a/src/map/battle.c b/src/map/battle.c index 37d3ec13e..0ace7e941 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -39,6 +39,7 @@ int attr_fix_table[4][ELE_MAX][ELE_MAX]; struct Battle_Config battle_config; +struct battle_interface battle_s; static struct eri *delay_damage_ers; //For battle delay damage structures. int battle_getcurrentskill(struct block_list *bl) { //Returns the current/last skill in use by this bl. diff --git a/src/map/battle.h b/src/map/battle.h index 37968f53a..9a8c18fd7 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -556,7 +556,7 @@ struct battle_interface { struct block_list* (*get_enemy_area) (struct block_list *src, int x, int y, int range, int type, int ignore_id); /* damages area, originally for royal guard's reflect damage */ int (*damage_area) ( struct block_list *bl, va_list ap); -} battle_s; +}; struct battle_interface *battle; diff --git a/src/map/battleground.c b/src/map/battleground.c index 3f0b9ee41..4bf0843d5 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -28,6 +28,7 @@ static DBMap* bg_team_db; // int bg_id -> struct battleground_data* static unsigned int bg_team_counter = 0; // Next bg_id +struct battleground_interface bg_s; struct battleground_data* bg_team_search(int bg_id) { // Search a BG Team using bg_id if( !bg_id ) return NULL; diff --git a/src/map/battleground.h b/src/map/battleground.h index f76d84d0c..88d75f953 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -101,7 +101,7 @@ struct battleground_interface { void (*queue_check) (struct bg_arena *arena); /* */ void (*config_read) (void); -} bg_s; +}; struct battleground_interface *bg; diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 7041042df..73c50b0bf 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -37,7 +37,7 @@ enum e_buyingstore_failure static unsigned int buyingstore_nextid = 0; static const short buyingstore_blankslots[MAX_SLOTS] = { 0 }; // used when checking whether or not an item's card slots are blank - +struct buyingstore_interface buyingstore_s; /// Returns unique buying store id static unsigned int buyingstore_getuid(void) diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index a416317be..ae5fcb9e5 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -29,7 +29,7 @@ struct buyingstore_interface { void (*trade) (struct map_session_data* sd, int account_id, unsigned int buyer_id, const uint8* itemlist, unsigned int count); bool (*search) (struct map_session_data* sd, unsigned short nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); -} buyingstore_s; +}; struct buyingstore_interface *buyingstore; diff --git a/src/map/chrif.c b/src/map/chrif.c index 80c82354c..c2067dbd1 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -48,6 +48,8 @@ static const int packet_len_table[0x3d] = { // U - used, F - free -1,10, 8, 2, 2,14,19,19, // 2b20-2b27: U->2b20, U->2b21, U->2b22, U->2b23, U->2b24, U->2b25, U->2b26, U->2b27 }; +struct chrif_interface chrif_s; + //Used Packets: //2af8: Outgoing, chrif_connect -> 'connect to charserver / auth @ charserver' //2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)' diff --git a/src/map/chrif.h b/src/map/chrif.h index 1af652cea..a6a5fc6bf 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -79,7 +79,7 @@ struct chrif_interface { int (*flush_fifo) (void); void (*skillid2idx) (int fd); -} chrif_s; +}; struct chrif_interface *chrif; diff --git a/src/map/clif.c b/src/map/clif.c index 0ad6fbd44..f925fcf55 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -53,6 +53,8 @@ #include #include +struct clif_interface clif_s; + //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET diff --git a/src/map/clif.h b/src/map/clif.h index c23db873e..a0946a48a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1149,7 +1149,7 @@ struct clif_interface { void (*pPartyBookingRefuseVolunteer) (int fd, struct map_session_data *sd); void (*pPartyBookingCancelVolunteer) (int fd, struct map_session_data *sd); #endif -} clif_s; +}; struct clif_interface *clif; diff --git a/src/map/guild.c b/src/map/guild.c index e093fdf92..aa1d8c7a9 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -30,6 +30,7 @@ #include #include +struct guild_interface guild_s; static DBMap* guild_db; // int guild_id -> struct guild* static DBMap* castle_db; // int castle_id -> struct guild_castle* diff --git a/src/map/guild.h b/src/map/guild.h index 9841f5451..1f61df09e 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -104,7 +104,7 @@ struct guild_interface { void (*flags_clear) (void); /* guild aura */ void (*aura_refresh) (struct map_session_data *sd, uint16 skill_id, uint16 skill_lv); -} guild_s; +}; struct guild_interface *guild; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index efb5c0eb3..0d1b6ebcb 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -40,6 +40,8 @@ #include #include +struct homunculus_interface homunculus_s; + //Returns the viewdata for homunculus struct view_data* homunculus_get_viewdata(int class_) { if (homdb_checkid(class_)) diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 86d437e73..4b35c0992 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -133,7 +133,7 @@ struct homunculus_interface { void (*exp_db_read) (void); void (*addspiritball) (struct homun_data *hd, int max); void (*delspiritball) (struct homun_data *hd, int count, int type); -} homunculus_s; +}; struct homunculus_interface *homun; diff --git a/src/map/instance.c b/src/map/instance.c index 6b80f5d75..9207c1d53 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -25,6 +25,8 @@ #include #include +struct instance_interface instance_s; + /// Checks whether given instance id is valid or not. bool instance_is_valid(int instance_id) { if( instance_id < 0 || instance_id >= instance->instances ) {// out of range diff --git a/src/map/instance.h b/src/map/instance.h index e86586e44..164aaf662 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -62,7 +62,7 @@ struct instance_interface { void (*check_kick) (struct map_session_data *sd); void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout); bool (*valid) (int instance_id); -} instance_s; +}; struct instance_interface *instance; diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 7f03ed8d4..0be8074c8 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -19,6 +19,8 @@ #include #include +struct irc_bot_interface irc_bot_s; + char send_string[200]; int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) { diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 911a15b0e..1fd4b58ab 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -52,7 +52,7 @@ struct irc_bot_interface { void (*pong) (int fd, char *cmd, char *source, char *target, char *msg); void (*join) (int fd, char *cmd, char *source, char *target, char *msg); void (*privmsg) (int fd, char *cmd, char *source, char *target, char *msg); -} irc_bot_s; +}; struct irc_bot_interface *ircbot; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 5fae29500..4e0477b75 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -24,6 +24,8 @@ static DBMap* itemdb_other;// int nameid -> struct item_data* struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex] +struct itemdb_interface itemdb_s; + /** * Search for item name * name = item alias, so we should find items aliases first. if not found then look for "jname" (full name) diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 5e870a5f2..dcd0ae644 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -302,7 +302,7 @@ struct itemdb_interface { int (*group_item) (struct item_group *group); int (*chain_item) (unsigned short chain_id, int *rate); void (*package_item) (struct map_session_data *sd, struct item_package *package); -} itemdb_s; +}; struct itemdb_interface *itemdb; diff --git a/src/map/log.c b/src/map/log.c index ae516b84e..79e3b87e6 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -18,6 +18,7 @@ #include #include +struct log_interface log_s; /// filters for item logging typedef enum e_log_filter { diff --git a/src/map/log.h b/src/map/log.h index 462a12ff5..376483fe7 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -78,7 +78,7 @@ struct log_interface { int (*config_read) (const char* cfgName); void (*config_done) (void); -} log_s; +}; struct log_interface *logs; diff --git a/src/map/mail.c b/src/map/mail.c index 9a8d4e521..021a51cde 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -15,6 +15,8 @@ #include #include +struct mail_interface mail_s; + void mail_clear(struct map_session_data *sd) { sd->mail.nameid = 0; diff --git a/src/map/mail.h b/src/map/mail.h index 99742c7bd..b2b9048cb 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -17,7 +17,7 @@ struct mail_interface { int (*openmail) (struct map_session_data *sd); void (*deliveryfail) (struct map_session_data *sd, struct mail_message *msg); bool (*invalid_operation) (struct map_session_data *sd); -} mail_s; +}; struct mail_interface *mail; diff --git a/src/map/map.c b/src/map/map.c index 389c031bd..10d413676 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -132,6 +132,8 @@ int enable_grf = 0; //To enable/disable reading maps from GRF files, bypassing m struct eri *map_iterator_ers; char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made +struct map_interface iMap_s; + /*========================================== * server player count (of all mapservers) *------------------------------------------*/ diff --git a/src/map/map.h b/src/map/map.h index 3b53b71cc..6002e56da 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -906,7 +906,7 @@ struct map_interface { void (*clean) (int i); void (*do_shutdown) (void); -} iMap_s; +}; struct map_interface *iMap; diff --git a/src/map/party.c b/src/map/party.c index 154f84207..30740b058 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -33,6 +33,8 @@ static DBMap* party_db; // int party_id -> struct party_data* (releases data) static DBMap* party_booking_db; // int char_id -> struct party_booking_ad_info* (releases data) // Party Booking [Spiria] static unsigned long party_booking_nextid = 1; +struct party_interface party_s; + int party_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data); /*========================================== diff --git a/src/map/party.h b/src/map/party.h index f215baa56..3ce47141c 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -123,7 +123,7 @@ struct party_interface { void (*booking_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount); #endif bool (*booking_delete) (struct map_session_data *sd); -} party_s; +}; struct party_interface *party; diff --git a/src/map/pc.c b/src/map/pc.c index 3e823bb97..3ddae9222 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -89,6 +89,8 @@ struct item_cd { short nameid[MAX_ITEMDELAYS];//skill id }; +struct pc_interface pc_s; + //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pcdb_checkid first! diff --git a/src/map/pc.h b/src/map/pc.h index 8be2b7344..0bc1f7325 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -951,7 +951,7 @@ struct pc_interface { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int (*level_penalty_mod) (struct map_session_data *sd, struct mob_data * md, int type); #endif -} pc_s; +}; struct pc_interface *pc; diff --git a/src/map/script.c b/src/map/script.c index 858c66874..ee1143f05 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -176,6 +176,8 @@ int potion_hp=0, potion_per_hp=0, potion_sp=0, potion_per_sp=0; int potion_target=0; +struct script_interface script_s; + c_op get_com(unsigned char *script,int *pos); int get_num(unsigned char *script,int *pos); diff --git a/src/map/script.h b/src/map/script.h index 902125681..25a891897 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -393,7 +393,7 @@ struct script_interface { bool (*queue_remove) (int idx, int var); int (*queue_create) (void); void (*queue_clear) (int idx); -} script_s; +}; struct script_interface *script; diff --git a/src/map/searchstore.c b/src/map/searchstore.c index d346a0de6..c7f4f9fed 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -39,6 +39,7 @@ enum e_searchstore_effecttype { typedef bool (*searchstore_search_t)(struct map_session_data* sd, unsigned short nameid); typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s); +struct searchstore_interface searchstore_s; /// retrieves search function by type static inline searchstore_search_t searchstore_getsearchfunc(unsigned char type) { diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 61e65c7d2..42d47c7c0 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -52,7 +52,7 @@ struct searchstore_interface { bool (*queryremote) (struct map_session_data* sd, int account_id); void (*clearremote) (struct map_session_data* sd); bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine); -} searchstore_s; +}; struct searchstore_interface *searchstore; diff --git a/src/map/skill.c b/src/map/skill.c index 4bd27f578..dc89f3170 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -104,6 +104,9 @@ struct s_skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT]; int firewall_unit_pos; int icewall_unit_pos; int earthstrain_unit_pos; + +struct skill_interface skill_s; + //Since only mob-casted splash skills can hit ice-walls static inline int splash_target(struct block_list* bl) { #ifndef RENEWAL diff --git a/src/map/skill.h b/src/map/skill.h index 338537975..fceef5556 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1936,7 +1936,7 @@ struct skill_interface { int (*changematerial) (struct map_session_data *sd, int n, unsigned short *item_list); int (*get_elemental_type) (uint16 skill_id, uint16 skill_lv); void (*cooldown_save) (struct map_session_data * sd); -} skill_s; +}; struct skill_interface *skill; diff --git a/src/map/storage.c b/src/map/storage.c index 5b3c75d58..7a4649a98 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -24,6 +24,9 @@ #include #include +struct storage_interface storage_s; +struct guild_storage_interface gstorage_s; + /*========================================== * Sort items in the warehouse *------------------------------------------*/ diff --git a/src/map/storage.h b/src/map/storage.h index fc05ef06c..83243a622 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -26,7 +26,7 @@ struct storage_interface { int (*gettocart) (struct map_session_data *sd,int index,int amount); void (*close) (struct map_session_data *sd); void (*pc_quit) (struct map_session_data *sd, int flag); -} storage_s; +}; struct storage_interface *storage; struct guild_storage_interface { @@ -46,7 +46,7 @@ struct guild_storage_interface { int (*pc_quit) (struct map_session_data *sd,int flag); int (*save) (int account_id, int guild_id, int flag); int (*saved) (int guild_id); //Ack from char server that guild store was saved. -} gstorage_s; +}; struct guild_storage_interface *gstorage; diff --git a/src/map/trade.c b/src/map/trade.c index c44f04884..13b5f5431 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -24,6 +24,8 @@ //Max distance from traders to enable a trade to take place. #define TRADE_DISTANCE 2 +struct trade_interface trade_s; + /*========================================== * Initiates a trade request. *------------------------------------------*/ diff --git a/src/map/trade.h b/src/map/trade.h index 8bf918ad2..e8ac4a8c4 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -17,7 +17,7 @@ struct trade_interface { void (*ok) (struct map_session_data *sd); void (*cancel) (struct map_session_data *sd); void (*commit) (struct map_session_data *sd); -} trade_s; +}; struct trade_interface *trade; diff --git a/src/map/vending.c b/src/map/vending.c index 898008a3a..2784d46a2 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -21,6 +21,8 @@ #include #include +struct vending_interface vending_s; + /// Returns an unique vending shop id. static inline unsigned int getid(void) { return vending->next_id++; diff --git a/src/map/vending.h b/src/map/vending.h index 0148deb71..1b4381ccd 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -29,7 +29,7 @@ struct vending_interface { void (*purchase) (struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count); bool (*search) (struct map_session_data* sd, unsigned short nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); -} vending_s; +}; struct vending_interface * vending; -- cgit v1.2.3-60-g2f50