From d33469689ea8e671fa0d525d54bce6932dfe9107 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 2 Feb 2014 15:02:14 -0200 Subject: [PATCH] Introducing HPM Datacheck http://hercules.ws/board/topic/4283-introducing-hpm-datacheck/ Signed-off-by: shennetsind --- src/char/char.h | 6 ++-- src/char/int_auction.h | 6 ++-- src/char/int_elemental.h | 6 ++-- src/char/int_guild.h | 6 ++-- src/char/int_homun.h | 6 ++-- src/char/int_mail.h | 6 ++-- src/char/int_mercenary.h | 6 ++-- src/char/int_party.h | 6 ++-- src/char/int_pet.h | 6 ++-- src/char/int_quest.h | 6 ++-- src/char/int_storage.h | 6 ++-- src/char/inter.h | 6 ++-- src/char/pincode.h | 6 ++-- src/common/HPM.c | 26 +++++++++++++++ src/common/HPM.h | 8 +++-- src/common/HPMi.h | 15 ++++++--- src/common/atomic.h | 6 ++-- src/common/cbasetypes.h | 6 ++-- src/common/conf.h | 6 ++-- src/common/console.h | 6 ++-- src/common/core.h | 6 ++-- src/common/db.h | 6 ++-- src/common/des.h | 6 ++-- src/common/ers.h | 6 ++-- src/common/grfio.h | 6 ++-- src/common/malloc.h | 6 ++-- src/common/mapindex.h | 6 ++-- src/common/md5calc.h | 6 ++-- src/common/mmo.h | 6 ++-- src/common/mutex.h | 6 ++-- src/common/nullpo.h | 6 ++-- src/common/random.h | 6 ++-- src/common/showmsg.h | 6 ++-- src/common/socket.h | 6 ++-- src/common/spinlock.h | 6 ++-- src/common/strlib.h | 6 ++-- src/common/thread.h | 6 ++-- src/common/timer.h | 8 +++-- src/common/utils.h | 6 ++-- src/config/const.h | 7 ++-- src/login/account.h | 6 ++-- src/login/ipban.h | 6 ++-- src/login/login.h | 6 ++-- src/login/loginlog.h | 6 ++-- src/map/HPMmap.c | 71 +++++++++++++++++++++++++++++++++------- src/map/HPMmap.h | 10 ++++-- src/map/atcommand.h | 6 ++-- src/map/battle.h | 6 ++-- src/map/battleground.h | 6 ++-- src/map/buyingstore.h | 6 ++-- src/map/chat.h | 6 ++-- src/map/chrif.h | 6 ++-- src/map/clif.h | 6 ++-- src/map/date.h | 6 ++-- src/map/duel.h | 6 ++-- src/map/elemental.h | 6 ++-- src/map/guild.h | 6 ++-- src/map/homunculus.h | 6 ++-- src/map/instance.h | 6 ++-- src/map/intif.h | 6 ++-- src/map/irc-bot.h | 6 ++-- src/map/itemdb.h | 6 ++-- src/map/log.h | 6 ++-- src/map/mail.h | 6 ++-- src/map/map.c | 2 ++ src/map/map.h | 6 ++-- src/map/mapreg.h | 6 ++-- src/map/mercenary.h | 6 ++-- src/map/mob.h | 6 ++-- src/map/npc.h | 6 ++-- src/map/packets.h | 6 ++-- src/map/packets_struct.h | 6 ++-- src/map/party.h | 6 ++-- src/map/path.h | 6 ++-- src/map/pc.h | 7 ++-- src/map/pc_groups.h | 6 ++-- src/map/pet.h | 6 ++-- src/map/quest.h | 6 ++-- src/map/script.h | 6 ++-- src/map/searchstore.h | 6 ++-- src/map/skill.h | 6 ++-- src/map/status.h | 6 ++-- src/map/storage.h | 6 ++-- src/map/trade.h | 7 ++-- src/map/unit.h | 11 ++++--- src/map/vending.h | 6 ++-- 86 files changed, 357 insertions(+), 265 deletions(-) diff --git a/src/char/char.h b/src/char/char.h index 3e3774c1fa6..06c0556c59b 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CHAR_SQL_H_ -#define _CHAR_SQL_H_ +#ifndef _COMMON_CHAR_H_ +#define _COMMON_CHAR_H_ #include "../config/core.h" #include "../common/core.h" // CORE_ST_LAST @@ -121,4 +121,4 @@ void global_accreg_to_login_start (int account_id, int char_id); void global_accreg_to_login_send (void); void global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, bool is_string); -#endif /* _CHAR_SQL_H_ */ +#endif /* _COMMON_CHAR_H_ */ diff --git a/src/char/int_auction.h b/src/char/int_auction.h index bf26b152c03..f10794f73bd 100644 --- a/src/char/int_auction.h +++ b/src/char/int_auction.h @@ -1,12 +1,12 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_AUCTION_SQL_H_ -#define _INT_AUCTION_SQL_H_ +#ifndef _CHAR_INT_AUCTION_H_ +#define _CHAR_INT_AUCTION_H_ int inter_auction_parse_frommap(int fd); int inter_auction_sql_init(void); void inter_auction_sql_final(void); -#endif /* _INT_AUCTION_SQL_H_ */ +#endif /* _CHAR_INT_AUCTION_H_ */ diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h index 7eb5c2958f1..c90891fc446 100644 --- a/src/char/int_elemental.h +++ b/src/char/int_elemental.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_ELEMENTAL_SQL_H_ -#define _INT_ELEMENTAL_SQL_H_ +#ifndef _CHAR_INT_ELEMENTAL_H_ +#define _CHAR_INT_ELEMENTAL_H_ struct s_elemental; @@ -12,4 +12,4 @@ int inter_elemental_parse_frommap(int fd); bool mapif_elemental_delete(int ele_id); -#endif /* _INT_ELEMENTAL_SQL_H_ */ +#endif /* _CHAR_INT_ELEMENTAL_H_ */ diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 47c42dcc553..4eb7d310b79 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_GUILD_SQL_H_ -#define _INT_GUILD_SQL_H_ +#ifndef _CHAR_INT_GUILD_H_ +#define _CHAR_INT_GUILD_H_ enum { GS_BASIC = 0x0001, @@ -34,4 +34,4 @@ int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char int inter_guild_CharOnline(int char_id, int guild_id); int inter_guild_CharOffline(int char_id, int guild_id); -#endif /* _INT_GUILD_SQL_H_ */ +#endif /* _CHAR_INT_GUILD_H_ */ diff --git a/src/char/int_homun.h b/src/char/int_homun.h index 1c0d76269df..561dc848f5a 100644 --- a/src/char/int_homun.h +++ b/src/char/int_homun.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_HOMUN_SQL_H_ -#define _INT_HOMUN_SQL_H_ +#ifndef _CHAR_INT_HOMUN_H_ +#define _CHAR_INT_HOMUN_H_ struct s_homunculus; @@ -15,4 +15,4 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd); bool mapif_homunculus_delete(int homun_id); bool mapif_homunculus_rename(char *name); -#endif /* _INT_HOMUN_SQL_H_ */ +#endif /* _CHAR_INT_HOMUN_H_ */ diff --git a/src/char/int_mail.h b/src/char/int_mail.h index 77db51e5b2a..7c06cdc1ff3 100644 --- a/src/char/int_mail.h +++ b/src/char/int_mail.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_MAIL_SQL_H_ -#define _INT_MAIL_SQL_H_ +#ifndef _CHAR_INT_MAIL_H_ +#define _CHAR_INT_MAIL_H_ int inter_mail_parse_frommap(int fd); void mail_sendmail(int send_id, const char* send_name, int dest_id, const char* dest_name, const char* title, const char* body, int zeny, struct item *item); @@ -13,4 +13,4 @@ void inter_mail_sql_final(void); int mail_savemessage(struct mail_message* msg); void mapif_Mail_new(struct mail_message *msg); -#endif /* _INT_MAIL_SQL_H_ */ +#endif /* _CHAR_INT_MAIL_H_ */ diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h index 01e4a841f7d..b614b8cf771 100644 --- a/src/char/int_mercenary.h +++ b/src/char/int_mercenary.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_MERCENARY_SQL_H_ -#define _INT_MERCENARY_SQL_H_ +#ifndef _CHAR_INT_MERCENARY_H_ +#define _CHAR_INT_MERCENARY_H_ struct s_mercenary; @@ -17,4 +17,4 @@ bool mercenary_owner_delete(int char_id); bool mapif_mercenary_delete(int merc_id); -#endif /* _INT_MERCENARY_SQL_H_ */ +#endif /* _CHAR_INT_MERCENARY_H_ */ diff --git a/src/char/int_party.h b/src/char/int_party.h index d8cdcdc6af8..84f00635a44 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_PARTY_SQL_H_ -#define _INT_PARTY_SQL_H_ +#ifndef _CHAR_INT_PARTY_H_ +#define _CHAR_INT_PARTY_H_ //Party Flags on what to save/delete. enum { @@ -23,4 +23,4 @@ int inter_party_leave(int party_id,int account_id, int char_id); int inter_party_CharOnline(int char_id, int party_id); int inter_party_CharOffline(int char_id, int party_id); -#endif /* _INT_PARTY_SQL_H_ */ +#endif /* _CHAR_INT_PARTY_H_ */ diff --git a/src/char/int_pet.h b/src/char/int_pet.h index 733468c7728..a16cb7a3707 100644 --- a/src/char/int_pet.h +++ b/src/char/int_pet.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_PET_SQL_H_ -#define _INT_PET_SQL_H_ +#ifndef _CHAR_INT_PET_H_ +#define _CHAR_INT_PET_H_ struct s_pet; @@ -18,4 +18,4 @@ int inter_pet_sql_init(void); //Exported for use in the TXT-SQL converter. int inter_pet_tosql(int pet_id, struct s_pet *p); -#endif /* _INT_PET_SQL_H_ */ +#endif /* _CHAR_INT_PET_H_ */ diff --git a/src/char/int_quest.h b/src/char/int_quest.h index b0403f4361b..6267c74ad90 100644 --- a/src/char/int_quest.h +++ b/src/char/int_quest.h @@ -1,10 +1,10 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _QUEST_H_ -#define _QUEST_H_ +#ifndef _CHAR_QUEST_H_ +#define _CHAR_QUEST_H_ int inter_quest_parse_frommap(int fd); -#endif +#endif /* _CHAR_QUEST_H_ */ diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 811608f82c0..1693499a57e 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _INT_STORAGE_SQL_H_ -#define _INT_STORAGE_SQL_H_ +#ifndef _CHAR_INT_STORAGE_H_ +#define _CHAR_INT_STORAGE_H_ struct storage_data; struct guild_storage; @@ -19,4 +19,4 @@ int storage_fromsql(int account_id, struct storage_data* p); int storage_tosql(int account_id,struct storage_data *p); int guild_storage_tosql(int guild_id, struct guild_storage *p); -#endif /* _INT_STORAGE_SQL_H_ */ +#endif /* _CHAR_INT_STORAGE_H_ */ diff --git a/src/char/inter.h b/src/char/inter.h index 9b958dc72ea..2c07b20e247 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _INTER_SQL_H_ -#define _INTER_SQL_H_ +#ifndef _CHAR_INTER_H_ +#define _CHAR_INTER_H_ struct accreg; #include "../common/sql.h" @@ -41,4 +41,4 @@ uint64 inter_chk_lastuid(int8 flag, uint64 value); #define updateLastUid(val_) #endif -#endif /* _INTER_SQL_H_ */ +#endif /* _CHAR_INTER_H_ */ diff --git a/src/char/pincode.h b/src/char/pincode.h index a17f70de5d8..3b71eec7ce2 100644 --- a/src/char/pincode.h +++ b/src/char/pincode.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PINCODE_H_ -#define _PINCODE_H_ +#ifndef _CHAR_PINCODE_H_ +#define _CHAR_PINCODE_H_ #include "char.h" @@ -40,4 +40,4 @@ struct pincode_interface *pincode; void pincode_defaults(void); -#endif /* _PINCODE_H_ */ +#endif /* _CHAR_PINCODE_H_ */ diff --git a/src/common/HPM.c b/src/common/HPM.c index 1edf24901ad..cf296e593a4 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -116,6 +116,8 @@ struct hplugin *hplugin_load(const char* filename) { bool anyEvent = false; void **import_symbol_ref; Sql **sql_handle; + unsigned int *HPMDataCheckLen; + struct s_HPMDataCheck *HPMDataCheck; if( HPM->exists(filename) ) { ShowWarning("HPM:plugin_load: attempting to load duplicate '"CL_WHITE"%s"CL_RESET"', skipping...\n", filename); @@ -203,6 +205,24 @@ struct hplugin *hplugin_load(const char* filename) { 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; + } + + 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; + } + + if( !HPM->DataCheck(HPMDataCheck,*HPMDataCheckLen,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; + } + /* id */ plugin->hpi->pid = plugin->idx; /* core */ @@ -255,6 +275,11 @@ void hplugins_config_read(void) { const char *config_filename = "conf/plugins.conf"; // FIXME hardcoded name FILE *fp; + if( !HPM->DataCheck ) { + ShowError("HPM:config_read: HPM->DataCheck not set! Failure\n"); + return; + } + /* yes its ugly, its temporary and will be gone as soon as the new inter-server.conf is set */ if( (fp = fopen("conf/import/plugins.conf","r")) ) { config_filename = "conf/import/plugins.conf"; @@ -829,4 +854,5 @@ void hpm_defaults(void) { HPM->grabHPData = hplugins_grabHPData; HPM->grabHPDataSub = NULL; HPM->parseConf = hplugins_parse_conf; + HPM->DataCheck = NULL; } diff --git a/src/common/HPM.h b/src/common/HPM.h index 393f8f81908..52ad24a0366 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _HPM_H_ -#define _HPM_H_ +#ifndef _COMMON_HPM_H_ +#define _COMMON_HPM_H_ #include "../common/cbasetypes.h" #include "../common/HPMi.h" @@ -146,10 +146,12 @@ struct HPM_interface { bool (*grabHPDataSub) (struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr); /* for custom config parsing */ bool (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point); + /* validates plugin data */ + bool (*DataCheck) (struct s_HPMDataCheck *src, unsigned int size, char *name); } HPM_s; struct HPM_interface *HPM; void hpm_defaults(void); -#endif /* _HPM_H_ */ +#endif /* _COMMON_HPM_H_ */ diff --git a/src/common/HPMi.h b/src/common/HPMi.h index fdb6ccf52f3..b33ad955ccc 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _HPMi_H_ -#define _HPMi_H_ +#ifndef _COMMON_HPMi_H_ +#define _COMMON_HPMi_H_ #include "../common/cbasetypes.h" #include "../common/core.h" @@ -20,7 +20,7 @@ struct map_session_data; #define HPExport #endif -#ifndef _SHOWMSG_H_ +#ifndef _COMMON_SHOWMSG_H_ HPExport void (*ShowMessage) (const char *, ...); HPExport void (*ShowStatus) (const char *, ...); HPExport void (*ShowSQL) (const char *, ...); @@ -45,6 +45,11 @@ struct hplugin_info { char* req_version; }; +struct s_HPMDataCheck { + char *name; + unsigned int size; +}; + HPExport void *(*import_symbol) (char *name, unsigned int pID); HPExport Sql *mysql_handle; @@ -187,8 +192,8 @@ HPExport struct HPMi_interface { /* pc group permission */ void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); } HPMi_s; -#ifndef _HPM_H_ +#ifndef _COMMON_HPM_H_ HPExport struct HPMi_interface *HPMi; #endif -#endif /* _HPMi_H_ */ +#endif /* _COMMON_HPMi_H_ */ diff --git a/src/common/atomic.h b/src/common/atomic.h index 5a2ddb4f0a7..c2227a9d43e 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -1,8 +1,8 @@ // Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _rA_ATOMIC_H_ -#define _rA_ATOMIC_H_ +#ifndef _COMMON_ATOMIC_H_ +#define _COMMON_ATOMIC_H_ // Atomic Operations // (Interlocked CompareExchange, Add .. and so on ..) @@ -144,4 +144,4 @@ static forceinline int32 InterlockedExchange(volatile int32 *target, int32 val){ #endif //endif compiler decission -#endif +#endif /* _COMMON_ATOMIC_H_ */ diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 97789750643..654334a9bbb 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -1,5 +1,5 @@ -#ifndef _CBASETYPES_H_ -#define _CBASETYPES_H_ +#ifndef _COMMON_CBASETYPES_H_ +#define _COMMON_CBASETYPES_H_ /* +--------+-----------+--------+---------+ * | ILP32 | LP64 | ILP64 | (LL)P64 | @@ -431,4 +431,4 @@ void SET_FUNCPOINTER(T1& var, T2 p) #endif -#endif /* _CBASETYPES_H_ */ +#endif /* _COMMON_CBASETYPES_H_ */ diff --git a/src/common/conf.h b/src/common/conf.h index 05e2b1adaf2..9aff3df475d 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CONF_H_ -#define _CONF_H_ +#ifndef _COMMON_CONF_H_ +#define _COMMON_CONF_H_ #include "../common/cbasetypes.h" #include "../../3rdparty/libconfig/libconfig.h" @@ -94,4 +94,4 @@ struct libconfig_interface *libconfig; void libconfig_defaults(void); -#endif // _CONF_H_ +#endif // _COMMON_CONF_H_ diff --git a/src/common/console.h b/src/common/console.h index 1beed964a0f..513c769ffdf 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _CONSOLE_H_ -#define _CONSOLE_H_ +#ifndef _COMMON_CONSOLE_H_ +#define _COMMON_CONSOLE_H_ #include "../common/thread.h" #include "../common/mutex.h" @@ -72,4 +72,4 @@ struct console_interface *console; void console_defaults(void); -#endif /* _CONSOLE_H_ */ +#endif /* _COMMON_CONSOLE_H_ */ diff --git a/src/common/core.h b/src/common/core.h index 8fdcdcfc301..72f956e1daf 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CORE_H_ -#define _CORE_H_ +#ifndef _COMMON_CORE_H_ +#define _COMMON_CORE_H_ #include "../common/db.h" #include "../common/mmo.h" @@ -50,4 +50,4 @@ enum E_CORE_ST { /// If NULL, runflag is set to CORE_ST_STOP instead. extern void (*shutdown_callback)(void); -#endif /* _CORE_H_ */ +#endif /* _COMMON_CORE_H_ */ diff --git a/src/common/db.h b/src/common/db.h index c00489b93c9..67abe6f1997 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -39,8 +39,8 @@ * @encoding US-ASCII * * @see common#db.c * \*****************************************************************************/ -#ifndef _DB_H_ -#define _DB_H_ +#ifndef _COMMON_DB_H_ +#define _COMMON_DB_H_ #include "../common/cbasetypes.h" #include @@ -1548,4 +1548,4 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); -#endif /* _DB_H_ */ +#endif /* _COMMON_DB_H_ */ diff --git a/src/common/des.h b/src/common/des.h index e42136436ed..3f55448badc 100644 --- a/src/common/des.h +++ b/src/common/des.h @@ -1,7 +1,7 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _DES_H_ -#define _DES_H_ +#ifndef _COMMON_DES_H_ +#define _COMMON_DES_H_ /// One 64-bit block. @@ -12,4 +12,4 @@ void des_decrypt_block(BIT64* block); void des_decrypt(unsigned char* data, size_t size); -#endif // _DES_H_ +#endif // _COMMON_DES_H_ diff --git a/src/common/ers.h b/src/common/ers.h index d74ee02a5fe..4dae19f3b49 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -37,8 +37,8 @@ * @author Flavio @ Amazon Project * * @encoding US-ASCII * \*****************************************************************************/ -#ifndef _ERS_H_ -#define _ERS_H_ +#ifndef _COMMON_ERS_H_ +#define _COMMON_ERS_H_ #include "../common/cbasetypes.h" @@ -180,4 +180,4 @@ void ers_report(void); void ers_force_destroy_all(void); #endif /* DISABLE_ERS / not DISABLE_ERS */ -#endif /* _ERS_H_ */ +#endif /* _COMMON_ERS_H_ */ diff --git a/src/common/grfio.h b/src/common/grfio.h index a88b2039345..4f5d0d6bc59 100644 --- a/src/common/grfio.h +++ b/src/common/grfio.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _GRFIO_H_ -#define _GRFIO_H_ +#ifndef _COMMON_GRFIO_H_ +#define _COMMON_GRFIO_H_ void grfio_init(const char* fname); void grfio_final(void); @@ -14,4 +14,4 @@ unsigned long grfio_crc32(const unsigned char *buf, unsigned int len); int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen); -#endif /* _GRFIO_H_ */ +#endif /* _COMMON_GRFIO_H_ */ diff --git a/src/common/malloc.h b/src/common/malloc.h index 19b5213bb7e..7309bb0f762 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _MALLOC_H_ -#define _MALLOC_H_ +#ifndef _COMMON_MALLOC_H_ +#define _COMMON_MALLOC_H_ #include "../common/cbasetypes.h" @@ -88,4 +88,4 @@ struct malloc_interface { void memmgr_report (int extra); struct malloc_interface *iMalloc; -#endif /* _MALLOC_H_ */ +#endif /* _COMMON_MALLOC_H_ */ diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 98150f44146..fa9b9e92031 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MAPINDEX_H_ -#define _MAPINDEX_H_ +#ifndef _COMMON_MAPINDEX_H_ +#define _COMMON_MAPINDEX_H_ #include "../common/db.h" #include "../common/mmo.h" @@ -90,4 +90,4 @@ struct mapindex_interface *mapindex; void mapindex_defaults(void); -#endif /* _MAPINDEX_H_ */ +#endif /* _COMMON_MAPINDEX_H_ */ diff --git a/src/common/md5calc.h b/src/common/md5calc.h index 323affa2cbd..d0caf678711 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -1,8 +1,8 @@ -#ifndef _MD5CALC_H_ -#define _MD5CALC_H_ +#ifndef _COMMON_MD5CALC_H_ +#define _COMMON_MD5CALC_H_ void MD5_String(const char * string, char * output); void MD5_Binary(const char * string, unsigned char * output); void MD5_Salt(unsigned int len, char * output); -#endif /* _MD5CALC_H_ */ +#endif /* _COMMON_MD5CALC_H_ */ diff --git a/src/common/mmo.h b/src/common/mmo.h index 573962601f5..2b66c516c0f 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MMO_H_ -#define _MMO_H_ +#ifndef _COMMON_MMO_H_ +#define _COMMON_MMO_H_ #include "cbasetypes.h" #include "../common/db.h" @@ -886,4 +886,4 @@ enum e_pc_reg_loading { #error MAX_ZENY is too big #endif -#endif /* _MMO_H_ */ +#endif /* _COMMON_MMO_H_ */ diff --git a/src/common/mutex.h b/src/common/mutex.h index 1999627cdbf..eeb24e6ff5b 100644 --- a/src/common/mutex.h +++ b/src/common/mutex.h @@ -1,8 +1,8 @@ // Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _rA_MUTEX_H_ -#define _rA_MUTEX_H_ +#ifndef _COMMON_MUTEX_H_ +#define _COMMON_MUTEX_H_ typedef struct ramutex *ramutex; // Mutex @@ -89,4 +89,4 @@ void racond_signal( racond c ); void racond_broadcast( racond c ); -#endif +#endif /* _COMMON_MUTEX_H_ */ diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 581252ccaf1..fb1cf0febc9 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef COMMON_NULLPO_H -#define COMMON_NULLPO_H +#ifndef _COMMON_NULLPO_H_ +#define _COMMON_NULLPO_H_ #include "../common/cbasetypes.h" @@ -125,4 +125,4 @@ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title); -#endif /* COMMON_NULLPO_H */ +#endif /* _COMMON_NULLPO_H_ */ diff --git a/src/common/random.h b/src/common/random.h index 43dfd36c078..ab83fb4d4fc 100644 --- a/src/common/random.h +++ b/src/common/random.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _RANDOM_H_ -#define _RANDOM_H_ +#ifndef _COMMON_RANDOM_H_ +#define _COMMON_RANDOM_H_ #include "../common/cbasetypes.h" @@ -15,4 +15,4 @@ int32 rnd_value(int32 min, int32 max);// [min, max] double rnd_uniform(void);// [0.0, 1.0) double rnd_uniform53(void);// [0.0, 1.0) -#endif /* _RANDOM_H_ */ +#endif /* _COMMON_RANDOM_H_ */ diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 01eae4480a9..b59214ab000 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _SHOWMSG_H_ -#define _SHOWMSG_H_ +#ifndef _COMMON_SHOWMSG_H_ +#define _COMMON_SHOWMSG_H_ #ifndef _HPMi_H_ #include "../../3rdparty/libconfig/libconfig.h" @@ -104,4 +104,4 @@ extern void ClearScreen(void); #endif extern int _vShowMessage(enum msg_type flag, const char *string, va_list ap); -#endif /* _SHOWMSG_H_ */ +#endif /* _COMMON_SHOWMSG_H_ */ diff --git a/src/common/socket.h b/src/common/socket.h index 6879d2e90d8..ca914171682 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _SOCKET_H_ -#define _SOCKET_H_ +#ifndef _COMMON_SOCKET_H_ +#define _COMMON_SOCKET_H_ #include "../common/cbasetypes.h" @@ -196,4 +196,4 @@ void socket_defaults(void); #define set_eof(fd) ( sockt->set_eof(fd) ) #endif /* _H_SOCKET_C_ */ -#endif /* _SOCKET_H_ */ +#endif /* _COMMON_SOCKET_H_ */ diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 9b9e4ce9499..29fbb355b13 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -1,6 +1,6 @@ #pragma once -#ifndef _rA_SPINLOCK_H_ -#define _rA_SPINLOCK_H_ +#ifndef _COMMON_SPINLOCK_H_ +#define _COMMON_SPINLOCK_H_ // // CAS based Spinlock Implementation @@ -101,4 +101,4 @@ static forceinline void LeaveSpinLock(PSPIN_LOCK lck){ -#endif +#endif /* _COMMON_SPINLOCK_H_ */ diff --git a/src/common/strlib.h b/src/common/strlib.h index 7a106640112..10844d257a6 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _STRLIB_H_ -#define _STRLIB_H_ +#ifndef _COMMON_STRLIB_H_ +#define _COMMON_STRLIB_H_ #include "../common/cbasetypes.h" #include @@ -191,4 +191,4 @@ void strlib_defaults(void); #define bin2hex(output,input,count) (strlib->bin2hex((output),(input),(count))) #endif /* STRLIB_C */ -#endif /* _STRLIB_H_ */ +#endif /* _COMMON_STRLIB_H_ */ diff --git a/src/common/thread.h b/src/common/thread.h index a5a66e9542f..d6b2bbc6ec2 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -2,8 +2,8 @@ // For more information, see LICENCE in the main folder #pragma once -#ifndef _rA_THREAD_H_ -#define _rA_THREAD_H_ +#ifndef _COMMON_THREAD_H_ +#define _COMMON_THREAD_H_ #include "../common/cbasetypes.h" @@ -116,4 +116,4 @@ void rathread_init(); void rathread_final(); -#endif +#endif /* _COMMON_THREAD_H_ */ diff --git a/src/common/timer.h b/src/common/timer.h index af1a2b036d5..ab3ffc21f62 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -1,8 +1,10 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _TIMER_H_ -#define _TIMER_H_ + +#ifndef _COMMON_TIMER_H_ +#define _COMMON_TIMER_H_ + #include "../common/cbasetypes.h" #define DIFF_TICK(a,b) ((a)-(b)) @@ -65,4 +67,4 @@ struct timer_interface *timer; void timer_defaults(void); -#endif /* _TIMER_H_ */ +#endif /* _COMMON_TIMER_H_ */ diff --git a/src/common/utils.h b/src/common/utils.h index 719e1e53317..68dd01ac46c 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _UTILS_H_ -#define _UTILS_H_ +#ifndef _COMMON_UTILS_H_ +#define _COMMON_UTILS_H_ #include "../common/cbasetypes.h" #include // FILE* @@ -54,4 +54,4 @@ struct HCache_interface *HCache; void HCache_defaults(void); -#endif /* _UTILS_H_ */ +#endif /* _COMMON_UTILS_H_ */ diff --git a/src/config/const.h b/src/config/const.h index fc82d66f932..6557cb98713 100644 --- a/src/config/const.h +++ b/src/config/const.h @@ -1,8 +1,9 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _H_CONSTANTS_ -#define _H_CONSTANTS_ + +#ifndef _CONFIG_CONSTANTS_H_ +#define _CONFIG_CONSTANTS_H_ /** * Hercules configuration file (http://hercules.ws) @@ -117,4 +118,4 @@ /** * End of File **/ -#endif /* _H_CONSTANTS_ */ +#endif /* _CONFIG_CONSTANTS_H_ */ diff --git a/src/login/account.h b/src/login/account.h index 74a9e9626c6..234e7c0c1aa 100644 --- a/src/login/account.h +++ b/src/login/account.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef __ACCOUNT_H_INCLUDED__ -#define __ACCOUNT_H_INCLUDED__ +#ifndef _LOGIN_ACCOUNT_H_ +#define _LOGIN_ACCOUNT_H_ #include "../common/cbasetypes.h" #include "../common/mmo.h" // ACCOUNT_REG2_NUM @@ -139,4 +139,4 @@ Sql *account_db_sql_up(AccountDB* self); void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id); void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id); -#endif // __ACCOUNT_H_INCLUDED__ +#endif /* _LOGIN_ACCOUNT_H_ */ diff --git a/src/login/ipban.h b/src/login/ipban.h index b2a1a7d9e74..e6851d8dd9a 100644 --- a/src/login/ipban.h +++ b/src/login/ipban.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef __IPBAN_H_INCLUDED__ -#define __IPBAN_H_INCLUDED__ +#ifndef _LOGIN_IPBAN_H_ +#define _LOGIN_IPBAN_H_ #include "../common/cbasetypes.h" @@ -22,4 +22,4 @@ void ipban_log(uint32 ip); bool ipban_config_read(const char* key, const char* value); -#endif // __IPBAN_H_INCLUDED__ +#endif /* _LOGIN_IPBAN_H_ */ diff --git a/src/login/login.h b/src/login/login.h index d6a02112582..14c361a15bd 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _LOGIN_H_ -#define _LOGIN_H_ +#ifndef _LOGIN_LOGIN_H_ +#define _LOGIN_LOGIN_H_ #include "../common/mmo.h" // NAME_LENGTH,SEX_* #include "../common/core.h" // CORE_ST_LAST @@ -100,4 +100,4 @@ extern struct mmo_char_server server[MAX_SERVERS]; extern struct Login_Config login_config; -#endif /* _LOGIN_H_ */ +#endif /* _LOGIN_LOGIN_H_ */ diff --git a/src/login/loginlog.h b/src/login/loginlog.h index a1ffaae85c2..730fb6e62b2 100644 --- a/src/login/loginlog.h +++ b/src/login/loginlog.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef __LOGINLOG_H_INCLUDED__ -#define __LOGINLOG_H_INCLUDED__ +#ifndef _LOGIN_LOGINLOG_H_ +#define _LOGIN_LOGINLOG_H_ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); @@ -12,4 +12,4 @@ bool loginlog_final(void); bool loginlog_config_read(const char* w1, const char* w2); -#endif // __LOGINLOG_H_INCLUDED__ +#endif /* _LOGIN_LOGINLOG_H_ */ diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 4b1338b8d65..1688f37cec9 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -34,6 +34,8 @@ #include #include +#include "../plugins/HPMDataCheck.h" + struct HPM_atcommand_list { //tracking currently not enabled // - requires modifying how plugins calls atcommand creation @@ -46,6 +48,11 @@ struct HPM_atcommand_list { struct HPM_atcommand_list *atcommand_list = NULL; unsigned int atcommand_list_items = 0; +/** + * (char*) data name -> (unsigned int) HPMDataCheck[] index + **/ +DBMap *datacheck_db; + bool HPM_map_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr) { /* record address */ switch( type ) { @@ -113,20 +120,28 @@ void HPM_map_atcommands(void) { } } -void HPM_map_do_final(void) { - unsigned char i; +/** + * Called by HPM->DataCheck on a plugins incoming data, ensures data structs in use are matching! + **/ +bool HPM_map_DataCheck (struct s_HPMDataCheck *src, unsigned int size, char *name) { + unsigned int i, j; - if( atcommand_list ) - aFree(atcommand_list); - /** - * why is pcg->HPM being cleared here? because PCG's do_final is not final, - * is used on reload, and would thus cause plugin-provided permissions to go away - **/ - for( i = 0; i < pcg->HPMpermissions_count; i++ ) { - aFree(pcg->HPMpermissions[i].name); + for(i = 0; i < size; i++) { + + if( !strdb_exists(datacheck_db, src[i].name) ) { + ShowError("HPMDataCheck:%s: '%s' was not found\n",name,src[i].name); + return false; + } else { + j = strdb_uiget(datacheck_db, src[i].name);/* not double lookup; exists sets cache to found data */ + ShowDebug("Testing[%s/%s] %u vs %u\n",src[i].name,HPMDataCheck[j].name,src[i].size,HPMDataCheck[j].size); + if( src[i].size != HPMDataCheck[j].size ) { + ShowWarning("HPMDataCheck:%s: '%s' size mismatch %u != %u\n",name,src[i].name,src[i].size,HPMDataCheck[j].size); + return false; + } + } } - if( pcg->HPMpermissions ) - aFree(pcg->HPMpermissions); + + return true; } /** @@ -141,3 +156,35 @@ void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned in pcg->HPMpermissions[index].name = aStrdup(name); pcg->HPMpermissions[index].mask = mask; } + +void HPM_map_do_init(void) { + unsigned int i; + + /** + * Populates datacheck_db for easy lookup later on + **/ + datacheck_db = strdb_alloc(DB_OPT_BASE,0); + + for(i = 0; i < HPMDataCheckLen; i++) { + strdb_uiput(datacheck_db, HPMDataCheck[i].name, i); + } + +} + +void HPM_map_do_final(void) { + unsigned char i; + + if( atcommand_list ) + aFree(atcommand_list); + /** + * why is pcg->HPM being cleared here? because PCG's do_final is not final, + * is used on reload, and would thus cause plugin-provided permissions to go away + **/ + for( i = 0; i < pcg->HPMpermissions_count; i++ ) { + aFree(pcg->HPMpermissions[i].name); + } + if( pcg->HPMpermissions ) + aFree(pcg->HPMpermissions); + + db_destroy(datacheck_db); +} diff --git a/src/map/HPMmap.h b/src/map/HPMmap.h index ff8cf4c74b2..f291575fb45 100644 --- a/src/map/HPMmap.h +++ b/src/map/HPMmap.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _HPM_MAP_ -#define _HPM_MAP_ +#ifndef _MAP_HPMMAP_H_ +#define _MAP_HPMMAP_H_ #include "../common/cbasetypes.h" #include "../map/atcommand.h" @@ -22,4 +22,8 @@ void HPM_map_do_final(void); void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask); -#endif /* _HPM_MAP_ */ +bool HPM_map_DataCheck(struct s_HPMDataCheck *src, unsigned int size, char *name); + +void HPM_map_do_init(void); + +#endif /* _MAP_HPMMAP_H_ */ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index f959409243b..39f7cc2b20b 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _ATCOMMAND_H_ -#define _ATCOMMAND_H_ +#ifndef _MAP_ATCOMMAND_H_ +#define _MAP_ATCOMMAND_H_ #include "../common/conf.h" #include "../common/db.h" @@ -121,4 +121,4 @@ void atcommand_defaults(void); /* 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) -#endif /* _ATCOMMAND_H_ */ +#endif /* _MAP_ATCOMMAND_H_ */ diff --git a/src/map/battle.h b/src/map/battle.h index 98f2e37e8ce..0fcef729271 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _BATTLE_H_ -#define _BATTLE_H_ +#ifndef _MAP_BATTLE_H_ +#define _MAP_BATTLE_H_ #include "../common/cbasetypes.h" #include "map.h" //ELE_MAX @@ -596,4 +596,4 @@ struct battle_interface { struct battle_interface *battle; void battle_defaults(void); -#endif /* _BATTLE_H_ */ +#endif /* _MAP_BATTLE_H_ */ diff --git a/src/map/battleground.h b/src/map/battleground.h index 4aeb9f87936..ed734756621 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _BATTLEGROUND_H_ -#define _BATTLEGROUND_H_ +#ifndef _MAP_BATTLEGROUND_H_ +#define _MAP_BATTLEGROUND_H_ #include "../common/mmo.h" // struct party #include "clif.h" @@ -112,4 +112,4 @@ struct battleground_interface *bg; void battleground_defaults(void); -#endif /* _BATTLEGROUND_H_ */ +#endif /* _MAP_BATTLEGROUND_H_ */ diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index b0db4066138..5141a1013c7 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _BUYINGSTORE_H_ -#define _BUYINGSTORE_H_ +#ifndef _MAP_BUYINGSTORE_H_ +#define _MAP_BUYINGSTORE_H_ /** * Declarations @@ -70,4 +70,4 @@ struct buyingstore_interface *buyingstore; void buyingstore_defaults (void); -#endif // _BUYINGSTORE_H_ +#endif // _MAP_BUYINGSTORE_H_ diff --git a/src/map/chat.h b/src/map/chat.h index fcbadf00818..71e5a11ec20 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CHAT_H_ -#define _CHAT_H_ +#ifndef _MAP_CHAT_H_ +#define _MAP_CHAT_H_ #include "map.h" // struct block_list, CHATROOM_TITLE_SIZE @@ -55,4 +55,4 @@ struct chat_interface *chat; void chat_defaults(void); -#endif /* _CHAT_H_ */ +#endif /* _MAP_CHAT_H_ */ diff --git a/src/map/chrif.h b/src/map/chrif.h index 163fdf670f1..59e45a2ea47 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CHRIF_H_ -#define _CHRIF_H_ +#ifndef _MAP_CHRIF_H_ +#define _MAP_CHRIF_H_ #include "../common/cbasetypes.h" #include @@ -148,4 +148,4 @@ void chrif_defaults(void); // There's no need for another function when a simple macro can do exactly the same effect #define chrif_char_offline(x) chrif->char_offline_nsd((x)->status.account_id,(x)->status.char_id) -#endif /* _CHRIF_H_ */ +#endif /* _MAP_CHRIF_H_ */ diff --git a/src/map/clif.h b/src/map/clif.h index 6405bbd3ee7..1e0319b7bee 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _CLIF_H_ -#define _CLIF_H_ +#ifndef _MAP_CLIF_H_ +#define _MAP_CLIF_H_ #include "../common/cbasetypes.h" #include "../common/db.h" @@ -1275,4 +1275,4 @@ struct clif_interface *clif; void clif_defaults(void); -#endif /* _CLIF_H_ */ +#endif /* _MAP_CLIF_H_ */ diff --git a/src/map/date.h b/src/map/date.h index cc19d88d16c..02238d7ea2c 100644 --- a/src/map/date.h +++ b/src/map/date.h @@ -1,8 +1,8 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#ifndef _DATE_H_ -#define _DATE_H_ +#ifndef _MAP_DATE_H_ +#define _MAP_DATE_H_ int date_get_year(void); int date_get_month(void); @@ -15,4 +15,4 @@ int is_day_of_sun(void); int is_day_of_moon(void); int is_day_of_star(void); -#endif /* _DATE_H_ */ +#endif /* _MAP_DATE_H_ */ diff --git a/src/map/duel.h b/src/map/duel.h index d60c9531a1e..5405d2eeea6 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _DUEL_H_ -#define _DUEL_H_ +#ifndef _MAP_DUEL_H_ +#define _MAP_DUEL_H_ struct duel { int members_count; @@ -42,4 +42,4 @@ struct duel_interface *duel; void duel_defaults(void); -#endif /* _DUEL_H_ */ +#endif /* _MAP_DUEL_H_ */ diff --git a/src/map/elemental.h b/src/map/elemental.h index 830a6a5777c..6d04a41a580 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _ELEMENTAL_H_ -#define _ELEMENTAL_H_ +#ifndef _MAP_ELEMENTAL_H_ +#define _MAP_ELEMENTAL_H_ #include "status.h" // struct status_data, struct status_change #include "unit.h" // struct unit_data @@ -120,4 +120,4 @@ struct elemental_interface *elemental; void elemental_defaults(void); -#endif /* _ELEMENTAL_H_ */ +#endif /* _MAP_ELEMENTAL_H_ */ diff --git a/src/map/guild.h b/src/map/guild.h index 7878d75c346..b03bd664d7d 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _GUILD_H_ -#define _GUILD_H_ +#ifndef _MAP_GUILD_H_ +#define _MAP_GUILD_H_ //#include "../common/mmo.h" #include "map.h" // NAME_LENGTH @@ -173,4 +173,4 @@ struct guild_interface *guild; void guild_defaults(void); -#endif /* _GUILD_H_ */ +#endif /* _MAP_GUILD_H_ */ diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 117f9da8e53..db250f5117c 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _HOMUNCULUS_H_ -#define _HOMUNCULUS_H_ +#ifndef _MAP_HOMUNCULUS_H_ +#define _MAP_HOMUNCULUS_H_ #include "status.h" // struct status_data, struct status_change #include "unit.h" // struct unit_data @@ -146,4 +146,4 @@ struct homunculus_interface *homun; void homunculus_defaults(void); -#endif /* _HOMUNCULUS_H_ */ +#endif /* _MAP_HOMUNCULUS_H_ */ diff --git a/src/map/instance.h b/src/map/instance.h index 764a55b2bec..66a7d0d6c1b 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _INSTANCE_H_ -#define _INSTANCE_H_ +#ifndef _MAP_INSTANCE_H_ +#define _MAP_INSTANCE_H_ #define INSTANCE_NAME_LENGTH (60+1) @@ -82,4 +82,4 @@ struct instance_interface *instance; void instance_defaults(void); -#endif +#endif /* _MAP_INSTANCE_H_ */ diff --git a/src/map/intif.h b/src/map/intif.h index f0bb5c16e2f..290dcfcdc32 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _INTIF_H_ -#define _INFIF_H_ +#ifndef _MAP_INTIF_H_ +#define _MAP_INTIF_H_ /** @@ -183,4 +183,4 @@ struct intif_interface *intif; void intif_defaults(void); -#endif /* _INTIF_H_ */ +#endif /* _MAP_INTIF_H_ */ diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 7d6a19eba2a..c15a5d46a20 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -3,8 +3,8 @@ // Base Author: shennetsind @ http://hercules.ws -#ifndef _IRC_BOT_H_ -#define _IRC_BOT_H_ +#ifndef _MAP_IRC_BOT_H_ +#define _MAP_IRC_BOT_H_ #define IRC_NICK_LENGTH 40 #define IRC_IDENT_LENGTH 40 @@ -61,4 +61,4 @@ struct irc_bot_interface *ircbot; void ircbot_defaults(void); -#endif /* _IRC_BOT_H_ */ +#endif /* _MAP_IRC_BOT_H_ */ diff --git a/src/map/itemdb.h b/src/map/itemdb.h index b3ff606df83..74ced13e018 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _ITEMDB_H_ -#define _ITEMDB_H_ +#ifndef _MAP_ITEMDB_H_ +#define _MAP_ITEMDB_H_ #include "../common/db.h" #include "../common/mmo.h" // ITEM_NAME_LENGTH @@ -582,4 +582,4 @@ struct itemdb_interface *itemdb; void itemdb_defaults(void); -#endif /* _ITEMDB_H_ */ +#endif /* _MAP_ITEMDB_H_ */ diff --git a/src/map/log.h b/src/map/log.h index 9864a54d773..b2cb92c20f0 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _LOG_H_ -#define _LOG_H_ +#ifndef _MAP_LOG_H_ +#define _MAP_LOG_H_ #include "../common/cbasetypes.h" #include "../common/sql.h" @@ -134,4 +134,4 @@ struct log_interface *logs; void log_defaults(void); -#endif /* _LOG_H_ */ +#endif /* _MAP_LOG_H_ */ diff --git a/src/map/mail.h b/src/map/mail.h index b2b9048cbfc..8df537ff30c 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MAIL_H_ -#define _MAIL_H_ +#ifndef _MAP_MAIL_H_ +#define _MAP_MAIL_H_ #include "../common/mmo.h" @@ -23,4 +23,4 @@ struct mail_interface *mail; void mail_defaults(void); -#endif /* _MAIL_H_ */ +#endif /* _MAP_MAIL_H_ */ diff --git a/src/map/map.c b/src/map/map.c index 33721b0285d..2be61587f31 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5447,6 +5447,8 @@ int do_init(int argc, char *argv[]) map_load_defaults(); + HPM_map_do_init(); + HPM->DataCheck = HPM_map_DataCheck; HPM->load_sub = HPM_map_plugin_load_sub; HPM->symbol_defaults_sub = map_hp_symbols; HPM->grabHPDataSub = HPM_map_grabHPData; diff --git a/src/map/map.h b/src/map/map.h index 130b181da1e..8faf6388e5e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MAP_H_ -#define _MAP_H_ +#ifndef _MAP_MAP_H_ +#define _MAP_MAP_H_ #include "../common/cbasetypes.h" #include "../common/core.h" // CORE_ST_LAST @@ -1066,4 +1066,4 @@ struct map_interface *map; void map_defaults(void); -#endif /* _MAP_H_ */ +#endif /* _MAP_MAP_H_ */ diff --git a/src/map/mapreg.h b/src/map/mapreg.h index 157e634cc90..c92b6f602e1 100644 --- a/src/map/mapreg.h +++ b/src/map/mapreg.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MAPREG_H_ -#define _MAPREG_H_ +#ifndef _MAP_MAPREG_H_ +#define _MAP_MAPREG_H_ #include "../common/cbasetypes.h" #include "../common/db.h" @@ -51,4 +51,4 @@ struct mapreg_interface *mapreg; void mapreg_defaults(void); -#endif /* _MAPREG_H_ */ +#endif /* _MAP_MAPREG_H_ */ diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 3f2214b659c..dd9266b2e22 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -1,8 +1,8 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MERCENARY_H_ -#define _MERCENARY_H_ +#ifndef _MAP_MERCENARY_H_ +#define _MAP_MERCENARY_H_ #include "status.h" // struct status_data, struct status_change #include "unit.h" // struct unit_data @@ -98,4 +98,4 @@ struct mercenary_interface *mercenary; void mercenary_defaults(void); -#endif /* _MERCENARY_H_ */ +#endif /* _MAP_MERCENARY_H_ */ diff --git a/src/map/mob.h b/src/map/mob.h index 9321cb4fd42..80175b1dbb1 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _MOB_H_ -#define _MOB_H_ +#ifndef _MAP_MOB_H_ +#define _MAP_MOB_H_ #include "../common/mmo.h" // struct item #include "guild.h" // struct guardian_data @@ -364,4 +364,4 @@ struct mob_interface *mob; void mob_defaults(void); -#endif /* _MOB_H_ */ +#endif /* _MAP_MOB_H_ */ diff --git a/src/map/npc.h b/src/map/npc.h index 266d174fb33..719974ac4a9 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _NPC_H_ -#define _NPC_H_ +#ifndef _MAP_NPC_H_ +#define _MAP_NPC_H_ #include "map.h" // struct block_list #include "status.h" // struct status_change @@ -346,4 +346,4 @@ struct pcre_interface *libpcre; void npc_chat_defaults(void); #endif -#endif /* _NPC_H_ */ +#endif /* _MAP_NPC_H_ */ diff --git a/src/map/packets.h b/src/map/packets.h index cea916f6d02..4cf6f6d6a7b 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -3,8 +3,8 @@ //Included directly by clif.h in packet_loaddb() -#ifndef _PACKETS_H_ -#define _PACKETS_H_ +#ifndef _MAP_PACKETS_H_ +#define _MAP_PACKETS_H_ #ifndef packet #define packet(a,b,...) @@ -2693,4 +2693,4 @@ packet(0x020d,-1); packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3); #endif -#endif /* _PACKETS_H_ */ +#endif /* _MAP_PACKETS_H_ */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1156f446539..4a599463aa8 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3,8 +3,8 @@ /* Hercules Renewal: Phase Two http://hercules.ws/board/topic/383-hercules-renewal-phase-two/ */ -#ifndef _PACKETS_STRUCT_H_ -#define _PACKETS_STRUCT_H_ +#ifndef _MAP_PACKETS_STRUCT_H_ +#define _MAP_PACKETS_STRUCT_H_ #include "../common/mmo.h" @@ -945,4 +945,4 @@ struct packet_npc_market_open { #pragma pack(pop) #endif // not NetBSD < 6 / Solaris -#endif /* _PACKETS_STRUCT_H_ */ +#endif /* _MAP_PACKETS_STRUCT_H_ */ diff --git a/src/map/party.h b/src/map/party.h index 051c98af28d..05b5309e641 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PARTY_H_ -#define _PARTY_H_ +#ifndef _MAP_PARTY_H_ +#define _MAP_PARTY_H_ #include "../common/mmo.h" // struct party #include "../config/core.h" @@ -141,4 +141,4 @@ struct party_interface *party; void party_defaults(void); -#endif /* _PARTY_H_ */ +#endif /* _MAP_PARTY_H_ */ diff --git a/src/map/path.h b/src/map/path.h index a889a6409aa..0b67a0120b4 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PATH_H_ -#define _PATH_H_ +#ifndef _MAP_PATH_H_ +#define _MAP_PATH_H_ #include "map.h" // enum cell_chk @@ -46,4 +46,4 @@ struct path_interface *path; void path_defaults(void); -#endif /* _PATH_H_ */ +#endif /* _MAP_PATH_H_ */ diff --git a/src/map/pc.h b/src/map/pc.h index 487266646bc..03b3ddca095 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1,8 +1,9 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PC_H_ -#define _PC_H_ + +#ifndef _MAP_PC_H_ +#define _MAP_PC_H_ #include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus #include "../common/ers.h" @@ -1044,4 +1045,4 @@ struct pc_interface *pc; void pc_defaults(void); -#endif /* _PC_H_ */ +#endif /* _MAP_PC_H_ */ diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 3396512ea71..5c03f999fd2 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PC_GROUPS_H_ -#define _PC_GROUPS_H_ +#ifndef _MAP_PC_GROUPS_H_ +#define _MAP_PC_GROUPS_H_ /// PC permissions enum e_pc_permission { @@ -92,4 +92,4 @@ struct pc_groups_interface *pcg; void pc_groups_defaults(void); -#endif // _PC_GROUPS_H_ +#endif /* _MAP_PC_GROUPS_H_ */ diff --git a/src/map/pet.h b/src/map/pet.h index f1a2197006f..537a50c4b7d 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _PET_H_ -#define _PET_H_ +#ifndef _MAP_PET_H_ +#define _MAP_PET_H_ #define MAX_PET_DB 300 #define MAX_PETLOOT_SIZE 30 @@ -152,4 +152,4 @@ struct pet_interface *pet; void pet_defaults(void); -#endif /* _PET_H_ */ +#endif /* _MAP_PET_H_ */ diff --git a/src/map/quest.h b/src/map/quest.h index 28815a6c36b..e01e3561903 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _QUEST_H_ -#define _QUEST_H_ +#ifndef _MAP_QUEST_H_ +#define _MAP_QUEST_H_ #define MAX_QUEST_DB (60355+1) // Highest quest ID + 1 @@ -48,4 +48,4 @@ struct quest_interface *quest; void quest_defaults(void); -#endif +#endif /* _MAP_QUEST_H_ */ diff --git a/src/map/script.h b/src/map/script.h index 97db2a77522..b7e9e57415d 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _SCRIPT_H_ -#define _SCRIPT_H_ +#ifndef _MAP_SCRIPT_H_ +#define _MAP_SCRIPT_H_ #include "../common/strlib.h" //StringBuf #include "../common/cbasetypes.h" @@ -700,4 +700,4 @@ struct script_interface *script; void script_defaults(void); -#endif /* _SCRIPT_H_ */ +#endif /* _MAP_SCRIPT_H_ */ diff --git a/src/map/searchstore.h b/src/map/searchstore.h index d7a327181a1..827e3905320 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _SEARCHSTORE_H_ -#define _SEARCHSTORE_H_ +#ifndef _MAP_SEARCHSTORE_H_ +#define _MAP_SEARCHSTORE_H_ /** * Defines @@ -93,4 +93,4 @@ struct searchstore_interface *searchstore; void searchstore_defaults (void); -#endif // _SEARCHSTORE_H_ +#endif /* _MAP_SEARCHSTORE_H_ */ diff --git a/src/map/skill.h b/src/map/skill.h index 28cb548d27a..78829f17e64 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _SKILL_H_ -#define _SKILL_H_ +#ifndef _MAP_SKILL_H_ +#define _MAP_SKILL_H_ #include "../common/mmo.h" // MAX_SKILL, struct square #include "../common/db.h" @@ -2015,4 +2015,4 @@ struct skill_interface *skill; void skill_defaults(void); -#endif /* _SKILL_H_ */ +#endif /* _MAP_SKILL_H_ */ diff --git a/src/map/status.h b/src/map/status.h index f319b150670..d3148b4e0b2 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _STATUS_H_ -#define _STATUS_H_ +#ifndef _MAP_STATUS_H_ +#define _MAP_STATUS_H_ #include "../common/mmo.h" @@ -2012,4 +2012,4 @@ struct status_interface *status; void status_defaults(void); -#endif /* _STATUS_H_ */ +#endif /* _MAP_STATUS_H_ */ diff --git a/src/map/storage.h b/src/map/storage.h index 8a10c9f3b75..8f9f904f665 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _STORAGE_H_ -#define _STORAGE_H_ +#ifndef _MAP_STORAGE_H_ +#define _MAP_STORAGE_H_ struct storage_data; struct guild_storage; @@ -59,4 +59,4 @@ struct guild_storage_interface *gstorage; void storage_defaults(void); void gstorage_defaults(void); -#endif /* _STORAGE_H_ */ +#endif /* _MAP_STORAGE_H_ */ diff --git a/src/map/trade.h b/src/map/trade.h index d0b90050499..f2c0d462231 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -2,10 +2,11 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _TRADE_H_ -#define _TRADE_H_ +#ifndef _MAP_TRADE_H_ +#define _MAP_TRADE_H_ //Max distance from traders to enable a trade to take place. +//TODO: battle_config candidate? #define TRADE_DISTANCE 2 struct map_session_data; @@ -26,4 +27,4 @@ struct trade_interface *trade; void trade_defaults(void); -#endif /* _TRADE_H_ */ +#endif /* _MAP_TRADE_H_ */ diff --git a/src/map/unit.h b/src/map/unit.h index a2d74387575..33fa4e052c4 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -1,8 +1,9 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams -#ifndef _UNIT_H_ -#define _UNIT_H_ +#ifndef _MAP_UNIT_H_ +#define _MAP_UNIT_H_ //#include "map.h" struct block_list; @@ -125,4 +126,4 @@ struct unit_interface *unit; void unit_defaults(void); -#endif /* _UNIT_H_ */ +#endif /* _MAP_UNIT_H_ */ diff --git a/src/map/vending.h b/src/map/vending.h index b760bf0649f..b2ba2295570 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -2,8 +2,8 @@ // See the LICENSE file // Portions Copyright (c) Athena Dev Teams -#ifndef _VENDING_H_ -#define _VENDING_H_ +#ifndef _MAP_VENDING_H_ +#define _MAP_VENDING_H_ #include "../common/cbasetypes.h" #include "../common/db.h" @@ -35,4 +35,4 @@ struct vending_interface *vending; void vending_defaults(void); -#endif /* _VENDING_H_ */ +#endif /* _MAP_VENDING_H_ */