diff options
Diffstat (limited to 'src/common')
49 files changed, 876 insertions, 370 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 6e73d1b2a..cdd9bb769 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -3,28 +3,29 @@ #define HERCULES_CORE -#include "../config/core.h" // CONSOLE_INPUT +#include "config/core.h" // CONSOLE_INPUT #include "HPM.h" +#include "common/cbasetypes.h" +#include "common/conf.h" +#include "common/console.h" +#include "common/core.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/socket.h" +#include "common/sql.h" +#include "common/strlib.h" +#include "common/sysinfo.h" +#include "common/timer.h" +#include "common/utils.h" +#include "common/nullpo.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../common/cbasetypes.h" -#include "../common/conf.h" -#include "../common/console.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/socket.h" -#include "../common/sql.h" -#include "../common/strlib.h" -#include "../common/sysinfo.h" -#include "../common/timer.h" -#include "../common/utils.h" -#include "../common/nullpo.h" - #ifndef WIN32 # include <unistd.h> #endif @@ -114,9 +115,8 @@ bool hplugin_populate(struct hplugin *plugin, const char *filename) { for(i = 0; i < length; i++) { void **Link; if (!( Link = plugin_import(plugin->dll, ToLink[i].name,void **))) { - ShowWarning("HPM:plugin_load: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", ToLink[i].name, filename); - HPM->unload(plugin); - return false; + ShowFatalError("HPM:plugin_load: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", ToLink[i].name, filename); + exit(EXIT_FAILURE); } *Link = ToLink[i].Ref; } @@ -144,15 +144,13 @@ struct hplugin *hplugin_load(const char* filename) { if (!(plugin->dll = plugin_open(filename))) { char buf[1024]; - ShowWarning("HPM:plugin_load: failed to load '"CL_WHITE"%s"CL_RESET"' (error: %s), skipping...\n", filename, plugin_geterror(buf)); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to load '"CL_WHITE"%s"CL_RESET"' (error: %s)!\n", filename, plugin_geterror(buf)); + exit(EXIT_FAILURE); } if( !( info = plugin_import(plugin->dll, "pinfo",struct hplugin_info*) ) ) { - ShowDebug("HPM:plugin_load: failed to retrieve 'plugin_info' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'plugin_info' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } if( !(info->type & SERVER_TYPE) ) { @@ -161,40 +159,35 @@ struct hplugin *hplugin_load(const char* filename) { } if( !HPM->iscompatible(info->req_version) ) { - ShowWarning("HPM:plugin_load: '"CL_WHITE"%s"CL_RESET"' incompatible version '%s' -> '%s', skipping...\n", filename, info->req_version, HPM_VERSION); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: '"CL_WHITE"%s"CL_RESET"' incompatible version '%s' -> '%s'!\n", filename, info->req_version, HPM_VERSION); + exit(EXIT_FAILURE); } plugin->info = info; plugin->filename = aStrdup(filename); if( !( import_symbol_ref = plugin_import(plugin->dll, "import_symbol",void **) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'import_symbol' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'import_symbol' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } *import_symbol_ref = HPM->import_symbol; if( !( sql_handle = plugin_import(plugin->dll, "mysql_handle",Sql **) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'mysql_handle' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'mysql_handle' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } *sql_handle = HPM->import_symbol("sql_handle",plugin->idx); if( !( HPMi = plugin_import(plugin->dll, "HPMi",struct HPMi_interface **) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'HPMi' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMi' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } if( !( *HPMi = plugin_import(plugin->dll, "HPMi_s",struct HPMi_interface *) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'HPMi_s' for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMi_s' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } plugin->hpi = *HPMi; @@ -214,37 +207,32 @@ struct hplugin *hplugin_load(const char* filename) { anyEvent = true; if( !anyEvent ) { - ShowWarning("HPM:plugin_load: no events found for '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowWarning("HPM:plugin_load: no events found for '"CL_WHITE"%s"CL_RESET"'!\n", filename); + exit(EXIT_FAILURE); } if( !HPM->populate(plugin,filename) ) return NULL; if( !( HPMDataCheckLen = plugin_import(plugin->dll, "HPMDataCheckLen", unsigned int *) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'HPMDataCheckLen' for '"CL_WHITE"%s"CL_RESET"', most likely not including HPMDataCheck.h, skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMDataCheckLen' for '"CL_WHITE"%s"CL_RESET"', most likely not including HPMDataCheck.h!\n", filename); + exit(EXIT_FAILURE); } if( !( HPMDataCheckVer = plugin_import(plugin->dll, "HPMDataCheckVer", int *) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'HPMDataCheckVer' for '"CL_WHITE"%s"CL_RESET"', most likely an outdated plugin, skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMDataCheckVer' for '"CL_WHITE"%s"CL_RESET"', most likely an outdated plugin!\n", filename); + exit(EXIT_FAILURE); } if( !( HPMDataCheck = plugin_import(plugin->dll, "HPMDataCheck", struct s_HPMDataCheck *) ) ) { - ShowWarning("HPM:plugin_load: failed to retrieve 'HPMDataCheck' for '"CL_WHITE"%s"CL_RESET"', most likely not including HPMDataCheck.h, skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMDataCheck' for '"CL_WHITE"%s"CL_RESET"', most likely not including HPMDataCheck.h!\n", filename); + exit(EXIT_FAILURE); } // TODO: Remove the HPM->DataCheck != NULL check once login and char support is complete if (HPM->DataCheck != NULL && !HPM->DataCheck(HPMDataCheck,*HPMDataCheckLen,*HPMDataCheckVer,plugin->info->name)) { - ShowWarning("HPM:plugin_load: '"CL_WHITE"%s"CL_RESET"' failed DataCheck, out of sync from the core (recompile plugin), skipping...\n", filename); - HPM->unload(plugin); - return NULL; + ShowFatalError("HPM:plugin_load: '"CL_WHITE"%s"CL_RESET"' failed DataCheck, out of sync from the core (recompile plugin)!\n", filename); + exit(EXIT_FAILURE); } /* id */ @@ -264,6 +252,8 @@ struct hplugin *hplugin_load(const char* filename) { if( HPM->load_sub ) HPM->load_sub(plugin); + ShowStatus("HPM: Loaded plugin '"CL_WHITE"%s"CL_RESET"' (%s).\n", plugin->info->name, plugin->info->version); + return plugin; } @@ -351,11 +341,14 @@ void hplugins_config_read(void) { struct hplugin *plugin; snprintf(filename, 60, "plugins/%s%s", hooking_plugin_name, DLL_EXT); if ((plugin = HPM->load(filename))) { - bool (*func)(bool *fr); + const char * (*func)(bool *fr); bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); - if ((func = plugin_import(plugin->dll, "Hooked",bool (*)(bool *))) + if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *))) && (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int)))) { - if (func(&HPM->force_return)) { + const char *failed = func(&HPM->force_return); + if (failed) { + ShowError("HPM: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", failed, plugin_name); + } else { HPM->hooking = true; HPM->addhook_sub = addhook_sub; } diff --git a/src/common/HPM.h b/src/common/HPM.h index e99b0f2ae..1358f19dc 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -8,8 +8,8 @@ #error You should never include HPM.h from a plugin. #endif -#include "../common/HPMi.h" -#include "../common/cbasetypes.h" +#include "common/HPMi.h" +#include "common/cbasetypes.h" #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 40c949d53..a27dbeb07 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -9,7 +9,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #ifdef CHAR_CHAR_H + { "char_auth_node", sizeof(struct char_auth_node), SERVER_TYPE_CHAR }, { "char_interface", sizeof(struct char_interface), SERVER_TYPE_CHAR }, + { "char_session_data", sizeof(struct char_session_data), SERVER_TYPE_CHAR }, + { "mmo_map_server", sizeof(struct mmo_map_server), SERVER_TYPE_CHAR }, + { "online_char_data", sizeof(struct online_char_data), SERVER_TYPE_CHAR }, #else #define CHAR_CHAR_H #endif // CHAR_CHAR_H @@ -94,10 +98,24 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_CONF_H #endif // COMMON_CONF_H + #ifdef COMMON_CONSOLE_H + { "CParseEntry", sizeof(struct CParseEntry), SERVER_TYPE_ALL }, + { "console_interface", sizeof(struct console_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_CONSOLE_H + #endif // COMMON_CONSOLE_H + #ifdef COMMON_CORE_H + { "CmdlineArgData", sizeof(struct CmdlineArgData), SERVER_TYPE_ALL }, + { "cmdline_interface", sizeof(struct cmdline_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_CORE_H + #endif // COMMON_CORE_H #ifdef COMMON_DB_H { "DBData", sizeof(struct DBData), SERVER_TYPE_ALL }, { "DBIterator", sizeof(struct DBIterator), SERVER_TYPE_ALL }, { "DBMap", sizeof(struct DBMap), SERVER_TYPE_ALL }, + { "db_interface", sizeof(struct db_interface), SERVER_TYPE_ALL }, + { "linkdb_node", sizeof(struct linkdb_node), SERVER_TYPE_ALL }, #else #define COMMON_DB_H #endif // COMMON_DB_H @@ -111,24 +129,85 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_ERS_H #endif // COMMON_ERS_H + #ifdef COMMON_HPMI_H + { "HPMi_interface", sizeof(struct HPMi_interface), SERVER_TYPE_ALL }, + { "hplugin_info", sizeof(struct hplugin_info), SERVER_TYPE_ALL }, + { "s_HPMDataCheck", sizeof(struct s_HPMDataCheck), SERVER_TYPE_ALL }, + #else + #define COMMON_HPMI_H + #endif // COMMON_HPMI_H + #ifdef COMMON_MALLOC_H + { "malloc_interface", sizeof(struct malloc_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_MALLOC_H + #endif // COMMON_MALLOC_H #ifdef COMMON_MAPINDEX_H { "mapindex_interface", sizeof(struct mapindex_interface), SERVER_TYPE_ALL }, #else #define COMMON_MAPINDEX_H #endif // COMMON_MAPINDEX_H #ifdef COMMON_MMO_H + { "auction_data", sizeof(struct auction_data), SERVER_TYPE_ALL }, + { "fame_list", sizeof(struct fame_list), SERVER_TYPE_ALL }, + { "guild", sizeof(struct guild), SERVER_TYPE_ALL }, + { "guild_alliance", sizeof(struct guild_alliance), SERVER_TYPE_ALL }, + { "guild_castle", sizeof(struct guild_castle), SERVER_TYPE_ALL }, + { "guild_expulsion", sizeof(struct guild_expulsion), SERVER_TYPE_ALL }, + { "guild_member", sizeof(struct guild_member), SERVER_TYPE_ALL }, + { "guild_position", sizeof(struct guild_position), SERVER_TYPE_ALL }, + { "guild_skill", sizeof(struct guild_skill), SERVER_TYPE_ALL }, + { "guild_storage", sizeof(struct guild_storage), SERVER_TYPE_ALL }, + { "hotkey", sizeof(struct hotkey), SERVER_TYPE_ALL }, + { "item", sizeof(struct item), SERVER_TYPE_ALL }, + { "mail_data", sizeof(struct mail_data), SERVER_TYPE_ALL }, + { "mail_message", sizeof(struct mail_message), SERVER_TYPE_ALL }, + { "mmo_charstatus", sizeof(struct mmo_charstatus), SERVER_TYPE_ALL }, + { "party", sizeof(struct party), SERVER_TYPE_ALL }, + { "party_member", sizeof(struct party_member), SERVER_TYPE_ALL }, + { "point", sizeof(struct point), SERVER_TYPE_ALL }, { "quest", sizeof(struct quest), SERVER_TYPE_ALL }, + { "s_elemental", sizeof(struct s_elemental), SERVER_TYPE_ALL }, + { "s_friend", sizeof(struct s_friend), SERVER_TYPE_ALL }, + { "s_homunculus", sizeof(struct s_homunculus), SERVER_TYPE_ALL }, + { "s_mercenary", sizeof(struct s_mercenary), SERVER_TYPE_ALL }, + { "s_pet", sizeof(struct s_pet), SERVER_TYPE_ALL }, + { "s_skill", sizeof(struct s_skill), SERVER_TYPE_ALL }, + { "script_reg_num", sizeof(struct script_reg_num), SERVER_TYPE_ALL }, + { "script_reg_state", sizeof(struct script_reg_state), SERVER_TYPE_ALL }, + { "script_reg_str", sizeof(struct script_reg_str), SERVER_TYPE_ALL }, + { "status_change_data", sizeof(struct status_change_data), SERVER_TYPE_ALL }, + { "storage_data", sizeof(struct storage_data), SERVER_TYPE_ALL }, #else #define COMMON_MMO_H #endif // COMMON_MMO_H + #ifdef COMMON_NULLPO_H + { "nullpo_interface", sizeof(struct nullpo_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_NULLPO_H + #endif // COMMON_NULLPO_H #ifdef COMMON_SOCKET_H + { "hSockOpt", sizeof(struct hSockOpt), SERVER_TYPE_ALL }, + { "socket_data", sizeof(struct socket_data), SERVER_TYPE_ALL }, { "socket_interface", sizeof(struct socket_interface), SERVER_TYPE_ALL }, #else #define COMMON_SOCKET_H #endif // COMMON_SOCKET_H + #ifdef COMMON_SPINLOCK_H + { "SPIN_LOCK", sizeof(struct SPIN_LOCK), SERVER_TYPE_ALL }, + #else + #define COMMON_SPINLOCK_H + #endif // COMMON_SPINLOCK_H + #ifdef COMMON_SQL_H + { "sql_interface", sizeof(struct sql_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_SQL_H + #endif // COMMON_SQL_H #ifdef COMMON_STRLIB_H { "StringBuf", sizeof(struct StringBuf), SERVER_TYPE_ALL }, { "s_svstate", sizeof(struct s_svstate), SERVER_TYPE_ALL }, + { "stringbuf_interface", sizeof(struct stringbuf_interface), SERVER_TYPE_ALL }, + { "strlib_interface", sizeof(struct strlib_interface), SERVER_TYPE_ALL }, + { "sv_interface", sizeof(struct sv_interface), SERVER_TYPE_ALL }, #else #define COMMON_STRLIB_H #endif // COMMON_STRLIB_H @@ -137,96 +216,446 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_SYSINFO_H #endif // COMMON_SYSINFO_H + #ifdef COMMON_TIMER_H + { "TimerData", sizeof(struct TimerData), SERVER_TYPE_ALL }, + { "timer_interface", sizeof(struct timer_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_TIMER_H + #endif // COMMON_TIMER_H + #ifdef COMMON_UTILS_H + { "HCache_interface", sizeof(struct HCache_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_UTILS_H + #endif // COMMON_UTILS_H + #ifdef LOGIN_ACCOUNT_H + { "Account_engine", sizeof(struct Account_engine), SERVER_TYPE_LOGIN }, + { "AccountDB", sizeof(struct AccountDB), SERVER_TYPE_LOGIN }, + { "AccountDBIterator", sizeof(struct AccountDBIterator), SERVER_TYPE_LOGIN }, + { "mmo_account", sizeof(struct mmo_account), SERVER_TYPE_LOGIN }, + #else + #define LOGIN_ACCOUNT_H + #endif // LOGIN_ACCOUNT_H #ifdef LOGIN_LOGIN_H + { "Login_Config", sizeof(struct Login_Config), SERVER_TYPE_LOGIN }, + { "client_hash_node", sizeof(struct client_hash_node), SERVER_TYPE_LOGIN }, + { "login_auth_node", sizeof(struct login_auth_node), SERVER_TYPE_LOGIN }, { "login_interface", sizeof(struct login_interface), SERVER_TYPE_LOGIN }, + { "login_session_data", sizeof(struct login_session_data), SERVER_TYPE_LOGIN }, + { "mmo_char_server", sizeof(struct mmo_char_server), SERVER_TYPE_LOGIN }, + { "online_login_data", sizeof(struct online_login_data), SERVER_TYPE_LOGIN }, #else #define LOGIN_LOGIN_H #endif // LOGIN_LOGIN_H #ifdef MAP_ATCOMMAND_H { "AliasInfo", sizeof(struct AliasInfo), SERVER_TYPE_MAP }, + { "AtCommandInfo", sizeof(struct AtCommandInfo), SERVER_TYPE_MAP }, + { "atcmd_binding_data", sizeof(struct atcmd_binding_data), SERVER_TYPE_MAP }, { "atcommand_interface", sizeof(struct atcommand_interface), SERVER_TYPE_MAP }, #else #define MAP_ATCOMMAND_H #endif // MAP_ATCOMMAND_H + #ifdef MAP_BATTLEGROUND_H + { "battleground_data", sizeof(struct battleground_data), SERVER_TYPE_MAP }, + { "battleground_interface", sizeof(struct battleground_interface), SERVER_TYPE_MAP }, + { "battleground_member_data", sizeof(struct battleground_member_data), SERVER_TYPE_MAP }, + { "bg_arena", sizeof(struct bg_arena), SERVER_TYPE_MAP }, + #else + #define MAP_BATTLEGROUND_H + #endif // MAP_BATTLEGROUND_H #ifdef MAP_BATTLE_H + { "Battle_Config", sizeof(struct Battle_Config), SERVER_TYPE_MAP }, { "Damage", sizeof(struct Damage), SERVER_TYPE_MAP }, { "battle_interface", sizeof(struct battle_interface), SERVER_TYPE_MAP }, + { "delay_damage", sizeof(struct delay_damage), SERVER_TYPE_MAP }, #else #define MAP_BATTLE_H #endif // MAP_BATTLE_H #ifdef MAP_BUYINGSTORE_H { "buyingstore_interface", sizeof(struct buyingstore_interface), SERVER_TYPE_MAP }, + { "s_buyingstore", sizeof(struct s_buyingstore), SERVER_TYPE_MAP }, { "s_buyingstore_item", sizeof(struct s_buyingstore_item), SERVER_TYPE_MAP }, #else #define MAP_BUYINGSTORE_H #endif // MAP_BUYINGSTORE_H #ifdef MAP_CHANNEL_H { "Channel_Config", sizeof(struct Channel_Config), SERVER_TYPE_MAP }, + { "channel_ban_entry", sizeof(struct channel_ban_entry), SERVER_TYPE_MAP }, + { "channel_data", sizeof(struct channel_data), SERVER_TYPE_MAP }, + { "channel_interface", sizeof(struct channel_interface), SERVER_TYPE_MAP }, #else #define MAP_CHANNEL_H #endif // MAP_CHANNEL_H + #ifdef MAP_CHAT_H + { "chat_data", sizeof(struct chat_data), SERVER_TYPE_MAP }, + { "chat_interface", sizeof(struct chat_interface), SERVER_TYPE_MAP }, + #else + #define MAP_CHAT_H + #endif // MAP_CHAT_H #ifdef MAP_CHRIF_H { "auth_node", sizeof(struct auth_node), SERVER_TYPE_MAP }, + { "chrif_interface", sizeof(struct chrif_interface), SERVER_TYPE_MAP }, #else #define MAP_CHRIF_H #endif // MAP_CHRIF_H #ifdef MAP_CLIF_H + { "cdelayed_damage", sizeof(struct cdelayed_damage), SERVER_TYPE_MAP }, { "clif_interface", sizeof(struct clif_interface), SERVER_TYPE_MAP }, + { "hCSData", sizeof(struct hCSData), SERVER_TYPE_MAP }, + { "merge_item", sizeof(struct merge_item), SERVER_TYPE_MAP }, + { "s_packet_db", sizeof(struct s_packet_db), SERVER_TYPE_MAP }, #else #define MAP_CLIF_H #endif // MAP_CLIF_H + #ifdef MAP_DUEL_H + { "duel", sizeof(struct duel), SERVER_TYPE_MAP }, + { "duel_interface", sizeof(struct duel_interface), SERVER_TYPE_MAP }, + #else + #define MAP_DUEL_H + #endif // MAP_DUEL_H #ifdef MAP_ELEMENTAL_H + { "elemental_data", sizeof(struct elemental_data), SERVER_TYPE_MAP }, + { "elemental_interface", sizeof(struct elemental_interface), SERVER_TYPE_MAP }, { "elemental_skill", sizeof(struct elemental_skill), SERVER_TYPE_MAP }, + { "s_elemental_db", sizeof(struct s_elemental_db), SERVER_TYPE_MAP }, #else #define MAP_ELEMENTAL_H #endif // MAP_ELEMENTAL_H #ifdef MAP_GUILD_H { "eventlist", sizeof(struct eventlist), SERVER_TYPE_MAP }, { "guardian_data", sizeof(struct guardian_data), SERVER_TYPE_MAP }, + { "guild_expcache", sizeof(struct guild_expcache), SERVER_TYPE_MAP }, + { "guild_interface", sizeof(struct guild_interface), SERVER_TYPE_MAP }, + { "s_guild_skill_tree", sizeof(struct s_guild_skill_tree), SERVER_TYPE_MAP }, #else #define MAP_GUILD_H #endif // MAP_GUILD_H + #ifdef MAP_HOMUNCULUS_H + { "h_stats", sizeof(struct h_stats), SERVER_TYPE_MAP }, + { "homun_data", sizeof(struct homun_data), SERVER_TYPE_MAP }, + { "homun_dbs", sizeof(struct homun_dbs), SERVER_TYPE_MAP }, + { "homun_skill_tree_entry", sizeof(struct homun_skill_tree_entry), SERVER_TYPE_MAP }, + { "homunculus_interface", sizeof(struct homunculus_interface), SERVER_TYPE_MAP }, + { "s_homunculus_db", sizeof(struct s_homunculus_db), SERVER_TYPE_MAP }, + #else + #define MAP_HOMUNCULUS_H + #endif // MAP_HOMUNCULUS_H + #ifdef MAP_INSTANCE_H + { "instance_data", sizeof(struct instance_data), SERVER_TYPE_MAP }, + { "instance_interface", sizeof(struct instance_interface), SERVER_TYPE_MAP }, + #else + #define MAP_INSTANCE_H + #endif // MAP_INSTANCE_H + #ifdef MAP_INTIF_H + { "intif_interface", sizeof(struct intif_interface), SERVER_TYPE_MAP }, + #else + #define MAP_INTIF_H + #endif // MAP_INTIF_H + #ifdef MAP_IRC_BOT_H + { "irc_bot_interface", sizeof(struct irc_bot_interface), SERVER_TYPE_MAP }, + { "irc_func", sizeof(struct irc_func), SERVER_TYPE_MAP }, + #else + #define MAP_IRC_BOT_H + #endif // MAP_IRC_BOT_H + #ifdef MAP_ITEMDB_H + { "item_chain", sizeof(struct item_chain), SERVER_TYPE_MAP }, + { "item_chain_entry", sizeof(struct item_chain_entry), SERVER_TYPE_MAP }, + { "item_combo", sizeof(struct item_combo), SERVER_TYPE_MAP }, + { "item_data", sizeof(struct item_data), SERVER_TYPE_MAP }, + { "item_group", sizeof(struct item_group), SERVER_TYPE_MAP }, + { "item_package", sizeof(struct item_package), SERVER_TYPE_MAP }, + { "item_package_must_entry", sizeof(struct item_package_must_entry), SERVER_TYPE_MAP }, + { "item_package_rand_entry", sizeof(struct item_package_rand_entry), SERVER_TYPE_MAP }, + { "item_package_rand_group", sizeof(struct item_package_rand_group), SERVER_TYPE_MAP }, + { "itemdb_interface", sizeof(struct itemdb_interface), SERVER_TYPE_MAP }, + #else + #define MAP_ITEMDB_H + #endif // MAP_ITEMDB_H + #ifdef MAP_LOG_H + { "log_interface", sizeof(struct log_interface), SERVER_TYPE_MAP }, + #else + #define MAP_LOG_H + #endif // MAP_LOG_H + #ifdef MAP_MAIL_H + { "mail_interface", sizeof(struct mail_interface), SERVER_TYPE_MAP }, + #else + #define MAP_MAIL_H + #endif // MAP_MAIL_H #ifdef MAP_MAPREG_H + { "mapreg_interface", sizeof(struct mapreg_interface), SERVER_TYPE_MAP }, { "mapreg_save", sizeof(struct mapreg_save), SERVER_TYPE_MAP }, #else #define MAP_MAPREG_H #endif // MAP_MAPREG_H #ifdef MAP_MAP_H + { "block_list", sizeof(struct block_list), SERVER_TYPE_MAP }, + { "charid2nick", sizeof(struct charid2nick), SERVER_TYPE_MAP }, + { "charid_request", sizeof(struct charid_request), SERVER_TYPE_MAP }, + { "flooritem_data", sizeof(struct flooritem_data), SERVER_TYPE_MAP }, + { "iwall_data", sizeof(struct iwall_data), SERVER_TYPE_MAP }, + { "map_cache_main_header", sizeof(struct map_cache_main_header), SERVER_TYPE_MAP }, + { "map_cache_map_info", sizeof(struct map_cache_map_info), SERVER_TYPE_MAP }, + { "map_data", sizeof(struct map_data), SERVER_TYPE_MAP }, { "map_data_other_server", sizeof(struct map_data_other_server), SERVER_TYPE_MAP }, + { "map_drop_list", sizeof(struct map_drop_list), SERVER_TYPE_MAP }, + { "map_interface", sizeof(struct map_interface), SERVER_TYPE_MAP }, + { "map_zone_data", sizeof(struct map_zone_data), SERVER_TYPE_MAP }, + { "map_zone_disabled_command_entry", sizeof(struct map_zone_disabled_command_entry), SERVER_TYPE_MAP }, + { "map_zone_disabled_skill_entry", sizeof(struct map_zone_disabled_skill_entry), SERVER_TYPE_MAP }, + { "map_zone_skill_damage_cap_entry", sizeof(struct map_zone_skill_damage_cap_entry), SERVER_TYPE_MAP }, + { "mapcell", sizeof(struct mapcell), SERVER_TYPE_MAP }, + { "mapflag_skill_adjust", sizeof(struct mapflag_skill_adjust), SERVER_TYPE_MAP }, + { "mapit_interface", sizeof(struct mapit_interface), SERVER_TYPE_MAP }, + { "questinfo", sizeof(struct questinfo), SERVER_TYPE_MAP }, + { "spawn_data", sizeof(struct spawn_data), SERVER_TYPE_MAP }, #else #define MAP_MAP_H #endif // MAP_MAP_H + #ifdef MAP_MERCENARY_H + { "mercenary_data", sizeof(struct mercenary_data), SERVER_TYPE_MAP }, + { "mercenary_interface", sizeof(struct mercenary_interface), SERVER_TYPE_MAP }, + { "s_mercenary_db", sizeof(struct s_mercenary_db), SERVER_TYPE_MAP }, + #else + #define MAP_MERCENARY_H + #endif // MAP_MERCENARY_H + #ifdef MAP_MOB_H + { "item_drop", sizeof(struct item_drop), SERVER_TYPE_MAP }, + { "item_drop_list", sizeof(struct item_drop_list), SERVER_TYPE_MAP }, + { "mob_chat", sizeof(struct mob_chat), SERVER_TYPE_MAP }, + { "mob_data", sizeof(struct mob_data), SERVER_TYPE_MAP }, + { "mob_db", sizeof(struct mob_db), SERVER_TYPE_MAP }, + { "mob_interface", sizeof(struct mob_interface), SERVER_TYPE_MAP }, + { "mob_skill", sizeof(struct mob_skill), SERVER_TYPE_MAP }, + { "spawn_info", sizeof(struct spawn_info), SERVER_TYPE_MAP }, + #else + #define MAP_MOB_H + #endif // MAP_MOB_H + #ifdef MAP_NPC_H + { "event_data", sizeof(struct event_data), SERVER_TYPE_MAP }, + { "npc_data", sizeof(struct npc_data), SERVER_TYPE_MAP }, + { "npc_interface", sizeof(struct npc_interface), SERVER_TYPE_MAP }, + { "npc_item_list", sizeof(struct npc_item_list), SERVER_TYPE_MAP }, + { "npc_label_list", sizeof(struct npc_label_list), SERVER_TYPE_MAP }, + { "npc_path_data", sizeof(struct npc_path_data), SERVER_TYPE_MAP }, + { "npc_shop_data", sizeof(struct npc_shop_data), SERVER_TYPE_MAP }, + { "npc_src_list", sizeof(struct npc_src_list), SERVER_TYPE_MAP }, + { "npc_timerevent_list", sizeof(struct npc_timerevent_list), SERVER_TYPE_MAP }, + #else + #define MAP_NPC_H + #endif // MAP_NPC_H #ifdef MAP_PACKETS_STRUCT_H + { "EQUIPITEM_INFO", sizeof(struct EQUIPITEM_INFO), SERVER_TYPE_MAP }, { "EQUIPSLOTINFO", sizeof(struct EQUIPSLOTINFO), SERVER_TYPE_MAP }, + { "NORMALITEM_INFO", sizeof(struct NORMALITEM_INFO), SERVER_TYPE_MAP }, + { "packet_additem", sizeof(struct packet_additem), SERVER_TYPE_MAP }, + { "packet_authok", sizeof(struct packet_authok), SERVER_TYPE_MAP }, + { "packet_banking_check", sizeof(struct packet_banking_check), SERVER_TYPE_MAP }, + { "packet_banking_deposit_ack", sizeof(struct packet_banking_deposit_ack), SERVER_TYPE_MAP }, + { "packet_banking_deposit_req", sizeof(struct packet_banking_deposit_req), SERVER_TYPE_MAP }, + { "packet_banking_withdraw_ack", sizeof(struct packet_banking_withdraw_ack), SERVER_TYPE_MAP }, + { "packet_banking_withdraw_req", sizeof(struct packet_banking_withdraw_req), SERVER_TYPE_MAP }, + { "packet_bgqueue_ack", sizeof(struct packet_bgqueue_ack), SERVER_TYPE_MAP }, + { "packet_bgqueue_battlebegin_ack", sizeof(struct packet_bgqueue_battlebegin_ack), SERVER_TYPE_MAP }, + { "packet_bgqueue_battlebegins", sizeof(struct packet_bgqueue_battlebegins), SERVER_TYPE_MAP }, + { "packet_bgqueue_checkstate", sizeof(struct packet_bgqueue_checkstate), SERVER_TYPE_MAP }, + { "packet_bgqueue_notice_delete", sizeof(struct packet_bgqueue_notice_delete), SERVER_TYPE_MAP }, + { "packet_bgqueue_notify_entry", sizeof(struct packet_bgqueue_notify_entry), SERVER_TYPE_MAP }, + { "packet_bgqueue_register", sizeof(struct packet_bgqueue_register), SERVER_TYPE_MAP }, + { "packet_bgqueue_revoke_req", sizeof(struct packet_bgqueue_revoke_req), SERVER_TYPE_MAP }, + { "packet_bgqueue_update_info", sizeof(struct packet_bgqueue_update_info), SERVER_TYPE_MAP }, + { "packet_cart_additem_ack", sizeof(struct packet_cart_additem_ack), SERVER_TYPE_MAP }, + { "packet_damage", sizeof(struct packet_damage), SERVER_TYPE_MAP }, + { "packet_dropflooritem", sizeof(struct packet_dropflooritem), SERVER_TYPE_MAP }, + { "packet_equip_item", sizeof(struct packet_equip_item), SERVER_TYPE_MAP }, + { "packet_equipitem_ack", sizeof(struct packet_equipitem_ack), SERVER_TYPE_MAP }, + { "packet_gm_monster_item", sizeof(struct packet_gm_monster_item), SERVER_TYPE_MAP }, + { "packet_graffiti_entry", sizeof(struct packet_graffiti_entry), SERVER_TYPE_MAP }, + { "packet_idle_unit", sizeof(struct packet_idle_unit), SERVER_TYPE_MAP }, + { "packet_idle_unit2", sizeof(struct packet_idle_unit2), SERVER_TYPE_MAP }, + { "packet_item_drop_announce", sizeof(struct packet_item_drop_announce), SERVER_TYPE_MAP }, + { "packet_itemlist_equip", sizeof(struct packet_itemlist_equip), SERVER_TYPE_MAP }, + { "packet_itemlist_normal", sizeof(struct packet_itemlist_normal), SERVER_TYPE_MAP }, + { "packet_maptypeproperty2", sizeof(struct packet_maptypeproperty2), SERVER_TYPE_MAP }, + { "packet_monster_hp", sizeof(struct packet_monster_hp), SERVER_TYPE_MAP }, + { "packet_notify_bounditem", sizeof(struct packet_notify_bounditem), SERVER_TYPE_MAP }, + { "packet_npc_market_open", sizeof(struct packet_npc_market_open), SERVER_TYPE_MAP }, + { "packet_npc_market_purchase", sizeof(struct packet_npc_market_purchase), SERVER_TYPE_MAP }, + { "packet_npc_market_result_ack", sizeof(struct packet_npc_market_result_ack), SERVER_TYPE_MAP }, + { "packet_package_item_announce", sizeof(struct packet_package_item_announce), SERVER_TYPE_MAP }, + { "packet_party_leader_changed", sizeof(struct packet_party_leader_changed), SERVER_TYPE_MAP }, + { "packet_roulette_close_ack", sizeof(struct packet_roulette_close_ack), SERVER_TYPE_MAP }, + { "packet_roulette_generate_ack", sizeof(struct packet_roulette_generate_ack), SERVER_TYPE_MAP }, + { "packet_roulette_info_ack", sizeof(struct packet_roulette_info_ack), SERVER_TYPE_MAP }, + { "packet_roulette_itemrecv_ack", sizeof(struct packet_roulette_itemrecv_ack), SERVER_TYPE_MAP }, + { "packet_roulette_itemrecv_req", sizeof(struct packet_roulette_itemrecv_req), SERVER_TYPE_MAP }, + { "packet_roulette_open_ack", sizeof(struct packet_roulette_open_ack), SERVER_TYPE_MAP }, + { "packet_sc_notick", sizeof(struct packet_sc_notick), SERVER_TYPE_MAP }, + { "packet_script_clear", sizeof(struct packet_script_clear), SERVER_TYPE_MAP }, + { "packet_skill_entry", sizeof(struct packet_skill_entry), SERVER_TYPE_MAP }, + { "packet_spawn_unit", sizeof(struct packet_spawn_unit), SERVER_TYPE_MAP }, + { "packet_spawn_unit2", sizeof(struct packet_spawn_unit2), SERVER_TYPE_MAP }, + { "packet_status_change", sizeof(struct packet_status_change), SERVER_TYPE_MAP }, + { "packet_status_change2", sizeof(struct packet_status_change2), SERVER_TYPE_MAP }, + { "packet_status_change_end", sizeof(struct packet_status_change_end), SERVER_TYPE_MAP }, + { "packet_storelist_equip", sizeof(struct packet_storelist_equip), SERVER_TYPE_MAP }, + { "packet_storelist_normal", sizeof(struct packet_storelist_normal), SERVER_TYPE_MAP }, + { "packet_unequipitem_ack", sizeof(struct packet_unequipitem_ack), SERVER_TYPE_MAP }, + { "packet_unit_walking", sizeof(struct packet_unit_walking), SERVER_TYPE_MAP }, + { "packet_viewequip_ack", sizeof(struct packet_viewequip_ack), SERVER_TYPE_MAP }, + { "packet_wis_end", sizeof(struct packet_wis_end), SERVER_TYPE_MAP }, #else #define MAP_PACKETS_STRUCT_H #endif // MAP_PACKETS_STRUCT_H + #ifdef MAP_PARTY_H + { "party_booking_ad_info", sizeof(struct party_booking_ad_info), SERVER_TYPE_MAP }, + { "party_booking_detail", sizeof(struct party_booking_detail), SERVER_TYPE_MAP }, + { "party_data", sizeof(struct party_data), SERVER_TYPE_MAP }, + { "party_interface", sizeof(struct party_interface), SERVER_TYPE_MAP }, + { "party_member_data", sizeof(struct party_member_data), SERVER_TYPE_MAP }, + #else + #define MAP_PARTY_H + #endif // MAP_PARTY_H + #ifdef MAP_PATH_H + { "path_interface", sizeof(struct path_interface), SERVER_TYPE_MAP }, + { "shootpath_data", sizeof(struct shootpath_data), SERVER_TYPE_MAP }, + { "walkpath_data", sizeof(struct walkpath_data), SERVER_TYPE_MAP }, + #else + #define MAP_PATH_H + #endif // MAP_PATH_H + #ifdef MAP_PC_GROUPS_H + { "GroupSettings", sizeof(struct GroupSettings), SERVER_TYPE_MAP }, + { "pc_groups_interface", sizeof(struct pc_groups_interface), SERVER_TYPE_MAP }, + { "pc_groups_new_permission", sizeof(struct pc_groups_new_permission), SERVER_TYPE_MAP }, + { "pc_groups_permission_table", sizeof(struct pc_groups_permission_table), SERVER_TYPE_MAP }, + #else + #define MAP_PC_GROUPS_H + #endif // MAP_PC_GROUPS_H #ifdef MAP_PC_H { "autotrade_vending", sizeof(struct autotrade_vending), SERVER_TYPE_MAP }, { "item_cd", sizeof(struct item_cd), SERVER_TYPE_MAP }, + { "map_session_data", sizeof(struct map_session_data), SERVER_TYPE_MAP }, + { "pc_combos", sizeof(struct pc_combos), SERVER_TYPE_MAP }, + { "pc_interface", sizeof(struct pc_interface), SERVER_TYPE_MAP }, + { "s_add_drop", sizeof(struct s_add_drop), SERVER_TYPE_MAP }, + { "s_addeffect", sizeof(struct s_addeffect), SERVER_TYPE_MAP }, + { "s_addeffectonskill", sizeof(struct s_addeffectonskill), SERVER_TYPE_MAP }, + { "s_autobonus", sizeof(struct s_autobonus), SERVER_TYPE_MAP }, + { "s_autospell", sizeof(struct s_autospell), SERVER_TYPE_MAP }, + { "sg_data", sizeof(struct sg_data), SERVER_TYPE_MAP }, + { "skill_tree_entry", sizeof(struct skill_tree_entry), SERVER_TYPE_MAP }, + { "weapon_data", sizeof(struct weapon_data), SERVER_TYPE_MAP }, #else #define MAP_PC_H #endif // MAP_PC_H + #ifdef MAP_PET_H + { "pet_bonus", sizeof(struct pet_bonus), SERVER_TYPE_MAP }, + { "pet_data", sizeof(struct pet_data), SERVER_TYPE_MAP }, + { "pet_interface", sizeof(struct pet_interface), SERVER_TYPE_MAP }, + { "pet_loot", sizeof(struct pet_loot), SERVER_TYPE_MAP }, + { "pet_recovery", sizeof(struct pet_recovery), SERVER_TYPE_MAP }, + { "pet_skill_attack", sizeof(struct pet_skill_attack), SERVER_TYPE_MAP }, + { "pet_skill_support", sizeof(struct pet_skill_support), SERVER_TYPE_MAP }, + { "s_pet_db", sizeof(struct s_pet_db), SERVER_TYPE_MAP }, + #else + #define MAP_PET_H + #endif // MAP_PET_H + #ifdef MAP_QUEST_H + { "quest_db", sizeof(struct quest_db), SERVER_TYPE_MAP }, + { "quest_dropitem", sizeof(struct quest_dropitem), SERVER_TYPE_MAP }, + { "quest_interface", sizeof(struct quest_interface), SERVER_TYPE_MAP }, + { "quest_objective", sizeof(struct quest_objective), SERVER_TYPE_MAP }, + #else + #define MAP_QUEST_H + #endif // MAP_QUEST_H #ifdef MAP_SCRIPT_H { "Script_Config", sizeof(struct Script_Config), SERVER_TYPE_MAP }, + { "casecheck_data", sizeof(struct casecheck_data), SERVER_TYPE_MAP }, + { "hQueue", sizeof(struct hQueue), SERVER_TYPE_MAP }, + { "hQueueIterator", sizeof(struct hQueueIterator), SERVER_TYPE_MAP }, { "reg_db", sizeof(struct reg_db), SERVER_TYPE_MAP }, + { "script_array", sizeof(struct script_array), SERVER_TYPE_MAP }, + { "script_code", sizeof(struct script_code), SERVER_TYPE_MAP }, + { "script_data", sizeof(struct script_data), SERVER_TYPE_MAP }, + { "script_function", sizeof(struct script_function), SERVER_TYPE_MAP }, { "script_interface", sizeof(struct script_interface), SERVER_TYPE_MAP }, + { "script_label_entry", sizeof(struct script_label_entry), SERVER_TYPE_MAP }, + { "script_retinfo", sizeof(struct script_retinfo), SERVER_TYPE_MAP }, + { "script_stack", sizeof(struct script_stack), SERVER_TYPE_MAP }, + { "script_state", sizeof(struct script_state), SERVER_TYPE_MAP }, + { "script_string_buf", sizeof(struct script_string_buf), SERVER_TYPE_MAP }, + { "script_syntax_data", sizeof(struct script_syntax_data), SERVER_TYPE_MAP }, + { "str_data_struct", sizeof(struct str_data_struct), SERVER_TYPE_MAP }, + { "string_translation", sizeof(struct string_translation), SERVER_TYPE_MAP }, #else #define MAP_SCRIPT_H #endif // MAP_SCRIPT_H #ifdef MAP_SEARCHSTORE_H + { "s_search_store_info", sizeof(struct s_search_store_info), SERVER_TYPE_MAP }, + { "s_search_store_info_item", sizeof(struct s_search_store_info_item), SERVER_TYPE_MAP }, { "searchstore_interface", sizeof(struct searchstore_interface), SERVER_TYPE_MAP }, #else #define MAP_SEARCHSTORE_H #endif // MAP_SEARCHSTORE_H #ifdef MAP_SKILL_H + { "s_skill_abra_db", sizeof(struct s_skill_abra_db), SERVER_TYPE_MAP }, + { "s_skill_arrow_db", sizeof(struct s_skill_arrow_db), SERVER_TYPE_MAP }, + { "s_skill_changematerial_db", sizeof(struct s_skill_changematerial_db), SERVER_TYPE_MAP }, + { "s_skill_db", sizeof(struct s_skill_db), SERVER_TYPE_MAP }, + { "s_skill_dbs", sizeof(struct s_skill_dbs), SERVER_TYPE_MAP }, + { "s_skill_improvise_db", sizeof(struct s_skill_improvise_db), SERVER_TYPE_MAP }, + { "s_skill_magicmushroom_db", sizeof(struct s_skill_magicmushroom_db), SERVER_TYPE_MAP }, + { "s_skill_produce_db", sizeof(struct s_skill_produce_db), SERVER_TYPE_MAP }, + { "s_skill_spellbook_db", sizeof(struct s_skill_spellbook_db), SERVER_TYPE_MAP }, + { "s_skill_unit_layout", sizeof(struct s_skill_unit_layout), SERVER_TYPE_MAP }, { "skill_cd", sizeof(struct skill_cd), SERVER_TYPE_MAP }, + { "skill_cd_entry", sizeof(struct skill_cd_entry), SERVER_TYPE_MAP }, { "skill_condition", sizeof(struct skill_condition), SERVER_TYPE_MAP }, { "skill_interface", sizeof(struct skill_interface), SERVER_TYPE_MAP }, + { "skill_timerskill", sizeof(struct skill_timerskill), SERVER_TYPE_MAP }, + { "skill_unit", sizeof(struct skill_unit), SERVER_TYPE_MAP }, + { "skill_unit_group", sizeof(struct skill_unit_group), SERVER_TYPE_MAP }, + { "skill_unit_group_tickset", sizeof(struct skill_unit_group_tickset), SERVER_TYPE_MAP }, { "skill_unit_save", sizeof(struct skill_unit_save), SERVER_TYPE_MAP }, #else #define MAP_SKILL_H #endif // MAP_SKILL_H + #ifdef MAP_STATUS_H + { "regen_data", sizeof(struct regen_data), SERVER_TYPE_MAP }, + { "regen_data_sub", sizeof(struct regen_data_sub), SERVER_TYPE_MAP }, + { "s_refine_info", sizeof(struct s_refine_info), SERVER_TYPE_MAP }, + { "s_status_dbs", sizeof(struct s_status_dbs), SERVER_TYPE_MAP }, + { "sc_display_entry", sizeof(struct sc_display_entry), SERVER_TYPE_MAP }, + { "status_change", sizeof(struct status_change), SERVER_TYPE_MAP }, + { "status_change_entry", sizeof(struct status_change_entry), SERVER_TYPE_MAP }, + { "status_data", sizeof(struct status_data), SERVER_TYPE_MAP }, + { "status_interface", sizeof(struct status_interface), SERVER_TYPE_MAP }, + { "weapon_atk", sizeof(struct weapon_atk), SERVER_TYPE_MAP }, + #else + #define MAP_STATUS_H + #endif // MAP_STATUS_H + #ifdef MAP_STORAGE_H + { "guild_storage_interface", sizeof(struct guild_storage_interface), SERVER_TYPE_MAP }, + { "storage_interface", sizeof(struct storage_interface), SERVER_TYPE_MAP }, + #else + #define MAP_STORAGE_H + #endif // MAP_STORAGE_H + #ifdef MAP_TRADE_H + { "trade_interface", sizeof(struct trade_interface), SERVER_TYPE_MAP }, + #else + #define MAP_TRADE_H + #endif // MAP_TRADE_H + #ifdef MAP_UNIT_H + { "unit_data", sizeof(struct unit_data), SERVER_TYPE_MAP }, + { "unit_interface", sizeof(struct unit_interface), SERVER_TYPE_MAP }, + { "view_data", sizeof(struct view_data), SERVER_TYPE_MAP }, + #else + #define MAP_UNIT_H + #endif // MAP_UNIT_H + #ifdef MAP_VENDING_H + { "s_vending", sizeof(struct s_vending), SERVER_TYPE_MAP }, + { "vending_interface", sizeof(struct vending_interface), SERVER_TYPE_MAP }, + #else + #define MAP_VENDING_H + #endif // MAP_VENDING_H }; HPExport unsigned int HPMDataCheckLen = ARRAYLENGTH(HPMDataCheck); HPExport int HPMDataCheckVer = 1; diff --git a/src/common/HPMi.h b/src/common/HPMi.h index d4b2e323c..b700c1b73 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -4,10 +4,10 @@ #ifndef COMMON_HPMI_H #define COMMON_HPMI_H -#include "../common/cbasetypes.h" -#include "../common/console.h" -#include "../common/core.h" -#include "../common/sql.h" +#include "common/cbasetypes.h" +#include "common/console.h" +#include "common/core.h" +#include "common/sql.h" struct script_state; struct AtCommandInfo; @@ -21,7 +21,7 @@ struct map_session_data; #endif /* after */ -#include "../common/showmsg.h" +#include "common/showmsg.h" #define HPM_VERSION "1.0" #define HPM_ADDCONF_LENGTH 40 @@ -83,6 +83,7 @@ enum HPluginDataTypes { HPDT_MOBDB, HPDT_MOBDATA, HPDT_ITEMDATA, + HPDT_BGDATA, }; /* used in macros and conf storage */ @@ -146,6 +147,10 @@ enum HPluginConfType { #define addToITEMDATA(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_ITEMDATA,HPMi->pid,(ptr),(data),(index),(autofree))) #define getFromITEMDATA(ptr,index) (HPMi->getFromHPData(HPDT_ITEMDATA,HPMi->pid,(ptr),(index))) #define removeFromITEMDATA(ptr,index) (HPMi->removeFromHPData(HPDT_ITEMDATA,HPMi->pid,(ptr),(index))) +/* battleground_data */ +#define addToBGDATA(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_BGDATA,HPMi->pid,(ptr),(data),(index),(autofree))) +#define getFromBGDATA(ptr,index) (HPMi->getFromHPData(HPDT_BGDATA,HPMi->pid,(ptr),(index))) +#define removeFromBGDATA(ptr,index) (HPMi->removeFromHPData(HPDT_BGDATA,HPMi->pid,(ptr),(index))) /* HPMi->addCommand */ #define addAtcommand(cname,funcname) \ diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 5dfdd35bd..f6f993165 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -6,17 +6,20 @@ CONFIG_D = ../config CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) -LIBCONFIG_D = ../../3rdparty/libconfig +COMMON_INCLUDE = -I.. + +THIRDPARTY_D = ../../3rdparty +THIRDPARTY_INCLUDE = -I$(THIRDPARTY_D) + +LIBCONFIG_D = $(THIRDPARTY_D)/libconfig LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \ scanner.o strbuf.o) LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \ scanctx.h scanner.h strbuf.h wincompat.h) -LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D) -MT19937AR_D = ../../3rdparty/mt19937ar +MT19937AR_D = $(THIRDPARTY_D)/mt19937ar MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o MT19937AR_H = $(MT19937AR_D)/mt19937ar.h -MT19937AR_INCLUDE = -I$(MT19937AR_D) COMMON_SHARED_C = conf.c db.c des.c ers.c grfio.c HPM.c mapindex.c md5calc.c \ mutex.c nullpo.c random.c showmsg.c strlib.c sysinfo.c \ @@ -116,15 +119,15 @@ obj_all/sysinfo.o: sysinfo.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_ obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $< obj_all/mini%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $< obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_sql @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< # missing object files $(MT19937AR_OBJ): diff --git a/src/common/atomic.h b/src/common/atomic.h index a42dfad1c..c1ea2aa48 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -14,10 +14,10 @@ // // our Abstraction is fully API-Compatible to Microsoft's implementation @ NT5.0+ // -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #if defined(_MSC_VER) -#include "../common/winapi.h" +#include "common/winapi.h" // This checks if C/C++ Compiler Version is 18.00 #if _MSC_VER < 1800 diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 3ff0db795..ce8fc6bcf 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -97,6 +97,7 @@ #include <inttypes.h> #include <stdint.h> #include <limits.h> +#include <time.h> // temporary fix for bugreport:4961 (unintended conversion from signed to unsigned) // (-20 >= UCHAR_MAX) returns true @@ -419,4 +420,10 @@ typedef char bool; #define h64BPTRSIZE(y) (y) #endif +/** Support macros for marking blocks to memset to 0 */ +#define BEGIN_ZEROED_BLOCK int8 HERC__zeroed_block_BEGIN +#define END_ZEROED_BLOCK int8 HERC__zeroed_block_END +#define ZEROED_BLOCK_POS(x) (&(x)->HERC__zeroed_block_BEGIN) +#define ZEROED_BLOCK_SIZE(x) ((char*)&((x)->HERC__zeroed_block_END) - (char*)&((x)->HERC__zeroed_block_BEGIN) + sizeof((x)->HERC__zeroed_block_END)) + #endif /* COMMON_CBASETYPES_H */ diff --git a/src/common/conf.c b/src/common/conf.c index c974decf9..cb0194c3a 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -6,9 +6,9 @@ #include "conf.h" -#include "../../3rdparty/libconfig/libconfig.h" +#include "common/showmsg.h" // ShowError -#include "../common/showmsg.h" // ShowError +#include <libconfig/libconfig.h> /* interface source */ struct libconfig_interface libconfig_s; diff --git a/src/common/conf.h b/src/common/conf.h index bd97d5c1e..1889aeb3a 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -5,9 +5,9 @@ #ifndef COMMON_CONF_H #define COMMON_CONF_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" -#include "../../3rdparty/libconfig/libconfig.h" +#include <libconfig/libconfig.h> /** * The libconfig interface -- specially for plugins, but we enforce it throughout the core to be consistent diff --git a/src/common/console.c b/src/common/console.c index 97ca0650e..95d1e69fe 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -4,34 +4,33 @@ #define HERCULES_CORE -#include "../config/core.h" // CONSOLE_INPUT, MAX_CONSOLE_INPUT +#include "config/core.h" // CONSOLE_INPUT, MAX_CONSOLE_INPUT #include "console.h" -#include <stdio.h> -#include <stdlib.h> - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" #ifndef MINICORE -# include "../common/atomic.h" -# include "../common/ers.h" -# include "../common/malloc.h" -# include "../common/mutex.h" -# include "../common/spinlock.h" -# include "../common/sql.h" -# include "../common/strlib.h" -# include "../common/thread.h" -# include "../common/timer.h" +# include "common/atomic.h" +# include "common/ers.h" +# include "common/malloc.h" +# include "common/mutex.h" +# include "common/spinlock.h" +# include "common/sql.h" +# include "common/strlib.h" +# include "common/thread.h" +# include "common/timer.h" #endif +#include <stdio.h> +#include <stdlib.h> #if !defined(WIN32) # include <sys/time.h> # include <unistd.h> #else -# include "../common/winapi.h" // Console close event handling +# include "common/winapi.h" // Console close event handling # ifdef CONSOLE_INPUT # include <conio.h> /* _kbhit() */ # endif @@ -63,7 +62,7 @@ void display_title(void) { ShowMessage(""CL_BG_RED""CL_BT_WHITE" | | | | __/ | | (__| |_| | | __/\\__ \\ "CL_CLL""CL_NORMAL"\n"); ShowMessage(""CL_BG_RED""CL_BT_WHITE" \\_| |_/\\___|_| \\___|\\__,_|_|\\___||___/ "CL_CLL""CL_NORMAL"\n"); ShowMessage(""CL_BG_RED""CL_BT_WHITE" "CL_CLL""CL_NORMAL"\n"); - ShowMessage(""CL_BG_RED""CL_BT_WHITE" http://hercules.ws/board/ "CL_CLL""CL_NORMAL"\n"); + ShowMessage(""CL_BG_RED""CL_BT_WHITE" http://herc.ws/board/ "CL_CLL""CL_NORMAL"\n"); ShowMessage(""CL_BG_RED""CL_BT_WHITE" "CL_CLL""CL_NORMAL"\n"); ShowInfo("Hercules %d-bit for %s\n", sysinfo->is64bit() ? 64 : 32, sysinfo->platform()); diff --git a/src/common/console.h b/src/common/console.h index 3d3c8e9dd..643edc3d9 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -4,13 +4,13 @@ #ifndef COMMON_CONSOLE_H #define COMMON_CONSOLE_H -#include "../config/core.h" // MAX_CONSOLE_INPUT +#include "config/core.h" // MAX_CONSOLE_INPUT -#include "../common/cbasetypes.h" -#include "../common/mutex.h" -#include "../common/spinlock.h" -#include "../common/sql.h" -#include "../common/thread.h" +#include "common/cbasetypes.h" +#include "common/mutex.h" +#include "common/spinlock.h" +#include "common/sql.h" +#include "common/thread.h" /** * Queue Max diff --git a/src/common/core.c b/src/common/core.c index 8bf381589..e663c4e4c 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -4,41 +4,39 @@ #define HERCULES_CORE -#include "../config/core.h" +#include "config/core.h" #include "core.h" -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "../common/cbasetypes.h" -#include "../common/console.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/random.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/sysinfo.h" -#include "../common/nullpo.h" +#include "common/cbasetypes.h" +#include "common/console.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/random.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/sysinfo.h" +#include "common/nullpo.h" #ifndef MINICORE -# include "../common/HPM.h" -# include "../common/conf.h" -# include "../common/db.h" -# include "../common/ers.h" -# include "../common/socket.h" -# include "../common/sql.h" -# include "../common/thread.h" -# include "../common/timer.h" -# include "../common/utils.h" +# include "common/HPM.h" +# include "common/conf.h" +# include "common/ers.h" +# include "common/socket.h" +# include "common/sql.h" +# include "common/thread.h" +# include "common/timer.h" +# include "common/utils.h" #endif #ifndef _WIN32 # include <unistd.h> #else -# include "../common/winapi.h" // Console close event handling +# include "common/winapi.h" // Console close event handling #endif +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> /// Called when a terminate signal is received. void (*shutdown_callback)(void) = NULL; @@ -250,7 +248,7 @@ static CMDLINEARG(help) */ static CMDLINEARG(version) { - ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://hercules.ws/\n"); + ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://herc.ws/\n"); ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rizon.net/#Hercules\n"); ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n"); return false; diff --git a/src/common/core.h b/src/common/core.h index 827d345ba..c2a8d9e58 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -5,9 +5,7 @@ #ifndef COMMON_CORE_H #define COMMON_CORE_H -#include "../common/cbasetypes.h" -#include "../common/db.h" -#include "../common/mmo.h" +#include "common/cbasetypes.h" /* so that developers with --enable-debug can raise signals from any section of the code they'd like */ #ifdef DEBUG diff --git a/src/common/db.c b/src/common/db.c index 69e2333a9..5063425e6 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -72,15 +72,15 @@ #include "db.h" +#include "common/ers.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" + #include <stdio.h> #include <stdlib.h> -#include "../common/ers.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" - struct db_interface DB_s; /*****************************************************************************\ diff --git a/src/common/db.h b/src/common/db.h index cd61e1543..f75cbd8dc 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -42,9 +42,9 @@ #ifndef COMMON_DB_H #define COMMON_DB_H -#include <stdarg.h> +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdarg.h> /*****************************************************************************\ * (1) Section with public typedefs, enums, unions, structures and defines. * @@ -71,10 +71,10 @@ * @see #db_custom_release(DBRelease) */ typedef enum DBRelease { - DB_RELEASE_NOTHING = 0, - DB_RELEASE_KEY = 1, - DB_RELEASE_DATA = 2, - DB_RELEASE_BOTH = 3 + DB_RELEASE_NOTHING = 0x0, + DB_RELEASE_KEY = 0x1, + DB_RELEASE_DATA = 0x2, + DB_RELEASE_BOTH = DB_RELEASE_KEY|DB_RELEASE_DATA, } DBRelease; /** @@ -127,13 +127,13 @@ typedef enum DBType { * @see #db_alloc(const char *,int,DBType,DBOptions,unsigned short) */ typedef enum DBOptions { - DB_OPT_BASE = 0, - DB_OPT_DUP_KEY = 1, - DB_OPT_RELEASE_KEY = 2, - DB_OPT_RELEASE_DATA = 4, - DB_OPT_RELEASE_BOTH = 6, - DB_OPT_ALLOW_NULL_KEY = 8, - DB_OPT_ALLOW_NULL_DATA = 16, + DB_OPT_BASE = 0x00, + DB_OPT_DUP_KEY = 0x01, + DB_OPT_RELEASE_KEY = 0x02, + DB_OPT_RELEASE_DATA = 0x04, + DB_OPT_RELEASE_BOTH = DB_OPT_RELEASE_KEY|DB_OPT_RELEASE_DATA, + DB_OPT_ALLOW_NULL_KEY = 0x08, + DB_OPT_ALLOW_NULL_DATA = 0x10, } DBOptions; /** diff --git a/src/common/des.c b/src/common/des.c index 89a920bc9..0a702bfdf 100644 --- a/src/common/des.c +++ b/src/common/des.c @@ -5,7 +5,7 @@ #include "des.h" -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /// DES (Data Encryption Standard) algorithm, modified version. /// @see http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=5099. diff --git a/src/common/des.h b/src/common/des.h index 9e6aec4fd..6f54b36f2 100644 --- a/src/common/des.h +++ b/src/common/des.h @@ -3,7 +3,7 @@ #ifndef COMMON_DES_H #define COMMON_DES_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /// One 64-bit block. typedef struct BIT64 { uint8_t b[8]; } BIT64; diff --git a/src/common/ers.c b/src/common/ers.c index 52cba0fe5..91fc6ccfb 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -44,14 +44,14 @@ #include "ers.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" // CREATE, RECREATE, aMalloc, aFree +#include "common/nullpo.h" +#include "common/showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL + #include <stdlib.h> #include <string.h> -#include "../common/cbasetypes.h" -#include "../common/malloc.h" // CREATE, RECREATE, aMalloc, aFree -#include "../common/nullpo.h" -#include "../common/showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL - #ifndef DISABLE_ERS #define ERS_BLOCK_ENTRIES 2048 diff --git a/src/common/ers.h b/src/common/ers.h index 85ddfed7a..09290186e 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -40,7 +40,7 @@ #ifndef COMMON_ERS_H #define COMMON_ERS_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /*****************************************************************************\ * (1) All public parts of the Entry Reusage System. * @@ -71,11 +71,11 @@ #endif /* not ERS_ALIGN_ENTRY */ enum ERSOptions { - ERS_OPT_NONE = 0x0, - ERS_OPT_CLEAR = 0x1,/* silently clears any entries left in the manager upon destruction */ - ERS_OPT_WAIT = 0x2,/* wait for entries to come in order to list! */ - ERS_OPT_FREE_NAME = 0x4,/* name is dynamic memory, and should be freed */ - ERS_OPT_CLEAN = 0x8,/* clears used memory upon ers_free so that its all new to be reused on the next alloc */ + ERS_OPT_NONE = 0x00, + ERS_OPT_CLEAR = 0x01,/* silently clears any entries left in the manager upon destruction */ + ERS_OPT_WAIT = 0x02,/* wait for entries to come in order to list! */ + ERS_OPT_FREE_NAME = 0x04,/* name is dynamic memory, and should be freed */ + ERS_OPT_CLEAN = 0x08,/* clears used memory upon ers_free so that its all new to be reused on the next alloc */ ERS_OPT_FLEX_CHUNK = 0x10,/* signs that it should look for its own cache given it'll have a dynamic chunk size, so that it doesn't affect the other ERS it'd otherwise be sharing */ /* Compound, is used to determine whether it should be looking for a cache of matching options */ diff --git a/src/common/grfio.c b/src/common/grfio.c index d226fb158..614678da8 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -6,20 +6,19 @@ #include "grfio.h" +#include "common/cbasetypes.h" +#include "common/des.h" +#include "common/malloc.h" +#include "common/nullpo.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/utils.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sys/stat.h> #include <zlib.h> -#include "../common/cbasetypes.h" -#include "../common/des.h" -#include "../common/malloc.h" -#include "../common/nullpo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/utils.h" - //---------------------------- // file entry table struct //---------------------------- @@ -36,8 +35,8 @@ typedef struct FILELIST { } FILELIST; #define FILELIST_TYPE_FILE 0x01 // entry is a file -#define FILELIST_TYPE_ENCRYPT_HEADER 0x04 // encryption mode 1 (header DES only) #define FILELIST_TYPE_ENCRYPT_MIXED 0x02 // encryption mode 0 (header DES + periodic DES/shuffle) +#define FILELIST_TYPE_ENCRYPT_HEADER 0x04 // encryption mode 1 (header DES only) //gentry ... > 0 : data read from a grf file (gentry_table[gentry-1]) //gentry ... 0 : data read from a local file (data directory) @@ -645,6 +644,7 @@ static int grfio_entryread(const char *grfname, int gentry) aFree(rBuf); entrys = getlong(grf_header+0x26) - 7; + Assert_retr(4, entrys >= 0); // Get an entry for (entry = 0, ofs = 0; entry < entrys; ++entry) { diff --git a/src/common/malloc.c b/src/common/malloc.c index c647dc18f..ec0467495 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -6,14 +6,14 @@ #include "malloc.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> - -#include "../common/core.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" struct malloc_interface iMalloc_s; @@ -22,7 +22,7 @@ struct malloc_interface iMalloc_s; #if defined(MEMWATCH) # include <string.h> -# include "memwatch.h" +# include <memwatch.h> # define MALLOC(n,file,line,func) mwMalloc((n),(file),(line)) # define CALLOC(m,n,file,line,func) mwCalloc((m),(n),(file),(line)) # define REALLOC(p,n,file,line,func) mwRealloc((p),(n),(file),(line)) @@ -36,7 +36,7 @@ struct malloc_interface iMalloc_s; # include <string.h> # include <stdlib.h> -# include "dmalloc.h" +# include <dmalloc.h> # define MALLOC(n,file,line,func) dmalloc_malloc((file),(line),(n),DMALLOC_FUNC_MALLOC,0,0) # define CALLOC(m,n,file,line,func) dmalloc_malloc((file),(line),(m)*(n),DMALLOC_FUNC_CALLOC,0,0) # define REALLOC(p,n,file,line,func) dmalloc_realloc((file),(line),(p),(n),DMALLOC_FUNC_REALLOC,0) @@ -48,7 +48,7 @@ struct malloc_interface iMalloc_s; #elif defined(GCOLLECT) -# include "gc.h" +# include <gc.h> # ifdef GC_ADD_CALLER # define RETURN_ADDR 0, # else diff --git a/src/common/malloc.h b/src/common/malloc.h index 7ed2fb19c..20260de84 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -4,7 +4,7 @@ #ifndef COMMON_MALLOC_H #define COMMON_MALLOC_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #define ALC_MARK __FILE__, __LINE__, __func__ diff --git a/src/common/mapindex.c b/src/common/mapindex.c index 035518f68..18aa413cc 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -6,15 +6,14 @@ #include "mapindex.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> - -#include "../common/db.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" /* mapindex.c interface source */ struct mapindex_interface mapindex_s; @@ -193,7 +192,7 @@ void mapindex_defaults(void) { mapindex = &mapindex_s; /* TODO: place it in inter-server.conf? */ - snprintf(mapindex->config_file, 80, "%s","db/map_index.txt"); + snprintf(mapindex->config_file, sizeof(mapindex->config_file), "%s","db/map_index.txt"); /* */ mapindex->db = NULL; mapindex->num = 0; diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 87a275f57..c334e7cca 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -5,8 +5,9 @@ #ifndef COMMON_MAPINDEX_H #define COMMON_MAPINDEX_H -#include "../common/db.h" -#include "../common/mmo.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/mmo.h" #define MAX_MAPINDEX 2000 diff --git a/src/common/md5calc.c b/src/common/md5calc.c index 7b31a38d6..e594c364f 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -10,16 +10,13 @@ #include "md5calc.h" +#include "common/cbasetypes.h" +#include "common/random.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../common/random.h" - -#ifndef UINT_MAX -#define UINT_MAX 4294967295U -#endif - // Global variable static unsigned int *pX; diff --git a/src/common/mmo.h b/src/common/mmo.h index 48eba0041..3e497c667 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -5,10 +5,8 @@ #ifndef COMMON_MMO_H #define COMMON_MMO_H -#include <time.h> - -#include "../common/cbasetypes.h" -#include "../common/db.h" +#include "config/core.h" +#include "common/cbasetypes.h" // server->client protocol version // 0 - pre-? @@ -118,15 +116,16 @@ #define MAX_STORAGE 600 #define MAX_GUILD_STORAGE 600 #define MAX_PARTY 12 -#define MAX_GUILD (16+10*6) // Increased max guild members +6 per 1 extension levels [Lupus] -#define MAX_GUILDPOSITION 20 // Increased max guild positions to accommodate for all members [Valaris] (removed) [PoW] +#define BASE_GUILD_SIZE 16 // Base guild members (without GD_EXTENSION) +#define MAX_GUILD (BASE_GUILD_SIZE+10*6) // Increased max guild members +6 per 1 extension levels [Lupus] +#define MAX_GUILDPOSITION 20 // Increased max guild positions to accomodate for all members [Valaris] (removed) [PoW] #define MAX_GUILDEXPULSION 32 #define MAX_GUILDALLIANCE 16 -#define MAX_GUILDSKILL 15 // Increased max guild skills because of new skills [Sara-chan] +#define MAX_GUILDSKILL 15 // Increased max guild skills because of new skills [Sara-chan] #define MAX_GUILDLEVEL 50 -#define MAX_GUARDIANS 8 // Local max per castle. [Skotlex] -#define MAX_QUEST_OBJECTIVES 3 // Max quest objectives for a quest -#define MAX_START_ITEMS 32 // Max number of items allowed to be given to a char whenever it's created. [mkbu95] +#define MAX_GUARDIANS 8 // Local max per castle. [Skotlex] +#define MAX_QUEST_OBJECTIVES 3 // Max quest objectives for a quest +#define MAX_START_ITEMS 32 // Max number of items allowed to be given to a char whenever it's created. [mkbu95] // for produce #define MIN_ATTRIBUTE 0 @@ -189,6 +188,16 @@ #define EL_CLASS_BASE 2114 #define EL_CLASS_MAX (EL_CLASS_BASE+MAX_ELEMENTAL_CLASS-1) +// The following system marks a different job ID system used by the map server, +// which makes a lot more sense than the normal one. [Skotlex] +// These marks the "level" of the job. +#define JOBL_2_1 0x100 //256 +#define JOBL_2_2 0x200 //512 +#define JOBL_2 0x300 +#define JOBL_UPPER 0x1000 //4096 +#define JOBL_BABY 0x2000 //8192 +#define JOBL_THIRD 0x4000 //16384 + struct HPluginData; enum item_types { @@ -298,6 +307,49 @@ enum e_item_bound_type { IBT_MAX = 0x4, }; +enum { + OPTION_NOTHING = 0x00000000, + OPTION_SIGHT = 0x00000001, + OPTION_HIDE = 0x00000002, + OPTION_CLOAK = 0x00000004, + OPTION_FALCON = 0x00000010, + OPTION_RIDING = 0x00000020, + OPTION_INVISIBLE = 0x00000040, + OPTION_ORCISH = 0x00000800, + OPTION_WEDDING = 0x00001000, + OPTION_RUWACH = 0x00002000, + OPTION_CHASEWALK = 0x00004000, + OPTION_FLYING = 0x00008000, //Note that clientside Flying and Xmas are 0x8000 for clients prior to 2007. + OPTION_XMAS = 0x00010000, + OPTION_TRANSFORM = 0x00020000, + OPTION_SUMMER = 0x00040000, + OPTION_DRAGON1 = 0x00080000, + OPTION_WUG = 0x00100000, + OPTION_WUGRIDER = 0x00200000, + OPTION_MADOGEAR = 0x00400000, + OPTION_DRAGON2 = 0x00800000, + OPTION_DRAGON3 = 0x01000000, + OPTION_DRAGON4 = 0x02000000, + OPTION_DRAGON5 = 0x04000000, + OPTION_HANBOK = 0x08000000, + OPTION_OKTOBERFEST = 0x10000000, + +#ifndef NEW_CARTS + OPTION_CART1 = 0x00000008, + OPTION_CART2 = 0x00000080, + OPTION_CART3 = 0x00000100, + OPTION_CART4 = 0x00000200, + OPTION_CART5 = 0x00000400, + + /* compound constant for older carts */ + OPTION_CART = OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5, +#endif + + // compound constants + OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, + OPTION_COSTUME = OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER|OPTION_HANBOK|OPTION_OKTOBERFEST, +}; + struct s_skill { unsigned short id; unsigned char lv; @@ -677,6 +729,12 @@ enum { //Change Member Infos GMI_LEVEL, }; +enum guild_permission { // Guild permissions + GPERM_INVITE = 0x01, + GPERM_EXPEL = 0x10, + GPERM_BOTH = GPERM_INVITE|GPERM_EXPEL, +}; + enum { GD_SKILLBASE=10000, GD_APPROVAL=10000, @@ -927,6 +985,30 @@ enum e_pc_reg_loading { PRL_ALL = 0xFF, }; +/** + * Values to be used as operation_type in chrif_char_ask_name + */ +enum zh_char_ask_name_type { + CHAR_ASK_NAME_BLOCK = 1, // account block + CHAR_ASK_NAME_BAN = 2, // account ban + CHAR_ASK_NAME_UNBLOCK = 3, // account unblock + CHAR_ASK_NAME_UNBAN = 4, // account unban + CHAR_ASK_NAME_CHANGESEX = 5, // change sex + CHAR_ASK_NAME_CHARBAN = 6, // character ban + CHAR_ASK_NAME_CHARUNBAN = 7, // character unban + CHAR_ASK_NAME_CHANGECHARSEX = 8, // change character sex +}; + +/** + * Values to be used as answer in chrig_char_ask_name_answer + */ +enum hz_char_ask_name_answer { + CHAR_ASK_NAME_ANS_DONE = 0, // login-server request done + CHAR_ASK_NAME_ANS_NOTFOUND = 1, // player not found + CHAR_ASK_NAME_ANS_GMLOW = 2, // gm level too low + CHAR_ASK_NAME_ANS_OFFLINE = 3, // login-server offline +}; + /* packet size constant for itemlist */ #if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART #define MAX_ITEMLIST MAX_INVENTORY diff --git a/src/common/mutex.c b/src/common/mutex.c index 7307f5f15..5dfb3d01c 100644 --- a/src/common/mutex.c +++ b/src/common/mutex.c @@ -5,20 +5,18 @@ #include "mutex.h" -#include "../common/cbasetypes.h" // for WIN32 +#include "common/cbasetypes.h" // for WIN32 +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/timer.h" #ifdef WIN32 -#include "../common/winapi.h" +#include "common/winapi.h" #else #include <pthread.h> -#include <time.h> #include <sys/time.h> #endif -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/timer.h" - struct ramutex{ #ifdef WIN32 CRITICAL_SECTION hMutex; diff --git a/src/common/mutex.h b/src/common/mutex.h index fa8170c98..a70f0e8fd 100644 --- a/src/common/mutex.h +++ b/src/common/mutex.h @@ -4,7 +4,7 @@ #ifndef COMMON_MUTEX_H #define COMMON_MUTEX_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" typedef struct ramutex ramutex; // Mutex typedef struct racond racond; // Condition Var diff --git a/src/common/nullpo.c b/src/common/nullpo.c index e61d52257..a8980885f 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -6,11 +6,15 @@ #include "nullpo.h" +#include "common/showmsg.h" + #include <stdio.h> #include <stdarg.h> +#include <stdlib.h> #include <string.h> - -#include "../common/showmsg.h" +#ifdef __GNUC__ +#include <execinfo.h> +#endif struct nullpo_interface nullpo_s; @@ -24,6 +28,12 @@ struct nullpo_interface nullpo_s; * @param title Message title to display (i.e. failed assertion or nullpo info) */ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { +#ifdef __GNUC__ + void *array[10]; + int size; + char **strings; + int i; +#endif if (file == NULL) file = "??"; @@ -32,6 +42,13 @@ void assert_report(const char *file, int line, const char *func, const char *tar ShowError("--- %s --------------------------------------------\n", title); ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); +#ifdef __GNUC__ + size = (int)backtrace(array, 10); + strings = backtrace_symbols(array, size); + for (i = 0; i < size; i++) + ShowError("%s\n", strings[i]); + free(strings); +#endif ShowError("--- end %s ----------------------------------------\n", title); } diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 573e351e0..a59c2ac2b 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -5,7 +5,7 @@ #ifndef COMMON_NULLPO_H #define COMMON_NULLPO_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" // enabled by default on debug builds #if defined(DEBUG) && !defined(NULLPO_CHECK) diff --git a/src/common/random.c b/src/common/random.c index 88d5748cf..a4d7c5d34 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -5,16 +5,14 @@ #include "random.h" -#include <time.h> // time +#include "common/cbasetypes.h" // for WIN32 +#include "common/showmsg.h" +#include "common/timer.h" // gettick -#include <mt19937ar.h> // init_genrand, genrand_int32, genrand_res53 - -#include "../common/cbasetypes.h" // for WIN32 -#include "../common/showmsg.h" -#include "../common/timer.h" // gettick +#include <mt19937ar/mt19937ar.h> // init_genrand, genrand_int32, genrand_res53 #if defined(WIN32) -# include "../common/winapi.h" +# include "common/winapi.h" #elif defined(HAVE_GETPID) || defined(HAVE_GETTID) # include <sys/types.h> # include <unistd.h> diff --git a/src/common/random.h b/src/common/random.h index 0ca375d28..379e675b2 100644 --- a/src/common/random.h +++ b/src/common/random.h @@ -4,7 +4,7 @@ #ifndef COMMON_RANDOM_H #define COMMON_RANDOM_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef HERCULES_CORE void rnd_init(void); diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 0dd645eeb..01dc0b01a 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -6,20 +6,18 @@ #include "showmsg.h" +#include "common/cbasetypes.h" +#include "common/core.h" //[Ind] - For SERVER_TYPE +#include "common/strlib.h" // StringBuf + +#include <libconfig/libconfig.h> + #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // atexit -#include <string.h> -#include <time.h> - -#include "../../3rdparty/libconfig/libconfig.h" - -#include "../common/cbasetypes.h" -#include "../common/core.h" //[Ind] - For SERVER_TYPE -#include "../common/strlib.h" // StringBuf #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" #else // not WIN32 # include <unistd.h> #endif // WIN32 diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 48e763c25..63e42ab57 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -5,16 +5,16 @@ #ifndef COMMON_SHOWMSG_H #define COMMON_SHOWMSG_H -#include <stdarg.h> - -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef HERCULES_CORE -# include "../../3rdparty/libconfig/libconfig.h" +# include <libconfig/libconfig.h> #else -# include "../common/HPMi.h" +# include "common/HPMi.h" #endif +#include <stdarg.h> + // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color // some code explanation (used here): @@ -23,58 +23,55 @@ // \033[0m : reset color parameter // \033[1m : use bold for font -#define CL_RESET "\033[0m" -#define CL_CLS "\033[2J" -#define CL_CLL "\033[K" +#define CL_RESET "\033[0m" +#define CL_CLS "\033[2J" +#define CL_CLL "\033[K" // font settings -#define CL_BOLD "\033[1m" -#define CL_NORM CL_RESET -#define CL_NORMAL CL_RESET -#define CL_NONE CL_RESET -// foreground color and bold font (bright color on windows) -#define CL_WHITE "\033[1;37m" -#define CL_GRAY "\033[1;30m" -#define CL_RED "\033[1;31m" -#define CL_GREEN "\033[1;32m" -#define CL_YELLOW "\033[1;33m" -#define CL_BLUE "\033[1;34m" -#define CL_MAGENTA "\033[1;35m" -#define CL_CYAN "\033[1;36m" +#define CL_BOLD "\033[1m" +#define CL_NORM CL_RESET +#define CL_NORMAL CL_RESET +#define CL_NONE CL_RESET // background color -#define CL_BG_BLACK "\033[40m" -#define CL_BG_RED "\033[41m" -#define CL_BG_GREEN "\033[42m" -#define CL_BG_YELLOW "\033[43m" -#define CL_BG_BLUE "\033[44m" -#define CL_BG_MAGENTA "\033[45m" -#define CL_BG_CYAN "\033[46m" -#define CL_BG_WHITE "\033[47m" +#define CL_BG_BLACK "\033[40m" +#define CL_BG_RED "\033[41m" +#define CL_BG_GREEN "\033[42m" +#define CL_BG_YELLOW "\033[43m" +#define CL_BG_BLUE "\033[44m" +#define CL_BG_MAGENTA "\033[45m" +#define CL_BG_CYAN "\033[46m" +#define CL_BG_WHITE "\033[47m" // foreground color and normal font (normal color on windows) -#define CL_LT_BLACK "\033[0;30m" -#define CL_LT_RED "\033[0;31m" -#define CL_LT_GREEN "\033[0;32m" -#define CL_LT_YELLOW "\033[0;33m" -#define CL_LT_BLUE "\033[0;34m" -#define CL_LT_MAGENTA "\033[0;35m" -#define CL_LT_CYAN "\033[0;36m" -#define CL_LT_WHITE "\033[0;37m" +#define CL_LT_BLACK "\033[0;30m" +#define CL_LT_RED "\033[0;31m" +#define CL_LT_GREEN "\033[0;32m" +#define CL_LT_YELLOW "\033[0;33m" +#define CL_LT_BLUE "\033[0;34m" +#define CL_LT_MAGENTA "\033[0;35m" +#define CL_LT_CYAN "\033[0;36m" +#define CL_LT_WHITE "\033[0;37m" // foreground color and bold font (bright color on windows) -#define CL_BT_BLACK "\033[1;30m" -#define CL_BT_RED "\033[1;31m" -#define CL_BT_GREEN "\033[1;32m" -#define CL_BT_YELLOW "\033[1;33m" -#define CL_BT_BLUE "\033[1;34m" -#define CL_BT_MAGENTA "\033[1;35m" -#define CL_BT_CYAN "\033[1;36m" -#define CL_BT_WHITE "\033[1;37m" +#define CL_BT_BLACK "\033[1;30m" +#define CL_BT_RED "\033[1;31m" +#define CL_BT_GREEN "\033[1;32m" +#define CL_BT_YELLOW "\033[1;33m" +#define CL_BT_BLUE "\033[1;34m" +#define CL_BT_MAGENTA "\033[1;35m" +#define CL_BT_CYAN "\033[1;36m" +#define CL_BT_WHITE "\033[1;37m" -#define CL_WTBL "\033[37;44m" // white on blue -#define CL_XXBL "\033[0;44m" // default on blue -#define CL_PASS "\033[0;32;42m" // green on green +// foreground color and bold font (bright color on windows) +#define CL_WHITE CL_BT_WHITE +#define CL_GRAY CL_BT_BLACK +#define CL_RED CL_BT_RED +#define CL_GREEN CL_BT_GREEN +#define CL_YELLOW CL_BT_YELLOW +#define CL_BLUE CL_BT_BLUE +#define CL_MAGENTA CL_BT_MAGENTA +#define CL_CYAN CL_BT_CYAN -#define CL_SPACE " " // space equivalent of the print messages +#define CL_SPACE " " // space aquivalent of the print messages enum msg_type { MSG_NONE, diff --git a/src/common/socket.c b/src/common/socket.c index 1b7f36f8b..17c31db50 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -4,26 +4,26 @@ #define HERCULES_CORE -#include "../config/core.h" // SHOW_SERVER_STATS +#include "config/core.h" // SHOW_SERVER_STATS #define H_SOCKET_C #include "socket.h" #undef H_SOCKET_C +#include "common/HPM.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/timer.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sys/types.h> -#include "../common/HPM.h" -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/timer.h" - #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" #else # include <arpa/inet.h> # include <errno.h> diff --git a/src/common/socket.h b/src/common/socket.h index 6323a6862..bd5d9baa2 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -5,12 +5,10 @@ #ifndef COMMON_SOCKET_H #define COMMON_SOCKET_H -#include <time.h> - -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" typedef long in_addr_t; #else # include <netinet/in.h> diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 413067b68..811b239df 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -14,12 +14,12 @@ // // -#include "../common/atomic.h" -#include "../common/cbasetypes.h" -#include "../common/thread.h" +#include "common/atomic.h" +#include "common/cbasetypes.h" +#include "common/thread.h" #ifdef WIN32 -#include "../common/winapi.h" +#include "common/winapi.h" #endif #ifdef WIN32 diff --git a/src/common/sql.c b/src/common/sql.c index 4ca14d43b..a93092533 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -6,19 +6,17 @@ #include "sql.h" -#include <stdlib.h> // strtoul -#include <string.h> // strlen/strnlen/memcpy/memset - -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/timer.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/timer.h" #ifdef WIN32 -# include "../common/winapi.h" // Needed before mysql.h +# include "common/winapi.h" // Needed before mysql.h #endif #include <mysql.h> +#include <stdlib.h> // strtoul void hercules_mysql_error_handler(unsigned int ecode); diff --git a/src/common/sql.h b/src/common/sql.h index c3598273e..d76b4f9d4 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -5,9 +5,9 @@ #ifndef COMMON_SQL_H #define COMMON_SQL_H -#include <stdarg.h>// va_list +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdarg.h>// va_list // Return codes #define SQL_ERROR (-1) diff --git a/src/common/strlib.c b/src/common/strlib.c index b5fcff576..555f591e6 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -8,14 +8,14 @@ #include "strlib.h" #undef H_STRLIB_C +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" + #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" - #define J_MAX_MALLOC_SIZE 65535 struct strlib_interface strlib_s; diff --git a/src/common/strlib.h b/src/common/strlib.h index c687d9e17..a768ebff5 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -5,11 +5,11 @@ #ifndef COMMON_STRLIB_H #define COMMON_STRLIB_H +#include "common/cbasetypes.h" + #include <stdarg.h> #include <string.h> -#include "../common/cbasetypes.h" - #ifdef WIN32 #define HAVE_STRTOK_R #define strtok_r(s,delim,save_ptr) strtok_r_((s),(delim),(save_ptr)) diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index a1dbed4d1..a27357e7e 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -1,6 +1,6 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -// Base Author: Haru @ http://hercules.ws +// Base Author: Haru @ http://herc.ws /// See sysinfo.h for a description of this file @@ -8,16 +8,14 @@ #include "sysinfo.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/malloc.h" +#include "common/strlib.h" + #include <stdio.h> // fopen #include <stdlib.h> // atoi - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/strlib.h" - #ifdef WIN32 -# include <string.h> // strlen # include <windows.h> #else # include <unistd.h> diff --git a/src/common/sysinfo.h b/src/common/sysinfo.h index 70f665071..3c0d01ca1 100644 --- a/src/common/sysinfo.h +++ b/src/common/sysinfo.h @@ -1,6 +1,6 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -// Base Author: Haru @ http://hercules.ws +// Base Author: Haru @ http://herc.ws #ifndef COMMON_SYSINFO_H #define COMMON_SYSINFO_H @@ -11,7 +11,7 @@ * cached at compile time) */ -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" struct sysinfo_private; diff --git a/src/common/thread.c b/src/common/thread.c index 95212b4b0..9b9308d06 100644 --- a/src/common/thread.c +++ b/src/common/thread.c @@ -10,10 +10,13 @@ #include "thread.h" -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" // sysinfo->getpagesize() #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" # define __thread __declspec( thread ) #else # include <pthread.h> @@ -24,10 +27,6 @@ # include <unistd.h> #endif -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" // sysinfo->getpagesize() - // When Compiling using MSC (on win32..) we know we have support in any case! #ifdef _MSC_VER #define HAS_TLS diff --git a/src/common/thread.h b/src/common/thread.h index f79eb77f9..36ea006b3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -4,7 +4,7 @@ #ifndef COMMON_THREAD_H #define COMMON_THREAD_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" typedef struct rAthread rAthread; typedef void* (*rAthreadProc)(void*); diff --git a/src/common/timer.c b/src/common/timer.c index 45dbb9f50..06309642e 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -6,24 +6,23 @@ #include "timer.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include "../common/cbasetypes.h" -#include "../common/db.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/utils.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/utils.h" #ifdef WIN32 -# include "../common/winapi.h" // GetTickCount() +# include "common/winapi.h" // GetTickCount() #else # include <sys/time.h> // struct timeval, gettimeofday() # include <unistd.h> #endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + struct timer_interface timer_s; // If the server can't handle processing thousands of monsters diff --git a/src/common/timer.h b/src/common/timer.h index 6e8a72389..46a036ec7 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -5,7 +5,7 @@ #ifndef COMMON_TIMER_H #define COMMON_TIMER_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #define DIFF_TICK(a,b) ((a)-(b)) #define DIFF_TICK32(a,b) ((int32)((a)-(b))) diff --git a/src/common/utils.c b/src/common/utils.c index ad68706ca..07e2e9fdf 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -6,32 +6,28 @@ #include "utils.h" -#include <math.h> // floor() -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> // cache purposes [Ind/Hercules] - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/socket.h" -#include "../common/strlib.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/socket.h" +#include "common/strlib.h" #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" # ifndef F_OK # define F_OK 0x0 # endif /* F_OK */ #else # include <dirent.h> -# include <sys/stat.h> # include <unistd.h> #endif +#include <math.h> // floor() +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> // cache purposes [Ind/Hercules] + struct HCache_interface HCache_s; /// Dumps given buffer into file pointed to by a handle. diff --git a/src/common/utils.h b/src/common/utils.h index e6102f184..0ac818468 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -5,10 +5,9 @@ #ifndef COMMON_UTILS_H #define COMMON_UTILS_H -#include <stdio.h> // FILE* -#include <time.h> +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdio.h> // FILE* /* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ #define HCACHE_KEY 'k' |