diff options
author | Haru <haru@dotalux.com> | 2015-01-12 18:29:24 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-01-12 18:35:36 +0100 |
commit | 4fa9fd843e19d041a6b142722e1f2c717a45f625 (patch) | |
tree | 5271cda69234c97a07a1ed9f2f6ef8510bdf94ac /src | |
parent | fe00cc320396bc7ac301a22592b718792ae49adf (diff) | |
download | hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.gz hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.bz2 hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.tar.xz hercules-4fa9fd843e19d041a6b142722e1f2c717a45f625.zip |
Blocked compilation of plugins that use unavailable functions
- Rather than failing at runtime, plugins that try to access
non-interfaced, unavailable functions or variables, will now show an
error at compile-time.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
82 files changed, 223 insertions, 53 deletions
diff --git a/src/char/HPMchar.h b/src/char/HPMchar.h index 9d367725c..aa266f1de 100644 --- a/src/char/HPMchar.h +++ b/src/char/HPMchar.h @@ -4,6 +4,10 @@ #ifndef CHAR_HPMCHAR_H #define CHAR_HPMCHAR_H +#ifndef HERCULES_CORE +#error You should never include HPMchar.h from a plugin. +#endif + #include "../common/cbasetypes.h" #include "../common/HPM.h" diff --git a/src/char/char.h b/src/char/char.h index a6707a7f9..4b68dc43c 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -63,6 +63,7 @@ enum { TABLE_GUILD_STORAGE, }; +#ifdef HERCULES_CORE extern int char_name_option; extern char char_name_letters[]; extern bool char_gm_read; @@ -112,6 +113,7 @@ extern int log_inter; void char_load_defaults(); void char_defaults(); +#endif // HERCULES_CORE struct char_auth_node { int account_id; diff --git a/src/char/geoip.h b/src/char/geoip.h index 8cad2f73b..a7ab6b9a4 100644 --- a/src/char/geoip.h +++ b/src/char/geoip.h @@ -27,6 +27,8 @@ struct geoip_interface { struct geoip_interface *geoip; +#ifdef HERCULES_CORE void geoip_defaults(void); +#endif // HERCULES_CORE #endif /* CHAR_GEOIP_H */ diff --git a/src/char/int_auction.h b/src/char/int_auction.h index ad8ac7b67..c27ecd6c3 100644 --- a/src/char/int_auction.h +++ b/src/char/int_auction.h @@ -6,7 +6,9 @@ #include "../common/mmo.h" +#ifdef HERCULES_CORE void inter_auction_defaults(void); +#endif // HERCULES_CORE /** * inter_auction_interface interface diff --git a/src/char/int_elemental.h b/src/char/int_elemental.h index 611d97550..7aa379ebb 100644 --- a/src/char/int_elemental.h +++ b/src/char/int_elemental.h @@ -6,7 +6,9 @@ #include "../common/cbasetypes.h" +#ifdef HERCULES_CORE void inter_elemental_defaults(void); +#endif // HERCULES_CORE /** * inter_elemental_interface interface diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 960150f4f..e7d089943 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -22,7 +22,9 @@ enum { GS_REMOVE = 0x8000, }; +#ifdef HERCULES_CORE void inter_guild_defaults(void); +#endif // HERCULES_CORE /** * inter_guild interface diff --git a/src/char/int_homun.h b/src/char/int_homun.h index 5bfa355d4..0212da150 100644 --- a/src/char/int_homun.h +++ b/src/char/int_homun.h @@ -8,7 +8,9 @@ struct s_homunculus; +#ifdef HERCULES_CORE void inter_homunculus_defaults(void); +#endif // HERCULES_CORE /** * inter_homunculus interface diff --git a/src/char/int_mail.h b/src/char/int_mail.h index 5ce7bafa2..02f640ae2 100644 --- a/src/char/int_mail.h +++ b/src/char/int_mail.h @@ -10,7 +10,9 @@ struct item; struct mail_data; struct mail_message; +#ifdef HERCULES_CORE void inter_mail_defaults(void); +#endif // HERCULES_CORE /** * inter_mail interface diff --git a/src/char/int_mercenary.h b/src/char/int_mercenary.h index b22ea61b2..049429e1d 100644 --- a/src/char/int_mercenary.h +++ b/src/char/int_mercenary.h @@ -8,7 +8,9 @@ struct mmo_charstatus; +#ifdef HERCULES_CORE void inter_mercenary_defaults(void); +#endif // HERCULES_CORE /** * inter_mercenary interface diff --git a/src/char/int_party.h b/src/char/int_party.h index 0c70a5300..61d828bc0 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -23,7 +23,9 @@ struct party_data { unsigned char size; //Total size of party. }; +#ifdef HERCULES_CORE void inter_party_defaults(void); +#endif // HERCULES_CORE /** * inter_party interface diff --git a/src/char/int_pet.h b/src/char/int_pet.h index 873613307..69e440781 100644 --- a/src/char/int_pet.h +++ b/src/char/int_pet.h @@ -6,7 +6,9 @@ struct s_pet; +#ifdef HERCULES_CORE void inter_pet_defaults(void); +#endif // HERCULES_CORE /** * inter_pet interface diff --git a/src/char/int_quest.h b/src/char/int_quest.h index 265a3f97a..2cb359d40 100644 --- a/src/char/int_quest.h +++ b/src/char/int_quest.h @@ -4,7 +4,9 @@ #ifndef CHAR_QUEST_H #define CHAR_QUEST_H +#ifdef HERCULES_CORE void inter_quest_defaults(void); +#endif // HERCULES_CORE /** * inter_quest interface diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 6c380f29b..11a16de83 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -7,7 +7,9 @@ struct storage_data; struct guild_storage; +#ifdef HERCULES_CORE void inter_storage_defaults(void); +#endif // HERCULES_CORE /** * inter_storage interface diff --git a/src/char/inter.h b/src/char/inter.h index c4bb43c1d..7f5b5fc22 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -13,9 +13,11 @@ struct accreg; #define inter_cfgName "conf/inter-server.conf" +#ifdef HERCULES_CORE extern unsigned int party_share_level; void inter_defaults(void); +#endif // HERCULES_CORE /** * inter interface diff --git a/src/char/loginif.h b/src/char/loginif.h index 27eb62a1a..634bd4b8b 100644 --- a/src/char/loginif.h +++ b/src/char/loginif.h @@ -28,6 +28,8 @@ struct loginif_interface { struct loginif_interface *loginif; +#ifdef HERCULES_CORE void loginif_defaults(void); +#endif // HERCULES_CORE #endif /* CHAR_LOGINIF_H */ diff --git a/src/char/mapif.h b/src/char/mapif.h index f9c06256d..528522d1e 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -193,6 +193,8 @@ struct mapif_interface { struct mapif_interface *mapif; +#ifdef HERCULES_CORE void mapif_defaults(void); +#endif // HERCULES_CORE #endif /* CHAR_MAPIF_H */ diff --git a/src/char/pincode.h b/src/char/pincode.h index f4265716a..178d7e427 100644 --- a/src/char/pincode.h +++ b/src/char/pincode.h @@ -42,6 +42,8 @@ struct pincode_interface { struct pincode_interface *pincode; +#ifdef HERCULES_CORE void pincode_defaults(void); +#endif // HERCULES_CORE #endif /* CHAR_PINCODE_H */ diff --git a/src/common/conf.h b/src/common/conf.h index 9ea5f5b72..bd97d5c1e 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -93,6 +93,8 @@ struct libconfig_interface { struct libconfig_interface *libconfig; +#ifdef HERCULES_CORE void libconfig_defaults(void); +#endif // HERCULES_CORE #endif // COMMON_CONF_H diff --git a/src/common/console.c b/src/common/console.c index 6c5a5c886..0b1b9cf93 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -40,6 +40,11 @@ struct console_interface console_s; #ifdef CONSOLE_INPUT struct console_input_interface console_input_s; + +struct { + char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT]; + unsigned short count; +} cinput; #endif /*====================================== diff --git a/src/common/console.h b/src/common/console.h index 062d48bbe..3d3c8e9dd 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -44,11 +44,6 @@ struct CParseEntry { unsigned short next_count; }; -struct { - char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT]; - unsigned short count; -} cinput; - #ifdef CONSOLE_INPUT struct console_input_interface { /* vars */ @@ -91,6 +86,8 @@ struct console_interface { struct console_interface *console; +#ifdef HERCULES_CORE void console_defaults(void); +#endif // HERCULES_CORE #endif /* COMMON_CONSOLE_H */ diff --git a/src/common/core.h b/src/common/core.h index a8337e1b9..025f636e9 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -13,15 +13,8 @@ # include <signal.h> #endif -extern int arg_c; -extern char **arg_v; - #define HERC_UNKNOWN_VER '\x02' -/// @see E_CORE_ST -extern int runflag; -extern char *SERVER_NAME; - enum server_types { SERVER_TYPE_UNKNOWN = 0x0, SERVER_TYPE_LOGIN = 0x1, @@ -29,13 +22,6 @@ enum server_types { SERVER_TYPE_MAP = 0x4, }; -enum server_types SERVER_TYPE; - -extern int do_init(int,char**); -extern void set_server_type(void); -extern void do_abort(void); -extern int do_final(void); - /// The main loop continues until runflag is CORE_ST_STOP enum E_CORE_ST { CORE_ST_STOP = 0, @@ -43,8 +29,24 @@ enum E_CORE_ST { CORE_ST_LAST }; +#ifdef HERCULES_CORE +extern int arg_c; +extern char **arg_v; + +/// @see E_CORE_ST +extern int runflag; +extern char *SERVER_NAME; + +enum server_types SERVER_TYPE; + +extern int do_init(int,char**); +extern void set_server_type(void); +extern void do_abort(void); +extern int do_final(void); + /// Called when a terminate signal is received. (Ctrl+C pressed) /// If NULL, runflag is set to CORE_ST_STOP instead. extern void (*shutdown_callback)(void); +#endif // HERCULES_CORE #endif /* COMMON_CORE_H */ diff --git a/src/common/db.h b/src/common/db.h index 88265c3e8..cd61e1543 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -929,6 +929,7 @@ struct linkdb_node { typedef void (*LinkDBFunc)(void* key, void* data, va_list args); +#ifdef HERCULES_CORE void linkdb_insert (struct linkdb_node** head, void *key, void* data); // Doesn't take into account duplicate keys void linkdb_replace (struct linkdb_node** head, void *key, void* data); // Takes into account duplicate keys void* linkdb_search (struct linkdb_node** head, void *key); @@ -936,6 +937,7 @@ void* linkdb_erase (struct linkdb_node** head, void *key); void linkdb_final (struct linkdb_node** head); void linkdb_vforeach(struct linkdb_node** head, LinkDBFunc func, va_list ap); void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...); +#endif // HERCULES_CORE diff --git a/src/common/des.h b/src/common/des.h index 2c7190f23..9e6aec4fd 100644 --- a/src/common/des.h +++ b/src/common/des.h @@ -8,9 +8,9 @@ /// One 64-bit block. typedef struct BIT64 { uint8_t b[8]; } BIT64; - +#ifdef HERCULES_CORE void des_decrypt_block(BIT64* block); void des_decrypt(unsigned char* data, size_t size); - +#endif // HERCULES_CORE #endif // COMMON_DES_H diff --git a/src/common/ers.h b/src/common/ers.h index 8c56118ae..85ddfed7a 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -148,6 +148,7 @@ typedef struct eri { # define ers_destroy(obj) ((obj)->destroy(obj)) # define ers_chunk_size(obj,size) ((obj)->chunk_size((obj),(size))) +#ifdef HERCULES_CORE /** * Get a new instance of the manager that handles the specified entry size. * Size has to greater than 0. @@ -173,6 +174,7 @@ void ers_report(void); * Clears the remainder of the managers **/ void ers_final(void); +#endif // HERCULES_CORE #endif /* DISABLE_ERS / not DISABLE_ERS */ #endif /* COMMON_ERS_H */ diff --git a/src/common/grfio.h b/src/common/grfio.h index 15659c17c..adffe0990 100644 --- a/src/common/grfio.h +++ b/src/common/grfio.h @@ -4,6 +4,7 @@ #ifndef COMMON_GRFIO_H #define COMMON_GRFIO_H +#ifdef HERCULES_CORE void grfio_init(const char* fname); void grfio_final(void); void* grfio_reads(const char* fname, int* size); @@ -13,5 +14,6 @@ char* grfio_find_file(const char* fname); 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 // HERCULES_CORE #endif /* COMMON_GRFIO_H */ diff --git a/src/common/malloc.h b/src/common/malloc.h index 53d2ebdd2..bc79ac65a 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -65,8 +65,12 @@ //void malloc_init (void); //void malloc_final (void); +#ifdef HERCULES_CORE void malloc_defaults(void); +void memmgr_report(int extra); +#endif // HERCULES_CORE + struct malloc_interface { void (*init) (void); void (*final) (void); @@ -85,7 +89,5 @@ struct malloc_interface { void (*post_shutdown) (void); }; -void memmgr_report (int extra); - struct malloc_interface *iMalloc; #endif /* COMMON_MALLOC_H */ diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 8e552261a..87a275f57 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -96,6 +96,8 @@ struct mapindex_interface { struct mapindex_interface *mapindex; +#ifdef HERCULES_CORE void mapindex_defaults(void); +#endif // HERCULES_CORE #endif /* COMMON_MAPINDEX_H */ diff --git a/src/common/md5calc.h b/src/common/md5calc.h index 740e2edcc..f06a01f4d 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.h @@ -1,8 +1,10 @@ #ifndef COMMON_MD5CALC_H #define COMMON_MD5CALC_H +#ifdef HERCULES_CORE 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 // HERCULES_CORE #endif /* COMMON_MD5CALC_H */ diff --git a/src/common/mutex.h b/src/common/mutex.h index d298c05af..fa8170c98 100644 --- a/src/common/mutex.h +++ b/src/common/mutex.h @@ -9,6 +9,7 @@ typedef struct ramutex ramutex; // Mutex typedef struct racond racond; // Condition Var +#ifdef HERCULES_CORE /** * Creates a Mutex * @@ -88,6 +89,6 @@ void racond_signal(racond *c); * All Waiters getting notified. */ void racond_broadcast(racond *c); - +#endif // HERCULES_CORE #endif /* COMMON_MUTEX_H */ diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 581252cca..407f45403 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -123,6 +123,8 @@ if (Assert_chk(t)) break; else (void)0 +#ifdef HERCULES_CORE void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title); +#endif // HERCULES_CORE #endif /* COMMON_NULLPO_H */ diff --git a/src/common/random.h b/src/common/random.h index 15d7f8ab1..0ca375d28 100644 --- a/src/common/random.h +++ b/src/common/random.h @@ -6,6 +6,7 @@ #include "../common/cbasetypes.h" +#ifdef HERCULES_CORE void rnd_init(void); void rnd_seed(uint32); @@ -14,5 +15,6 @@ uint32 rnd_roll(uint32 dice_faces);// [0, dice_faces) 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 // HERCULES_CORE #endif /* COMMON_RANDOM_H */ diff --git a/src/common/showmsg.h b/src/common/showmsg.h index f3fb50257..48e763c25 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -76,11 +76,6 @@ #define CL_SPACE " " // space equivalent of the print messages -extern int stdout_with_ansisequence; //If the color ANSI sequences are to be used. [flaviojs] -extern int msg_silent; //Specifies how silent the console is. [Skotlex] -extern int console_msg_log; //Specifies what error messages to log. [Ind] -extern char timestamp_format[20]; //For displaying Timestamps [Skotlex] - enum msg_type { MSG_NONE, MSG_STATUS, @@ -93,8 +88,15 @@ enum msg_type { MSG_FATALERROR }; -extern void ClearScreen(void); #ifdef HERCULES_CORE +extern int stdout_with_ansisequence; //If the color ANSI sequences are to be used. [flaviojs] +extern int msg_silent; //Specifies how silent the console is. [Skotlex] +extern int console_msg_log; //Specifies what error messages to log. [Ind] +extern char timestamp_format[20]; //For displaying Timestamps [Skotlex] + +extern void ClearScreen(void); +extern int vShowMessage_(enum msg_type flag, const char *string, va_list ap); + extern void ShowMessage(const char *, ...) __attribute__((format(printf, 1, 2))); extern void ShowStatus(const char *, ...) __attribute__((format(printf, 1, 2))); extern void ShowSQL(const char *, ...) __attribute__((format(printf, 1, 2))); @@ -117,6 +119,4 @@ extern void ClearScreen(void); HPExport void (*ShowFatalError) (const char *, ...) __attribute__((format(printf, 1, 2))); #endif -extern int vShowMessage_(enum msg_type flag, const char *string, va_list ap); - #endif /* COMMON_SHOWMSG_H */ diff --git a/src/common/socket.h b/src/common/socket.h index b9c562a29..6323a6862 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -171,7 +171,9 @@ struct socket_interface { struct socket_interface *sockt; +#ifdef HERCULES_CORE void socket_defaults(void); +#endif // HERCULES_CORE /* the purpose of these macros is simply to not make calling them be an annoyance */ #ifndef H_SOCKET_C diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 85a78ed33..413067b68 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -39,7 +39,7 @@ typedef struct SPIN_LOCK{ #endif - +#ifdef HERCULES_CORE static forceinline void InitializeSpinLock(SPIN_LOCK *lck){ lck->lock = 0; lck->nest = 0; @@ -93,7 +93,6 @@ static forceinline void LeaveSpinLock(SPIN_LOCK *lck){ dropsynclock(&lck->sync_lock); } - - +#endif // HERCULES_CORE #endif /* COMMON_SPINLOCK_H */ diff --git a/src/common/sql.h b/src/common/sql.h index 9a79b3f33..c3598273e 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -271,17 +271,21 @@ struct sql_interface { struct sql_interface *SQL; +#ifdef HERCULES_CORE void sql_defaults(void); +void Sql_Init(void); + +void Sql_HerculesUpdateCheck(Sql* self); +void Sql_HerculesUpdateSkip(Sql* self,const char *filename); +#endif // HERCULES_CORE + #if defined(SQL_REMOVE_SHOWDEBUG) #define Sql_ShowDebug(self) (void)0 #else #define Sql_ShowDebug(self) (SQL->ShowDebug_((self), __FILE__, __LINE__)) #endif -void Sql_HerculesUpdateCheck(Sql* self); -void Sql_HerculesUpdateSkip(Sql* self,const char *filename); - #if defined(SQL_REMOVE_SHOWDEBUG) #define SqlStmt_ShowDebug(self) (void)0 #else @@ -289,6 +293,4 @@ void Sql_HerculesUpdateSkip(Sql* self,const char *filename); #define SqlStmt_ShowDebug(self) (SQL->StmtShowDebug_((self), __FILE__, __LINE__)) #endif -void Sql_Init(void); - #endif /* COMMON_SQL_H */ diff --git a/src/common/strlib.h b/src/common/strlib.h index 0c596cb8f..c687d9e17 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -156,7 +156,9 @@ struct sv_interface { struct sv_interface *sv; +#ifdef HERCULES_CORE void strlib_defaults(void); +#endif // HERCULES_CORE /* the purpose of these macros is simply to not make calling them be an annoyance */ #ifndef H_STRLIB_C diff --git a/src/common/sysinfo.h b/src/common/sysinfo.h index 600206a21..70f665071 100644 --- a/src/common/sysinfo.h +++ b/src/common/sysinfo.h @@ -46,6 +46,8 @@ struct sysinfo_interface { struct sysinfo_interface *sysinfo; +#ifdef HERCULES_CORE void sysinfo_defaults(void); +#endif // HERCULES_CORE #endif /* COMMON_SYSINFO_H */ diff --git a/src/common/thread.h b/src/common/thread.h index f00e7290d..f79eb77f9 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -16,6 +16,7 @@ typedef enum RATHREAD_PRIO { } RATHREAD_PRIO; +#ifdef HERCULES_CORE /** * Creates a new Thread * @@ -109,10 +110,8 @@ RATHREAD_PRIO rathread_prio_get(rAthread *handle); */ void rathread_yield(void); - - void rathread_init(void); void rathread_final(void); - +#endif // HERCULES_CORE #endif /* COMMON_THREAD_H */ diff --git a/src/common/timer.h b/src/common/timer.h index d0927adde..6e8a72389 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -65,6 +65,8 @@ struct timer_interface { struct timer_interface *timer; +#ifdef HERCULES_CORE void timer_defaults(void); +#endif // HERCULES_CORE #endif /* COMMON_TIMER_H */ diff --git a/src/common/utils.h b/src/common/utils.h index 421698d95..e6102f184 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -13,6 +13,10 @@ /* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ #define HCACHE_KEY 'k' +//Caps values to min/max +#define cap_value(a, min, max) (((a) >= (max)) ? (max) : ((a) <= (min)) ? (min) : (a)) + +#ifdef HERCULES_CORE // generate a hex dump of the first 'length' bytes of 'buffer' void WriteDump(FILE* fp, const void* buffer, size_t length); void ShowDump(const void* buffer, size_t length); @@ -20,9 +24,6 @@ void ShowDump(const void* buffer, size_t length); void findfile(const char *p, const char *pat, void (func)(const char*)); bool exists(const char* filename); -//Caps values to min/max -#define cap_value(a, min, max) (((a) >= (max)) ? (max) : ((a) <= (min)) ? (min) : (a)) - /// calculates the value of A / B, in percent (rounded down) unsigned int get_percentage(const unsigned int A, const unsigned int B); @@ -49,6 +50,7 @@ extern float GetFloat(const unsigned char* buf); size_t hread(void * ptr, size_t size, size_t count, FILE * stream); size_t hwrite(const void * ptr, size_t size, size_t count, FILE * stream); +#endif // HERCULES_CORE /* [Ind/Hercules] Caching */ struct HCache_interface { @@ -63,6 +65,8 @@ struct HCache_interface { struct HCache_interface *HCache; +#ifdef HERCULES_CORE void HCache_defaults(void); +#endif // HERCULES_CORE #endif /* COMMON_UTILS_H */ diff --git a/src/login/HPMlogin.h b/src/login/HPMlogin.h index 6bdc0fb7b..6e01eae01 100644 --- a/src/login/HPMlogin.h +++ b/src/login/HPMlogin.h @@ -4,6 +4,10 @@ #ifndef LOGIN_HPMLOGIN_H #define LOGIN_HPMLOGIN_H +#ifndef HERCULES_CORE +#error You should never include HPMlogin.h from a plugin. +#endif + #include "../common/cbasetypes.h" #include "../common/HPM.h" diff --git a/src/login/account.h b/src/login/account.h index fb7368d69..82ae28bbb 100644 --- a/src/login/account.h +++ b/src/login/account.h @@ -13,8 +13,10 @@ typedef struct AccountDB AccountDB; typedef struct AccountDBIterator AccountDBIterator; +#ifdef HERCULES_CORE // standard engines AccountDB* account_db_sql(void); +#endif // HERCULES_CORE struct mmo_account { @@ -139,9 +141,11 @@ struct AccountDB AccountDBIterator* (*iterator)(AccountDB* self); }; +#ifdef HERCULES_CORE 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 // HERCULES_CORE #endif /* LOGIN_ACCOUNT_H */ diff --git a/src/login/ipban.h b/src/login/ipban.h index b4f3ac51b..c6535ec10 100644 --- a/src/login/ipban.h +++ b/src/login/ipban.h @@ -6,6 +6,8 @@ #include "../common/cbasetypes.h" +#ifdef HERCULES_CORE +// TODO: Interface // initialize void ipban_init(void); @@ -19,7 +21,7 @@ bool ipban_check(uint32 ip); void ipban_log(uint32 ip); // parses configuration option -bool ipban_config_read(const char* key, const char* value); - +bool ipban_config_read(const char *key, const char* value); +#endif // HERCULES_CORE #endif /* LOGIN_IPBAN_H */ diff --git a/src/login/login.h b/src/login/login.h index 4c9bbd8b7..8a377927b 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -23,7 +23,7 @@ enum E_LOGINSERVER_ST // supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both #define PASSWORDENC 3 -#define PASSWD_LEN 32+1 // 23+1 for plaintext, 32+1 for md5-ed passwords +#define PASSWD_LEN (32+1) // 23+1 for plaintext, 32+1 for md5-ed passwords struct login_session_data { int account_id; @@ -130,8 +130,10 @@ struct online_login_data { #define sex_str2num(str) ( ((str) == 'F') ? SEX_FEMALE : ((str) == 'M') ? SEX_MALE : SEX_SERVER ) #define MAX_SERVERS 30 +#ifdef HERCULES_CORE extern struct mmo_char_server server[MAX_SERVERS]; extern struct Login_Config login_config; +#endif // HERCULES_CORE /** * Login.c Interface @@ -202,6 +204,8 @@ struct login_interface { struct login_interface *login; +#ifdef HERCULES_CORE void login_defaults(void); +#endif // HERCULES_CORE #endif /* LOGIN_LOGIN_H */ diff --git a/src/login/loginlog.h b/src/login/loginlog.h index 52e18f3d1..2104ff277 100644 --- a/src/login/loginlog.h +++ b/src/login/loginlog.h @@ -6,10 +6,13 @@ #include "../common/cbasetypes.h" +#ifdef HERCULES_CORE +// TODO: Interface unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes); void login_log(uint32 ip, const char* username, int rcode, const char* message); bool loginlog_init(void); bool loginlog_final(void); bool loginlog_config_read(const char* w1, const char* w2); +#endif // HERCULES_CORE #endif /* LOGIN_LOGINLOG_H */ diff --git a/src/map/HPMmap.h b/src/map/HPMmap.h index fa2f625c0..0c727d017 100644 --- a/src/map/HPMmap.h +++ b/src/map/HPMmap.h @@ -4,6 +4,10 @@ #ifndef MAP_HPMMAP_H #define MAP_HPMMAP_H +#ifndef HERCULES_CORE +#error You should never include HPMmap.h from a plugin. +#endif + #include "../common/cbasetypes.h" #include "../map/atcommand.h" #include "../common/HPM.h" diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 356487bd1..8d0399f25 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -116,7 +116,9 @@ struct atcommand_interface { struct atcommand_interface *atcommand; +#ifdef HERCULES_CORE void atcommand_defaults(void); +#endif // HERCULES_CORE /* stay here */ #define ACMD(x) static bool atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message, struct AtCommandInfo *info) diff --git a/src/map/battle.h b/src/map/battle.h index ea2538c30..ddd98ec69 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -487,7 +487,9 @@ struct Battle_Config { int feature_roulette; }; +#ifdef HERCULES_CORE extern struct Battle_Config battle_config; +#endif // HERCULES_CORE /* criteria for battle_config.idletime_critera */ enum e_battle_config_idletime { @@ -620,5 +622,8 @@ struct battle_interface { struct battle_interface *battle; +#ifdef HERCULES_CORE void battle_defaults(void); +#endif // HERCULES_CORE + #endif /* MAP_BATTLE_H */ diff --git a/src/map/battleground.h b/src/map/battleground.h index c1d3be054..9878d6be0 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -120,6 +120,8 @@ struct battleground_interface { struct battleground_interface *bg; +#ifdef HERCULES_CORE void battleground_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_BATTLEGROUND_H */ diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index c981cc444..7b8e369d2 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -73,6 +73,8 @@ struct buyingstore_interface { struct buyingstore_interface *buyingstore; +#ifdef HERCULES_CORE void buyingstore_defaults (void); +#endif // HERCULES_CORE #endif // MAP_BUYINGSTORE_H diff --git a/src/map/chat.h b/src/map/chat.h index 6fca018f4..ced216b41 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -57,6 +57,8 @@ struct chat_interface { struct chat_interface *chat; +#ifdef HERCULES_CORE void chat_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_CHAT_H */ diff --git a/src/map/chrif.h b/src/map/chrif.h index 2ef4d0eb5..271fc076d 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -40,6 +40,8 @@ struct auth_node { enum sd_state state; //To track whether player was login in/out or changing maps. }; +#define chrif_char_offline(x) chrif->char_offline_nsd((x)->status.account_id,(x)->status.char_id) + /*===================================== * Interface : chrif.h * Generated by HerculesInterfaceMaker @@ -150,8 +152,8 @@ struct chrif_interface { struct chrif_interface *chrif; +#ifdef HERCULES_CORE 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 // HERCULES_CORE #endif /* MAP_CHRIF_H */ diff --git a/src/map/clif.h b/src/map/clif.h index 4c90a3a28..3144f1586 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1337,6 +1337,8 @@ struct clif_interface { struct clif_interface *clif; +#ifdef HERCULES_CORE void clif_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_CLIF_H */ diff --git a/src/map/date.h b/src/map/date.h index c3f353f64..a57d8132c 100644 --- a/src/map/date.h +++ b/src/map/date.h @@ -6,6 +6,8 @@ #include "../common/cbasetypes.h" +#ifdef HERCULES_CORE +// TODO: Interface int date_get_year(void); int date_get_month(void); int date_get_day(void); @@ -16,5 +18,6 @@ int date_get_sec(void); bool is_day_of_sun(void); bool is_day_of_moon(void); bool is_day_of_star(void); +#endif // HERCULES_CORE #endif /* MAP_DATE_H */ diff --git a/src/map/duel.h b/src/map/duel.h index 5466f3b43..fa12a4032 100644 --- a/src/map/duel.h +++ b/src/map/duel.h @@ -44,6 +44,8 @@ struct duel_interface { struct duel_interface *duel; +#ifdef HERCULES_CORE void duel_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_DUEL_H */ diff --git a/src/map/elemental.h b/src/map/elemental.h index ca13c30b8..8015f84c0 100644 --- a/src/map/elemental.h +++ b/src/map/elemental.h @@ -119,6 +119,8 @@ struct elemental_interface { struct elemental_interface *elemental; +#ifdef HERCULES_CORE void elemental_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_ELEMENTAL_H */ diff --git a/src/map/guild.h b/src/map/guild.h index eb6de7070..a75b8a7a5 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -165,6 +165,8 @@ struct guild_interface { struct guild_interface *guild; +#ifdef HERCULES_CORE void guild_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_GUILD_H */ diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 5b1fd2031..18f8728d3 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -157,6 +157,8 @@ struct homunculus_interface { struct homunculus_interface *homun; +#ifdef HERCULES_CORE void homunculus_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_HOMUNCULUS_H */ diff --git a/src/map/instance.h b/src/map/instance.h index 4848c9c59..80bd1f012 100644 --- a/src/map/instance.h +++ b/src/map/instance.h @@ -86,6 +86,8 @@ struct instance_interface { struct instance_interface *instance; +#ifdef HERCULES_CORE void instance_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_INSTANCE_H */ diff --git a/src/map/intif.h b/src/map/intif.h index fe47d6537..52aa32259 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -184,6 +184,8 @@ struct intif_interface { struct intif_interface *intif; +#ifdef HERCULES_CORE void intif_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_INTIF_H */ diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 0c26c3cd8..23c2fabc8 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -61,6 +61,8 @@ struct irc_bot_interface { struct irc_bot_interface *ircbot; +#ifdef HERCULES_CORE void ircbot_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_IRC_BOT_H */ diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 902e6e5e9..1d811e3cb 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -621,6 +621,8 @@ struct itemdb_interface { struct itemdb_interface *itemdb; +#ifdef HERCULES_CORE void itemdb_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_ITEMDB_H */ diff --git a/src/map/log.h b/src/map/log.h index fb61b6e66..b4b8b84f4 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -131,6 +131,8 @@ struct log_interface { struct log_interface *logs; +#ifdef HERCULES_CORE void log_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_LOG_H */ diff --git a/src/map/mail.h b/src/map/mail.h index 64b0f9779..db49ca39e 100644 --- a/src/map/mail.h +++ b/src/map/mail.h @@ -25,6 +25,8 @@ struct mail_interface { struct mail_interface *mail; +#ifdef HERCULES_CORE void mail_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_MAIL_H */ diff --git a/src/map/map.h b/src/map/map.h index 447437cf4..f5f85f334 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1078,6 +1078,8 @@ struct map_interface { struct map_interface *map; +#ifdef HERCULES_CORE void map_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_MAP_H */ diff --git a/src/map/mapreg.h b/src/map/mapreg.h index 59d226cda..9c9a1acee 100644 --- a/src/map/mapreg.h +++ b/src/map/mapreg.h @@ -48,6 +48,8 @@ struct mapreg_interface { struct mapreg_interface *mapreg; +#ifdef HERCULES_CORE void mapreg_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_MAPREG_H */ diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 68f60b08b..fbf3603f6 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -97,6 +97,8 @@ struct mercenary_interface { struct mercenary_interface *mercenary; +#ifdef HERCULES_CORE void mercenary_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_MERCENARY_H */ diff --git a/src/map/mob.h b/src/map/mob.h index 9aac2c664..02ae1630a 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -382,6 +382,8 @@ struct mob_interface { struct mob_interface *mob; +#ifdef HERCULES_CORE void mob_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_MOB_H */ diff --git a/src/map/npc.h b/src/map/npc.h index b0014e323..68d683847 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -281,7 +281,9 @@ struct npc_interface { struct npc_interface *npc; +#ifdef HERCULES_CORE void npc_defaults(void); +#endif // HERCULES_CORE /* comes from npc_chat.c */ @@ -347,7 +349,9 @@ struct pcre_interface *libpcre; /** * Also defaults libpcre **/ +#ifdef HERCULES_CORE void npc_chat_defaults(void); -#endif +#endif // HERCULES_CORE +#endif // PCRE_SUPPORT #endif /* MAP_NPC_H */ diff --git a/src/map/party.h b/src/map/party.h index f6cd448a6..a541d03cb 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -141,6 +141,8 @@ struct party_interface { struct party_interface *party; +#ifdef HERCULES_CORE void party_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_PARTY_H */ diff --git a/src/map/path.h b/src/map/path.h index 4b71f2189..eb42df6d0 100644 --- a/src/map/path.h +++ b/src/map/path.h @@ -55,6 +55,8 @@ struct path_interface { struct path_interface *path; +#ifdef HERCULES_CORE void path_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_PATH_H */ diff --git a/src/map/pc.h b/src/map/pc.h index 1f5e26270..7e2fa8558 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1024,6 +1024,8 @@ struct pc_interface { struct pc_interface *pc; +#ifdef HERCULES_CORE void pc_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_PC_H */ diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 48ff782dd..8dd95a177 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -98,6 +98,8 @@ struct pc_groups_interface { struct pc_groups_interface *pcg; +#ifdef HERCULES_CORE void pc_groups_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_PC_GROUPS_H */ diff --git a/src/map/pet.h b/src/map/pet.h index cffcf7dd0..0b51bcb16 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -155,6 +155,8 @@ struct pet_interface { struct pet_interface *pet; +#ifdef HERCULES_CORE void pet_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_PET_H */ diff --git a/src/map/quest.h b/src/map/quest.h index 9d617e369..f988d0c61 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -50,6 +50,8 @@ struct quest_interface { struct quest_interface *quest; +#ifdef HERCULES_CORE void quest_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_QUEST_H */ diff --git a/src/map/script.h b/src/map/script.h index 548c0f261..ad63c1ad7 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -716,6 +716,8 @@ struct script_interface { struct script_interface *script; +#ifdef HERCULES_CORE void script_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_SCRIPT_H */ diff --git a/src/map/searchstore.h b/src/map/searchstore.h index d8abde615..6664eddfa 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -97,6 +97,8 @@ struct searchstore_interface { struct searchstore_interface *searchstore; -void searchstore_defaults (void); +#ifdef HERCULES_CORE +void searchstore_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_SEARCHSTORE_H */ diff --git a/src/map/skill.h b/src/map/skill.h index 6cb43405f..c0456a6d8 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2079,6 +2079,8 @@ struct skill_interface { struct skill_interface *skill; +#ifdef HERCULES_CORE void skill_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_SKILL_H */ diff --git a/src/map/status.h b/src/map/status.h index 63f9854d5..f281a4d08 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2122,6 +2122,8 @@ struct status_interface { struct status_interface *status; +#ifdef HERCULES_CORE void status_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_STATUS_H */ diff --git a/src/map/storage.h b/src/map/storage.h index fcf9a52e4..6393e124a 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -56,7 +56,9 @@ struct guild_storage_interface { struct guild_storage_interface *gstorage; +#ifdef HERCULES_CORE void storage_defaults(void); void gstorage_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_STORAGE_H */ diff --git a/src/map/trade.h b/src/map/trade.h index f91ccd4a2..85e73025c 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -25,6 +25,8 @@ struct trade_interface { struct trade_interface *trade; +#ifdef HERCULES_CORE void trade_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_TRADE_H */ diff --git a/src/map/vending.h b/src/map/vending.h index 63cb632a9..00d3eefff 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -34,6 +34,8 @@ struct vending_interface { struct vending_interface *vending; +#ifdef HERCULES_CORE void vending_defaults(void); +#endif // HERCULES_CORE #endif /* MAP_VENDING_H */ |