From 4fa9fd843e19d041a6b142722e1f2c717a45f625 Mon Sep 17 00:00:00 2001 From: Haru Date: Mon, 12 Jan 2015 18:29:24 +0100 Subject: 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 --- src/login/HPMlogin.h | 4 ++++ src/login/account.h | 4 ++++ src/login/ipban.h | 6 ++++-- src/login/login.h | 6 +++++- src/login/loginlog.h | 3 +++ 5 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/login') 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 */ -- cgit v1.2.3-60-g2f50