diff options
Diffstat (limited to 'src/map')
75 files changed, 187 insertions, 138 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6c5a6282e..1fec0af5b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -58,6 +58,7 @@ #include <string.h> struct atcommand_interface atcommand_s; +struct atcommand_interface *atcommand; static char atcmd_output[CHAT_SIZE_MAX]; static char atcmd_player_name[NAME_LENGTH]; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 88ddde8c2..ccc7d3725 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -6,7 +6,7 @@ #define MAP_ATCOMMAND_H #include "map/pc_groups.h" -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/conf.h" #include "common/db.h" @@ -127,12 +127,12 @@ struct atcommand_interface { const char* (*msgsd) (struct map_session_data *sd, int msg_number); }; -struct atcommand_interface *atcommand; - #ifdef HERCULES_CORE void atcommand_defaults(void); #endif // HERCULES_CORE +HPShared struct atcommand_interface *atcommand; + /* stay here */ #define ACMD(x) static bool atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message, struct AtCommandInfo *info) diff --git a/src/map/battle.c b/src/map/battle.c index f64fde55f..671d63200 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -43,6 +43,7 @@ struct Battle_Config battle_config; struct battle_interface battle_s; +struct battle_interface *battle; int battle_getcurrentskill(struct block_list *bl) { //Returns the current/last skill in use by this bl. struct unit_data *ud; diff --git a/src/map/battle.h b/src/map/battle.h index 6bc2659b9..b211afff5 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -6,7 +6,7 @@ #define MAP_BATTLE_H #include "map/map.h" //ELE_MAX -#include "common/cbasetypes.h" +#include "common/hercules.h" /** * Declarations @@ -509,10 +509,6 @@ struct Battle_Config { int feature_roulette; }; -#ifdef HERCULES_CORE -extern struct Battle_Config battle_config; -#endif // HERCULES_CORE - /* criteria for battle_config.idletime_critera */ enum e_battle_config_idletime { BCIDLE_WALK = 0x001, @@ -643,10 +639,12 @@ struct battle_interface { void (*calc_misc_attack_unknown) (struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *mflag, struct Damage *md); }; -struct battle_interface *battle; - #ifdef HERCULES_CORE +extern struct Battle_Config battle_config; + void battle_defaults(void); #endif // HERCULES_CORE +HPShared struct battle_interface *battle; + #endif /* MAP_BATTLE_H */ diff --git a/src/map/battleground.c b/src/map/battleground.c index 0fe42110f..915ccc851 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -32,6 +32,7 @@ #include <string.h> struct battleground_interface bg_s; +struct battleground_interface *bg; /// Search a BG Team using bg_id struct battleground_data* bg_team_search(int bg_id) { diff --git a/src/map/battleground.h b/src/map/battleground.h index a67deb722..094037f43 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -6,7 +6,7 @@ #define MAP_BATTLEGROUND_H #include "map/map.h" // EVENT_NAME_LENGTH -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" // struct party @@ -127,10 +127,10 @@ struct battleground_interface { void (*config_read) (void); }; -struct battleground_interface *bg; - #ifdef HERCULES_CORE void battleground_defaults(void); #endif // HERCULES_CORE +HPShared struct battleground_interface *bg; + #endif /* MAP_BATTLEGROUND_H */ diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index d1ce4ba0d..a1b6e9e65 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -19,6 +19,7 @@ #include "common/strlib.h" // safestrncpy struct buyingstore_interface buyingstore_s; +struct buyingstore_interface *buyingstore; /// Returns unique buying store id unsigned int buyingstore_getuid(void) { diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index f23790459..74f61239f 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -5,7 +5,7 @@ #ifndef MAP_BUYINGSTORE_H #define MAP_BUYINGSTORE_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // MAX_SLOTS struct map_session_data; @@ -71,10 +71,10 @@ struct buyingstore_interface { unsigned int (*getuid) (void); }; -struct buyingstore_interface *buyingstore; - #ifdef HERCULES_CORE void buyingstore_defaults (void); #endif // HERCULES_CORE +HPShared struct buyingstore_interface *buyingstore; + #endif // MAP_BUYINGSTORE_H diff --git a/src/map/channel.c b/src/map/channel.c index ab6694345..337d05504 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -28,6 +28,7 @@ #include <string.h> struct channel_interface channel_s; +struct channel_interface *channel; static struct Channel_Config channel_config; diff --git a/src/map/channel.h b/src/map/channel.h index de1779d96..391045c59 100644 --- a/src/map/channel.h +++ b/src/map/channel.h @@ -4,7 +4,7 @@ #ifndef MAP_CHANNEL_H #define MAP_CHANNEL_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" @@ -109,10 +109,10 @@ struct channel_interface { void (*config_read) (void); }; -struct channel_interface *channel; - #ifdef HERCULES_CORE void channel_defaults(void); #endif // HERCULES_CORE +HPShared struct channel_interface *channel; + #endif /* MAP_CHANNEL_H */ diff --git a/src/map/chat.c b/src/map/chat.c index 08c904290..ed9d9c598 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -24,6 +24,7 @@ #include <string.h> struct chat_interface chat_s; +struct chat_interface *chat; /// Initializes a chatroom object (common functionality for both pc and npc chatrooms). /// Returns a chatroom object on success, or NULL on failure. diff --git a/src/map/chat.h b/src/map/chat.h index 31048d5dd..68f9107f3 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -6,7 +6,7 @@ #define MAP_CHAT_H #include "map/map.h" // struct block_list, CHATROOM_TITLE_SIZE -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct chat_data; @@ -55,10 +55,10 @@ struct chat_interface { struct chat_data* (*create) (struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl); }; -struct chat_interface *chat; - #ifdef HERCULES_CORE void chat_defaults(void); #endif // HERCULES_CORE +HPShared struct chat_interface *chat; + #endif /* MAP_CHAT_H */ diff --git a/src/map/chrif.c b/src/map/chrif.c index 62df026da..ac96e1d84 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -38,6 +38,7 @@ #include <sys/types.h> struct chrif_interface chrif_s; +struct chrif_interface *chrif; //Used Packets: //2af8: Outgoing, chrif_connect -> 'connect to charserver / auth @ charserver' diff --git a/src/map/chrif.h b/src/map/chrif.h index cac965f74..25f69a309 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -6,7 +6,7 @@ #define MAP_CHRIF_H #include "map/map.h" //TBL_PC -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct eri; @@ -150,10 +150,10 @@ struct chrif_interface { void (*del_scdata_single) (int account_id, int char_id, short type); }; -struct chrif_interface *chrif; - #ifdef HERCULES_CORE void chrif_defaults(void); #endif // HERCULES_CORE +HPShared struct chrif_interface *chrif; + #endif /* MAP_CHRIF_H */ diff --git a/src/map/clif.c b/src/map/clif.c index 0784326c9..296fd5cb3 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -59,6 +59,9 @@ #include <time.h> struct clif_interface clif_s; +struct clif_interface *clif; + +struct s_packet_db packet_db[MAX_PACKET_DB + 1]; /* re-usable */ static struct packet_itemlist_normal itemlist_normal; diff --git a/src/map/clif.h b/src/map/clif.h index c827406ca..66a749818 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -7,7 +7,7 @@ #include "map/map.h" #include "map/packets_struct.h" -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" #include <stdarg.h> @@ -558,11 +558,6 @@ struct merge_item { }; /** - * Vars - **/ -struct s_packet_db packet_db[MAX_PACKET_DB + 1]; - -/** * Clif.c Interface **/ struct clif_interface { @@ -1322,10 +1317,15 @@ struct clif_interface { void (*pNPCMarketPurchase) (int fd, struct map_session_data *sd); }; -struct clif_interface *clif; - #ifdef HERCULES_CORE +/** + * Vars + **/ +extern struct s_packet_db packet_db[MAX_PACKET_DB + 1]; + void clif_defaults(void); #endif // HERCULES_CORE +HPShared struct clif_interface *clif; + #endif /* MAP_CLIF_H */ diff --git a/src/map/duel.c b/src/map/duel.c index 4cd2e276f..762745b75 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -17,6 +17,7 @@ #include <time.h> struct duel_interface duel_s; +struct duel_interface *duel; /*========================================== * Duel organizing functions [LuzZza] diff --git a/src/map/duel.h b/src/map/duel.h index 0c55c1266..c77f1c351 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -5,7 +5,7 @@ #ifndef MAP_DUEL_H #define MAP_DUEL_H -#include "common/cbasetypes.h" +#include "common/hercules.h" struct map_session_data; @@ -42,10 +42,10 @@ struct duel_interface { void (*final) (void); }; -struct duel_interface *duel; - #ifdef HERCULES_CORE void duel_defaults(void); #endif // HERCULES_CORE +HPShared struct duel_interface *duel; + #endif /* MAP_DUEL_H */ diff --git a/src/map/elemental.c b/src/map/elemental.c index 459ce2a39..d74e7a199 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -42,6 +42,7 @@ #include <string.h> struct elemental_interface elemental_s; +struct elemental_interface *elemental; int elemental_search_index(int class_) { int i; diff --git a/src/map/elemental.h b/src/map/elemental.h index 582e1059c..d040f8337 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -7,7 +7,7 @@ #include "map/status.h" // struct status_data, struct status_change #include "map/unit.h" // struct unit_data -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // NAME_LENGTH #include <stdarg.h> @@ -120,10 +120,10 @@ struct elemental_interface { int (*read_db) (void); }; -struct elemental_interface *elemental; - #ifdef HERCULES_CORE void elemental_defaults(void); #endif // HERCULES_CORE +HPShared struct elemental_interface *elemental; + #endif /* MAP_ELEMENTAL_H */ diff --git a/src/map/guild.c b/src/map/guild.c index 5f6ce83c6..15c65ec98 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -36,6 +36,7 @@ #include <string.h> struct guild_interface guild_s; +struct guild_interface *guild; /*========================================== * Retrieves and validates the sd pointer for this guild member [Skotlex] diff --git a/src/map/guild.h b/src/map/guild.h index 18a25af58..a11585fbc 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -6,7 +6,7 @@ #define MAP_GUILD_H #include "map/map.h" // EVENT_NAME_LENGTH, TBL_PC -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" @@ -163,10 +163,10 @@ struct guild_interface { void (*castle_reconnect_sub) (void *key, void *data, va_list ap); }; -struct guild_interface *guild; - #ifdef HERCULES_CORE void guild_defaults(void); #endif // HERCULES_CORE +HPShared struct guild_interface *guild; + #endif /* MAP_GUILD_H */ diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 305d60f5b..cc736708d 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -45,6 +45,8 @@ struct homunculus_interface homunculus_s; struct homun_dbs homundbs; +struct homunculus_interface *homun; + //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 95b613fff..9d23fbe2c 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -7,6 +7,7 @@ #include "map/status.h" // struct status_data, struct status_change #include "map/unit.h" // struct unit_data +#include "common/hercules.h" #include "common/mmo.h" struct map_session_data; @@ -160,10 +161,10 @@ struct homunculus_interface { int8 (*get_intimacy_grade) (struct homun_data *hd); }; -struct homunculus_interface *homun; - #ifdef HERCULES_CORE void homunculus_defaults(void); #endif // HERCULES_CORE +HPShared struct homunculus_interface *homun; + #endif /* MAP_HOMUNCULUS_H */ diff --git a/src/map/instance.c b/src/map/instance.c index 92acd1bbb..1fc396325 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -32,6 +32,7 @@ #include <time.h> struct instance_interface instance_s; +struct instance_interface *instance; /// Checks whether given instance id is valid or not. bool instance_is_valid(int instance_id) { diff --git a/src/map/instance.h b/src/map/instance.h index e17d6866f..589e1a511 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -6,7 +6,7 @@ #define MAP_INSTANCE_H #include "map/script.h" // struct reg_db -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // struct point struct HPluginData; @@ -85,10 +85,10 @@ struct instance_interface { int (*destroy_timer) (int tid, int64 tick, int id, intptr_t data); }; -struct instance_interface *instance; - #ifdef HERCULES_CORE void instance_defaults(void); #endif // HERCULES_CORE +HPShared struct instance_interface *instance; + #endif /* MAP_INSTANCE_H */ diff --git a/src/map/intif.c b/src/map/intif.c index a2e19f9e9..12f679552 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -37,6 +37,7 @@ #include <sys/types.h> struct intif_interface intif_s; +struct intif_interface *intif; #define inter_fd (chrif->fd) // alias diff --git a/src/map/intif.h b/src/map/intif.h index 3303feb6e..369ac1d9b 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -5,7 +5,7 @@ #ifndef MAP_INTIF_H #define MAP_INTIF_H -#include "common/cbasetypes.h" +#include "common/hercules.h" /** * Declarations @@ -182,10 +182,10 @@ struct intif_interface { void (*pDeleteHomunculusOk) (int fd); }; -struct intif_interface *intif; - #ifdef HERCULES_CORE void intif_defaults(void); #endif // HERCULES_CORE +HPShared struct intif_interface *intif; + #endif /* MAP_INTIF_H */ diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 34069f74f..86f854ff7 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -24,6 +24,7 @@ //#define IRCBOT_DEBUG struct irc_bot_interface irc_bot_s; +struct irc_bot_interface *ircbot; char send_string[IRC_MESSAGE_LENGTH]; diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index b0bfd72f8..a85fc46e8 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -6,7 +6,7 @@ #ifndef MAP_IRC_BOT_H #define MAP_IRC_BOT_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #define IRC_NICK_LENGTH 40 #define IRC_IDENT_LENGTH 40 @@ -59,10 +59,10 @@ struct irc_bot_interface { void (*usernick) (int fd, char *cmd, char *source, char *target, char *msg); }; -struct irc_bot_interface *ircbot; - #ifdef HERCULES_CORE void ircbot_defaults(void); #endif // HERCULES_CORE +HPShared struct irc_bot_interface *ircbot; + #endif /* MAP_IRC_BOT_H */ diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 644c16a00..7f5c2224c 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -26,6 +26,7 @@ #include <string.h> struct itemdb_interface itemdb_s; +struct itemdb_interface *itemdb; /** * Search for item name diff --git a/src/map/itemdb.h b/src/map/itemdb.h index e50ebfd3d..a3edd451e 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -6,7 +6,7 @@ #define MAP_ITEMDB_H /* #include "map/map.h" */ -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/conf.h" #include "common/db.h" #include "common/mmo.h" // ITEM_NAME_LENGTH @@ -618,10 +618,10 @@ struct itemdb_interface { bool (*lookup_const) (const config_setting_t *it, const char *name, int *value); }; -struct itemdb_interface *itemdb; - #ifdef HERCULES_CORE void itemdb_defaults(void); #endif // HERCULES_CORE +HPShared struct itemdb_interface *itemdb; + #endif /* MAP_ITEMDB_H */ diff --git a/src/map/log.c b/src/map/log.c index 0a9b16418..0c5977c05 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -23,6 +23,7 @@ #include <string.h> struct log_interface log_s; +struct log_interface *logs; /// obtain log type character for item/zeny logs char log_picktype2char(e_log_pick_type type) { diff --git a/src/map/log.h b/src/map/log.h index ef654149c..4b2b5d4d6 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -5,7 +5,7 @@ #ifndef MAP_LOG_H #define MAP_LOG_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/sql.h" /** @@ -129,10 +129,10 @@ struct log_interface { bool (*should_log_item) (int nameid, int amount, int refine, struct item_data *id); }; -struct log_interface *logs; - #ifdef HERCULES_CORE void log_defaults(void); #endif // HERCULES_CORE +HPShared struct log_interface *logs; + #endif /* MAP_LOG_H */ diff --git a/src/map/mail.c b/src/map/mail.c index 184e2be8d..0bdad2877 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -19,6 +19,7 @@ #include <string.h> struct mail_interface mail_s; +struct mail_interface *mail; void mail_clear(struct map_session_data *sd) { diff --git a/src/map/mail.h b/src/map/mail.h index 4f325067d..128b1fbaa 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -5,7 +5,7 @@ #ifndef MAP_MAIL_H #define MAP_MAIL_H -#include "common/cbasetypes.h" +#include "common/hercules.h" struct item; struct mail_message; @@ -23,10 +23,10 @@ struct mail_interface { bool (*invalid_operation) (struct map_session_data *sd); }; -struct mail_interface *mail; - #ifdef HERCULES_CORE void mail_defaults(void); #endif // HERCULES_CORE +HPShared struct mail_interface *mail; + #endif /* MAP_MAIL_H */ diff --git a/src/map/map.c b/src/map/map.c index a39c6a03a..5766563c7 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -69,6 +69,9 @@ struct map_interface map_s; struct mapit_interface mapit_s; +struct map_interface *map; +struct mapit_interface *mapit; + /*========================================== * server player count (of all mapservers) *------------------------------------------*/ diff --git a/src/map/map.h b/src/map/map.h index 826548f49..d4ab954be 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -5,10 +5,8 @@ #ifndef MAP_MAP_H #define MAP_MAP_H -#include "config/core.h" - #include "map/atcommand.h" -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/core.h" // CORE_ST_LAST #include "common/db.h" #include "common/mapindex.h" @@ -215,7 +213,13 @@ enum { #define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) #define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000) // Specifies maps where players may hit each other -#define map_flag_vs(m) (map->list[m].flag.pvp || map->list[m].flag.gvg_dungeon || map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) || map->list[m].flag.battleground) +#define map_flag_vs(m) ( \ + map->list[m].flag.pvp \ + || map->list[m].flag.gvg_dungeon \ + || map->list[m].flag.gvg \ + || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) \ + || map->list[m].flag.battleground \ + ) // Specifies maps that have special GvG/WoE restrictions #define map_flag_gvg(m) (map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle)) // Specifies if the map is tagged as GvG/WoE (regardless of map->agit_flag status) @@ -762,8 +766,6 @@ struct mapit_interface { bool (*exists) (struct s_mapiterator* iter); }; -struct mapit_interface *mapit; - #define mapit_getallusers() (mapit->alloc(MAPIT_NORMAL,BL_PC)) #define mapit_geteachpc() (mapit->alloc(MAPIT_NORMAL,BL_PC)) #define mapit_geteachmob() (mapit->alloc(MAPIT_NORMAL,BL_MOB)) @@ -1085,10 +1087,11 @@ END_ZEROED_BLOCK; void (*zone_clear_single) (struct map_zone_data *zone); }; -struct map_interface *map; - #ifdef HERCULES_CORE void map_defaults(void); #endif // HERCULES_CORE +HPShared struct mapit_interface *mapit; +HPShared struct map_interface *map; + #endif /* MAP_MAP_H */ diff --git a/src/map/mapreg.h b/src/map/mapreg.h index cafd25b64..09d051bab 100644 --- a/src/map/mapreg.h +++ b/src/map/mapreg.h @@ -6,7 +6,7 @@ #define MAP_MAPREG_H #include "map/script.h" // struct reg_db -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct eri; @@ -48,10 +48,10 @@ struct mapreg_interface { bool (*config_read) (const char *w1, const char *w2); }; -struct mapreg_interface *mapreg; - #ifdef HERCULES_CORE void mapreg_defaults(void); #endif // HERCULES_CORE +HPShared struct mapreg_interface *mapreg; + #endif /* MAP_MAPREG_H */ diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index bed40e295..37c830e2e 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -21,6 +21,7 @@ #include <string.h> struct mapreg_interface mapreg_s; +struct mapreg_interface *mapreg; #define MAPREG_AUTOSAVE_INTERVAL (300*1000) diff --git a/src/map/mercenary.c b/src/map/mercenary.c index c60234d5d..ff37f396d 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -44,6 +44,8 @@ struct mercenary_interface mercenary_s; struct s_mercenary_db mercdb[MAX_MERCENARY_CLASS]; +struct mercenary_interface *mercenary; + int merc_search_index(int class_) { int i; diff --git a/src/map/mercenary.h b/src/map/mercenary.h index c96b5a5ef..9e0c59428 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -6,7 +6,7 @@ #include "map/status.h" // struct status_data, struct status_change #include "map/unit.h" // struct unit_data -#include "common/cbasetypes.h" +#include "common/hercules.h" struct map_session_data; @@ -97,10 +97,10 @@ struct mercenary_interface { bool (*read_skill_db_sub) (char* str[], int columns, int current); }; -struct mercenary_interface *mercenary; - #ifdef HERCULES_CORE void mercenary_defaults(void); #endif // HERCULES_CORE +HPShared struct mercenary_interface *mercenary; + #endif /* MAP_MERCENARY_H */ diff --git a/src/map/mob.c b/src/map/mob.c index 8112c208c..f64c7e582 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -48,6 +48,7 @@ #include <string.h> struct mob_interface mob_s; +struct mob_interface *mob; #define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode. diff --git a/src/map/mob.h b/src/map/mob.h index 85d2bf9b8..4b8a054b5 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -8,7 +8,7 @@ #include "map/map.h" // struct block_list #include "map/status.h" // struct status_data, struct status_change #include "map/unit.h" // struct unit_data, view_data -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // struct item #define MAX_RANDOMMONSTER 5 @@ -272,8 +272,8 @@ struct item_drop_list { #define mob_stop_walking(md, type) (unit->stop_walking(&(md)->bl, (type))) #define mob_stop_attack(md) (unit->stop_attack(&(md)->bl)) -#define mob_is_battleground(md) ( map->list[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST)) ) -#define mob_is_gvg(md) (map->list[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2) ) +#define mob_is_battleground(md) (map->list[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST))) +#define mob_is_gvg(md) (map->list[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2)) #define mob_is_treasure(md) (((md)->class_ >= MOBID_TREAS01 && (md)->class_ <= MOBID_TREAS40) || ((md)->class_ >= MOBID_TREAS41 && (md)->class_ <= MOBID_TREAS49)) struct mob_interface { @@ -387,10 +387,10 @@ struct mob_interface { void (*destroy_mob_db) (int index); }; -struct mob_interface *mob; - #ifdef HERCULES_CORE void mob_defaults(void); #endif // HERCULES_CORE +HPShared struct mob_interface *mob; + #endif /* MAP_MOB_H */ diff --git a/src/map/npc.c b/src/map/npc.c index 8733ee7e4..bb0e772ae 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -43,6 +43,7 @@ #include <time.h> struct npc_interface npc_s; +struct npc_interface *npc; static int npc_id=START_NPC_NUM; static int npc_warp=0; diff --git a/src/map/npc.h b/src/map/npc.h index bc779b56b..14b89d128 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -8,7 +8,7 @@ #include "map/map.h" // struct block_list #include "map/status.h" // struct status_change #include "map/unit.h" // struct unit_data -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct HPluginData; @@ -279,12 +279,11 @@ struct npc_interface { int (*secure_timeout_timer) (int tid, int64 tick, int id, intptr_t data); }; -struct npc_interface *npc; - #ifdef HERCULES_CORE void npc_defaults(void); #endif // HERCULES_CORE +HPShared struct npc_interface *npc; /* comes from npc_chat.c */ #ifdef PCRE_SUPPORT @@ -326,8 +325,6 @@ struct npc_chat_interface { void (*finalize_pcrematch_entry) (struct pcrematch_entry* e); }; -struct npc_chat_interface *npc_chat; - /** * pcre interface (libpcre) * so that plugins may share and take advantage of the core's pcre @@ -344,14 +341,16 @@ struct pcre_interface { int (*get_substring) (const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr); }; -struct pcre_interface *libpcre; - /** * Also defaults libpcre **/ #ifdef HERCULES_CORE void npc_chat_defaults(void); #endif // HERCULES_CORE + +HPShared struct npc_chat_interface *npc_chat; +HPShared struct pcre_interface *libpcre; + #endif // PCRE_SUPPORT #endif /* MAP_NPC_H */ diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 67b78dcea..0b9023ede 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -30,6 +30,8 @@ struct npc_chat_interface npc_chat_s; struct pcre_interface libpcre_s; +struct npc_chat_interface *npc_chat; +struct pcre_interface *libpcre; /** * Written by MouseJstr in a vision... (2/21/2005) diff --git a/src/map/party.c b/src/map/party.c index 6b35debe5..472c03423 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -35,6 +35,7 @@ #include <string.h> struct party_interface party_s; +struct party_interface *party; /*========================================== * Fills the given party_member structure according to the sd provided. diff --git a/src/map/party.h b/src/map/party.h index 95faa2213..c7893add2 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -6,7 +6,7 @@ #define MAP_PARTY_H #include "map/map.h" // TBL_PC -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" // struct party @@ -139,10 +139,10 @@ struct party_interface { int (*db_final) (DBKey key, DBData *data, va_list ap); }; -struct party_interface *party; - #ifdef HERCULES_CORE void party_defaults(void); #endif // HERCULES_CORE +HPShared struct party_interface *party; + #endif /* MAP_PARTY_H */ diff --git a/src/map/path.c b/src/map/path.c index 3ded5423e..723fd8e8f 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -29,6 +29,7 @@ #define DIR_EAST 8 struct path_interface path_s; +struct path_interface *path; /// @name Structures and defines for A* pathfinding /// @{ diff --git a/src/map/path.h b/src/map/path.h index bbd81b8c6..2ece8f84b 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -6,7 +6,7 @@ #define MAP_PATH_H #include "map/map.h" // enum cell_chk -#include "common/cbasetypes.h" +#include "common/hercules.h" #define MOVE_COST 10 #define MOVE_DIAGONAL_COST 14 @@ -53,10 +53,10 @@ struct path_interface { int (*distance_client) (int dx, int dy); }; -struct path_interface *path; - #ifdef HERCULES_CORE void path_defaults(void); #endif // HERCULES_CORE +HPShared struct path_interface *path; + #endif /* MAP_PATH_H */ diff --git a/src/map/pc.c b/src/map/pc.c index d7b7a9f48..49b8f1f94 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -57,6 +57,7 @@ #include <time.h> struct pc_interface pc_s; +struct pc_interface *pc; //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 diff --git a/src/map/pc.h b/src/map/pc.h index d35c29bc7..85bbd2016 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -5,8 +5,6 @@ #ifndef MAP_PC_H #define MAP_PC_H -#include "config/core.h" // AUTOLOOTITEM_SIZE, RENEWAL, SECURE_NPCTIMEOUT - #include "map/battle.h" // battle #include "map/battleground.h" // enum bg_queue_types #include "map/buyingstore.h" // struct s_buyingstore @@ -19,7 +17,7 @@ #include "map/status.h" // enum sc_type, OPTION_* #include "map/unit.h" // struct unit_data, struct view_data #include "map/vending.h" // struct s_vending -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/ers.h" // struct eri #include "common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus, NEW_CARTS @@ -1072,10 +1070,10 @@ END_ZEROED_BLOCK; /* End */ int (*check_job_name) (const char *name); }; -struct pc_interface *pc; - #ifdef HERCULES_CORE void pc_defaults(void); #endif // HERCULES_CORE +HPShared struct pc_interface *pc; + #endif /* MAP_PC_H */ diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index f9a442d97..28bef6a85 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -21,6 +21,7 @@ static GroupSettings dummy_group; ///< dummy group used in dummy map sessions @see pc_get_dummy_sd() struct pc_groups_interface pcg_s; +struct pc_groups_interface *pcg; /** * Returns dummy group. diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 4fee312a4..6f92a7955 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -5,7 +5,7 @@ #ifndef MAP_PC_GROUPS_H #define MAP_PC_GROUPS_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/conf.h" #include "common/db.h" @@ -96,10 +96,10 @@ struct pc_groups_interface { int (*get_idx) (GroupSettings *group); }; -struct pc_groups_interface *pcg; - #ifdef HERCULES_CORE void pc_groups_defaults(void); #endif // HERCULES_CORE +HPShared struct pc_groups_interface *pcg; + #endif /* MAP_PC_GROUPS_H */ diff --git a/src/map/pet.c b/src/map/pet.c index b612a9505..1ac6d117a 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -37,6 +37,7 @@ #include <string.h> struct pet_interface pet_s; +struct pet_interface *pet; #define MIN_PETTHINKTIME 100 diff --git a/src/map/pet.h b/src/map/pet.h index 06302c9b2..84df856bf 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -8,7 +8,7 @@ #include "map/map.h" // struct block_list #include "map/status.h" // enum sc_type #include "map/unit.h" // struct unit_data -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // NAME_LENGTH, struct s_pet #define MAX_PET_DB 300 @@ -153,10 +153,10 @@ struct pet_interface { int (*read_db) (); }; -struct pet_interface *pet; - #ifdef HERCULES_CORE void pet_defaults(void); #endif // HERCULES_CORE +HPShared struct pet_interface *pet; + #endif /* MAP_PET_H */ diff --git a/src/map/quest.c b/src/map/quest.c index 463a3395a..ddbd2f92d 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -39,6 +39,8 @@ struct quest_interface quest_s; struct quest_db *db_data[MAX_QUEST_DB]; ///< Quest database +struct quest_interface *quest; + /** * Searches a quest by ID. * diff --git a/src/map/quest.h b/src/map/quest.h index 9b5199625..ccb3e58f9 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -6,7 +6,7 @@ #define MAP_QUEST_H #include "map/map.h" // TBL_PC -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/conf.h" #define MAX_QUEST_DB (60355+1) // Highest quest ID + 1 @@ -61,10 +61,10 @@ struct quest_interface { struct quest_db *(*read_db_sub) (config_setting_t *cs, int n, const char *source); }; -struct quest_interface *quest; - #ifdef HERCULES_CORE void quest_defaults(void); #endif // HERCULES_CORE +HPShared struct quest_interface *quest; + #endif /* MAP_QUEST_H */ diff --git a/src/map/script.c b/src/map/script.c index 4fb196255..cbbf306d1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -62,6 +62,7 @@ #endif struct script_interface script_s; +struct script_interface *script; static inline int GETVALUE(const unsigned char* buf, int i) { return (int)MakeDWord(MakeWord(buf[i], buf[i+1]), MakeWord(buf[i+2], 0)); diff --git a/src/map/script.h b/src/map/script.h index b3d2a3c8a..ad8ae82cb 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -6,7 +6,7 @@ #define MAP_SCRIPT_H #include "map/map.h" //EVENT_NAME_LENGTH -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" // struct item #include "common/sql.h" // Sql @@ -773,10 +773,10 @@ struct script_interface { void (*run_item_unequip_script) (struct map_session_data *sd, struct item_data *data, int oid); }; -struct script_interface *script; - #ifdef HERCULES_CORE void script_defaults(void); #endif // HERCULES_CORE +HPShared struct script_interface *script; + #endif /* MAP_SCRIPT_H */ diff --git a/src/map/searchstore.c b/src/map/searchstore.c index b9e23ae82..46b102ad5 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -15,6 +15,7 @@ #include "common/strlib.h" // safestrncpy struct searchstore_interface searchstore_s; +struct searchstore_interface *searchstore; /// 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 2778740a5..24d7665e0 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -6,7 +6,7 @@ #define MAP_SEARCHSTORE_H #include "map/map.h" // MESSAGE_SIZE -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // MAX_SLOTS #include <time.h> @@ -95,10 +95,10 @@ struct searchstore_interface { 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); }; -struct searchstore_interface *searchstore; - #ifdef HERCULES_CORE void searchstore_defaults(void); #endif // HERCULES_CORE +HPShared struct searchstore_interface *searchstore; + #endif /* MAP_SEARCHSTORE_H */ diff --git a/src/map/skill.c b/src/map/skill.c index e3f85f8d1..00babb4f6 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -64,6 +64,8 @@ struct skill_interface skill_s; struct s_skill_dbs skilldbs; +struct skill_interface *skill; + //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 aa0188be6..1db03bcd1 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -5,11 +5,9 @@ #ifndef MAP_SKILL_H #define MAP_SKILL_H -#include "config/core.h" // RENEWAL_CAST - #include "map/map.h" // struct block_list #include "map/status.h" // enum sc_type -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" #include "common/mmo.h" // MAX_SKILL, struct square @@ -2084,10 +2082,10 @@ struct skill_interface { void (*get_requirement_unknown) (struct status_change *sc, struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv, struct skill_condition *req); }; -struct skill_interface *skill; - #ifdef HERCULES_CORE void skill_defaults(void); #endif // HERCULES_CORE +HPShared struct skill_interface *skill; + #endif /* MAP_SKILL_H */ diff --git a/src/map/status.c b/src/map/status.c index e70fb1eb1..dc99c1f95 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -46,6 +46,8 @@ struct status_interface status_s; struct s_status_dbs statusdbs; +struct status_interface *status; + /** * Returns the status change associated with a skill. * @param skill The skill to look up diff --git a/src/map/status.h b/src/map/status.h index 45a1300a0..274c64c5b 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -5,10 +5,8 @@ #ifndef MAP_STATUS_H #define MAP_STATUS_H -#include "config/core.h" // defType, RENEWAL, RENEWAL_ASPD - #include "common/conf.h" -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/mmo.h" // NEW_CARTS struct block_list; @@ -2085,10 +2083,10 @@ struct status_interface { void (*read_job_db_sub) (int idx, const char *name, config_setting_t *jdb); }; -struct status_interface *status; - #ifdef HERCULES_CORE void status_defaults(void); #endif // HERCULES_CORE +HPShared struct status_interface *status; + #endif /* MAP_STATUS_H */ diff --git a/src/map/storage.c b/src/map/storage.c index 95194bc47..fb6e2ed45 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -28,6 +28,9 @@ struct storage_interface storage_s; struct guild_storage_interface gstorage_s; +struct storage_interface *storage; +struct guild_storage_interface *gstorage; + /*========================================== * Sort items in the warehouse *------------------------------------------*/ diff --git a/src/map/storage.h b/src/map/storage.h index 5f2c69f56..37f894f76 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -5,7 +5,7 @@ #ifndef MAP_STORAGE_H #define MAP_STORAGE_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct guild_storage; @@ -38,7 +38,6 @@ struct storage_interface { void (*sortitem) (struct item* items, unsigned int size); int (*reconnect_sub) (DBKey key, DBData *data, va_list ap); }; -struct storage_interface *storage; struct guild_storage_interface { struct DBMap* db; // int guild_id -> struct guild_storage* @@ -63,11 +62,12 @@ struct guild_storage_interface { DBData (*create) (DBKey key, va_list args); }; -struct guild_storage_interface *gstorage; - #ifdef HERCULES_CORE void storage_defaults(void); void gstorage_defaults(void); #endif // HERCULES_CORE +HPShared struct storage_interface *storage; +HPShared struct guild_storage_interface *gstorage; + #endif /* MAP_STORAGE_H */ diff --git a/src/map/trade.c b/src/map/trade.c index 2f6e2a648..8af3ddf4a 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -25,6 +25,7 @@ #include <string.h> struct trade_interface trade_s; +struct trade_interface *trade; /*========================================== * Initiates a trade request. diff --git a/src/map/trade.h b/src/map/trade.h index 85e73025c..010f67e26 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -5,6 +5,8 @@ #ifndef MAP_TRADE_H #define MAP_TRADE_H +#include "common/hercules.h" + //Max distance from traders to enable a trade to take place. //TODO: battle_config candidate? #define TRADE_DISTANCE 2 @@ -23,10 +25,10 @@ struct trade_interface { void (*commit) (struct map_session_data *sd); }; -struct trade_interface *trade; - #ifdef HERCULES_CORE void trade_defaults(void); #endif // HERCULES_CORE +HPShared struct trade_interface *trade; + #endif /* MAP_TRADE_H */ diff --git a/src/map/unit.c b/src/map/unit.c index 60911b85a..33360584a 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -49,6 +49,7 @@ const short dirx[8]={0,-1,-1,-1,0,1,1,1}; const short diry[8]={1,1,0,-1,-1,-1,0,1}; struct unit_interface unit_s; +struct unit_interface *unit; /** * Returns the unit_data for the given block_list. If the object is using diff --git a/src/map/unit.h b/src/map/unit.h index 00fff5981..0d970ca16 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -8,7 +8,7 @@ #include "map/clif.h" // clr_type #include "map/path.h" // struct walkpath_data #include "map/skill.h" // 'MAX_SKILLTIMERSKILL, struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset -#include "common/cbasetypes.h" +#include "common/hercules.h" struct map_session_data; struct block_list; @@ -84,9 +84,6 @@ struct view_data { unsigned dead_sit : 2; }; -extern const short dirx[8]; -extern const short diry[8]; - struct unit_interface { int (*init) (bool minimal); int (*final) (void); @@ -139,8 +136,13 @@ struct unit_interface { int (*free) (struct block_list *bl, clr_type clrtype); }; -struct unit_interface *unit; +#ifdef HERCULES_CORE +extern const short dirx[8]; +extern const short diry[8]; void unit_defaults(void); +#endif // HERCULES_CORE + +HPShared struct unit_interface *unit; #endif /* MAP_UNIT_H */ diff --git a/src/map/vending.c b/src/map/vending.c index d0f0dee00..80c79984e 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -25,6 +25,7 @@ #include <string.h> struct vending_interface vending_s; +struct vending_interface *vending; /// Returns an unique vending shop id. static inline unsigned int getid(void) { diff --git a/src/map/vending.h b/src/map/vending.h index 189189227..2f624fac7 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -5,7 +5,7 @@ #ifndef MAP_VENDING_H #define MAP_VENDING_H -#include "common/cbasetypes.h" +#include "common/hercules.h" #include "common/db.h" struct map_session_data; @@ -32,10 +32,10 @@ struct vending_interface { bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); }; -struct vending_interface *vending; - #ifdef HERCULES_CORE void vending_defaults(void); #endif // HERCULES_CORE +HPShared struct vending_interface *vending; + #endif /* MAP_VENDING_H */ |