diff options
author | Haru <haru@dotalux.com> | 2018-06-24 22:06:41 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-07-01 21:09:25 +0200 |
commit | b7e6439f0c788ceacc567fbb017d3c7f09913f78 (patch) | |
tree | a1e8a6093f3d7f3922465d77056419030e0e4ffc | |
parent | 4552fc0eab5cd9b723180a12d4ef50f7fe998b55 (diff) | |
download | hercules-b7e6439f0c788ceacc567fbb017d3c7f09913f78.tar.gz hercules-b7e6439f0c788ceacc567fbb017d3c7f09913f78.tar.bz2 hercules-b7e6439f0c788ceacc567fbb017d3c7f09913f78.tar.xz hercules-b7e6439f0c788ceacc567fbb017d3c7f09913f78.zip |
Change functions to static where possible (Part 3 - char)
This fixes issues with plugins defining symbols with the same names
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/char/char.c | 447 | ||||
-rw-r--r-- | src/char/geoip.c | 64 | ||||
-rw-r--r-- | src/char/int_auction.c | 19 | ||||
-rw-r--r-- | src/char/int_clan.c | 8 | ||||
-rw-r--r-- | src/char/int_elemental.c | 19 | ||||
-rw-r--r-- | src/char/int_guild.c | 76 | ||||
-rw-r--r-- | src/char/int_homun.c | 18 | ||||
-rw-r--r-- | src/char/int_mail.c | 26 | ||||
-rw-r--r-- | src/char/int_mercenary.c | 23 | ||||
-rw-r--r-- | src/char/int_party.c | 40 | ||||
-rw-r--r-- | src/char/int_pet.c | 22 | ||||
-rw-r--r-- | src/char/int_quest.c | 14 | ||||
-rw-r--r-- | src/char/int_rodex.c | 12 | ||||
-rw-r--r-- | src/char/int_storage.c | 22 | ||||
-rw-r--r-- | src/char/inter.c | 71 | ||||
-rw-r--r-- | src/char/loginif.c | 30 | ||||
-rw-r--r-- | src/char/mapif.c | 331 | ||||
-rw-r--r-- | src/char/pincode.c | 68 |
18 files changed, 674 insertions, 636 deletions
diff --git a/src/char/char.c b/src/char/char.c index 04db83eb9..486cc7c03 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -96,8 +96,8 @@ char party_db[256] = "party"; char pet_db[256] = "pet"; char mail_db[256] = "mail"; // MAIL SYSTEM char auction_db[256] = "auction"; // Auctions System -char friend_db[256] = "friends"; -char hotkey_db[256] = "hotkey"; +static char friend_db[256] = "friends"; +static char hotkey_db[256] = "hotkey"; char quest_db[256] = "quest"; char rodex_db[256] = "rodex_mail"; char rodex_item_db[256] = "rodex_items"; @@ -107,41 +107,41 @@ char mercenary_db[256] = "mercenary"; char mercenary_owner_db[256] = "mercenary_owner"; char ragsrvinfo_db[256] = "ragsrvinfo"; char elemental_db[256] = "elemental"; -char account_data_db[256] = "account_data"; +static char account_data_db[256] = "account_data"; char acc_reg_num_db[32] = "acc_reg_num_db"; char acc_reg_str_db[32] = "acc_reg_str_db"; char char_reg_str_db[32] = "char_reg_str_db"; char char_reg_num_db[32] = "char_reg_num_db"; -struct char_interface char_s; +static struct char_interface char_s; struct char_interface *chr; char db_path[1024] = "db"; -char wisp_server_name[NAME_LENGTH] = "Server"; -char login_ip_str[128]; -uint32 login_ip = 0; -uint16 login_port = 6900; -char char_ip_str[128]; -char bind_ip_str[128]; -uint32 bind_ip = INADDR_ANY; -int char_maintenance_min_group_id = 0; -bool enable_char_creation = true; ///< Whether to allow character creation. - -bool name_ignoring_case = false; // Allow or not identical name for characters but with a different case by [Yor] +static char wisp_server_name[NAME_LENGTH] = "Server"; +static char login_ip_str[128]; +static uint32 login_ip = 0; +static uint16 login_port = 6900; +static char char_ip_str[128]; +static char bind_ip_str[128]; +static uint32 bind_ip = INADDR_ANY; +static int char_maintenance_min_group_id = 0; +static bool enable_char_creation = true; ///< Whether to allow character creation. + +static bool name_ignoring_case = false; // Allow or not identical name for characters but with a different case by [Yor] int char_name_option = 0; // Option to know which letters/symbols are authorized in the name of a character (0: all, 1: only those in char_name_letters, 2: all EXCEPT those in char_name_letters) by [Yor] -char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the requested name cannot be determined +static char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the requested name cannot be determined #define TRIM_CHARS "\255\xA0\032\t\x0A\x0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex] char char_name_letters[1024] = ""; // list of letters/symbols allowed (or not) in a character name. by [Yor] -int char_del_level = 0; ///< From which level you can delete character [Lupus] -int char_del_delay = 86400; -bool char_aegis_delete = false; ///< Verify if char is in guild/party or char and reacts as Aegis does (disallow deletion), @see chr->delete2_req. +static int char_del_level = 0; ///< From which level you can delete character [Lupus] +static int char_del_delay = 86400; +static bool char_aegis_delete = false; ///< Verify if char is in guild/party or char and reacts as Aegis does (disallow deletion), @see chr->delete2_req. -int max_connect_user = -1; -int gm_allow_group = -1; +static int max_connect_user = -1; +static int gm_allow_group = -1; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; -int start_zeny = 0; +static int start_zeny = 0; /// Start items for new characters struct start_item_s { @@ -150,28 +150,28 @@ struct start_item_s { int loc; bool stackable; }; -VECTOR_DECL(struct start_item_s) start_items; +static VECTOR_DECL(struct start_item_s) start_items; int guild_exp_rate = 100; //Custom limits for the fame lists. [Skotlex] -int fame_list_size_chemist = MAX_FAME_LIST; -int fame_list_size_smith = MAX_FAME_LIST; -int fame_list_size_taekwon = MAX_FAME_LIST; +static int fame_list_size_chemist = MAX_FAME_LIST; +static int fame_list_size_smith = MAX_FAME_LIST; +static int fame_list_size_taekwon = MAX_FAME_LIST; // Char-server-side stored fame lists [DracoRPG] -struct fame_list smith_fame_list[MAX_FAME_LIST]; -struct fame_list chemist_fame_list[MAX_FAME_LIST]; -struct fame_list taekwon_fame_list[MAX_FAME_LIST]; +static struct fame_list smith_fame_list[MAX_FAME_LIST]; +static struct fame_list chemist_fame_list[MAX_FAME_LIST]; +static struct fame_list taekwon_fame_list[MAX_FAME_LIST]; // Initial position (it's possible to set it in conf file) #ifdef RENEWAL - struct point start_point = { 0, 97, 90 }; +static struct point start_point = { 0, 97, 90 }; #else - struct point start_point = { 0, 53, 111 }; +static struct point start_point = { 0, 53, 111 }; #endif -unsigned short skillid2idx[MAX_SKILL_ID]; +static unsigned short skillid2idx[MAX_SKILL_ID]; //----------------------------------------------------- // Auth database @@ -200,7 +200,7 @@ static struct DBData char_create_online_char_data(union DBKey key, va_list args) return DB->ptr2data(character); } -void char_set_account_online(int account_id) +static void char_set_account_online(int account_id) { WFIFOHEAD(chr->login_fd,6); WFIFOW(chr->login_fd,0) = 0x272b; @@ -208,7 +208,7 @@ void char_set_account_online(int account_id) WFIFOSET(chr->login_fd,6); } -void char_set_account_offline(int account_id) +static void char_set_account_offline(int account_id) { WFIFOHEAD(chr->login_fd,6); WFIFOW(chr->login_fd,0) = 0x272c; @@ -216,7 +216,7 @@ void char_set_account_offline(int account_id) WFIFOSET(chr->login_fd,6); } -void char_set_char_charselect(int account_id) +static void char_set_char_charselect(int account_id) { struct online_char_data* character; @@ -240,7 +240,7 @@ void char_set_char_charselect(int account_id) chr->set_account_online(account_id); } -void char_set_char_online(int map_id, int char_id, int account_id) +static void char_set_char_online(int map_id, int char_id, int account_id) { struct online_char_data* character; struct mmo_charstatus *cp; @@ -280,7 +280,7 @@ void char_set_char_online(int map_id, int char_id, int account_id) chr->set_account_online(account_id); } -void char_set_char_offline(int char_id, int account_id) +static void char_set_char_offline(int char_id, int account_id) { struct online_char_data* character; @@ -371,7 +371,7 @@ static int char_db_kickoffline(union DBKey key, struct DBData *data, va_list ap) return 1; } -void char_set_login_all_offline(void) +static void char_set_login_all_offline(void) { //Tell login-server to also mark all our characters as offline. WFIFOHEAD(chr->login_fd,2); @@ -379,7 +379,7 @@ void char_set_login_all_offline(void) WFIFOSET(chr->login_fd,2); } -void char_set_all_offline(int id) +static void char_set_all_offline(int id) { if (id < 0) ShowNotice("Sending all users offline.\n"); @@ -392,7 +392,7 @@ void char_set_all_offline(int id) chr->set_login_all_offline(); } -void char_set_all_offline_sql(void) +static void char_set_all_offline_sql(void) { //Set all players to 'OFFLINE' if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online` = '0'", char_db) ) @@ -414,7 +414,7 @@ static struct DBData char_create_charstatus(union DBKey key, va_list args) return DB->ptr2data(cp); } -int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) +static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) { int i = 0; int count = 0; @@ -709,7 +709,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) * @param[in] table Table to be used for the transaction. * @return -1 on failure or number of items added to the list if successful. */ -int char_getitemdata_from_sql(struct item *items, int max, int guid, enum inventory_table_type table) +static int char_getitemdata_from_sql(struct item *items, int max, int guid, enum inventory_table_type table) { int i = 0; struct SqlStmt *stmt = NULL; @@ -816,7 +816,7 @@ int char_getitemdata_from_sql(struct item *items, int max, int guid, enum invent * @param[in] tableswitch The type of table (@see enum inventory_table_type). * @retval -1 in case of failure, or number of changes made within the table. */ -int char_memitemdata_to_sql(const struct item *p_items, int guid, enum inventory_table_type table) +static int char_memitemdata_to_sql(const struct item *p_items, int guid, enum inventory_table_type table) { StringBuf buf; int i = 0, j = 0; @@ -1001,7 +1001,7 @@ int char_memitemdata_to_sql(const struct item *p_items, int guid, enum inventory * @retval SEX_FEMALE if the per-character sex is female * @retval 99 if the per-character sex is not defined or the current PACKETVER doesn't support it. */ -int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) +static int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) { #if PACKETVER >= 20141016 (void)sd; (void)p; // Unused @@ -1039,7 +1039,7 @@ int char_mmo_gender(const struct char_session_data *sd, const struct mmo_charsta //===================================================================================================== // Loads the basic character rooster for the given account. Returns total buffer used. -int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) +static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { struct SqlStmt *stmt; struct mmo_charstatus p; @@ -1135,7 +1135,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) } //===================================================================================================== -int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything) +static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool load_everything) { int i = 0; char t_msg[128] = ""; @@ -1412,7 +1412,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every } //========================================================================================================== -int char_mmo_char_sql_init(void) +static int char_mmo_char_sql_init(void) { chr->char_db_= idb_alloc(DB_OPT_RELEASE_DATA); @@ -1429,7 +1429,8 @@ int char_mmo_char_sql_init(void) } /* [Ind/Hercules] - special thanks to Yommy for providing the packet structure/data */ -bool char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) { +static bool char_char_slotchange(struct char_session_data *sd, int fd, unsigned short from, unsigned short to) +{ struct mmo_charstatus char_dat; int from_id = 0; @@ -1481,7 +1482,7 @@ bool char_char_slotchange(struct char_session_data *sd, int fd, unsigned short f //----------------------------------- // Function to change character's names //----------------------------------- -int char_rename_char_sql(struct char_session_data *sd, int char_id) +static int char_rename_char_sql(struct char_session_data *sd, int char_id) { struct mmo_charstatus char_dat; char esc_name[NAME_LENGTH*2+1]; @@ -1541,7 +1542,7 @@ int char_rename_char_sql(struct char_session_data *sd, int char_id) * @param esc_name Escaped version of the name, optional for faster processing. * @retval true if the character name already exists. */ -bool char_name_exists(const char *name, const char *esc_name) +static bool char_name_exists(const char *name, const char *esc_name) { char esc_name2[NAME_LENGTH * 2 + 1]; @@ -1579,7 +1580,7 @@ bool char_name_exists(const char *name, const char *esc_name) * @retval -2 if the name is too short or contains special characters. * @retval -5 if the name contains forbidden characters. */ -int char_check_char_name(const char *name, const char *esc_name) +static int char_check_char_name(const char *name, const char *esc_name) { int i; @@ -1639,7 +1640,7 @@ int char_check_char_name(const char *name, const char *esc_name) * -5: 'Symbols in Character Names are forbidden' * char_id: Success **/ -int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class, uint8 sex) +static int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class, uint8 sex) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; @@ -1749,7 +1750,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int /*----------------------------------------------------------------------------------------------------------*/ /* Divorce Players */ /*----------------------------------------------------------------------------------------------------------*/ -int char_divorce_char_sql(int partner_id1, int partner_id2) +static int char_divorce_char_sql(int partner_id1, int partner_id2) { unsigned char buf[64]; @@ -1772,7 +1773,7 @@ int char_divorce_char_sql(int partner_id1, int partner_id2) /* Returns 0 if successful * Returns < 0 for error */ -int char_delete_char_sql(int char_id) +static int char_delete_char_sql(int char_id) { char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped. @@ -1937,7 +1938,7 @@ int char_delete_char_sql(int char_id) //--------------------------------------------------------------------- // This function return the number of online players in all map-servers //--------------------------------------------------------------------- -int char_count_users(void) +static int char_count_users(void) { int i, users; @@ -1954,7 +1955,8 @@ int char_count_users(void) // Used in packets 0x6b (chars info) and 0x6d (new char info) // Returns the size #define MAX_CHAR_BUF 150 //Max size (for WFIFOHEAD calls) -int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { +static int char_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) +{ unsigned short offset = 0; uint8* buf; @@ -2061,7 +2063,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { } /* Made Possible by Yommy~! <3 */ -void char_mmo_char_send099d(int fd, struct char_session_data *sd) +static void char_mmo_char_send099d(int fd, struct char_session_data *sd) { // support added for client between 20121010 and 20130320 #if PACKETVER > 20120418 @@ -2074,7 +2076,8 @@ void char_mmo_char_send099d(int fd, struct char_session_data *sd) /* Sends character ban list */ /* Made Possible by Yommy~! <3 */ -void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { +static void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) +{ int i; time_t now = time(NULL); @@ -2114,7 +2117,8 @@ void char_mmo_char_send_ban_list(int fd, struct char_session_data *sd) { //---------------------------------------- // [Ind/Hercules] notify client about charselect window data //---------------------------------------- -void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { +static void char_mmo_char_send_slots_info(int fd, struct char_session_data *sd) +{ nullpo_retv(sd); WFIFOHEAD(fd,29); WFIFOW(fd,0) = 0x82d; @@ -2130,7 +2134,7 @@ void char_mmo_char_send_slots_info(int fd, struct char_session_data* sd) { //---------------------------------------- // Function to send characters to a player //---------------------------------------- -int char_mmo_char_send_characters(int fd, struct char_session_data* sd) +static int char_mmo_char_send_characters(int fd, struct char_session_data *sd) { int j, offset = 0; nullpo_ret(sd); @@ -2156,7 +2160,7 @@ int char_mmo_char_send_characters(int fd, struct char_session_data* sd) return 0; } -int char_char_married(int pl1, int pl2) +static int char_char_married(int pl1, int pl2) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `partner_id` FROM `%s` WHERE `char_id` = '%d'", char_db, pl1) ) Sql_ShowDebug(inter->sql_handle); @@ -2175,7 +2179,7 @@ int char_char_married(int pl1, int pl2) return 0; } -int char_char_child(int parent_id, int child_id) +static int char_char_child(int parent_id, int child_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) ) Sql_ShowDebug(inter->sql_handle); @@ -2194,7 +2198,7 @@ int char_char_child(int parent_id, int child_id) return 0; } -int char_char_family(int cid1, int cid2, int cid3) +static int char_char_family(int cid1, int cid2, int cid3) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) ) Sql_ShowDebug(inter->sql_handle); @@ -2224,7 +2228,7 @@ int char_char_family(int cid1, int cid2, int cid3) //---------------------------------------------------------------------- // Force disconnection of an online player (with account value) by [Yor] //---------------------------------------------------------------------- -void char_disconnect_player(int account_id) +static void char_disconnect_player(int account_id) { int i; struct char_session_data* sd; @@ -2235,7 +2239,7 @@ void char_disconnect_player(int account_id) sockt->eof(i); } -void char_authfail_fd(int fd, int type) +static void char_authfail_fd(int fd, int type) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x81; @@ -2243,7 +2247,7 @@ void char_authfail_fd(int fd, int type) WFIFOSET(fd,3); } -void char_request_account_data(int account_id) +static void char_request_account_data(int account_id) { WFIFOHEAD(chr->login_fd,6); WFIFOW(chr->login_fd,0) = 0x2716; @@ -2289,14 +2293,14 @@ static void char_auth_ok(int fd, struct char_session_data *sd) // continues when account data is received... } -void char_ping_login_server(int fd) +static void char_ping_login_server(int fd) { WFIFOHEAD(fd,2);// sends a ping packet to login server (will receive pong 0x2718) WFIFOW(fd,0) = 0x2719; WFIFOSET(fd,2); } -int char_parse_fromlogin_connection_state(int fd) +static int char_parse_fromlogin_connection_state(int fd) { if (RFIFOB(fd,2)) { //printf("connect login server error : %d\n", RFIFOB(fd,2)); @@ -2316,7 +2320,7 @@ int char_parse_fromlogin_connection_state(int fd) // 0 - rejected from server // -void char_auth_error(int fd, unsigned char flag) +static void char_auth_error(int fd, unsigned char flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x6c; @@ -2324,7 +2328,7 @@ void char_auth_error(int fd, unsigned char flag) WFIFOSET(fd,3); } -void char_parse_fromlogin_auth_state(int fd) +static void char_parse_fromlogin_auth_state(int fd) { struct char_session_data* sd = NULL; int account_id = RFIFOL(fd,2); @@ -2366,7 +2370,7 @@ void char_parse_fromlogin_auth_state(int fd) } } -void char_parse_fromlogin_account_data(int fd) +static void char_parse_fromlogin_account_data(int fd) { struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; int i; @@ -2409,14 +2413,14 @@ void char_parse_fromlogin_account_data(int fd) RFIFOSKIP(fd,72); } -void char_parse_fromlogin_login_pong(int fd) +static void char_parse_fromlogin_login_pong(int fd) { RFIFOSKIP(fd,2); if (sockt->session[fd]) sockt->session[fd]->flag.ping = 0; } -void char_changesex(int account_id, int sex) +static void char_changesex(int account_id, int sex) { unsigned char buf[7]; @@ -2437,7 +2441,7 @@ void char_changesex(int account_id, int sex) * @param class The character's current job class. * @param guild_id The character's guild ID. */ -void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) +static void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) { // job modification if (class == JOB_BARD || class == JOB_DANCER) @@ -2466,7 +2470,7 @@ void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) inter_guild->sex_changed(guild_id, acc, char_id, sex); } -int char_parse_fromlogin_changesex_reply(int fd) +static int char_parse_fromlogin_changesex_reply(int fd) { int char_id = 0, class = 0, guild_id = 0; int i; @@ -2513,14 +2517,14 @@ int char_parse_fromlogin_changesex_reply(int fd) return 0; } -void char_parse_fromlogin_account_reg2(int fd) +static void char_parse_fromlogin_account_reg2(int fd) { //Receive account_reg2 registry, forward to map servers. mapif->sendall(RFIFOP(fd, 0), RFIFOW(fd,2)); RFIFOSKIP(fd, RFIFOW(fd,2)); } -void char_parse_fromlogin_ban(int fd) +static void char_parse_fromlogin_ban(int fd) { mapif->ban(RFIFOL(fd,2), RFIFOB(fd,6), RFIFOL(fd,7)); // disconnect player if online on char-server @@ -2528,7 +2532,7 @@ void char_parse_fromlogin_ban(int fd) RFIFOSKIP(fd,11); } -void char_parse_fromlogin_kick(int fd) +static void char_parse_fromlogin_kick(int fd) { int aid = RFIFOL(fd,2); struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, aid); @@ -2558,7 +2562,7 @@ void char_parse_fromlogin_kick(int fd) idb_remove(auth_db, aid);// reject auth attempts from map-server } -void char_update_ip(int fd) +static void char_update_ip(int fd) { WFIFOHEAD(fd,6); WFIFOW(fd,0) = 0x2736; @@ -2566,7 +2570,7 @@ void char_update_ip(int fd) WFIFOSET(fd,6); } -void char_parse_fromlogin_update_ip(int fd) +static void char_parse_fromlogin_update_ip(int fd) { unsigned char buf[2]; uint32 new_ip = 0; @@ -2589,14 +2593,14 @@ void char_parse_fromlogin_update_ip(int fd) RFIFOSKIP(fd,2); } -void char_parse_fromlogin_accinfo2_failed(int fd) +static void char_parse_fromlogin_accinfo2_failed(int fd) { inter->accinfo2(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1, 0, 0); RFIFOSKIP(fd,18); } -void char_parse_fromlogin_accinfo2_ok(int fd) +static void char_parse_fromlogin_accinfo2_ok(int fd) { inter->accinfo2(true, RFIFOL(fd,167), RFIFOL(fd,171), RFIFOL(fd,175), RFIFOL(fd,179), RFIFOP(fd,2), RFIFOP(fd,26), RFIFOP(fd,59), RFIFOP(fd,99), RFIFOP(fd,119), @@ -2604,7 +2608,8 @@ void char_parse_fromlogin_accinfo2_ok(int fd) RFIFOSKIP(fd,183); } -int char_parse_fromlogin(int fd) { +static int char_parse_fromlogin(int fd) +{ // only process data from the login-server if( fd != chr->login_fd ) { ShowDebug("chr->parse_fromlogin: Disconnecting invalid session #%d (is not the login-server)\n", fd); @@ -2736,7 +2741,7 @@ int char_parse_fromlogin(int fd) { return 0; } -int char_request_accreg2(int account_id, int char_id) +static int char_request_accreg2(int account_id, int char_id) { if (chr->login_fd > 0) { WFIFOHEAD(chr->login_fd,10); @@ -2752,7 +2757,8 @@ int char_request_accreg2(int account_id, int char_id) /** * Handles global account reg saving that continues with chr->global_accreg_to_login_add and global_accreg_to_send **/ -void char_global_accreg_to_login_start (int account_id, int char_id) { +static void char_global_accreg_to_login_start(int account_id, int char_id) +{ WFIFOHEAD(chr->login_fd, 60000 + 300); WFIFOW(chr->login_fd,0) = 0x2728; WFIFOW(chr->login_fd,2) = 14; @@ -2764,14 +2770,16 @@ void char_global_accreg_to_login_start (int account_id, int char_id) { /** * Completes global account reg saving that starts chr->global_accreg_to_login_start and continues with chr->global_accreg_to_login_add **/ -void char_global_accreg_to_login_send (void) { +static void char_global_accreg_to_login_send(void) +{ WFIFOSET(chr->login_fd, WFIFOW(chr->login_fd,2)); } /** * Handles global account reg saving that starts chr->global_accreg_to_login_start and ends with global_accreg_to_send **/ -void char_global_accreg_to_login_add (const char *key, unsigned int index, intptr_t val, bool is_string) { +static void char_global_accreg_to_login_add(const char *key, unsigned int index, intptr_t val, bool is_string) +{ int nlen = WFIFOW(chr->login_fd, 2); size_t len = strlen(key)+1; @@ -2818,7 +2826,8 @@ void char_global_accreg_to_login_add (const char *key, unsigned int index, intpt } } -void char_read_fame_list(void) { +static void char_read_fame_list(void) +{ int i; char* data; size_t len; @@ -2876,7 +2885,8 @@ void char_read_fame_list(void) { } // Send map-servers the fame ranking lists -int char_send_fame_list(int fd) { +static int char_send_fame_list(int fd) +{ int i, len = 8; unsigned char buf[32000]; @@ -2911,7 +2921,8 @@ int char_send_fame_list(int fd) { return 0; } -void char_update_fame_list(int type, int index, int fame) { +static void char_update_fame_list(int type, int index, int fame) +{ unsigned char buf[8]; WBUFW(buf,0) = 0x2b22; WBUFB(buf,2) = type; @@ -2922,7 +2933,7 @@ void char_update_fame_list(int type, int index, int fame) { //Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size) and not NULL //Returns 1 on found, 0 on not found (buffer is filled with Unknown char name) -int char_loadName(int char_id, char* name) +static int char_loadName(int char_id, char *name) { char* data; size_t len; @@ -2942,13 +2953,13 @@ int char_loadName(int char_id, char* name) return 0; } -void char_parse_frommap_datasync(int fd) +static void char_parse_frommap_datasync(int fd) { sockt->datasync(fd, false); RFIFOSKIP(fd,RFIFOW(fd,2)); } -void char_parse_frommap_skillid2idx(int fd) +static void char_parse_frommap_skillid2idx(int fd) { int i; int j = RFIFOW(fd, 2) - 4; @@ -2966,7 +2977,7 @@ void char_parse_frommap_skillid2idx(int fd) RFIFOSKIP(fd, RFIFOW(fd, 2)); } -void char_map_received_ok(int fd) +static void char_map_received_ok(int fd) { WFIFOHEAD(fd, 3 + NAME_LENGTH); WFIFOW(fd,0) = 0x2afb; @@ -2975,7 +2986,7 @@ void char_map_received_ok(int fd) WFIFOSET(fd,3+NAME_LENGTH); } -void char_send_maps(int fd, int id, int j) +static void char_send_maps(int fd, int id, int j) { int k,i; @@ -3012,7 +3023,7 @@ void char_send_maps(int fd, int id, int j) } } -void char_parse_frommap_map_names(int fd, int id) +static void char_parse_frommap_map_names(int fd, int id) { int i; @@ -3033,7 +3044,7 @@ void char_parse_frommap_map_names(int fd, int id) RFIFOSKIP(fd,RFIFOW(fd,2)); } -void char_send_scdata(int fd, int aid, int cid) +static void char_send_scdata(int fd, int aid, int cid) { #ifdef ENABLE_SC_SAVING if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " @@ -3087,7 +3098,7 @@ void char_send_scdata(int fd, int aid, int cid) #endif } -void char_parse_frommap_request_scdata(int fd) +static void char_parse_frommap_request_scdata(int fd) { #ifdef ENABLE_SC_SAVING int aid = RFIFOL(fd,2); @@ -3097,7 +3108,7 @@ void char_parse_frommap_request_scdata(int fd) RFIFOSKIP(fd, 10); } -void char_parse_frommap_set_users_count(int fd, int id) +static void char_parse_frommap_set_users_count(int fd, int id) { if (RFIFOW(fd,2) != chr->server[id].users) { chr->server[id].users = RFIFOW(fd,2); @@ -3106,7 +3117,7 @@ void char_parse_frommap_set_users_count(int fd, int id) RFIFOSKIP(fd, 4); } -void char_parse_frommap_set_users(int fd, int id) +static void char_parse_frommap_set_users(int fd, int id) { //TODO: When data mismatches memory, update guild/party online/offline states. int i; @@ -3129,7 +3140,7 @@ void char_parse_frommap_set_users(int fd, int id) RFIFOSKIP(fd,RFIFOW(fd,2)); } -void char_save_character_ack(int fd, int aid, int cid) +static void char_save_character_ack(int fd, int aid, int cid) { WFIFOHEAD(fd,10); WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save. @@ -3138,7 +3149,7 @@ void char_save_character_ack(int fd, int aid, int cid) WFIFOSET(fd,10); } -void char_parse_frommap_save_character(int fd, int id) +static void char_parse_frommap_save_character(int fd, int id) { int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2); struct online_char_data* character; @@ -3172,7 +3183,7 @@ void char_parse_frommap_save_character(int fd, int id) // 0 - not ok // 1 - ok -void char_select_ack(int fd, int account_id, uint8 flag) +static void char_select_ack(int fd, int account_id, uint8 flag) { WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x2b03; @@ -3181,7 +3192,7 @@ void char_select_ack(int fd, int account_id, uint8 flag) WFIFOSET(fd,7); } -void char_parse_frommap_char_select_req(int fd) +static void char_parse_frommap_char_select_req(int fd) { int account_id = RFIFOL(fd,2); uint32 login_id1 = RFIFOL(fd,6); @@ -3218,7 +3229,7 @@ void char_parse_frommap_char_select_req(int fd) } } -void char_change_map_server_ack(int fd, const uint8 *data, bool ok) +static void char_change_map_server_ack(int fd, const uint8 *data, bool ok) { WFIFOHEAD(fd,30); WFIFOW(fd,0) = 0x2b06; @@ -3228,7 +3239,7 @@ void char_change_map_server_ack(int fd, const uint8 *data, bool ok) WFIFOSET(fd,30); } -void char_parse_frommap_change_map_server(int fd) +static void char_parse_frommap_change_map_server(int fd) { int map_id, map_fd = -1; struct mmo_charstatus* char_data; @@ -3281,7 +3292,7 @@ void char_parse_frommap_change_map_server(int fd) RFIFOSKIP(fd,39); } -void char_parse_frommap_remove_friend(int fd) +static void char_parse_frommap_remove_friend(int fd) { int char_id = RFIFOL(fd,2); int friend_id = RFIFOL(fd,6); @@ -3292,7 +3303,7 @@ void char_parse_frommap_remove_friend(int fd) RFIFOSKIP(fd,10); } -void char_char_name_ack(int fd, int char_id) +static void char_char_name_ack(int fd, int char_id) { WFIFOHEAD(fd,30); WFIFOW(fd,0) = 0x2b09; @@ -3306,13 +3317,13 @@ void char_char_name_ack(int fd, int char_id) WFIFOSET(fd,30); } -void char_parse_frommap_char_name_request(int fd) +static void char_parse_frommap_char_name_request(int fd) { chr->char_name_ack(fd, RFIFOL(fd,2)); RFIFOSKIP(fd,6); } -void char_parse_frommap_change_email(int fd) +static void char_parse_frommap_change_email(int fd) { if (chr->login_fd > 0) { // don't send request if no login-server WFIFOHEAD(chr->login_fd,86); @@ -3323,7 +3334,7 @@ void char_parse_frommap_change_email(int fd) RFIFOSKIP(fd, 86); } -void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) +static void char_ban(int account_id, int char_id, time_t *unban_time, short year, short month, short day, short hour, short minute, short second) { time_t timestamp; struct tm *tmtime; @@ -3365,7 +3376,7 @@ void char_ban(int account_id, int char_id, time_t *unban_time, short year, short } } -void char_unban(int char_id, int *result) +static void char_unban(int char_id, int *result) { /* handled by char server, so no redirection */ if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", char_db, char_id) ) { @@ -3375,7 +3386,7 @@ void char_unban(int char_id, int *result) } } -void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) +static void char_ask_name_ack(int fd, int acc, const char *name, int type, int result) { nullpo_retv(name); WFIFOHEAD(fd,34); @@ -3397,7 +3408,7 @@ void char_ask_name_ack(int fd, int acc, const char* name, int type, int result) * @retval 0 in case of success. * @retval 1 in case of failure. */ -int char_changecharsex(int char_id, int sex) +static int char_changecharsex(int char_id, int sex) { int class = 0, guild_id = 0, account_id = 0; char *data; @@ -3430,7 +3441,7 @@ int char_changecharsex(int char_id, int sex) return 0; } -void char_parse_frommap_change_account(int fd) +static void char_parse_frommap_change_account(int fd) { int result = 0; // 0-login-server request done, 1-player not found, 2-gm level too low, 3-login-server offline char esc_name[NAME_LENGTH*2+1]; @@ -3516,7 +3527,7 @@ void char_parse_frommap_change_account(int fd) } } -void char_parse_frommap_fame_list(int fd) +static void char_parse_frommap_fame_list(int fd) { int cid = RFIFOL(fd, 2); int fame = RFIFOL(fd, 6); @@ -3567,13 +3578,13 @@ void char_parse_frommap_fame_list(int fd) RFIFOSKIP(fd,11); } -void char_parse_frommap_divorce_char(int fd) +static void char_parse_frommap_divorce_char(int fd) { chr->divorce_char_sql(RFIFOL(fd,2), RFIFOL(fd,6)); RFIFOSKIP(fd,10); } -void char_parse_frommap_ragsrvinfo(int fd) +static void char_parse_frommap_ragsrvinfo(int fd) { char esc_server_name[sizeof(chr->server_name)*2+1]; @@ -3587,32 +3598,32 @@ void char_parse_frommap_ragsrvinfo(int fd) RFIFOSKIP(fd,14); } -void char_parse_frommap_set_char_offline(int fd) +static void char_parse_frommap_set_char_offline(int fd) { chr->set_char_offline(RFIFOL(fd,2),RFIFOL(fd,6)); RFIFOSKIP(fd,10); } -void char_parse_frommap_set_all_offline(int fd, int id) +static void char_parse_frommap_set_all_offline(int fd, int id) { chr->set_all_offline(id); RFIFOSKIP(fd,2); } -void char_parse_frommap_set_char_online(int fd, int id) +static void char_parse_frommap_set_char_online(int fd, int id) { chr->set_char_online(id, RFIFOL(fd,2),RFIFOL(fd,6)); RFIFOSKIP(fd,10); } -void char_parse_frommap_build_fame_list(int fd) +static void char_parse_frommap_build_fame_list(int fd) { chr->read_fame_list(); chr->send_fame_list(-1); RFIFOSKIP(fd,2); } -void char_parse_frommap_save_status_change_data(int fd) +static void char_parse_frommap_save_status_change_data(int fd) { #ifdef ENABLE_SC_SAVING int aid = RFIFOL(fd, 4); @@ -3647,20 +3658,20 @@ void char_parse_frommap_save_status_change_data(int fd) RFIFOSKIP(fd, RFIFOW(fd, 2)); } -void char_send_pong(int fd) +static void char_send_pong(int fd) { WFIFOHEAD(fd,2); WFIFOW(fd,0) = 0x2b24; WFIFOSET(fd,2); } -void char_parse_frommap_ping(int fd) +static void char_parse_frommap_ping(int fd) { chr->send_pong(fd); RFIFOSKIP(fd,2); } -void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struct mmo_charstatus* cd) +static void char_map_auth_ok(int fd, int account_id, struct char_auth_node *node, struct mmo_charstatus *cd) { nullpo_retv(cd); WFIFOHEAD(fd,25 + sizeof(struct mmo_charstatus)); @@ -3687,7 +3698,7 @@ void char_map_auth_ok(int fd, int account_id, struct char_auth_node* node, struc WFIFOSET(fd, WFIFOW(fd,2)); } -void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) +static void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip) { WFIFOHEAD(fd,19); WFIFOW(fd,0) = 0x2b27; @@ -3699,7 +3710,7 @@ void char_map_auth_failed(int fd, int account_id, int char_id, int login_id1, ch WFIFOSET(fd,19); } -void char_parse_frommap_auth_request(int fd, int id) +static void char_parse_frommap_auth_request(int fd, int id) { struct mmo_charstatus char_dat; struct char_auth_node* node; @@ -3752,14 +3763,14 @@ void char_parse_frommap_auth_request(int fd, int id) } } -void char_parse_frommap_update_ip(int fd, int id) +static void char_parse_frommap_update_ip(int fd, int id) { chr->server[id].ip = ntohl(RFIFOL(fd, 2)); ShowInfo("Updated IP address of map-server #%d to %u.%u.%u.%u.\n", id, CONVIP(chr->server[id].ip)); RFIFOSKIP(fd,6); } -void char_parse_frommap_scdata_update(int fd) +static void char_parse_frommap_scdata_update(int fd) { int account_id = RFIFOL(fd, 2); int char_id = RFIFOL(fd, 6); @@ -3779,7 +3790,7 @@ void char_parse_frommap_scdata_update(int fd) RFIFOSKIP(fd, 28); } -void char_parse_frommap_scdata_delete(int fd) +static void char_parse_frommap_scdata_delete(int fd) { int account_id = RFIFOL(fd, 2); int char_id = RFIFOL(fd, 6); @@ -3793,7 +3804,7 @@ void char_parse_frommap_scdata_delete(int fd) RFIFOSKIP(fd, 12); } -int char_parse_frommap(int fd) +static int char_parse_frommap(int fd) { int id; @@ -4025,14 +4036,14 @@ int char_parse_frommap(int fd) return 0; } -void do_init_mapif(void) +static void do_init_mapif(void) { int i; for( i = 0; i < ARRAYLENGTH(chr->server); ++i ) mapif->server_init(i); } -void do_final_mapif(void) +static void do_final_mapif(void) { int i; for( i = 0; i < ARRAYLENGTH(chr->server); ++i ) @@ -4041,7 +4052,7 @@ void do_final_mapif(void) // Searches for the mapserver that has a given map (and optionally ip/port, if not -1). // If found, returns the server's index in the 'server' array (otherwise returns -1). -int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) +static int char_search_mapserver(unsigned short map, uint32 ip, uint16 port) { int i, j; @@ -4073,7 +4084,7 @@ static int char_mapif_init(int fd) * @retval 0 if it is a WAN IP. * @return the appropriate LAN server address to send, if it is a LAN IP. */ -uint32 char_lan_subnet_check(uint32 ip) +static uint32 char_lan_subnet_check(uint32 ip) { struct s_subnet lan = {0}; if (sockt->lan_subnet_check(ip, &lan)) { @@ -4093,7 +4104,7 @@ uint32 char_lan_subnet_check(uint32 ip) /// 4 (0x71a): To delete a character you must withdraw from the guild. /// 5 (0x71b): To delete a character you must withdraw from the party. /// Any (0x718): An unknown error has occurred. -void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) +static void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) {// HC: <0828>.W <char id>.L <Msg:0-5>.L <deleteDate>.L WFIFOHEAD(fd,14); WFIFOW(fd,0) = 0x828; @@ -4108,7 +4119,7 @@ void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) WFIFOSET(fd,14); } -void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) +static void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) { WFIFOHEAD(fd,10); WFIFOW(fd,0) = 0x82a; @@ -4125,7 +4136,7 @@ void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) /// 4 (0x71d): Deleting not yet possible time. /// 5 (0x71e): Date of birth do not match. /// Any (0x718): An unknown error has occurred. -void char_delete2_accept_ack(int fd, int char_id, uint32 result) +static void char_delete2_accept_ack(int fd, int char_id, uint32 result) {// HC: <082a>.W <char id>.L <Msg:0-5>.L #if PACKETVER >= 20130000 /* not sure the exact date -- must refresh or client gets stuck */ if( result == 1 ) { @@ -4140,7 +4151,7 @@ void char_delete2_accept_ack(int fd, int char_id, uint32 result) /// 1 (0x718): none/success, (if char id not in deletion process): An unknown error has occurred. /// 2 (0x719): A database error occurred. /// Any (0x718): An unknown error has occurred. -void char_delete2_cancel_ack(int fd, int char_id, uint32 result) +static void char_delete2_cancel_ack(int fd, int char_id, uint32 result) {// HC: <082c>.W <char id>.L <Msg:1-2>.L WFIFOHEAD(fd,10); WFIFOW(fd,0) = 0x82c; @@ -4149,7 +4160,7 @@ void char_delete2_cancel_ack(int fd, int char_id, uint32 result) WFIFOSET(fd,10); } -static void char_delete2_req(int fd, struct char_session_data* sd) +static void char_delete2_req(int fd, struct char_session_data *sd) {// CH: <0827>.W <char id>.L int char_id, i; char* data; @@ -4220,7 +4231,7 @@ static void char_delete2_req(int fd, struct char_session_data* sd) chr->delete2_ack(fd, char_id, 1, delete_date); // 1: success } -static void char_delete2_accept(int fd, struct char_session_data* sd) +static void char_delete2_accept(int fd, struct char_session_data *sd) {// CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B char birthdate[8+1]; int char_id, i; @@ -4292,7 +4303,7 @@ static void char_delete2_accept(int fd, struct char_session_data* sd) chr->delete2_accept_ack(fd, char_id, 1); // 1: success } -static void char_delete2_cancel(int fd, struct char_session_data* sd) +static void char_delete2_cancel(int fd, struct char_session_data *sd) {// CH: <082b>.W <char id>.L int char_id, i; @@ -4319,14 +4330,14 @@ static void char_delete2_cancel(int fd, struct char_session_data* sd) chr->delete2_cancel_ack(fd, char_id, 1); // 1: success } -void char_send_account_id(int fd, int account_id) +static void char_send_account_id(int fd, int account_id) { WFIFOHEAD(fd,4); WFIFOL(fd,0) = account_id; WFIFOSET(fd,4); } -void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) +static void char_parse_char_connect(int fd, struct char_session_data *sd, uint32 ipl) { int account_id = RFIFOL(fd,2); uint32 login_id1 = RFIFOL(fd,6); @@ -4392,7 +4403,7 @@ void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl) } } -void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd, char *dnsHost) +static void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstatus *cd, char *dnsHost) { #if PACKETVER < 20170329 const int cmd = 0x71; @@ -4420,7 +4431,7 @@ void char_send_map_info(int fd, int i, uint32 subnet_map_ip, struct mmo_charstat WFIFOSET(fd, len); } -void char_send_wait_char_server(int fd) +static void char_send_wait_char_server(int fd) { WFIFOHEAD(fd, 24); WFIFOW(fd, 0) = 0x840; @@ -4429,7 +4440,7 @@ void char_send_wait_char_server(int fd) WFIFOSET(fd, 24); } -int char_search_default_maps_mapserver(struct mmo_charstatus *cd) +static int char_search_default_maps_mapserver(struct mmo_charstatus *cd) { int i; int j; @@ -4461,8 +4472,8 @@ int char_search_default_maps_mapserver(struct mmo_charstatus *cd) return i; } -void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) __attribute__((nonnull (2))); -void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) +static void char_parse_char_select(int fd, struct char_session_data *sd, uint32 ipl) __attribute__((nonnull (2))); +static void char_parse_char_select(int fd, struct char_session_data *sd, uint32 ipl) { struct mmo_charstatus char_dat; struct mmo_charstatus *cd; @@ -4592,7 +4603,7 @@ void char_parse_char_select(int fd, struct char_session_data* sd, uint32 ipl) idb_put(auth_db, sd->account_id, node); } -void char_creation_failed(int fd, int result) +static void char_creation_failed(int fd, int result) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x6e; @@ -4615,7 +4626,7 @@ void char_creation_failed(int fd, int result) WFIFOSET(fd,3); } -void char_creation_ok(int fd, struct mmo_charstatus *char_dat) +static void char_creation_ok(int fd, struct mmo_charstatus *char_dat) { int len; @@ -4626,8 +4637,8 @@ void char_creation_ok(int fd, struct mmo_charstatus *char_dat) WFIFOSET(fd,len); } -void char_parse_char_create_new_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_create_new_char(int fd, struct char_session_data* sd) +static void char_parse_char_create_new_char(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_create_new_char(int fd, struct char_session_data *sd) { int result; if (!enable_char_creation) { @@ -4680,7 +4691,7 @@ void char_parse_char_create_new_char(int fd, struct char_session_data* sd) // flag: // 0 = Incorrect Email address -void char_delete_char_failed(int fd, int flag) +static void char_delete_char_failed(int fd, int flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x70; @@ -4688,15 +4699,15 @@ void char_delete_char_failed(int fd, int flag) WFIFOSET(fd,3); } -void char_delete_char_ok(int fd) +static void char_delete_char_ok(int fd) { WFIFOHEAD(fd,2); WFIFOW(fd,0) = 0x6f; WFIFOSET(fd,2); } -void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) __attribute__((nonnull (2))); -void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned short cmd) +static void char_parse_char_delete_char(int fd, struct char_session_data *sd, unsigned short cmd) __attribute__((nonnull (2))); +static void char_parse_char_delete_char(int fd, struct char_session_data *sd, unsigned short cmd) { char email[40]; int cid = RFIFOL(fd,2); @@ -4750,12 +4761,12 @@ void char_parse_char_delete_char(int fd, struct char_session_data* sd, unsigned chr->delete_char_ok(fd); } -void char_parse_char_ping(int fd) +static void char_parse_char_ping(int fd) { RFIFOSKIP(fd,6); } -void char_allow_rename(int fd, int flag) +static void char_allow_rename(int fd, int flag) { WFIFOHEAD(fd, 4); WFIFOW(fd,0) = 0x28e; @@ -4763,8 +4774,8 @@ void char_allow_rename(int fd, int flag) WFIFOSET(fd,4); } -void char_parse_char_rename_char(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_rename_char(int fd, struct char_session_data* sd) +static void char_parse_char_rename_char(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_rename_char(int fd, struct char_session_data *sd) { int i, cid =RFIFOL(fd,2); char name[NAME_LENGTH]; @@ -4786,8 +4797,8 @@ void char_parse_char_rename_char(int fd, struct char_session_data* sd) chr->allow_rename(fd, i); } -void char_parse_char_rename_char2(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_rename_char2(int fd, struct char_session_data* sd) +static void char_parse_char_rename_char2(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_rename_char2(int fd, struct char_session_data *sd) { int i, aid = RFIFOL(fd,2), cid =RFIFOL(fd,6); char name[NAME_LENGTH]; @@ -4811,7 +4822,7 @@ void char_parse_char_rename_char2(int fd, struct char_session_data* sd) chr->allow_rename(fd, i); } -void char_rename_char_ack(int fd, int flag) +static void char_rename_char_ack(int fd, int flag) { WFIFOHEAD(fd, 4); WFIFOW(fd,0) = 0x290; @@ -4819,8 +4830,8 @@ void char_rename_char_ack(int fd, int flag) WFIFOSET(fd,4); } -void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) +static void char_parse_char_rename_char_confirm(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_rename_char_confirm(int fd, struct char_session_data *sd) { int i; int cid = RFIFOL(fd,2); @@ -4834,7 +4845,7 @@ void char_parse_char_rename_char_confirm(int fd, struct char_session_data* sd) chr->rename_char_ack(fd, i); } -void char_captcha_notsupported(int fd) +static void char_captcha_notsupported(int fd) { WFIFOHEAD(fd,5); WFIFOW(fd,0) = 0x7e9; @@ -4843,31 +4854,31 @@ void char_captcha_notsupported(int fd) WFIFOSET(fd,5); } -void char_parse_char_request_captcha(int fd) +static void char_parse_char_request_captcha(int fd) { chr->captcha_notsupported(fd); RFIFOSKIP(fd,8); } -void char_parse_char_check_captcha(int fd) +static void char_parse_char_check_captcha(int fd) { chr->captcha_notsupported(fd); RFIFOSKIP(fd,32); } -void char_parse_char_delete2_req(int fd, struct char_session_data* sd) +static void char_parse_char_delete2_req(int fd, struct char_session_data *sd) { chr->delete2_req(fd, sd); RFIFOSKIP(fd,6); } -void char_parse_char_delete2_accept(int fd, struct char_session_data* sd) +static void char_parse_char_delete2_accept(int fd, struct char_session_data *sd) { chr->delete2_accept(fd, sd); RFIFOSKIP(fd,12); } -void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) +static void char_parse_char_delete2_cancel(int fd, struct char_session_data *sd) { chr->delete2_cancel(fd, sd); RFIFOSKIP(fd,6); @@ -4876,7 +4887,7 @@ void char_parse_char_delete2_cancel(int fd, struct char_session_data* sd) // flag: // 0 - ok // 3 - error -void char_login_map_server_ack(int fd, uint8 flag) +static void char_login_map_server_ack(int fd, uint8 flag) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x2af9; @@ -4884,7 +4895,7 @@ void char_login_map_server_ack(int fd, uint8 flag) WFIFOSET(fd,3); } -void char_parse_char_login_map_server(int fd, uint32 ipl) +static void char_parse_char_login_map_server(int fd, uint32 ipl) { char l_user[24], l_pass[24]; int i; @@ -4916,8 +4927,8 @@ void char_parse_char_login_map_server(int fd, uint32 ipl) RFIFOSKIP(fd,60); } -void char_parse_char_pincode_check(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_pincode_check(int fd, struct char_session_data* sd) +static void char_parse_char_pincode_check(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_pincode_check(int fd, struct char_session_data *sd) { if (RFIFOL(fd,2) == sd->account_id) pincode->check(fd, sd); @@ -4925,8 +4936,8 @@ void char_parse_char_pincode_check(int fd, struct char_session_data* sd) RFIFOSKIP(fd, 10); } -void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_pincode_window(int fd, struct char_session_data* sd) +static void char_parse_char_pincode_window(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_pincode_window(int fd, struct char_session_data *sd) { if (RFIFOL(fd,2) == sd->account_id) pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET); @@ -4934,8 +4945,8 @@ void char_parse_char_pincode_window(int fd, struct char_session_data* sd) RFIFOSKIP(fd, 6); } -void char_parse_char_pincode_change(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_pincode_change(int fd, struct char_session_data* sd) +static void char_parse_char_pincode_change(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_pincode_change(int fd, struct char_session_data *sd) { if (RFIFOL(fd,2) == sd->account_id) pincode->change(fd, sd); @@ -4943,21 +4954,21 @@ void char_parse_char_pincode_change(int fd, struct char_session_data* sd) RFIFOSKIP(fd, 14); } -void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) __attribute__((nonnull (2))); -void char_parse_char_pincode_first_pin(int fd, struct char_session_data* sd) +static void char_parse_char_pincode_first_pin(int fd, struct char_session_data *sd) __attribute__((nonnull (2))); +static void char_parse_char_pincode_first_pin(int fd, struct char_session_data *sd) { if (RFIFOL(fd,2) == sd->account_id) pincode->setnew (fd, sd); RFIFOSKIP(fd, 10); } -void char_parse_char_request_chars(int fd, struct char_session_data* sd) +static void char_parse_char_request_chars(int fd, struct char_session_data *sd) { chr->mmo_char_send099d(fd, sd); RFIFOSKIP(fd,2); } -void char_change_character_slot_ack(int fd, bool ret) +static void char_change_character_slot_ack(int fd, bool ret) { WFIFOHEAD(fd, 8); WFIFOW(fd, 0) = 0x8d5; @@ -4967,7 +4978,7 @@ void char_change_character_slot_ack(int fd, bool ret) WFIFOSET(fd, 8); } -void char_parse_char_move_character(int fd, struct char_session_data* sd) +static void char_parse_char_move_character(int fd, struct char_session_data *sd) { bool ret = chr->char_slotchange(sd, fd, RFIFOW(fd, 2), RFIFOW(fd, 4)); chr->change_character_slot_ack(fd, ret); @@ -4981,14 +4992,14 @@ void char_parse_char_move_character(int fd, struct char_session_data* sd) RFIFOSKIP(fd, 8); } -int char_parse_char_unknown_packet(int fd, uint32 ipl) +static int char_parse_char_unknown_packet(int fd, uint32 ipl) { ShowError("chr->parse_char: Received unknown packet "CL_WHITE"0x%x"CL_RESET" from ip '"CL_WHITE"%s"CL_RESET"'! Disconnecting!\n", RFIFOW(fd,0), sockt->ip2str(ipl, NULL)); sockt->eof(fd); return 1; } -int char_parse_char(int fd) +static int char_parse_char(int fd) { unsigned short cmd; struct char_session_data* sd; @@ -5205,7 +5216,8 @@ int char_parse_char(int fd) return 0; } -int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) { +static int char_broadcast_user_count(int tid, int64 tick, int id, intptr_t data) +{ int users = chr->count_users(); // only send an update when needed @@ -5244,7 +5256,8 @@ static int char_send_accounts_tologin_sub(union DBKey key, struct DBData *data, return 0; } -int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { +static int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) +{ if (chr->login_fd > 0 && sockt->session[chr->login_fd]) { // send account list to login server @@ -5261,7 +5274,8 @@ int char_send_accounts_tologin(int tid, int64 tick, int id, intptr_t data) { return 0; } -int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) { +static int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) +{ if (chr->login_fd > 0 && sockt->session[chr->login_fd] != NULL) return 0; @@ -5285,7 +5299,8 @@ int char_check_connect_login_server(int tid, int64 tick, int id, intptr_t data) //Invoked 15 seconds after mapif->disconnectplayer in case the map server doesn't //replies/disconnect the player we tried to kick. [Skotlex] //------------------------------------------------ -static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) { +static int char_waiting_disconnect(int tid, int64 tick, int id, intptr_t data) +{ struct online_char_data* character; if ((character = (struct online_char_data*)idb_get(chr->online_char_db, id)) != NULL && character->waiting_disconnect == tid) { //Mark it offline due to timeout. @@ -5312,7 +5327,8 @@ static int char_online_data_cleanup_sub(union DBKey key, struct DBData *data, va return 0; } -static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { +static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) +{ chr->online_char_db->foreach(chr->online_char_db, chr->online_data_cleanup_sub); return 0; } @@ -5325,7 +5341,7 @@ static int char_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) * * @retval false in case of error. */ -bool char_sql_config_read(const char *filename, bool imported) +static bool char_sql_config_read(const char *filename, bool imported) { struct config_t config; const struct config_setting_t *setting = NULL; @@ -5382,7 +5398,7 @@ bool char_sql_config_read(const char *filename, bool imported) * * @retval false in case of error. */ -bool char_sql_config_read_registry(const char *filename, const struct config_t *config, bool imported) +static bool char_sql_config_read_registry(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5413,7 +5429,7 @@ bool char_sql_config_read_registry(const char *filename, const struct config_t * * * @retval false in case of error. */ -bool char_sql_config_read_pc(const char *filename, const struct config_t *config, bool imported) +static bool char_sql_config_read_pc(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5459,7 +5475,7 @@ bool char_sql_config_read_pc(const char *filename, const struct config_t *config * * @retval false in case of error. */ -bool char_sql_config_read_guild(const char *filename, const struct config_t *config, bool imported) +static bool char_sql_config_read_guild(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5493,7 +5509,7 @@ bool char_sql_config_read_guild(const char *filename, const struct config_t *con * * @retval false in case of error. */ -bool char_config_read(const char *filename, bool imported) +static bool char_config_read(const char *filename, bool imported) { struct config_t config; const char *import = NULL; @@ -5549,7 +5565,7 @@ bool char_config_read(const char *filename, bool imported) * * @retval false in case of error. */ -bool char_config_read_top(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_top(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5593,7 +5609,7 @@ bool char_config_read_top(const char *filename, const struct config_t *config, b * * @retval false in case of error. */ -bool char_config_read_inter(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_inter(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; const char *str = NULL; @@ -5637,7 +5653,7 @@ bool char_config_read_inter(const char *filename, const struct config_t *config, * * @retval false in case of error. */ -bool char_config_read_database(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_database(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5669,7 +5685,7 @@ bool char_config_read_database(const char *filename, const struct config_t *conf * * @retval false in case of error. */ -bool char_config_read_console(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_console(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting; @@ -5702,7 +5718,7 @@ bool char_config_read_console(const char *filename, const struct config_t *confi * * @retval false in case of error. */ -bool char_config_read_player(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_player(const char *filename, const struct config_t *config, bool imported) { bool retval = true; @@ -5730,7 +5746,7 @@ bool char_config_read_player(const char *filename, const struct config_t *config * * @retval false in case of error. */ -bool char_config_read_player_fame(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_player_fame(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5774,7 +5790,7 @@ bool char_config_read_player_fame(const char *filename, const struct config_t *c * * @retval false in case of error. */ -bool char_config_read_player_deletion(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_player_deletion(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5803,7 +5819,7 @@ bool char_config_read_player_deletion(const char *filename, const struct config_ * * @retval false in case of error. */ -bool char_config_read_player_name(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_player_name(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5829,7 +5845,7 @@ bool char_config_read_player_name(const char *filename, const struct config_t *c * * @param setting The already retrieved start_item setting. */ -void char_config_set_start_item(const struct config_setting_t *setting) +static void char_config_set_start_item(const struct config_setting_t *setting) { int i, count; @@ -5878,7 +5894,7 @@ void char_config_set_start_item(const struct config_setting_t *setting) * * @retval false in case of error. */ -bool char_config_read_player_new(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_player_new(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL, *setting2 = NULL; #ifdef RENEWAL @@ -5934,7 +5950,7 @@ bool char_config_read_player_new(const char *filename, const struct config_t *co * * @retval false in case of error. */ -bool char_config_read_permission(const char *filename, const struct config_t *config, bool imported) +static bool char_config_read_permission(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -5978,7 +5994,7 @@ bool char_config_read_permission(const char *filename, const struct config_t *co * * @retval false in case of error. */ -bool char_config_set_ip(const char *type, const char *value, uint32 *out_ip, char *out_ip_str) +static bool char_config_set_ip(const char *type, const char *value, uint32 *out_ip, char *out_ip_str) { uint32 ip = 0; @@ -5996,7 +6012,8 @@ bool char_config_set_ip(const char *type, const char *value, uint32 *out_ip, cha return true; } -int do_final(void) { +int do_final(void) +{ int i; ShowStatus("Terminating...\n"); @@ -6055,12 +6072,13 @@ void do_abort(void) { } -void set_server_type(void) { +void set_server_type(void) +{ SERVER_TYPE = SERVER_TYPE_CHAR; } /// Called when a terminate signal is received. -void do_shutdown(void) +static void do_shutdown(void) { if( core->runflag != CHARSERVER_ST_SHUTDOWN ) { @@ -6136,7 +6154,8 @@ void cmdline_args_init_local(void) CMDLINEARG_DEF2(net-config, netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); } -int do_init(int argc, char **argv) { +int do_init(int argc, char **argv) +{ int i; memset(&skillid2idx, 0, sizeof(skillid2idx)); diff --git a/src/char/geoip.c b/src/char/geoip.c index 78c89bcac..2870e5f0c 100644 --- a/src/char/geoip.c +++ b/src/char/geoip.c @@ -30,9 +30,9 @@ #include <stdio.h> #include <sys/stat.h> // for stat/lstat/fstat - [Dekamaster/Ultimate GM Tool] -struct s_geoip geoip_data; +static struct s_geoip geoip_data; -struct geoip_interface geoip_s; +static struct geoip_interface geoip_s; struct geoip_interface *geoip; /* [Dekamaster/Nightroad] */ @@ -40,36 +40,38 @@ struct geoip_interface *geoip; #define GEOIP_STRUCTURE_INFO_MAX_SIZE 20 #define GEOIP_COUNTRY_BEGIN 16776960 -const char * geoip_countryname[GEOIP_MAX_COUNTRIES] = {"Unknown","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Netherlands Antilles", - "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", - "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", - "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", - "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", - "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", - "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", - "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","France, Metropolitan","Gabon","United Kingdom","Grenada","Georgia","French Guiana", - "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", - "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", - "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", - "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", - "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", - "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", - "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", - "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", - "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", - "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", - "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", - "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", - "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", - "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", - "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", - "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", - "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", - "Saint Barthelemy", "Saint Martin", "Bonaire, Saint Eustatius and Saba", "South Sudan"}; +static const char *geoip_countryname[GEOIP_MAX_COUNTRIES] = { + "Unknown","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Netherlands Antilles", + "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", + "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", + "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", + "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", + "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", + "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", + "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","France, Metropolitan","Gabon","United Kingdom","Grenada","Georgia","French Guiana", + "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", + "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", + "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", + "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", + "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", + "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", + "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", + "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", + "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", + "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", + "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", + "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", + "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", + "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", + "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", + "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", + "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", + "Saint Barthelemy", "Saint Martin", "Bonaire, Saint Eustatius and Saba", "South Sudan" +}; /* [Dekamaster/Nightroad] */ /* WHY NOT A DBMAP: There are millions of entries in GeoIP and it has its own algorithm to go quickly through them, a DBMap wouldn't be efficient */ -const char* geoip_getcountry(uint32 ipnum) +static const char *geoip_getcountry(uint32 ipnum) { int depth; unsigned int x; @@ -111,7 +113,7 @@ const char* geoip_getcountry(uint32 ipnum) * Disables GeoIP * frees geoip.cache **/ -void geoip_final(bool shutdown) +static void geoip_final(bool shutdown) { if (geoip->data->cache) { aFree(geoip->data->cache); @@ -130,7 +132,7 @@ void geoip_final(bool shutdown) * geoip.cache should be freed after use! * http://dev.maxmind.com/geoip/legacy/geolite/ **/ -void geoip_init(void) +static void geoip_init(void) { int fno; char db_type = 1; diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 9cd4c900c..1e5b0a06d 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -40,7 +40,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_auction_interface inter_auction_s; +static struct inter_auction_interface inter_auction_s; struct inter_auction_interface *inter_auction; static int inter_auction_count(int char_id, bool buy) @@ -59,7 +59,7 @@ static int inter_auction_count(int char_id, bool buy) return i; } -void inter_auction_save(struct auction_data *auction) +static void inter_auction_save(struct auction_data *auction) { int j; StringBuf buf; @@ -91,7 +91,7 @@ void inter_auction_save(struct auction_data *auction) StrBuf->Destroy(&buf); } -unsigned int inter_auction_create(struct auction_data *auction) +static unsigned int inter_auction_create(struct auction_data *auction) { int j; StringBuf buf; @@ -148,7 +148,8 @@ unsigned int inter_auction_create(struct auction_data *auction) return auction->auction_id; } -static int inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) { +static int inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) +{ struct auction_data *auction; if( (auction = (struct auction_data *)idb_get(inter_auction->db, id)) != NULL ) { @@ -170,7 +171,7 @@ static int inter_auction_end_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void inter_auction_delete(struct auction_data *auction) +static void inter_auction_delete(struct auction_data *auction) { unsigned int auction_id; nullpo_retv(auction); @@ -186,7 +187,7 @@ void inter_auction_delete(struct auction_data *auction) idb_remove(inter_auction->db, auction_id); } -void inter_auctions_fromsql(void) +static void inter_auctions_fromsql(void) { int i; struct auction_data *auction; @@ -262,7 +263,7 @@ void inter_auctions_fromsql(void) /*========================================== * Packets From Map Server *------------------------------------------*/ -int inter_auction_parse_frommap(int fd) +static int inter_auction_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { @@ -277,7 +278,7 @@ int inter_auction_parse_frommap(int fd) return 1; } -int inter_auction_sql_init(void) +static int inter_auction_sql_init(void) { inter_auction->db = idb_alloc(DB_OPT_RELEASE_DATA); inter_auction->fromsql(); @@ -285,7 +286,7 @@ int inter_auction_sql_init(void) return 0; } -void inter_auction_sql_final(void) +static void inter_auction_sql_final(void) { inter_auction->db->destroy(inter_auction->db,NULL); diff --git a/src/char/int_clan.c b/src/char/int_clan.c index 1b875d7e1..9fb8ad95e 100644 --- a/src/char/int_clan.c +++ b/src/char/int_clan.c @@ -38,7 +38,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_clan_interface inter_clan_s; +static struct inter_clan_interface inter_clan_s; struct inter_clan_interface *inter_clan; /** @@ -51,7 +51,7 @@ struct inter_clan_interface *inter_clan; * @param kick_interval Time needed to consider a player inactive and kick it * @return 0 on failure, 1 on success */ -int inter_clan_kick_inactive_members(int clan_id, int kick_interval) +static int inter_clan_kick_inactive_members(int clan_id, int kick_interval) { if (clan_id <= 0) { ShowError("inter_clan_kick_inactive_members: Invalid clan id received '%d'\n", clan_id); @@ -81,7 +81,7 @@ int inter_clan_kick_inactive_members(int clan_id, int kick_interval) * @param clan_id Id of the clan * @param kick_interval Time needed to consider a player inactive and ignore it on the count */ -int inter_clan_count_members(int clan_id, int kick_interval) +static int inter_clan_count_members(int clan_id, int kick_interval) { struct SqlStmt *stmt; int count = 0; @@ -130,7 +130,7 @@ int inter_clan_count_members(int clan_id, int kick_interval) // Must Return // 1 : ok // 0 : error -int inter_clan_parse_frommap(int fd) +static int inter_clan_parse_frommap(int fd) { RFIFOHEAD(fd); diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c index 8aeb01704..175007b66 100644 --- a/src/char/int_elemental.c +++ b/src/char/int_elemental.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_elemental_interface inter_elemental_s; +static struct inter_elemental_interface inter_elemental_s; struct inter_elemental_interface *inter_elemental; /** @@ -50,7 +50,7 @@ struct inter_elemental_interface *inter_elemental; * @param[in,out] ele The new elemental's data. * @retval false in case of errors. */ -bool inter_elemental_create(struct s_elemental *ele) +static bool inter_elemental_create(struct s_elemental *ele) { nullpo_retr(false, ele); Assert_retr(false, ele->elemental_id == 0); @@ -73,7 +73,7 @@ bool inter_elemental_create(struct s_elemental *ele) * @param ele The elemental's data. * @retval false in case of errors. */ -bool inter_elemental_save(const struct s_elemental *ele) +static bool inter_elemental_save(const struct s_elemental *ele) { nullpo_retr(false, ele); Assert_retr(false, ele->elemental_id > 0); @@ -90,7 +90,7 @@ bool inter_elemental_save(const struct s_elemental *ele) return true; } -bool inter_elemental_load(int ele_id, int char_id, struct s_elemental *ele) +static bool inter_elemental_load(int ele_id, int char_id, struct s_elemental *ele) { char* data; @@ -135,7 +135,7 @@ bool inter_elemental_load(int ele_id, int char_id, struct s_elemental *ele) return true; } -bool inter_elemental_delete(int ele_id) +static bool inter_elemental_delete(int ele_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `ele_id` = '%d'", elemental_db, ele_id) ) { Sql_ShowDebug(inter->sql_handle); @@ -145,18 +145,21 @@ bool inter_elemental_delete(int ele_id) return true; } -void inter_elemental_sql_init(void) { +static void inter_elemental_sql_init(void) +{ return; } -void inter_elemental_sql_final(void) { +static void inter_elemental_sql_final(void) +{ return; } /*========================================== * Inter Packets *------------------------------------------*/ -int inter_elemental_parse_frommap(int fd) { +static int inter_elemental_parse_frommap(int fd) +{ unsigned short cmd = RFIFOW(fd,0); switch (cmd) { diff --git a/src/char/int_guild.c b/src/char/int_guild.c index c74c7f008..e7315ed50 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -51,12 +51,13 @@ #define GUILD_ALLIANCE_TYPE_MASK 0x01 #define GUILD_ALLIANCE_REMOVE 0x08 -struct inter_guild_interface inter_guild_s; +static struct inter_guild_interface inter_guild_s; struct inter_guild_interface *inter_guild; static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; -int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { +static int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) +{ static int last_id = 0; //To know in which guild we were. int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving. struct DBIterator *iter = db_iterator(inter_guild->guild_db); @@ -101,7 +102,7 @@ int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -int inter_guild_removemember_tosql(int account_id, int char_id) +static int inter_guild_removemember_tosql(int account_id, int char_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE from `%s` where `account_id` = '%d' and `char_id` = '%d'", guild_member_db, account_id, char_id) ) Sql_ShowDebug(inter->sql_handle); @@ -111,7 +112,7 @@ int inter_guild_removemember_tosql(int account_id, int char_id) } // Save guild into sql -int inter_guild_tosql(struct guild *g,int flag) +static int inter_guild_tosql(struct guild *g, int flag) { // Table guild (GS_BASIC_MASK) // GS_EMBLEM `emblem_len`,`emblem_id`,`emblem_data` @@ -343,7 +344,7 @@ int inter_guild_tosql(struct guild *g,int flag) } // Read guild from sql -struct guild * inter_guild_fromsql(int guild_id) +static struct guild *inter_guild_fromsql(int guild_id) { struct guild *g; char* data; @@ -533,7 +534,7 @@ struct guild * inter_guild_fromsql(int guild_id) } // `guild_castle` (`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`) -int inter_guild_castle_tosql(struct guild_castle *gc) +static int inter_guild_castle_tosql(struct guild_castle *gc) { StringBuf buf; int i; @@ -557,7 +558,7 @@ int inter_guild_castle_tosql(struct guild_castle *gc) } // Read guild_castle from SQL -struct guild_castle* inter_guild_castle_fromsql(int castle_id) +static struct guild_castle *inter_guild_castle_fromsql(int castle_id) { char *data; int i; @@ -609,7 +610,8 @@ struct guild_castle* inter_guild_castle_fromsql(int castle_id) // Read exp_guild.txt -bool inter_guild_exp_parse_row(char* split[], int column, int current) { +static bool inter_guild_exp_parse_row(char *split[], int column, int current) +{ int64 exp = strtoll(split[0], NULL, 10); nullpo_retr(true, split); @@ -623,7 +625,8 @@ bool inter_guild_exp_parse_row(char* split[], int column, int current) { } -int inter_guild_CharOnline(int char_id, int guild_id) { +static int inter_guild_CharOnline(int char_id, int guild_id) +{ struct guild *g; int i; @@ -672,7 +675,7 @@ int inter_guild_CharOnline(int char_id, int guild_id) { return 1; } -int inter_guild_CharOffline(int char_id, int guild_id) +static int inter_guild_CharOffline(int char_id, int guild_id) { struct guild *g=NULL; int online_count, i; @@ -728,7 +731,7 @@ int inter_guild_CharOffline(int char_id, int guild_id) } // Initialize guild sql -int inter_guild_sql_init(void) +static int inter_guild_sql_init(void) { //Initialize the guild cache inter_guild->guild_db= idb_alloc(DB_OPT_RELEASE_DATA); @@ -745,7 +748,7 @@ int inter_guild_sql_init(void) /** * @see DBApply */ -int inter_guild_db_final(union DBKey key, struct DBData *data, va_list ap) +static int inter_guild_db_final(union DBKey key, struct DBData *data, va_list ap) { struct guild *g = DB->data2ptr(data); nullpo_ret(g); @@ -756,7 +759,7 @@ int inter_guild_db_final(union DBKey key, struct DBData *data, va_list ap) return 0; } -void inter_guild_sql_final(void) +static void inter_guild_sql_final(void) { inter_guild->guild_db->destroy(inter_guild->guild_db, inter_guild->db_final); db_destroy(inter_guild->castle_db); @@ -764,7 +767,7 @@ void inter_guild_sql_final(void) } // Get guild_id by its name. Returns 0 if not found, -1 on error. -int inter_guild_search_guildname(const char *str) +static int inter_guild_search_guildname(const char *str) { int guild_id; char esc_name[NAME_LENGTH*2+1]; @@ -807,7 +810,8 @@ static bool inter_guild_check_empty(struct guild *g) return true; } -unsigned int inter_guild_nextexp(int level) { +static unsigned int inter_guild_nextexp(int level) +{ if (level == 0) return 1; if (level <= 0 || level > MAX_GUILDLEVEL) @@ -816,7 +820,7 @@ unsigned int inter_guild_nextexp(int level) { return inter_guild->exp[level-1]; } -int inter_guild_checkskill(struct guild *g, int id) +static int inter_guild_checkskill(struct guild *g, int id) { int idx = id - GD_SKILLBASE; @@ -827,7 +831,7 @@ int inter_guild_checkskill(struct guild *g, int id) return g->skill[idx].lv; } -int inter_guild_calcinfo(struct guild *g) +static int inter_guild_calcinfo(struct guild *g) { int i,c; unsigned int nextexp; @@ -891,7 +895,7 @@ int inter_guild_calcinfo(struct guild *g) return 0; } -struct guild *inter_guild_create(const char *name, const struct guild_member *master) +static struct guild *inter_guild_create(const char *name, const struct guild_member *master) { struct guild *g; int i=0; @@ -965,7 +969,7 @@ struct guild *inter_guild_create(const char *name, const struct guild_member *ma } // Add member to guild -bool inter_guild_add_member(int guild_id, const struct guild_member *member) +static bool inter_guild_add_member(int guild_id, const struct guild_member *member) { struct guild * g; int i; @@ -993,7 +997,7 @@ bool inter_guild_add_member(int guild_id, const struct guild_member *member) } // Delete member from guild -bool inter_guild_leave(int guild_id, int account_id, int char_id, int flag, const char *mes, int map_fd) +static bool inter_guild_leave(int guild_id, int account_id, int char_id, int flag, const char *mes, int map_fd) { int i; @@ -1049,7 +1053,7 @@ bool inter_guild_leave(int guild_id, int account_id, int char_id, int flag, cons } // Change member info -bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int16 class) +static bool inter_guild_update_member_info_short(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { // Could speed up by manipulating only guild_member struct guild *g; @@ -1099,7 +1103,7 @@ bool inter_guild_update_member_info_short(int guild_id, int account_id, int char } // BreakGuild -bool inter_guild_disband(int guild_id) +static bool inter_guild_disband(int guild_id) { struct guild *g = inter_guild->fromsql(guild_id); if (g == NULL) @@ -1150,7 +1154,7 @@ bool inter_guild_disband(int guild_id) * Changes basic guild information * The types are available in mmo.h::guild_basic_info **/ -bool inter_guild_update_basic_info(int guild_id, int type, const void *data, int len) +static bool inter_guild_update_basic_info(int guild_id, int type, const void *data, int len) { struct guild *g; struct guild_skill gd_skill; @@ -1206,7 +1210,7 @@ bool inter_guild_update_basic_info(int guild_id, int type, const void *data, int } // Modification of the guild -bool inter_guild_update_member_info(int guild_id, int account_id, int char_id, int type, const char *data, int len) +static bool inter_guild_update_member_info(int guild_id, int account_id, int char_id, int type, const char *data, int len) { // Could make some improvement in speed, because only change guild_member int i; @@ -1314,12 +1318,12 @@ bool inter_guild_update_member_info(int guild_id, int account_id, int char_id, i return true; } -int inter_guild_sex_changed(int guild_id, int account_id, int char_id, short gender) +static int inter_guild_sex_changed(int guild_id, int account_id, int char_id, short gender) { return inter_guild->update_member_info(guild_id, account_id, char_id, GMI_GENDER, (const char*)&gender, sizeof(gender)); } -int inter_guild_charname_changed(int guild_id, int account_id, int char_id, char *name) +static int inter_guild_charname_changed(int guild_id, int account_id, int char_id, char *name) { struct guild *g; int i, flag = 0; @@ -1357,7 +1361,7 @@ int inter_guild_charname_changed(int guild_id, int account_id, int char_id, char } // Change a position desc -bool inter_guild_update_position(int guild_id, int idx, const struct guild_position *p) +static bool inter_guild_update_position(int guild_id, int idx, const struct guild_position *p) { // Could make some improvement in speed, because only change guild_position struct guild *g; @@ -1375,7 +1379,7 @@ bool inter_guild_update_position(int guild_id, int idx, const struct guild_posit } // Guild Skill UP -bool inter_guild_use_skill_point(int guild_id, uint16 skill_id, int account_id, int max) +static bool inter_guild_use_skill_point(int guild_id, uint16 skill_id, int account_id, int max) { struct guild * g; int idx = skill_id - GD_SKILLBASE; @@ -1396,7 +1400,7 @@ bool inter_guild_use_skill_point(int guild_id, uint16 skill_id, int account_id, } //Manual deletion of an alliance when partnering guild does not exists. [Skotlex] -bool inter_guild_remove_alliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag) +static bool inter_guild_remove_alliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag) { int i; char name[NAME_LENGTH]; @@ -1415,7 +1419,7 @@ bool inter_guild_remove_alliance(struct guild *g, int guild_id, int account_id1, } // Alliance modification -bool inter_guild_change_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) +static bool inter_guild_change_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { // Could speed up struct guild *g[2] = { NULL }; @@ -1460,7 +1464,7 @@ bool inter_guild_change_alliance(int guild_id1, int guild_id2, int account_id1, } // Change guild message -bool inter_guild_update_notice(int guild_id, const char *mes1, const char *mes2) +static bool inter_guild_update_notice(int guild_id, const char *mes1, const char *mes2) { struct guild *g; @@ -1477,7 +1481,7 @@ bool inter_guild_update_notice(int guild_id, const char *mes1, const char *mes2) return true; } -bool inter_guild_update_emblem(int len, int guild_id, const char *data) +static bool inter_guild_update_emblem(int len, int guild_id, const char *data) { struct guild * g; @@ -1497,7 +1501,7 @@ bool inter_guild_update_emblem(int len, int guild_id, const char *data) return true; } -bool inter_guild_update_castle_data(int castle_id, int index, int value) +static bool inter_guild_update_castle_data(int castle_id, int index, int value) { struct guild_castle *gc = inter_guild->castle_fromsql(castle_id); @@ -1536,7 +1540,7 @@ bool inter_guild_update_castle_data(int castle_id, int index, int value) return true; } -bool inter_guild_change_leader(int guild_id, const char *name, int len) +static bool inter_guild_change_leader(int guild_id, const char *name, int len) { struct guild * g; struct guild_member gm; @@ -1582,7 +1586,7 @@ bool inter_guild_change_leader(int guild_id, const char *name, int len) // Must Return // 1 : ok // 0 : error -int inter_guild_parse_frommap(int fd) +static int inter_guild_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { @@ -1611,7 +1615,7 @@ int inter_guild_parse_frommap(int fd) return 1; } -int inter_guild_broken(int guild_id) +static int inter_guild_broken(int guild_id) { return mapif->guild_broken(guild_id, 0); } diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 28ec848be..5a1c9d23f 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -37,14 +37,14 @@ #include <stdio.h> #include <stdlib.h> -struct inter_homunculus_interface inter_homunculus_s; +static struct inter_homunculus_interface inter_homunculus_s; struct inter_homunculus_interface *inter_homunculus; -int inter_homunculus_sql_init(void) +static int inter_homunculus_sql_init(void) { return 0; } -void inter_homunculus_sql_final(void) +static void inter_homunculus_sql_final(void) { return; } @@ -59,7 +59,7 @@ void inter_homunculus_sql_final(void) * @param[in,out] hd The new homunculus' data. * @retval false in case of errors. */ -bool inter_homunculus_create(struct s_homunculus *hd) +static bool inter_homunculus_create(struct s_homunculus *hd) { char esc_name[NAME_LENGTH*2+1]; @@ -86,7 +86,7 @@ bool inter_homunculus_create(struct s_homunculus *hd) * @param hd The homunculus' data. * @retval false in case of errors. */ -bool inter_homunculus_save(const struct s_homunculus *hd) +static bool inter_homunculus_save(const struct s_homunculus *hd) { bool flag = true; char esc_name[NAME_LENGTH*2+1]; @@ -128,7 +128,7 @@ bool inter_homunculus_save(const struct s_homunculus *hd) } // Load an homunculus -bool inter_homunculus_load(int homun_id, struct s_homunculus* hd) +static bool inter_homunculus_load(int homun_id, struct s_homunculus *hd) { char* data; size_t len; @@ -209,7 +209,7 @@ bool inter_homunculus_load(int homun_id, struct s_homunculus* hd) return true; } -bool inter_homunculus_delete(int homun_id) +static bool inter_homunculus_delete(int homun_id) { if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%d'", homunculus_db, homun_id) || SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%d'", skill_homunculus_db, homun_id) @@ -220,7 +220,7 @@ bool inter_homunculus_delete(int homun_id) return true; } -bool inter_homunculus_rename(const char *name) +static bool inter_homunculus_rename(const char *name) { int i; @@ -245,7 +245,7 @@ bool inter_homunculus_rename(const char *name) /*========================================== * Inter Packets *------------------------------------------*/ -int inter_homunculus_parse_frommap(int fd) +static int inter_homunculus_parse_frommap(int fd) { unsigned short cmd = RFIFOW(fd,0); diff --git a/src/char/int_mail.c b/src/char/int_mail.c index a20446710..e0625fcab 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -37,10 +37,10 @@ #include <stdio.h> #include <stdlib.h> -struct inter_mail_interface inter_mail_s; +static struct inter_mail_interface inter_mail_s; struct inter_mail_interface *inter_mail; -static int inter_mail_fromsql(int char_id, struct mail_data* md) +static int inter_mail_fromsql(int char_id, struct mail_data *md) { int i, j; struct mail_message *msg; @@ -134,7 +134,7 @@ static int inter_mail_fromsql(int char_id, struct mail_data* md) /// Stores a single message in the database. /// Returns the message's ID if successful (or 0 if it fails). -int inter_mail_savemessage(struct mail_message* msg) +static int inter_mail_savemessage(struct mail_message *msg) { StringBuf buf; struct SqlStmt *stmt; @@ -179,7 +179,7 @@ int inter_mail_savemessage(struct mail_message* msg) /// Retrieves a single message from the database. /// Returns true if the operation succeeds (or false if it fails). -static bool inter_mail_loadmessage(int mail_id, struct mail_message* msg) +static bool inter_mail_loadmessage(int mail_id, struct mail_message *msg) { int j; StringBuf buf; @@ -245,7 +245,7 @@ static bool inter_mail_loadmessage(int mail_id, struct mail_message* msg) /*========================================== * Mark mail as 'Read' *------------------------------------------*/ -bool inter_mail_mark_read(int mail_id) +static bool inter_mail_mark_read(int mail_id) { if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `status` = '%d' WHERE `id` = '%d'", mail_db, MAIL_READ, mail_id)) { Sql_ShowDebug(inter->sql_handle); @@ -281,7 +281,7 @@ static bool inter_mail_DeleteAttach(int mail_id) return true; } -bool inter_mail_get_attachment(int char_id, int mail_id, struct mail_message *msg) +static bool inter_mail_get_attachment(int char_id, int mail_id, struct mail_message *msg) { nullpo_retr(false, msg); @@ -303,7 +303,7 @@ bool inter_mail_get_attachment(int char_id, int mail_id, struct mail_message *ms return true; } -bool inter_mail_delete(int char_id, int mail_id) +static bool inter_mail_delete(int char_id, int mail_id) { if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id)) { Sql_ShowDebug(inter->sql_handle); @@ -312,7 +312,7 @@ bool inter_mail_delete(int char_id, int mail_id) return true; } -bool inter_mail_return_message(int char_id, int mail_id, int *new_mail) +static bool inter_mail_return_message(int char_id, int mail_id, int *new_mail) { struct mail_message msg; nullpo_retr(false, new_mail); @@ -349,7 +349,7 @@ bool inter_mail_return_message(int char_id, int mail_id, int *new_mail) } -bool inter_mail_send(int account_id, struct mail_message *msg) +static bool inter_mail_send(int account_id, struct mail_message *msg) { char esc_name[NAME_LENGTH*2+1]; @@ -377,7 +377,7 @@ bool inter_mail_send(int account_id, struct mail_message *msg) return true; } -void inter_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) +static void inter_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) { struct mail_message msg; nullpo_retv(send_name); @@ -405,7 +405,7 @@ void inter_mail_sendmail(int send_id, const char* send_name, int dest_id, const /*========================================== * Packets From Map Server *------------------------------------------*/ -int inter_mail_parse_frommap(int fd) +static int inter_mail_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { @@ -421,12 +421,12 @@ int inter_mail_parse_frommap(int fd) return 1; } -int inter_mail_sql_init(void) +static int inter_mail_sql_init(void) { return 1; } -void inter_mail_sql_final(void) +static void inter_mail_sql_final(void) { return; } diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 52afdcb9f..21bfb5538 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -38,10 +38,10 @@ #include <stdio.h> #include <stdlib.h> -struct inter_mercenary_interface inter_mercenary_s; +static struct inter_mercenary_interface inter_mercenary_s; struct inter_mercenary_interface *inter_mercenary; -bool inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) +static bool inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) { char* data; @@ -70,7 +70,7 @@ bool inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) return true; } -bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) +static bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) { nullpo_ret(status); if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", @@ -83,7 +83,7 @@ bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) return true; } -bool inter_mercenary_owner_delete(int char_id) +static bool inter_mercenary_owner_delete(int char_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) Sql_ShowDebug(inter->sql_handle); @@ -104,7 +104,7 @@ bool inter_mercenary_owner_delete(int char_id) * @param[in,out] merc The new mercenary's data. * @retval false in case of errors. */ -bool inter_mercenary_create(struct s_mercenary *merc) +static bool inter_mercenary_create(struct s_mercenary *merc) { nullpo_retr(false, merc); Assert_retr(false, merc->mercenary_id == 0); @@ -126,7 +126,7 @@ bool inter_mercenary_create(struct s_mercenary *merc) * @param merc The mercenary's data. * @retval false in case of errors. */ -bool inter_mercenary_save(const struct s_mercenary *merc) +static bool inter_mercenary_save(const struct s_mercenary *merc) { nullpo_retr(false, merc); Assert_retr(false, merc->mercenary_id > 0); @@ -141,7 +141,7 @@ bool inter_mercenary_save(const struct s_mercenary *merc) return true; } -bool inter_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) +static bool inter_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) { char* data; @@ -174,7 +174,7 @@ bool inter_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) return true; } -bool inter_mercenary_delete(int merc_id) +static bool inter_mercenary_delete(int merc_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) ) { @@ -185,11 +185,12 @@ bool inter_mercenary_delete(int merc_id) return true; } -int inter_mercenary_sql_init(void) +static int inter_mercenary_sql_init(void) { return 0; } -void inter_mercenary_sql_final(void) + +static void inter_mercenary_sql_final(void) { return; } @@ -197,7 +198,7 @@ void inter_mercenary_sql_final(void) /*========================================== * Inter Packets *------------------------------------------*/ -int inter_mercenary_parse_frommap(int fd) +static int inter_mercenary_parse_frommap(int fd) { unsigned short cmd = RFIFOW(fd,0); diff --git a/src/char/int_party.c b/src/char/int_party.c index e089d1567..8ee03ecc5 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -39,11 +39,12 @@ #include <stdio.h> #include <stdlib.h> -struct inter_party_interface inter_party_s; +static struct inter_party_interface inter_party_s; struct inter_party_interface *inter_party; //Updates party's level range and unsets even share if broken. -static int inter_party_check_lv(struct party_data *p) { +static int inter_party_check_lv(struct party_data *p) +{ int i; unsigned int lv; nullpo_ret(p); @@ -121,7 +122,7 @@ static void inter_party_calc_state(struct party_data *p) } // Save party to mysql -int inter_party_tosql(struct party *p, int flag, int index) +static int inter_party_tosql(struct party *p, int flag, int index) { // 'party' ('party_id','name','exp','item','leader_id','leader_char') char esc_name[NAME_LENGTH*2+1];// escaped party name @@ -196,7 +197,7 @@ int inter_party_tosql(struct party *p, int flag, int index) } // Read party from mysql -struct party_data *inter_party_fromsql(int party_id) +static struct party_data *inter_party_fromsql(int party_id) { int leader_id = 0; int leader_char = 0; @@ -268,7 +269,7 @@ struct party_data *inter_party_fromsql(int party_id) return p; } -int inter_party_sql_init(void) +static int inter_party_sql_init(void) { //memory alloc inter_party->db = idb_alloc(DB_OPT_RELEASE_DATA); @@ -287,7 +288,7 @@ int inter_party_sql_init(void) return 0; } -void inter_party_sql_final(void) +static void inter_party_sql_final(void) { inter_party->db->destroy(inter_party->db, NULL); aFree(inter_party->pt); @@ -295,7 +296,7 @@ void inter_party_sql_final(void) } // Search for the party according to its name -struct party_data* inter_party_search_partyname(const char *const str) +static struct party_data *inter_party_search_partyname(const char *const str) { char esc_name[NAME_LENGTH*2+1]; char* data; @@ -314,14 +315,14 @@ struct party_data* inter_party_search_partyname(const char *const str) } // Returns whether this party can keep having exp share or not. -int inter_party_check_exp_share(struct party_data *const p) +static int inter_party_check_exp_share(struct party_data *const p) { nullpo_ret(p); return (p->party.count < 2 || p->max_lv - p->min_lv <= party_share_level); } // Is there any member in the party? -int inter_party_check_empty(struct party_data *p) +static int inter_party_check_empty(struct party_data *p) { int i; if (p==NULL||p->party.party_id==0) return 1; @@ -334,7 +335,7 @@ int inter_party_check_empty(struct party_data *p) } // Create Party -struct party_data *inter_party_create(const char *name, int item, int item2, const struct party_member *leader) +static struct party_data *inter_party_create(const char *name, int item, int item2, const struct party_member *leader) { struct party_data *p; int i; @@ -389,7 +390,7 @@ struct party_data *inter_party_create(const char *name, int item, int item2, con } // Add a player to party request -bool inter_party_add_member(int party_id, const struct party_member *member) +static bool inter_party_add_member(int party_id, const struct party_member *member) { struct party_data *p; int i; @@ -425,7 +426,7 @@ bool inter_party_add_member(int party_id, const struct party_member *member) } //Party setting change request -bool inter_party_change_option(int party_id, int account_id, int exp, int item, int map_fd) +static bool inter_party_change_option(int party_id, int account_id, int exp, int item, int map_fd) { struct party_data *p; int flag = 0; @@ -446,7 +447,7 @@ bool inter_party_change_option(int party_id, int account_id, int exp, int item, } //Request leave party -bool inter_party_leave(int party_id, int account_id, int char_id) +static bool inter_party_leave(int party_id, int account_id, int char_id) { struct party_data *p; int i,j; @@ -488,7 +489,7 @@ bool inter_party_leave(int party_id, int account_id, int char_id) } // When member goes to other map or levels up. -bool inter_party_change_map(int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv) +static bool inter_party_change_map(int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv) { struct party_data *p; int i; @@ -546,7 +547,7 @@ bool inter_party_change_map(int party_id, int account_id, int char_id, unsigned } //Request party dissolution -bool inter_party_disband(int party_id) +static bool inter_party_disband(int party_id) { struct party_data *p; @@ -559,7 +560,7 @@ bool inter_party_disband(int party_id) return 0; } -bool inter_party_change_leader(int party_id, int account_id, int char_id) +static bool inter_party_change_leader(int party_id, int account_id, int char_id) { struct party_data *p; int i; @@ -587,7 +588,7 @@ bool inter_party_change_leader(int party_id, int account_id, int char_id) // Return : // 0 : error // 1 : ok -int inter_party_parse_frommap(int fd) +static int inter_party_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)) { @@ -606,7 +607,7 @@ int inter_party_parse_frommap(int fd) return 1; } -int inter_party_CharOnline(int char_id, int party_id) +static int inter_party_CharOnline(int char_id, int party_id) { struct party_data* p; int i; @@ -653,7 +654,8 @@ int inter_party_CharOnline(int char_id, int party_id) return 1; } -int inter_party_CharOffline(int char_id, int party_id) { +static int inter_party_CharOffline(int char_id, int party_id) +{ struct party_data *p=NULL; int i; diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 0a3a51b3a..e824d7b58 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_pet_interface inter_pet_s; +static struct inter_pet_interface inter_pet_s; struct inter_pet_interface *inter_pet; /** @@ -51,7 +51,7 @@ struct inter_pet_interface *inter_pet; * @return The ID of the saved pet. * @retval 0 in case of errors. */ -int inter_pet_tosql(const struct s_pet *p) +static int inter_pet_tosql(const struct s_pet *p) { //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`) char esc_name[NAME_LENGTH*2+1];// escaped pet name @@ -91,7 +91,7 @@ int inter_pet_tosql(const struct s_pet *p) return pet_id; } -int inter_pet_fromsql(int pet_id, struct s_pet* p) +static int inter_pet_fromsql(int pet_id, struct s_pet *p) { char* data; size_t len; @@ -138,17 +138,21 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p) } //---------------------------------------------- -int inter_pet_sql_init(void) { +static int inter_pet_sql_init(void) +{ //memory alloc inter_pet->pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1); return 0; } -void inter_pet_sql_final(void) { + +static void inter_pet_sql_final(void) +{ if (inter_pet->pt) aFree(inter_pet->pt); return; } //---------------------------------- -int inter_pet_delete(int pet_id) { +static int inter_pet_delete(int pet_id) +{ ShowInfo("delete pet request: %d...\n",pet_id); if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) ) @@ -156,7 +160,7 @@ int inter_pet_delete(int pet_id) { return 0; } //------------------------------------------------------ -struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, +static struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) { nullpo_ret(pet_name); @@ -193,7 +197,7 @@ struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, sho return NULL; } -struct s_pet *inter_pet_load(int account_id, int char_id, int pet_id) +static struct s_pet *inter_pet_load(int account_id, int char_id, int pet_id) { memset(inter_pet->pt, 0, sizeof(struct s_pet)); @@ -213,7 +217,7 @@ struct s_pet *inter_pet_load(int account_id, int char_id, int pet_id) return NULL; } -int inter_pet_parse_frommap(int fd) +static int inter_pet_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd, 0)){ diff --git a/src/char/int_quest.c b/src/char/int_quest.c index afd01579e..0fa7771cb 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_quest_interface inter_quest_s; +static struct inter_quest_interface inter_quest_s; struct inter_quest_interface *inter_quest; /** @@ -48,7 +48,7 @@ struct inter_quest_interface *inter_quest; * @return Array of found entries. It has *count entries, and it is care of the * caller to aFree() it afterwards. */ -struct quest *inter_quest_fromsql(int char_id, int *count) +static struct quest *inter_quest_fromsql(int char_id, int *count) { struct quest *questlog = NULL; struct quest tmp_quest; @@ -129,7 +129,7 @@ struct quest *inter_quest_fromsql(int char_id, int *count) * @param quest_id Quest ID * @return false in case of errors, true otherwise */ -bool inter_quest_delete(int char_id, int quest_id) +static bool inter_quest_delete(int char_id, int quest_id) { if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, quest_id, char_id)) { Sql_ShowDebug(inter->sql_handle); @@ -146,7 +146,7 @@ bool inter_quest_delete(int char_id, int quest_id) * @param qd Quest data * @return false in case of errors, true otherwise */ -bool inter_quest_add(int char_id, struct quest qd) +static bool inter_quest_add(int char_id, struct quest qd) { StringBuf buf; int i; @@ -178,7 +178,7 @@ bool inter_quest_add(int char_id, struct quest qd) * @param qd Quest data * @return false in case of errors, true otherwise */ -bool inter_quest_update(int char_id, struct quest qd) +static bool inter_quest_update(int char_id, struct quest qd) { StringBuf buf; int i; @@ -200,7 +200,7 @@ bool inter_quest_update(int char_id, struct quest qd) return true; } -bool inter_quest_save(int char_id, const struct quest *new_qd, int new_n) +static bool inter_quest_save(int char_id, const struct quest *new_qd, int new_n) { int i, j, k, old_n; struct quest *old_qd = NULL; @@ -243,7 +243,7 @@ bool inter_quest_save(int char_id, const struct quest *new_qd, int new_n) * * @see inter_parse_frommap */ -int inter_quest_parse_frommap(int fd) +static int inter_quest_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { case 0x3060: mapif->parse_quest_load(fd); break; diff --git a/src/char/int_rodex.c b/src/char/int_rodex.c index ddd019bb8..e70a6bbf5 100644 --- a/src/char/int_rodex.c +++ b/src/char/int_rodex.c @@ -37,7 +37,7 @@ #include <stdio.h> #include <stdlib.h> -struct inter_rodex_interface inter_rodex_s; +static struct inter_rodex_interface inter_rodex_s; struct inter_rodex_interface *inter_rodex; // Loads new mails of this char_id/account_id @@ -298,7 +298,7 @@ static bool inter_rodex_checkname(const char *name, int *target_char_id, short * /// Stores a single message in the database. /// Returns the message's ID if successful (or 0 if it fails). -int64 inter_rodex_savemessage(struct rodex_message* msg) +static int64 inter_rodex_savemessage(struct rodex_message *msg) { char sender_name[NAME_LENGTH * 2 + 1]; char receiver_name[NAME_LENGTH * 2 + 1]; @@ -349,7 +349,7 @@ int64 inter_rodex_savemessage(struct rodex_message* msg) /*========================================== * Update/Delete mail *------------------------------------------*/ -bool inter_rodex_updatemail(int64 mail_id, int8 flag) +static bool inter_rodex_updatemail(int64 mail_id, int8 flag) { Assert_retr(false, mail_id > 0); Assert_retr(false, flag >= 0 && flag <= 4); @@ -392,7 +392,7 @@ bool inter_rodex_updatemail(int64 mail_id, int8 flag) /*========================================== * Packets From Map Server *------------------------------------------*/ -int inter_rodex_parse_frommap(int fd) +static int inter_rodex_parse_frommap(int fd) { switch(RFIFOW(fd,0)) { @@ -407,12 +407,12 @@ int inter_rodex_parse_frommap(int fd) return 1; } -int inter_rodex_sql_init(void) +static int inter_rodex_sql_init(void) { return 1; } -void inter_rodex_sql_final(void) +static void inter_rodex_sql_final(void) { return; } diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 3deb8d58b..da4522971 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -37,11 +37,11 @@ #include <stdio.h> #include <stdlib.h> -struct inter_storage_interface inter_storage_s; +static struct inter_storage_interface inter_storage_s; struct inter_storage_interface *inter_storage; /// Save storage data to sql -int inter_storage_tosql(int account_id, const struct storage_data *p) +static int inter_storage_tosql(int account_id, const struct storage_data *p) { int i = 0, j = 0; bool matched_p[MAX_STORAGE] = { false }; @@ -165,7 +165,7 @@ int inter_storage_tosql(int account_id, const struct storage_data *p) } /// Load storage data to mem -int inter_storage_fromsql(int account_id, struct storage_data *p) +static int inter_storage_fromsql(int account_id, struct storage_data *p) { StringBuf buf; char* data; @@ -235,7 +235,7 @@ int inter_storage_fromsql(int account_id, struct storage_data *p) } /// Save guild_storage data to sql -bool inter_storage_guild_storage_tosql(int guild_id, const struct guild_storage *p) +static bool inter_storage_guild_storage_tosql(int guild_id, const struct guild_storage *p) { nullpo_ret(p); @@ -255,7 +255,7 @@ bool inter_storage_guild_storage_tosql(int guild_id, const struct guild_storage } /// Load guild_storage data to mem -int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) +static int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) { StringBuf buf; char* data; @@ -315,24 +315,24 @@ int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) //--------------------------------------------------------- // storage data initialize -int inter_storage_sql_init(void) +static int inter_storage_sql_init(void) { return 1; } // storage data finalize -void inter_storage_sql_final(void) +static void inter_storage_sql_final(void) { return; } // q?f[^? -int inter_storage_delete(int account_id) +static int inter_storage_delete(int account_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `account_id`='%d'", storage_db, account_id) ) Sql_ShowDebug(inter->sql_handle); return 0; } -int inter_storage_guild_storage_delete(int guild_id) +static int inter_storage_guild_storage_delete(int guild_id) { if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_storage_db, guild_id) ) Sql_ShowDebug(inter->sql_handle); @@ -343,7 +343,7 @@ int inter_storage_guild_storage_delete(int guild_id) //Guild bound items pull for offline characters [Akinari] //Revised by [Mhalicot] //------------------------------------------------ -bool inter_storage_retrieve_bound_items(int char_id, int account_id, int guild_id) +static bool inter_storage_retrieve_bound_items(int char_id, int account_id, int guild_id) { #ifdef GP_BOUND_ITEMS StringBuf buf; @@ -517,7 +517,7 @@ bool inter_storage_retrieve_bound_items(int char_id, int account_id, int guild_i return true; } -int inter_storage_parse_frommap(int fd) +static int inter_storage_parse_frommap(int fd) { RFIFOHEAD(fd); switch(RFIFOW(fd,0)){ diff --git a/src/char/inter.c b/src/char/inter.c index 28e2f2488..718dfd60d 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -55,20 +55,20 @@ #define WISDATA_TTL (60*1000) // Wis data Time To Live (60 seconds) #define WISDELLIST_MAX 256 // Number of elements in the list Delete data Wis -struct inter_interface inter_s; +static struct inter_interface inter_s; struct inter_interface *inter; -int char_server_port = 3306; -char char_server_ip[32] = "127.0.0.1"; -char char_server_id[32] = "ragnarok"; -char char_server_pw[100] = "ragnarok"; -char char_server_db[32] = "ragnarok"; -char default_codepage[32] = ""; //Feature by irmin. +static int char_server_port = 3306; +static char char_server_ip[32] = "127.0.0.1"; +static char char_server_id[32] = "ragnarok"; +static char char_server_pw[100] = "ragnarok"; +static char char_server_db[32] = "ragnarok"; +static char default_codepage[32] = ""; //Feature by irmin. int party_share_level = 10; // recv. packet list -int inter_recv_packet_length[] = { +static int inter_recv_packet_length[] = { -1,-1, 7,-1, -1,13,36, (2 + 4 + 4 + 4 + NAME_LENGTH), 0, 0, 0, 0, 0, 0, 0, 0, // 3000- 6,-1, 0, 0, 0, 0, 0, 0, 10,-1, 0, 0, 0, 0, 0, 0, // 3010- Account Storage [Smokexyz] -1,10,-1,14, 14,19, 6,-1, 14,14, 0, 0, 0, 0, 0, 0, // 3020- Party @@ -85,9 +85,10 @@ static struct DBMap *wis_db = NULL; // int wis_id -> struct WisData* static int wis_dellist[WISDELLIST_MAX], wis_delnum; #define MAX_JOB_NAMES 150 -static char* msg_table[MAX_JOB_NAMES]; // messages 550 ~ 699 are job names +static char *msg_table[MAX_JOB_NAMES]; // messages 550 ~ 699 are job names -const char* inter_msg_txt(int msg_number) { +static const char *inter_msg_txt(int msg_number) +{ msg_number -= 550; if (msg_number >= 0 && msg_number < MAX_JOB_NAMES && msg_table[msg_number] != NULL && msg_table[msg_number][0] != '\0') @@ -106,7 +107,7 @@ const char* inter_msg_txt(int msg_number) { * @param[in] allow_override whether to allow duplicate message IDs to override the original value. * @return success state. */ -bool inter_msg_config_read(const char *cfg_name, bool allow_override) +static bool inter_msg_config_read(const char *cfg_name, bool allow_override) { int msg_number; char line[1024], w1[1024], w2[1024]; @@ -158,14 +159,14 @@ bool inter_msg_config_read(const char *cfg_name, bool allow_override) /*========================================== * Cleanup Message Data *------------------------------------------*/ -void inter_do_final_msg(void) +static void inter_do_final_msg(void) { int i; for (i = 0; i < MAX_JOB_NAMES; i++) aFree(msg_table[i]); } /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */ -const char* inter_job_name(int class) +static const char *inter_job_name(int class) { switch (class) { case JOB_NOVICE: // 550 @@ -398,7 +399,7 @@ const char* inter_job_name(int class) * Argument-list version of inter_msg_to_fd * @see inter_msg_to_fd */ -void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) +static void inter_vmsg_to_fd(int fd, int u_fd, int aid, char *msg, va_list ap) { char msg_out[512]; va_list apcopy; @@ -431,8 +432,8 @@ void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) * @param msg Message format string * @param ... Additional parameters for (v)sprinf */ -void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); -void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) +static void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5))); +static void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) { va_list ap; va_start(ap,msg); @@ -441,7 +442,7 @@ void inter_msg_to_fd(int fd, int u_fd, int aid, char *msg, ...) } /* [Dekamaster/Nightroad] */ -void inter_accinfo(int u_fd, int aid, int castergroup, const char *query, int map_fd) +static void inter_accinfo(int u_fd, int aid, int castergroup, const char *query, int map_fd) { char query_esq[NAME_LENGTH*2+1]; int account_id; @@ -499,7 +500,7 @@ void inter_accinfo(int u_fd, int aid, int castergroup, const char *query, int ma return; } -void inter_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, +static void inter_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_id, const char *userid, const char *user_pass, const char *email, const char *last_ip, const char *lastlogin, const char *pin_code, const char *birthdate, int group_id, int logincount, int state) { @@ -572,7 +573,7 @@ void inter_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int account_i * @param val either str or int, depending on type * @param type false when int, true otherwise **/ -void inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) +static void inter_savereg(int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string) { char val_esq[1000]; nullpo_retv(key); @@ -625,7 +626,7 @@ void inter_savereg(int account_id, int char_id, const char *key, unsigned int in } // Load account_reg from sql (type=2) -int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) +static int inter_accreg_fromsql(int account_id, int char_id, int fd, int type) { char* data; size_t len; @@ -802,7 +803,7 @@ int inter_accreg_fromsql(int account_id,int char_id, int fd, int type) * * @retval false in case of error. */ -bool inter_config_read_log(const char *filename, const struct config_t *config, bool imported) +static bool inter_config_read_log(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -830,7 +831,7 @@ bool inter_config_read_log(const char *filename, const struct config_t *config, * * @retval false in case of error. */ -bool inter_config_read_connection(const char *filename, const struct config_t *config, bool imported) +static bool inter_config_read_connection(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; @@ -863,7 +864,7 @@ bool inter_config_read_connection(const char *filename, const struct config_t *c * * @retval false in case of error. */ -bool inter_config_read(const char *filename, bool imported) +static bool inter_config_read(const char *filename, bool imported) { struct config_t config; const struct config_setting_t *setting = NULL; @@ -907,7 +908,7 @@ bool inter_config_read(const char *filename, bool imported) * Save interlog into sql (arglist version) * @see inter_log */ -int inter_vlog(char* fmt, va_list ap) +static int inter_vlog(char *fmt, va_list ap) { char str[255]; char esc_str[sizeof(str)*2+1];// escaped str @@ -930,7 +931,7 @@ int inter_vlog(char* fmt, va_list ap) * @param ... Additional (printf-like) arguments * @return Always 0 // FIXME */ -int inter_log(char* fmt, ...) +static int inter_log(char *fmt, ...) { va_list ap; int ret; @@ -943,7 +944,7 @@ int inter_log(char* fmt, ...) } // initialize -int inter_init_sql(const char *file) +static int inter_init_sql(const char *file) { inter->config_read(file, false); @@ -980,7 +981,7 @@ int inter_init_sql(const char *file) } // finalize -void inter_final(void) +static void inter_final(void) { wis_db->destroy(wis_db, NULL); @@ -1000,7 +1001,7 @@ void inter_final(void) return; } -int inter_mapif_init(int fd) +static int inter_mapif_init(int fd) { return 0; } @@ -1011,7 +1012,7 @@ int inter_mapif_init(int fd) * Existence check of WISP data * @see DBApply */ -int inter_check_ttl_wisdata_sub(union DBKey key, struct DBData *data, va_list ap) +static int inter_check_ttl_wisdata_sub(union DBKey key, struct DBData *data, va_list ap) { int64 tick; struct WisData *wd = DB->data2ptr(data); @@ -1024,7 +1025,7 @@ int inter_check_ttl_wisdata_sub(union DBKey key, struct DBData *data, va_list ap return 0; } -int inter_check_ttl_wisdata(void) +static int inter_check_ttl_wisdata(void) { int64 tick = timer->gettick(); int i; @@ -1044,7 +1045,7 @@ int inter_check_ttl_wisdata(void) return 0; } -struct WisData *inter_add_wisdata(int fd, const unsigned char *src, const unsigned char *dst, const unsigned char *msg, int msg_len) +static struct WisData *inter_add_wisdata(int fd, const unsigned char *src, const unsigned char *dst, const unsigned char *msg, int msg_len) { static int wisid = 0; struct WisData *wd; @@ -1066,12 +1067,12 @@ struct WisData *inter_add_wisdata(int fd, const unsigned char *src, const unsign return wd; } -struct WisData *inter_get_wisdata(int id) +static struct WisData *inter_get_wisdata(int id) { return idb_get(wis_db, id); } -void inter_remove_wisdata(int id) +static void inter_remove_wisdata(int id) { idb_remove(wis_db, id); } @@ -1082,7 +1083,7 @@ void inter_remove_wisdata(int id) /// or 0 if no complete packet exists in the queue. /// /// @param length The minimum allowed length, or -1 for dynamic lookup -int inter_check_length(int fd, int length) +static int inter_check_length(int fd, int length) { if( length == -1 ) {// variable-length packet @@ -1097,7 +1098,7 @@ int inter_check_length(int fd, int length) return length; } -int inter_parse_frommap(int fd) +static int inter_parse_frommap(int fd) { int cmd; int len = 0; diff --git a/src/char/loginif.c b/src/char/loginif.c index a34bac943..a093c8cf5 100644 --- a/src/char/loginif.c +++ b/src/char/loginif.c @@ -35,12 +35,12 @@ #include <stdlib.h> #include <string.h> -struct loginif_interface loginif_s; +static struct loginif_interface loginif_s; struct loginif_interface *loginif; /// Resets all the data. -void loginif_reset(void) __attribute__ ((noreturn)); -void loginif_reset(void) +static void loginif_reset(void) __attribute__ ((noreturn)); +static void loginif_reset(void) { int id; // TODO kick everyone out and reset everything or wait for connect and try to reacquire locks [FlavioJS] @@ -54,7 +54,7 @@ void loginif_reset(void) /// Checks the conditions for the server to stop. /// Releases the cookie when all characters are saved. /// If all the conditions are met, it stops the core loop. -void loginif_check_shutdown(void) +static void loginif_check_shutdown(void) { if( core->runflag != CHARSERVER_ST_SHUTDOWN ) return; @@ -63,14 +63,14 @@ void loginif_check_shutdown(void) /// Called when the connection to Login Server is disconnected. -void loginif_on_disconnect(void) +static void loginif_on_disconnect(void) { ShowWarning("Connection to Login Server lost.\n\n"); } /// Called when all the connection steps are completed. -void loginif_on_ready(void) +static void loginif_on_ready(void) { int i; @@ -85,7 +85,7 @@ void loginif_on_ready(void) ShowStatus("Awaiting maps from map-server.\n"); } -void do_init_loginif(void) +static void do_init_loginif(void) { // establish char-login connection if not present timer->add_func_list(chr->check_connect_login_server, "chr->check_connect_login_server"); @@ -96,7 +96,7 @@ void do_init_loginif(void) timer->add_interval(timer->gettick() + 1000, chr->send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour } -void do_final_loginif(void) +static void do_final_loginif(void) { if (chr->login_fd != -1) { sockt->close(chr->login_fd); @@ -104,7 +104,7 @@ void do_final_loginif(void) } } -void loginif_block_account(int account_id, int flag) +static void loginif_block_account(int account_id, int flag) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,10); @@ -114,7 +114,7 @@ void loginif_block_account(int account_id, int flag) WFIFOSET(chr->login_fd,10); } -void loginif_ban_account(int account_id, short year, short month, short day, short hour, short minute, short second) +static void loginif_ban_account(int account_id, short year, short month, short day, short hour, short minute, short second) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,18); @@ -129,7 +129,7 @@ void loginif_ban_account(int account_id, short year, short month, short day, sho WFIFOSET(chr->login_fd,18); } -void loginif_unban_account(int account_id) +static void loginif_unban_account(int account_id) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,6); @@ -138,7 +138,7 @@ void loginif_unban_account(int account_id) WFIFOSET(chr->login_fd,6); } -void loginif_changesex(int account_id) +static void loginif_changesex(int account_id) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,6); @@ -147,7 +147,7 @@ void loginif_changesex(int account_id) WFIFOSET(chr->login_fd,6); } -void loginif_auth(int fd, struct char_session_data* sd, uint32 ipl) +static void loginif_auth(int fd, struct char_session_data *sd, uint32 ipl) { Assert_retv(chr->login_fd != -1); nullpo_retv(sd); @@ -162,7 +162,7 @@ void loginif_auth(int fd, struct char_session_data* sd, uint32 ipl) WFIFOSET(chr->login_fd,23); } -void loginif_send_users_count(int users) +static void loginif_send_users_count(int users) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,6); @@ -171,7 +171,7 @@ void loginif_send_users_count(int users) WFIFOSET(chr->login_fd,6); } -void loginif_connect_to_server(void) +static void loginif_connect_to_server(void) { Assert_retv(chr->login_fd != -1); WFIFOHEAD(chr->login_fd,86); diff --git a/src/char/mapif.c b/src/char/mapif.c index cb1d50698..e0565c126 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -49,7 +49,10 @@ #include <stdlib.h> -void mapif_ban(int id, unsigned int flag, int status) +static struct mapif_interface mapif_s; +struct mapif_interface *mapif; + +static void mapif_ban(int id, unsigned int flag, int status) { // send to all map-servers to disconnect the player unsigned char buf[11]; @@ -61,14 +64,14 @@ void mapif_ban(int id, unsigned int flag, int status) } /// Initializes a server structure. -void mapif_server_init(int id) +static void mapif_server_init(int id) { //memset(&chr->server[id], 0, sizeof(server[id])); chr->server[id].fd = -1; } /// Destroys a server structure. -void mapif_server_destroy(int id) +static void mapif_server_destroy(int id) { if (chr->server[id].fd == -1) { sockt->close(chr->server[id].fd); @@ -77,7 +80,7 @@ void mapif_server_destroy(int id) } /// Resets all the data related to a server. -void mapif_server_reset(int id) +static void mapif_server_reset(int id) { int i, j; unsigned char buf[16384]; @@ -104,13 +107,13 @@ void mapif_server_reset(int id) } /// Called when the connection to a Map Server is disconnected. -void mapif_on_disconnect(int id) +static void mapif_on_disconnect(int id) { ShowStatus("Map-server #%d has disconnected.\n", id); mapif->server_reset(id); } -void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) +static void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, int map_fd) { Assert_retv(chr->login_fd > 0); WFIFOHEAD(chr->login_fd, 22); @@ -123,7 +126,7 @@ void mapif_on_parse_accinfo(int account_id, int u_fd, int u_aid, int u_group, in WFIFOSET(chr->login_fd, 22); } -void mapif_char_ban(int char_id, time_t timestamp) +static void mapif_char_ban(int char_id, time_t timestamp) { unsigned char buf[11]; WBUFW(buf, 0) = 0x2b14; @@ -133,7 +136,7 @@ void mapif_char_ban(int char_id, time_t timestamp) mapif->sendall(buf, 11); } -int mapif_sendall(const unsigned char *buf, unsigned int len) +static int mapif_sendall(const unsigned char *buf, unsigned int len) { int i, c; @@ -152,7 +155,7 @@ int mapif_sendall(const unsigned char *buf, unsigned int len) return c; } -int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) +static int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { int i, c; @@ -172,7 +175,7 @@ int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) } -int mapif_send(int fd, unsigned char *buf, unsigned int len) +static int mapif_send(int fd, unsigned char *buf, unsigned int len) { nullpo_ret(buf); if (fd >= 0) { @@ -188,7 +191,7 @@ int mapif_send(int fd, unsigned char *buf, unsigned int len) return 0; } -void mapif_send_users_count(int users) +static void mapif_send_users_count(int users) { uint8 buf[6]; // send number of players to all map-servers @@ -198,7 +201,7 @@ void mapif_send_users_count(int users) } -void mapif_auction_message(int char_id, unsigned char result) +static void mapif_auction_message(int char_id, unsigned char result) { unsigned char buf[74]; @@ -208,7 +211,7 @@ void mapif_auction_message(int char_id, unsigned char result) mapif->sendall(buf, 7); } -void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf) +static void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf) { int len = (sizeof(struct auction_data) * count) + 12; @@ -224,7 +227,7 @@ void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsig WFIFOSET(fd, len); } -void mapif_parse_auction_requestlist(int fd) +static void mapif_parse_auction_requestlist(int fd) { char searchtext[NAME_LENGTH]; int char_id = RFIFOL(fd, 4), len = sizeof(struct auction_data); @@ -266,7 +269,7 @@ void mapif_parse_auction_requestlist(int fd) mapif->auction_sendlist(fd, char_id, j, pages, buf); } -void mapif_auction_register(int fd, struct auction_data *auction) +static void mapif_auction_register(int fd, struct auction_data *auction) { int len = sizeof(struct auction_data) + 4; @@ -279,7 +282,7 @@ void mapif_auction_register(int fd, struct auction_data *auction) WFIFOSET(fd, len); } -void mapif_parse_auction_register(int fd) +static void mapif_parse_auction_register(int fd) { struct auction_data auction; if( RFIFOW(fd, 2) != sizeof(struct auction_data) + 4 ) @@ -292,7 +295,7 @@ void mapif_parse_auction_register(int fd) mapif->auction_register(fd, &auction); } -void mapif_auction_cancel(int fd, int char_id, unsigned char result) +static void mapif_auction_cancel(int fd, int char_id, unsigned char result) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3852; @@ -301,7 +304,7 @@ void mapif_auction_cancel(int fd, int char_id, unsigned char result) WFIFOSET(fd, 7); } -void mapif_parse_auction_cancel(int fd) +static void mapif_parse_auction_cancel(int fd) { int char_id = RFIFOL(fd, 2), auction_id = RFIFOL(fd, 6); struct auction_data *auction; @@ -328,7 +331,7 @@ void mapif_parse_auction_cancel(int fd) } -void mapif_auction_close(int fd, int char_id, unsigned char result) +static void mapif_auction_close(int fd, int char_id, unsigned char result) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3853; @@ -337,7 +340,7 @@ void mapif_auction_close(int fd, int char_id, unsigned char result) WFIFOSET(fd, 7); } -void mapif_parse_auction_close(int fd) +static void mapif_parse_auction_close(int fd) { int char_id = RFIFOL(fd, 2), auction_id = RFIFOL(fd, 6); struct auction_data *auction; @@ -367,7 +370,7 @@ void mapif_parse_auction_close(int fd) mapif->auction_close(fd, char_id, 0); // You have ended the auction } -void mapif_auction_bid(int fd, int char_id, int bid, unsigned char result) +static void mapif_auction_bid(int fd, int char_id, int bid, unsigned char result) { WFIFOHEAD(fd, 11); WFIFOW(fd, 0) = 0x3855; @@ -377,7 +380,7 @@ void mapif_auction_bid(int fd, int char_id, int bid, unsigned char result) WFIFOSET(fd, 11); } -void mapif_parse_auction_bid(int fd) +static void mapif_parse_auction_bid(int fd) { int char_id = RFIFOL(fd, 4), bid = RFIFOL(fd, 12); unsigned int auction_id = RFIFOL(fd, 8); @@ -424,7 +427,7 @@ void mapif_parse_auction_bid(int fd) mapif->auction_bid(fd, char_id, 0, 1); // You have successfully bid in the auction } -void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) +static void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) { int size = sizeof(struct s_elemental) + 5; @@ -437,7 +440,7 @@ void mapif_elemental_send(int fd, struct s_elemental *ele, unsigned char flag) WFIFOSET(fd, size); } -void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) +static void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) { struct s_elemental ele_; bool result; @@ -448,14 +451,14 @@ void mapif_parse_elemental_create(int fd, const struct s_elemental *ele) mapif->elemental_send(fd, &ele_, result); } -void mapif_parse_elemental_load(int fd, int ele_id, int char_id) +static void mapif_parse_elemental_load(int fd, int ele_id, int char_id) { struct s_elemental ele; bool result = inter_elemental->load(ele_id, char_id, &ele); mapif->elemental_send(fd, &ele, result); } -void mapif_elemental_deleted(int fd, unsigned char flag) +static void mapif_elemental_deleted(int fd, unsigned char flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x387d; @@ -463,13 +466,13 @@ void mapif_elemental_deleted(int fd, unsigned char flag) WFIFOSET(fd, 3); } -void mapif_parse_elemental_delete(int fd, int ele_id) +static void mapif_parse_elemental_delete(int fd, int ele_id) { bool result = inter_elemental->delete(ele_id); mapif->elemental_deleted(fd, result); } -void mapif_elemental_saved(int fd, unsigned char flag) +static void mapif_elemental_saved(int fd, unsigned char flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x387e; @@ -477,13 +480,13 @@ void mapif_elemental_saved(int fd, unsigned char flag) WFIFOSET(fd, 3); } -void mapif_parse_elemental_save(int fd, const struct s_elemental *ele) +static void mapif_parse_elemental_save(int fd, const struct s_elemental *ele) { bool result = inter_elemental->save(ele); mapif->elemental_saved(fd, result); } -int mapif_guild_created(int fd, int account_id, struct guild *g) +static int mapif_guild_created(int fd, int account_id, struct guild *g) { WFIFOHEAD(fd, 10); WFIFOW(fd, 0) = 0x3830; @@ -500,7 +503,7 @@ int mapif_guild_created(int fd, int account_id, struct guild *g) } // Guild not found -int mapif_guild_noinfo(int fd, int guild_id) +static int mapif_guild_noinfo(int fd, int guild_id) { unsigned char buf[12]; WBUFW(buf, 0) = 0x3831; @@ -515,7 +518,7 @@ int mapif_guild_noinfo(int fd, int guild_id) } // Send guild info -int mapif_guild_info(int fd, struct guild *g) +static int mapif_guild_info(int fd, struct guild *g) { unsigned char buf[8 + sizeof(struct guild)]; nullpo_ret(g); @@ -530,7 +533,7 @@ int mapif_guild_info(int fd, struct guild *g) } // ACK member add -int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag) +static int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, int flag) { WFIFOHEAD(fd, 15); WFIFOW(fd, 0) = 0x3832; @@ -543,7 +546,7 @@ int mapif_guild_memberadded(int fd, int guild_id, int account_id, int char_id, i } // ACK member leave -int mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes) +static int mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes) { unsigned char buf[55 + NAME_LENGTH]; @@ -563,7 +566,7 @@ int mapif_guild_withdraw(int guild_id, int account_id, int char_id, int flag, co } // Send short member's info -int mapif_guild_memberinfoshort(struct guild *g, int idx) +static int mapif_guild_memberinfoshort(struct guild *g, int idx) { unsigned char buf[23]; nullpo_ret(g); @@ -581,7 +584,7 @@ int mapif_guild_memberinfoshort(struct guild *g, int idx) } // Send guild broken -int mapif_guild_broken(int guild_id, int flag) +static int mapif_guild_broken(int guild_id, int flag) { unsigned char buf[7]; WBUFW(buf, 0) = 0x3836; @@ -593,7 +596,7 @@ int mapif_guild_broken(int guild_id, int flag) } // Send guild message -int mapif_guild_message(int guild_id, int account_id, const char *mes, int len, int sfd) +static int mapif_guild_message(int guild_id, int account_id, const char *mes, int len, int sfd) { unsigned char buf[512]; nullpo_ret(mes); @@ -609,7 +612,7 @@ int mapif_guild_message(int guild_id, int account_id, const char *mes, int len, } // Send basic info -int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len) +static int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int len) { unsigned char buf[2048]; nullpo_ret(data); @@ -625,7 +628,7 @@ int mapif_guild_basicinfochanged(int guild_id, int type, const void *data, int l } // Send member info -int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len) +static int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int type, const void *data, int len) { unsigned char buf[2048]; nullpo_ret(data); @@ -643,7 +646,7 @@ int mapif_guild_memberinfochanged(int guild_id, int account_id, int char_id, int } // ACK guild skill up -int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id) +static int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id) { unsigned char buf[14]; WBUFW(buf, 0) = 0x383c; @@ -655,7 +658,7 @@ int mapif_guild_skillupack(int guild_id, uint16 skill_id, int account_id) } // ACK guild alliance -int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2) +static int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2) { unsigned char buf[19 + 2 * NAME_LENGTH]; nullpo_ret(name1); @@ -673,7 +676,7 @@ int mapif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int acco } // Send a guild position desc -int mapif_guild_position(struct guild *g, int idx) +static int mapif_guild_position(struct guild *g, int idx) { unsigned char buf[12 + sizeof(struct guild_position)]; nullpo_ret(g); @@ -688,7 +691,7 @@ int mapif_guild_position(struct guild *g, int idx) } // Send the guild notice -int mapif_guild_notice(struct guild *g) +static int mapif_guild_notice(struct guild *g) { unsigned char buf[256]; nullpo_ret(g); @@ -701,7 +704,7 @@ int mapif_guild_notice(struct guild *g) } // Send emblem data -int mapif_guild_emblem(struct guild *g) +static int mapif_guild_emblem(struct guild *g) { unsigned char buf[12 + sizeof(g->emblem_data)]; nullpo_ret(g); @@ -714,7 +717,7 @@ int mapif_guild_emblem(struct guild *g) return 0; } -int mapif_guild_master_changed(struct guild *g, int aid, int cid) +static int mapif_guild_master_changed(struct guild *g, int aid, int cid) { unsigned char buf[14]; nullpo_ret(g); @@ -726,7 +729,7 @@ int mapif_guild_master_changed(struct guild *g, int aid, int cid) return 0; } -int mapif_guild_castle_dataload(int fd, int sz, const int *castle_ids) +static int mapif_guild_castle_dataload(int fd, int sz, const int *castle_ids) { struct guild_castle *gc = NULL; int num = (sz - 4) / sizeof(int); @@ -746,7 +749,7 @@ int mapif_guild_castle_dataload(int fd, int sz, const int *castle_ids) } // Guild creation request -int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const struct guild_member *master) +static int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const struct guild_member *master) { struct guild *g; nullpo_ret(name); @@ -764,7 +767,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const stru } // Return guild info to client -int mapif_parse_GuildInfo(int fd, int guild_id) +static int mapif_parse_GuildInfo(int fd, int guild_id) { struct guild * g = inter_guild->fromsql(guild_id); //We use this because on start-up the info of castle-owned guilds is required. [Skotlex] if (g != NULL) { @@ -777,7 +780,7 @@ int mapif_parse_GuildInfo(int fd, int guild_id) } // Add member to guild -int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m) +static int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m) { nullpo_ret(m); @@ -790,28 +793,28 @@ int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member * } // Delete member from guild -int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) +static int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes) { inter_guild->leave(guild_id, account_id, char_id, flag, mes, fd); return 0; } // Change member info -int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class) +static int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class) { inter_guild->update_member_info_short(guild_id, account_id, char_id, online, lv, class); return 0; } // BreakGuild -int mapif_parse_BreakGuild(int fd, int guild_id) +static int mapif_parse_BreakGuild(int fd, int guild_id) { inter_guild->disband(guild_id); return 0; } // Forward Guild message to others map servers -int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len) +static int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len) { return mapif->guild_message(guild_id,account_id,mes,len, fd); } @@ -820,7 +823,7 @@ int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *m * Changes basic guild information * The types are available in mmo.h::guild_basic_info **/ -int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len) +static int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len) { inter_guild->update_basic_info(guild_id, type, data, len); // Information is already sent in mapif->guild_info @@ -829,14 +832,14 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void } // Modification of the guild -int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len) +static int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int char_id, int type, const char *data, int len) { inter_guild->update_member_info(guild_id, account_id, char_id, type, data, len); return 0; } // Change a position desc -int mapif_parse_GuildPosition(int fd, int guild_id, int idx, const struct guild_position *p) +static int mapif_parse_GuildPosition(int fd, int guild_id, int idx, const struct guild_position *p) { nullpo_ret(p); inter_guild->update_position(guild_id, idx, p); @@ -844,50 +847,50 @@ int mapif_parse_GuildPosition(int fd, int guild_id, int idx, const struct guild_ } // Guild Skill UP -int mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max) +static int mapif_parse_GuildSkillUp(int fd, int guild_id, uint16 skill_id, int account_id, int max) { inter_guild->use_skill_point(guild_id, skill_id, account_id, max); return 0; } // Alliance modification -int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) +static int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { inter_guild->change_alliance(guild_id1, guild_id2, account_id1, account_id2, flag); return 0; } // Change guild message -int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2) +static int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *mes2) { inter_guild->update_notice(guild_id, mes1, mes2); return 0; } -int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data) +static int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char *data) { inter_guild->update_emblem(len, guild_id, data); return 0; } -int mapif_parse_GuildCastleDataLoad(int fd, int len, const int *castle_ids) +static int mapif_parse_GuildCastleDataLoad(int fd, int len, const int *castle_ids) { return mapif->guild_castle_dataload(fd, len, castle_ids); } -int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) +static int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value) { inter_guild->update_castle_data(castle_id, index, value); return 0; } -int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len) +static int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len) { inter_guild->change_leader(guild_id, name, len); return 0; } -void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag) +static void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag) { nullpo_retv(sh); WFIFOHEAD(fd, sizeof(struct s_homunculus) + 9); @@ -899,7 +902,7 @@ void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus WFIFOSET(fd, WFIFOW(fd, 2)); } -void mapif_homunculus_deleted(int fd, int flag) +static void mapif_homunculus_deleted(int fd, int flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x3893; @@ -907,7 +910,7 @@ void mapif_homunculus_deleted(int fd, int flag) WFIFOSET(fd, 3); } -void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) +static void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) { WFIFOHEAD(fd, sizeof(struct s_homunculus) + 9); WFIFOW(fd, 0) = 0x3891; @@ -923,7 +926,7 @@ void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd) WFIFOSET(fd, sizeof(struct s_homunculus) + 9); } -void mapif_homunculus_saved(int fd, int account_id, bool flag) +static void mapif_homunculus_saved(int fd, int account_id, bool flag) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3892; @@ -932,7 +935,7 @@ void mapif_homunculus_saved(int fd, int account_id, bool flag) WFIFOSET(fd, 7); } -void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name) +static void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, const char *name) { nullpo_retv(name); WFIFOHEAD(fd, NAME_LENGTH + 12); @@ -944,7 +947,7 @@ void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char WFIFOSET(fd, NAME_LENGTH + 12); } -void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct s_homunculus *phd) +static void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct s_homunculus *phd) { struct s_homunculus shd; bool result; @@ -955,32 +958,32 @@ void mapif_parse_homunculus_create(int fd, int len, int account_id, const struct mapif->homunculus_created(fd, account_id, &shd, result); } -void mapif_parse_homunculus_delete(int fd, int homun_id) +static void mapif_parse_homunculus_delete(int fd, int homun_id) { bool result = inter_homunculus->delete(homun_id); mapif->homunculus_deleted(fd, result); } -void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) +static void mapif_parse_homunculus_load(int fd, int account_id, int homun_id) { struct s_homunculus hd; bool result = inter_homunculus->load(homun_id, &hd); mapif->homunculus_loaded(fd, account_id, (result ? &hd : NULL)); } -void mapif_parse_homunculus_save(int fd, int len, int account_id, const struct s_homunculus *phd) +static void mapif_parse_homunculus_save(int fd, int len, int account_id, const struct s_homunculus *phd) { bool result = inter_homunculus->save(phd); mapif->homunculus_saved(fd, account_id, result); } -void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, const char *name) +static void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, const char *name) { bool result = inter_homunculus->rename(name); mapif->homunculus_renamed(fd, account_id, char_id, result, name); } -void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md) +static void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md) { nullpo_retv(md); //FIXME: dumping the whole structure like this is unsafe [ultramage] @@ -996,7 +999,7 @@ void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_d /*========================================== * Client Inbox Request *------------------------------------------*/ -void mapif_parse_mail_requestinbox(int fd) +static void mapif_parse_mail_requestinbox(int fd) { int char_id = RFIFOL(fd, 2); unsigned char flag = RFIFOB(fd, 6); @@ -1009,13 +1012,13 @@ void mapif_parse_mail_requestinbox(int fd) /*========================================== * Mark mail as 'Read' *------------------------------------------*/ -void mapif_parse_mail_read(int fd) +static void mapif_parse_mail_read(int fd) { int mail_id = RFIFOL(fd, 2); inter_mail->mark_read(mail_id); } -void mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg) +static void mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg) { nullpo_retv(msg); WFIFOHEAD(fd, sizeof(struct item) + 12); @@ -1027,7 +1030,7 @@ void mapif_mail_sendattach(int fd, int char_id, struct mail_message *msg) WFIFOSET(fd,WFIFOW(fd, 2)); } -void mapif_parse_mail_getattach(int fd) +static void mapif_parse_mail_getattach(int fd) { struct mail_message msg = { 0 }; int char_id = RFIFOL(fd, 2); @@ -1042,7 +1045,7 @@ void mapif_parse_mail_getattach(int fd) /*========================================== * Delete Mail *------------------------------------------*/ -void mapif_mail_delete(int fd, int char_id, int mail_id, bool failed) +static void mapif_mail_delete(int fd, int char_id, int mail_id, bool failed) { WFIFOHEAD(fd, 11); WFIFOW(fd, 0) = 0x384b; @@ -1052,7 +1055,7 @@ void mapif_mail_delete(int fd, int char_id, int mail_id, bool failed) WFIFOSET(fd, 11); } -void mapif_parse_mail_delete(int fd) +static void mapif_parse_mail_delete(int fd) { int char_id = RFIFOL(fd, 2); int mail_id = RFIFOL(fd, 6); @@ -1063,7 +1066,7 @@ void mapif_parse_mail_delete(int fd) /*========================================== * Report New Mail to Map Server *------------------------------------------*/ -void mapif_mail_new(struct mail_message *msg) +static void mapif_mail_new(struct mail_message *msg) { unsigned char buf[74]; @@ -1081,7 +1084,7 @@ void mapif_mail_new(struct mail_message *msg) /*========================================== * Return Mail *------------------------------------------*/ -void mapif_mail_return(int fd, int char_id, int mail_id, int new_mail) +static void mapif_mail_return(int fd, int char_id, int mail_id, int new_mail) { WFIFOHEAD(fd, 11); WFIFOW(fd, 0) = 0x384c; @@ -1091,7 +1094,7 @@ void mapif_mail_return(int fd, int char_id, int mail_id, int new_mail) WFIFOSET(fd, 11); } -void mapif_parse_mail_return(int fd) +static void mapif_parse_mail_return(int fd) { int char_id = RFIFOL(fd, 2); int mail_id = RFIFOL(fd, 6); @@ -1106,7 +1109,7 @@ void mapif_parse_mail_return(int fd) /*========================================== * Send Mail *------------------------------------------*/ -void mapif_mail_send(int fd, struct mail_message* msg) +static void mapif_mail_send(int fd, struct mail_message* msg) { int len = sizeof(struct mail_message) + 4; @@ -1118,7 +1121,7 @@ void mapif_mail_send(int fd, struct mail_message* msg) WFIFOSET(fd,len); } -void mapif_parse_mail_send(int fd) +static void mapif_parse_mail_send(int fd) { struct mail_message msg; int account_id = 0; @@ -1135,7 +1138,7 @@ void mapif_parse_mail_send(int fd) mapif->mail_new(&msg); // notify recipient } -void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) +static void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) { int size = sizeof(struct s_mercenary) + 5; @@ -1148,7 +1151,7 @@ void mapif_mercenary_send(int fd, struct s_mercenary *merc, unsigned char flag) WFIFOSET(fd,size); } -void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) +static void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) { struct s_mercenary merc_; bool result; @@ -1159,14 +1162,14 @@ void mapif_parse_mercenary_create(int fd, const struct s_mercenary *merc) mapif->mercenary_send(fd, &merc_, result); } -void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) +static void mapif_parse_mercenary_load(int fd, int merc_id, int char_id) { struct s_mercenary merc; bool result = inter_mercenary->load(merc_id, char_id, &merc); mapif->mercenary_send(fd, &merc, result); } -void mapif_mercenary_deleted(int fd, unsigned char flag) +static void mapif_mercenary_deleted(int fd, unsigned char flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x3871; @@ -1174,13 +1177,13 @@ void mapif_mercenary_deleted(int fd, unsigned char flag) WFIFOSET(fd, 3); } -void mapif_parse_mercenary_delete(int fd, int merc_id) +static void mapif_parse_mercenary_delete(int fd, int merc_id) { bool result = inter_mercenary->delete(merc_id); mapif->mercenary_deleted(fd, result); } -void mapif_mercenary_saved(int fd, unsigned char flag) +static void mapif_mercenary_saved(int fd, unsigned char flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x3872; @@ -1188,14 +1191,14 @@ void mapif_mercenary_saved(int fd, unsigned char flag) WFIFOSET(fd, 3); } -void mapif_parse_mercenary_save(int fd, const struct s_mercenary *merc) +static void mapif_parse_mercenary_save(int fd, const struct s_mercenary *merc) { bool result = inter_mercenary->save(merc); mapif->mercenary_saved(fd, result); } // Create a party whether or not -int mapif_party_created(int fd, int account_id, int char_id, struct party *p) +static int mapif_party_created(int fd, int account_id, int char_id, struct party *p) { WFIFOHEAD(fd, 39); WFIFOW(fd, 0) = 0x3820; @@ -1217,7 +1220,7 @@ int mapif_party_created(int fd, int account_id, int char_id, struct party *p) } //Party information not found -void mapif_party_noinfo(int fd, int party_id, int char_id) +static void mapif_party_noinfo(int fd, int party_id, int char_id) { WFIFOHEAD(fd, 12); WFIFOW(fd, 0) = 0x3821; @@ -1229,7 +1232,7 @@ void mapif_party_noinfo(int fd, int party_id, int char_id) } //Digest party information -void mapif_party_info(int fd, struct party* p, int char_id) +static void mapif_party_info(int fd, struct party* p, int char_id) { unsigned char buf[8 + sizeof(struct party)]; nullpo_retv(p); @@ -1245,7 +1248,7 @@ void mapif_party_info(int fd, struct party* p, int char_id) } //Whether or not additional party members -int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag) +static int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag) { WFIFOHEAD(fd, 15); WFIFOW(fd, 0) = 0x3822; @@ -1259,7 +1262,7 @@ int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, i } // Party setting change notification -int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) +static int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) { unsigned char buf[16]; nullpo_ret(p); @@ -1277,7 +1280,7 @@ int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag) } //Withdrawal notification party -int mapif_party_withdraw(int party_id, int account_id, int char_id) +static int mapif_party_withdraw(int party_id, int account_id, int char_id) { unsigned char buf[16]; @@ -1290,7 +1293,7 @@ int mapif_party_withdraw(int party_id, int account_id, int char_id) } //Party map update notification -int mapif_party_membermoved(struct party *p, int idx) +static int mapif_party_membermoved(struct party *p, int idx) { unsigned char buf[20]; @@ -1308,7 +1311,7 @@ int mapif_party_membermoved(struct party *p, int idx) } //Dissolution party notification -int mapif_party_broken(int party_id, int flag) +static int mapif_party_broken(int party_id, int flag) { unsigned char buf[16]; WBUFW(buf, 0) = 0x3826; @@ -1320,7 +1323,7 @@ int mapif_party_broken(int party_id, int flag) } //Remarks in the party -int mapif_party_message(int party_id, int account_id, const char *mes, int len, int sfd) +static int mapif_party_message(int party_id, int account_id, const char *mes, int len, int sfd) { unsigned char buf[512]; nullpo_ret(mes); @@ -1334,7 +1337,7 @@ int mapif_party_message(int party_id, int account_id, const char *mes, int len, } // Create Party -int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const struct party_member *leader) +static int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const struct party_member *leader) { struct party_data *p; @@ -1355,7 +1358,7 @@ int mapif_parse_CreateParty(int fd, const char *name, int item, int item2, const } // Party information request -void mapif_parse_PartyInfo(int fd, int party_id, int char_id) +static void mapif_parse_PartyInfo(int fd, int party_id, int char_id) { struct party_data *p; p = inter_party->fromsql(party_id); @@ -1367,7 +1370,7 @@ void mapif_parse_PartyInfo(int fd, int party_id, int char_id) } // Add a player to party request -int mapif_parse_PartyAddMember(int fd, int party_id, const struct party_member *member) +static int mapif_parse_PartyAddMember(int fd, int party_id, const struct party_member *member) { nullpo_ret(member); @@ -1381,47 +1384,47 @@ int mapif_parse_PartyAddMember(int fd, int party_id, const struct party_member * } //Party setting change request -int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) +static int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) { inter_party->change_option(party_id, account_id, exp, item, fd); return 0; } //Request leave party -int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) +static int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) { inter_party->leave(party_id, account_id, char_id); return 0; } // When member goes to other map or levels up. -int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv) +static int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv) { inter_party->change_map(party_id, account_id, char_id, map, online, lv); return 0; } //Request party dissolution -int mapif_parse_BreakParty(int fd, int party_id) +static int mapif_parse_BreakParty(int fd, int party_id) { inter_party->disband(party_id); return 0; } //Party sending the message -int mapif_parse_PartyMessage(int fd, int party_id, int account_id, const char *mes, int len) +static int mapif_parse_PartyMessage(int fd, int party_id, int account_id, const char *mes, int len) { return mapif->party_message(party_id, account_id, mes, len, fd); } -int mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id) +static int mapif_parse_PartyLeaderChange(int fd, int party_id, int account_id, int char_id) { if (!inter_party->change_leader(party_id, account_id, char_id)) return 0; return 1; } -int mapif_pet_created(int fd, int account_id, struct s_pet *p) +static int mapif_pet_created(int fd, int account_id, struct s_pet *p) { WFIFOHEAD(fd, 12); WFIFOW(fd, 0) = 0x3880; @@ -1439,7 +1442,7 @@ int mapif_pet_created(int fd, int account_id, struct s_pet *p) return 0; } -int mapif_pet_info(int fd, int account_id, struct s_pet *p) +static int mapif_pet_info(int fd, int account_id, struct s_pet *p) { nullpo_ret(p); WFIFOHEAD(fd, sizeof(struct s_pet) + 9); @@ -1453,7 +1456,7 @@ int mapif_pet_info(int fd, int account_id, struct s_pet *p) return 0; } -int mapif_pet_noinfo(int fd, int account_id) +static int mapif_pet_noinfo(int fd, int account_id) { WFIFOHEAD(fd, sizeof(struct s_pet) + 9); WFIFOW(fd, 0) = 0x3881; @@ -1466,7 +1469,7 @@ int mapif_pet_noinfo(int fd, int account_id) return 0; } -int mapif_save_pet_ack(int fd, int account_id, int flag) +static int mapif_save_pet_ack(int fd, int account_id, int flag) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3882; @@ -1477,7 +1480,7 @@ int mapif_save_pet_ack(int fd, int account_id, int flag) return 0; } -int mapif_delete_pet_ack(int fd, int flag) +static int mapif_delete_pet_ack(int fd, int flag) { WFIFOHEAD(fd, 3); WFIFOW(fd, 0) = 0x3883; @@ -1487,7 +1490,7 @@ int mapif_delete_pet_ack(int fd, int flag) return 0; } -int mapif_save_pet(int fd, int account_id, const struct s_pet *data) +static int mapif_save_pet(int fd, int account_id, const struct s_pet *data) { //here process pet save request. int len; @@ -1505,14 +1508,14 @@ int mapif_save_pet(int fd, int account_id, const struct s_pet *data) return 0; } -int mapif_delete_pet(int fd, int pet_id) +static int mapif_delete_pet(int fd, int pet_id) { mapif->delete_pet_ack(fd, inter_pet->delete_(pet_id)); return 0; } -int mapif_parse_CreatePet(int fd) +static int mapif_parse_CreatePet(int fd) { int account_id; struct s_pet *pet; @@ -1530,7 +1533,7 @@ int mapif_parse_CreatePet(int fd) return 0; } -int mapif_parse_LoadPet(int fd) +static int mapif_parse_LoadPet(int fd) { int account_id; struct s_pet *pet; @@ -1546,21 +1549,21 @@ int mapif_parse_LoadPet(int fd) return 0; } -int mapif_parse_SavePet(int fd) +static int mapif_parse_SavePet(int fd) { RFIFOHEAD(fd); mapif->save_pet(fd, RFIFOL(fd, 4), RFIFOP(fd, 8)); return 0; } -int mapif_parse_DeletePet(int fd) +static int mapif_parse_DeletePet(int fd) { RFIFOHEAD(fd); mapif->delete_pet(fd, RFIFOL(fd, 2)); return 0; } -void mapif_quest_save_ack(int fd, int char_id, bool success) +static void mapif_quest_save_ack(int fd, int char_id, bool success) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3861; @@ -1576,7 +1579,7 @@ void mapif_quest_save_ack(int fd, int char_id, bool success) * * @see inter_parse_frommap */ -int mapif_parse_quest_save(int fd) +static int mapif_parse_quest_save(int fd) { int num = (RFIFOW(fd, 2) - 8) / sizeof(struct quest); int char_id = RFIFOL(fd, 4); @@ -1594,7 +1597,7 @@ int mapif_parse_quest_save(int fd) return 0; } -void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests) +static void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_quests) { WFIFOHEAD(fd,num_quests*sizeof(struct quest) + 8); WFIFOW(fd, 0) = 0x3860; @@ -1618,7 +1621,7 @@ void mapif_send_quests(int fd, int char_id, struct quest *tmp_questlog, int num_ * * @see inter_parse_frommap */ -int mapif_parse_quest_load(int fd) +static int mapif_parse_quest_load(int fd) { int char_id = RFIFOL(fd,2); struct quest *tmp_questlog = NULL; @@ -1638,7 +1641,7 @@ int mapif_parse_quest_load(int fd) /*========================================== * Inbox Request *------------------------------------------*/ -void mapif_parse_rodex_requestinbox(int fd) +static void mapif_parse_rodex_requestinbox(int fd) { int count; int char_id = RFIFOL(fd,2); @@ -1657,7 +1660,7 @@ void mapif_parse_rodex_requestinbox(int fd) VECTOR_CLEAR(mails); } -void mapif_rodex_sendinbox(int fd, int char_id, int8 opentype, int8 flag, int count, int64 mail_id, struct rodex_maillist *mails) +static void mapif_rodex_sendinbox(int fd, int char_id, int8 opentype, int8 flag, int count, int64 mail_id, struct rodex_maillist *mails) { int per_packet = (UINT16_MAX - 24) / sizeof(struct rodex_message); int sent = 0; @@ -1706,7 +1709,7 @@ void mapif_rodex_sendinbox(int fd, int char_id, int8 opentype, int8 flag, int co /*========================================== * Checks if there are new mails *------------------------------------------*/ -void mapif_parse_rodex_checkhasnew(int fd) +static void mapif_parse_rodex_checkhasnew(int fd) { int char_id = RFIFOL(fd, 2); int account_id = RFIFOL(fd, 6); @@ -1719,7 +1722,7 @@ void mapif_parse_rodex_checkhasnew(int fd) mapif->rodex_sendhasnew(fd, char_id, has_new); } -void mapif_rodex_sendhasnew(int fd, int char_id, bool has_new) +static void mapif_rodex_sendhasnew(int fd, int char_id, bool has_new) { Assert_retv(char_id > 0); @@ -1733,7 +1736,7 @@ void mapif_rodex_sendhasnew(int fd, int char_id, bool has_new) /*========================================== * Update/Delete mail *------------------------------------------*/ -void mapif_parse_rodex_updatemail(int fd) +static void mapif_parse_rodex_updatemail(int fd) { int64 mail_id = RFIFOL(fd, 2); int8 flag = RFIFOB(fd, 10); @@ -1744,7 +1747,7 @@ void mapif_parse_rodex_updatemail(int fd) /*========================================== * Send Mail *------------------------------------------*/ -void mapif_parse_rodex_send(int fd) +static void mapif_parse_rodex_send(int fd) { struct rodex_message msg = { 0 }; @@ -1758,7 +1761,7 @@ void mapif_parse_rodex_send(int fd) mapif->rodex_send(fd, msg.sender_id, msg.receiver_id, msg.receiver_accountid, msg.id > 0 ? true : false); } -void mapif_rodex_send(int fd, int sender_id, int receiver_id, int receiver_accountid, bool result) +static void mapif_rodex_send(int fd, int sender_id, int receiver_id, int receiver_accountid, bool result) { Assert_retv(sender_id >= 0); Assert_retv(receiver_id + receiver_accountid > 0); @@ -1775,7 +1778,7 @@ void mapif_rodex_send(int fd, int sender_id, int receiver_id, int receiver_accou /*------------------------------------------ * Check Player *------------------------------------------*/ -void mapif_parse_rodex_checkname(int fd) +static void mapif_parse_rodex_checkname(int fd) { int reqchar_id = RFIFOL(fd, 2); char name[NAME_LENGTH]; @@ -1790,7 +1793,7 @@ void mapif_parse_rodex_checkname(int fd) mapif->rodex_checkname(fd, reqchar_id, 0, 0, 0, name); } -void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, short target_class, int target_level, char *name) +static void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, short target_class, int target_level, char *name) { nullpo_retv(name); Assert_retv(reqchar_id > 0); @@ -1806,7 +1809,7 @@ void mapif_rodex_checkname(int fd, int reqchar_id, int target_char_id, short tar WFIFOSET(fd, 16 + NAME_LENGTH); } -int mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag) +static int mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag) { if (SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id)) { Sql_ShowDebug(inter->sql_handle); @@ -1833,7 +1836,7 @@ int mapif_load_guild_storage(int fd, int account_id, int guild_id, char flag) return 0; } -int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail) +static int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail) { WFIFOHEAD(fd, 11); WFIFOW(fd, 0) = 0x3819; @@ -1851,7 +1854,7 @@ int mapif_save_guild_storage_ack(int fd, int account_id, int guild_id, int fail) * @param account_id [in] account id of the session. * @return 1 on success, 0 on failure. */ -int mapif_account_storage_load(int fd, int account_id) +static int mapif_account_storage_load(int fd, int account_id) { struct storage_data stor = { 0 }; int count = 0, i = 0, len = 0; @@ -1882,7 +1885,7 @@ int mapif_account_storage_load(int fd, int account_id) * @param fd [in] file/socket descriptor * @return 1 on success, 0 on failure. */ -int mapif_parse_AccountStorageLoad(int fd) +static int mapif_parse_AccountStorageLoad(int fd) { int account_id = RFIFOL(fd, 2); @@ -1900,7 +1903,7 @@ int mapif_parse_AccountStorageLoad(int fd) * @param fd [in] file/socket descriptor. * @return 1 on success, 0 on failure. */ -int mapif_parse_AccountStorageSave(int fd) +static int mapif_parse_AccountStorageSave(int fd) { int payload_size = RFIFOW(fd, 2) - 8, account_id = RFIFOL(fd, 4); int i = 0, count = 0; @@ -1942,7 +1945,7 @@ int mapif_parse_AccountStorageSave(int fd) * @param account_id [in] Account ID of the storage in question. * @param flag [in] Save flag, true for success and false for failure. */ -void mapif_send_AccountStorageSaveAck(int fd, int account_id, bool flag) +static void mapif_send_AccountStorageSaveAck(int fd, int account_id, bool flag) { WFIFOHEAD(fd, 7); WFIFOW(fd, 0) = 0x3808; @@ -1951,7 +1954,7 @@ void mapif_send_AccountStorageSaveAck(int fd, int account_id, bool flag) WFIFOSET(fd, 7); } -int mapif_parse_LoadGuildStorage(int fd) +static int mapif_parse_LoadGuildStorage(int fd) { RFIFOHEAD(fd); @@ -1960,7 +1963,7 @@ int mapif_parse_LoadGuildStorage(int fd) return 0; } -int mapif_parse_SaveGuildStorage(int fd) +static int mapif_parse_SaveGuildStorage(int fd) { int guild_id; int len; @@ -1980,7 +1983,7 @@ int mapif_parse_SaveGuildStorage(int fd) return 0; } -int mapif_itembound_ack(int fd, int aid, int guild_id) +static int mapif_itembound_ack(int fd, int aid, int guild_id) { #ifdef GP_BOUND_ITEMS WFIFOHEAD(fd, 8); @@ -1992,7 +1995,7 @@ int mapif_itembound_ack(int fd, int aid, int guild_id) return 0; } -void mapif_parse_ItemBoundRetrieve(int fd) +static void mapif_parse_ItemBoundRetrieve(int fd) { #ifdef GP_BOUND_ITEMS int char_id = RFIFOL(fd, 2); @@ -2012,7 +2015,7 @@ void mapif_parse_ItemBoundRetrieve(int fd) mapif->itembound_ack(fd, RFIFOL(fd, 6), RFIFOW(fd, 10)); } -void mapif_parse_accinfo(int fd) +static void mapif_parse_accinfo(int fd) { char query[NAME_LENGTH]; int u_fd = RFIFOL(fd, 2), aid = RFIFOL(fd, 6), castergroup = RFIFOL(fd, 10); @@ -2023,7 +2026,7 @@ void mapif_parse_accinfo(int fd) } // broadcast sending -int mapif_broadcast(const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) +static int mapif_broadcast(const unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char)); @@ -2044,7 +2047,7 @@ int mapif_broadcast(const unsigned char *mes, int len, unsigned int fontColor, s } // Wis sending -int mapif_wis_message(struct WisData *wd) +static int mapif_wis_message(struct WisData *wd) { unsigned char buf[2048]; nullpo_ret(wd); @@ -2065,7 +2068,7 @@ int mapif_wis_message(struct WisData *wd) return 0; } -void mapif_wis_response(int fd, const unsigned char *src, int flag) +static void mapif_wis_response(int fd, const unsigned char *src, int flag) { unsigned char buf[27]; nullpo_retv(src); @@ -2076,7 +2079,7 @@ void mapif_wis_response(int fd, const unsigned char *src, int flag) } // Wis sending result -int mapif_wis_end(struct WisData *wd, int flag) +static int mapif_wis_end(struct WisData *wd, int flag) { nullpo_ret(wd); mapif->wis_response(wd->fd, wd->src, flag); @@ -2094,14 +2097,14 @@ static void mapif_account_reg(int fd, unsigned char *src) #endif // 0 // Send the requested account_reg -int mapif_account_reg_reply(int fd,int account_id,int char_id, int type) +static int mapif_account_reg_reply(int fd,int account_id,int char_id, int type) { inter->accreg_fromsql(account_id, char_id, fd, type); return 0; } //Request to kick char from a certain map server. [Skotlex] -int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) +static int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) { if (fd < 0) return -1; @@ -2115,14 +2118,14 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason) } // broadcast sending -int mapif_parse_broadcast(int fd) +static int mapif_parse_broadcast(int fd) { mapif->broadcast(RFIFOP(fd, 16), RFIFOW(fd, 2), RFIFOL(fd, 4), RFIFOW(fd, 8), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), fd); return 0; } // Wisp/page request to send -int mapif_parse_WisRequest(int fd) +static int mapif_parse_WisRequest(int fd) { struct WisData* wd; char name[NAME_LENGTH]; @@ -2166,7 +2169,7 @@ int mapif_parse_WisRequest(int fd) } // Wisp/page transmission result -int mapif_parse_WisReply(int fd) +static int mapif_parse_WisReply(int fd) { int id, flag; struct WisData *wd; @@ -2186,7 +2189,7 @@ int mapif_parse_WisReply(int fd) } // Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers) -int mapif_parse_WisToGM(int fd) +static int mapif_parse_WisToGM(int fd) { unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B @@ -2198,7 +2201,7 @@ int mapif_parse_WisToGM(int fd) } // Save account_reg into sql (type=2) -int mapif_parse_Registry(int fd) +static int mapif_parse_Registry(int fd) { int account_id = RFIFOL(fd, 4), char_id = RFIFOL(fd, 8), count = RFIFOW(fd, 12); @@ -2251,7 +2254,7 @@ int mapif_parse_Registry(int fd) } // Request the value of all registries. -int mapif_parse_RegistryRequest(int fd) +static int mapif_parse_RegistryRequest(int fd) { //Load Char Registry if (RFIFOB(fd, 12)) @@ -2265,7 +2268,7 @@ int mapif_parse_RegistryRequest(int fd) return 1; } -void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, const char *const name) +static void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, const char *const name) { nullpo_retv(name); WFIFOHEAD(fd, NAME_LENGTH+13); @@ -2278,7 +2281,7 @@ void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int fla WFIFOSET(fd, NAME_LENGTH + 13); } -int mapif_parse_NameChangeRequest(int fd) +static int mapif_parse_NameChangeRequest(int fd) { int account_id, char_id, type; const char *name; @@ -2313,7 +2316,7 @@ int mapif_parse_NameChangeRequest(int fd) } // Clan System -int mapif_parse_ClanMemberKick(int fd, int clan_id, int kick_interval) +static int mapif_parse_ClanMemberKick(int fd, int clan_id, int kick_interval) { int count = 0; @@ -2328,7 +2331,7 @@ int mapif_parse_ClanMemberKick(int fd, int clan_id, int kick_interval) return 0; } -int mapif_parse_ClanMemberCount(int fd, int clan_id, int kick_interval) +static int mapif_parse_ClanMemberCount(int fd, int clan_id, int kick_interval) { WFIFOHEAD(fd, 10); WFIFOW(fd, 0) = 0x3858; @@ -2338,10 +2341,8 @@ int mapif_parse_ClanMemberCount(int fd, int clan_id, int kick_interval) return 0; } -struct mapif_interface mapif_s; -struct mapif_interface *mapif; - -void mapif_defaults(void) { +void mapif_defaults(void) +{ mapif = &mapif_s; mapif->ban = mapif_ban; diff --git a/src/char/pincode.c b/src/char/pincode.c index 8fc4e6c36..5a7eb1cab 100644 --- a/src/char/pincode.c +++ b/src/char/pincode.c @@ -37,10 +37,10 @@ #include <stdio.h> #include <stdlib.h> -struct pincode_interface pincode_s; +static struct pincode_interface pincode_s; struct pincode_interface *pincode; -void pincode_handle (int fd, struct char_session_data* sd) +static void pincode_handle(int fd, struct char_session_data *sd) { struct online_char_data* character; @@ -72,7 +72,7 @@ void pincode_handle (int fd, struct char_session_data* sd) character->pincode_enable = -1; } -void pincode_check(int fd, struct char_session_data* sd) +static void pincode_check(int fd, struct char_session_data *sd) { char pin[5] = "\0\0\0\0"; @@ -104,12 +104,12 @@ void pincode_check(int fd, struct char_session_data* sd) } /** -* Check if this pincode is blacklisted or not -* -* @param (const char *) pin The pin to be verified -* @return bool -*/ -bool pincode_isBlacklisted(const char *pin) + * Check if this pincode is blacklisted or not + * + * @param (const char *) pin The pin to be verified + * @return bool + */ +static bool pincode_isBlacklisted(const char *pin) { int i; @@ -124,7 +124,7 @@ bool pincode_isBlacklisted(const char *pin) return false; } -int pincode_compare(int fd, struct char_session_data* sd, char* pin) +static int pincode_compare(int fd, struct char_session_data *sd, char *pin) { nullpo_ret(sd); nullpo_ret(pin); @@ -142,7 +142,7 @@ int pincode_compare(int fd, struct char_session_data* sd, char* pin) } } -void pincode_change(int fd, struct char_session_data* sd) +static void pincode_change(int fd, struct char_session_data *sd) { char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0"; @@ -174,7 +174,7 @@ void pincode_change(int fd, struct char_session_data* sd) pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK); } -void pincode_setnew(int fd, struct char_session_data* sd) +static void pincode_setnew(int fd, struct char_session_data *sd) { char newpin[5] = "\0\0\0\0"; @@ -198,13 +198,13 @@ void pincode_setnew(int fd, struct char_session_data* sd) } /** -* Send state of making new pincode -* -* @param[in] fd -* @param[in, out] sd Session Data -* @param[in] state Pincode Edit State -*/ -void pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) + * Send state of making new pincode + * + * @param[in] fd + * @param[in, out] sd Session Data + * @param[in] state Pincode Edit State + */ +static void pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) { nullpo_retv(sd); @@ -216,13 +216,13 @@ void pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_r } /** -* Send state of editing pincode -* -* @param[in] fd -* @param[in, out] sd Session Data -* @param[in] state Pincode Edit State -*/ -void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) + * Send state of editing pincode + * + * @param[in] fd + * @param[in, out] sd Session Data + * @param[in] state Pincode Edit State + */ +static void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) { nullpo_retv(sd); @@ -242,7 +242,7 @@ void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_r // 6 = client shows msgstr(1897) Unable to use your KSSN number // 7 = char select window shows a button - client sends 0x8c5 // 8 = pincode was incorrect -void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login_response state) +static void pincode_loginstate(int fd, struct char_session_data *sd, enum pincode_login_response state) { nullpo_retv(sd); @@ -265,7 +265,7 @@ void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login // 8 = pincode was incorrect // [4144] pincode_loginstate2 can replace pincode_loginstate, // but kro using pincode_loginstate2 only for send wrong pin error or locked after 3 pins wrong -void pincode_loginstate2(int fd, struct char_session_data* sd, enum pincode_login_response state, enum pincode_login_response2 flag) +static void pincode_loginstate2(int fd, struct char_session_data *sd, enum pincode_login_response state, enum pincode_login_response2 flag) { #if PACKETVER_MAIN_NUM >= 20180124 || PACKETVER_RE_NUM >= 20180124 || PACKETVER_ZERO_NUM >= 20180131 nullpo_retv(sd); @@ -280,7 +280,7 @@ void pincode_loginstate2(int fd, struct char_session_data* sd, enum pincode_logi #endif } -void pincode_notifyLoginPinUpdate(int account_id, char* pin) +static void pincode_notifyLoginPinUpdate(int account_id, char *pin) { nullpo_retv(pin); @@ -292,7 +292,7 @@ void pincode_notifyLoginPinUpdate(int account_id, char* pin) WFIFOSET(chr->login_fd, 11); } -void pincode_notifyLoginPinError(int account_id) +static void pincode_notifyLoginPinError(int account_id) { WFIFOHEAD(chr->login_fd, 6); WFIFOW(chr->login_fd, 0) = 0x2739; @@ -300,7 +300,7 @@ void pincode_notifyLoginPinError(int account_id) WFIFOSET(chr->login_fd, 6); } -void pincode_decrypt(unsigned int userSeed, char* pin) +static void pincode_decrypt(unsigned int userSeed, char *pin) { int i; char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; @@ -337,7 +337,7 @@ void pincode_decrypt(unsigned int userSeed, char* pin) * * @retval false in case of error. */ -bool pincode_config_read(const char *filename, const struct config_t *config, bool imported) +static bool pincode_config_read(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; const struct config_setting_t *temp = NULL; @@ -426,12 +426,12 @@ bool pincode_config_read(const char *filename, const struct config_t *config, bo return true; } -void do_pincode_init(void) +static void do_pincode_init(void) { VECTOR_INIT(pincode->blacklist); } -void do_pincode_final(void) +static void do_pincode_final(void) { while (VECTOR_LENGTH(pincode->blacklist) > 0) { aFree(VECTOR_POP(pincode->blacklist)); |