diff options
author | Haru <haru@dotalux.com> | 2018-07-01 21:51:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-01 21:51:00 +0200 |
commit | 0a151c27ebef40f965cd87f436c72c044a3284ac (patch) | |
tree | d2892f1fe37846f56da93c89aa0b29e9442205ca | |
parent | 392238d4a9fe4ca3cc68098d9709c27c92409c8b (diff) | |
parent | 42f7eb821648b0076163faf968a83ab5dd2ce672 (diff) | |
download | hercules-0a151c27ebef40f965cd87f436c72c044a3284ac.tar.gz hercules-0a151c27ebef40f965cd87f436c72c044a3284ac.tar.bz2 hercules-0a151c27ebef40f965cd87f436c72c044a3284ac.tar.xz hercules-0a151c27ebef40f965cd87f436c72c044a3284ac.zip |
Merge pull request #2112 from MishimaHaruna/staticfunctions
Staticfunctions
87 files changed, 6920 insertions, 5517 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)); diff --git a/src/common/HPM.c b/src/common/HPM.c index c84b447e8..300edf60a 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -48,25 +48,25 @@ # include <unistd.h> #endif -struct malloc_interface iMalloc_HPM; -struct malloc_interface *HPMiMalloc; -struct HPM_interface HPM_s; +static struct malloc_interface iMalloc_HPM; +static struct malloc_interface *HPMiMalloc; +static struct HPM_interface HPM_s; struct HPM_interface *HPM; -struct HPMHooking_core_interface HPMHooking_core_s; +static struct HPMHooking_core_interface HPMHooking_core_s; /** * (char*) data name -> (unsigned int) HPMDataCheck[] index **/ -struct DBMap *datacheck_db; -int datacheck_version; -const struct s_HPMDataCheck *datacheck_data; +static struct DBMap *datacheck_db; +static int datacheck_version; +static const struct s_HPMDataCheck *datacheck_data; /** * Executes an event on all loaded plugins. * * @param type The event type to trigger. */ -void hplugin_trigger_event(enum hp_event_types type) +static void hplugin_trigger_event(enum hp_event_types type) { int i; for (i = 0; i < VECTOR_LENGTH(HPM->plugins); i++) { @@ -82,7 +82,7 @@ void hplugin_trigger_event(enum hp_event_types type) * @param value The symbol value. * @param name The symbol name. */ -void hplugin_export_symbol(void *value, const char *name) +static void hplugin_export_symbol(void *value, const char *name) { struct hpm_symbol *symbol = NULL; CREATE(symbol ,struct hpm_symbol, 1); @@ -100,7 +100,7 @@ void hplugin_export_symbol(void *value, const char *name) * @return The symbol value. * @retval NULL if the symbol wasn't found. */ -void *hplugin_import_symbol(char *name, unsigned int pID) +static void *hplugin_import_symbol(char *name, unsigned int pID) { int i; nullpo_retr(NULL, name); @@ -113,7 +113,8 @@ void *hplugin_import_symbol(char *name, unsigned int pID) return NULL; } -bool hplugin_iscompatible(char* version) { +static bool hplugin_iscompatible(char *version) +{ unsigned int req_major = 0, req_minor = 0; if( version == NULL ) @@ -131,7 +132,7 @@ bool hplugin_iscompatible(char* version) { * @retval true if the plugin exists and is currently loaded. * @retval false otherwise. */ -bool hplugin_exists(const char *filename) +static bool hplugin_exists(const char *filename) { int i; nullpo_retr(false, filename); @@ -147,7 +148,7 @@ bool hplugin_exists(const char *filename) * * @return A (retained) pointer to the initialized data. */ -struct hplugin *hplugin_create(void) +static struct hplugin *hplugin_create(void) { struct hplugin *plugin = NULL; CREATE(plugin, struct hplugin, 1); @@ -158,7 +159,7 @@ struct hplugin *hplugin_create(void) return plugin; } -bool hplugins_addpacket(unsigned short cmd, unsigned short length, void (*receive) (int fd), unsigned int point, unsigned int pluginID) +static bool hplugins_addpacket(unsigned short cmd, unsigned short length, void (*receive) (int fd), unsigned int point, unsigned int pluginID) { struct HPluginPacket *packet; int i; @@ -204,7 +205,7 @@ bool hplugins_addpacket(unsigned short cmd, unsigned short length, void (*receiv * initialized through \c HPM->data_store_create() and ownership is passed * to the caller. */ -bool hplugin_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize) +static bool hplugin_data_store_validate(enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize) { struct hplugin_data_store *store; nullpo_retr(false, storeptr); @@ -248,7 +249,7 @@ bool hplugin_data_store_validate(enum HPluginDataTypes type, struct hplugin_data * @param classid[in] The entry class identifier. * @param autofree[in] Whether the entry should be automatically freed when removed. */ -void hplugins_addToHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, bool autofree) +static void hplugins_addToHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store **storeptr, void *data, uint32 classid, bool autofree) { struct hplugin_data_store *store; struct hplugin_data_entry *entry; @@ -293,7 +294,7 @@ void hplugins_addToHPData(enum HPluginDataTypes type, uint32 pluginID, struct hp * * @return The retrieved entry, or NULL. */ -void *hplugins_getFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid) +static void *hplugins_getFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid) { int i; @@ -320,7 +321,7 @@ void *hplugins_getFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct * @param store[in] The store. * @param classid[in] The entry class identifier. */ -void hplugins_removeFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid) +static void hplugins_removeFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid) { struct hplugin_data_entry *entry; int i; @@ -344,7 +345,7 @@ void hplugins_removeFromHPData(enum HPluginDataTypes type, uint32 pluginID, stru } /* TODO: add ability for tracking using pID for the upcoming runtime load/unload support. */ -bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) +static bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) { if (!HPM->hooking->enabled) { ShowError("HPM:AddHook Fail! '%s' tried to hook to '%s' but HPMHooking is disabled!\n",HPM->pid2name(pID),target); @@ -360,13 +361,13 @@ bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsi return false; } -void HPM_HookStop(const char *func, unsigned int pID) +static void HPM_HookStop(const char *func, unsigned int pID) { /* track? */ HPM->hooking->force_return = true; } -bool HPM_HookStopped(void) +static bool HPM_HookStopped(void) { return HPM->hooking->force_return; } @@ -381,7 +382,7 @@ bool HPM_HookStopped(void) * @param help the help string to be displayed by '--help', if any. * @return the success status. */ -bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help) +static bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help) { int i; @@ -410,7 +411,7 @@ bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, CmdlineExecF * @retval true if the listener was added successfully. * @retval false in case of error. */ -bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key), bool required) +static bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *name, void (*parse_func) (const char *key, const char *val), int (*return_func) (const char *key), bool required) { struct HPConfListenStorage *conf; int i; @@ -450,7 +451,7 @@ bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *na return true; } -struct hplugin *hplugin_load(const char* filename) +static struct hplugin *hplugin_load(const char *filename) { struct hplugin *plugin; struct hplugin_info *info; @@ -598,7 +599,7 @@ struct hplugin *hplugin_load(const char* filename) * * @param plugin The plugin data. */ -void hplugin_unload(struct hplugin* plugin) +static void hplugin_unload(struct hplugin *plugin) { int i; nullpo_retv(plugin); @@ -628,7 +629,7 @@ CMDLINEARG(loadplugin) /** * Reads the plugin configuration and loads the plugins as necessary. */ -void hplugins_config_read(void) +static void hplugins_config_read(void) { struct config_t plugins_conf; struct config_setting_t *plist = NULL; @@ -707,7 +708,7 @@ void hplugins_config_read(void) * * @see CPCMD() */ -CPCMD(plugins) +static CPCMD(plugins) { int i; @@ -733,7 +734,7 @@ CPCMD(plugins) * @retval 1 OK * @retval 2 incomplete packet */ -unsigned char hplugins_parse_packets(int fd, int packet_id, enum HPluginPacketHookingPoints point) +static unsigned char hplugins_parse_packets(int fd, int packet_id, enum HPluginPacketHookingPoints point) { struct HPluginPacket *packet = NULL; int i; @@ -765,7 +766,7 @@ unsigned char hplugins_parse_packets(int fd, int packet_id, enum HPluginPacketHo * @retval "core" if the plugin ID belongs to the Hercules core. * @retval "UnknownPlugin" if the plugin wasn't found. */ -char *hplugins_id2name(unsigned int pid) +static char *hplugins_id2name(unsigned int pid) { int i; @@ -791,7 +792,7 @@ char *hplugins_id2name(unsigned int pid) * @param file The string/filename to retain * @return A retained copy of the source string. */ -const char *HPM_file2ptr(const char *file) +static const char *HPM_file2ptr(const char *file) { int i; @@ -810,27 +811,27 @@ const char *HPM_file2ptr(const char *file) return HPM->filenames.data[i].name; } -void* HPM_mmalloc(size_t size, const char *file, int line, const char *func) +static void *HPM_mmalloc(size_t size, const char *file, int line, const char *func) { return iMalloc->malloc(size,HPM_file2ptr(file),line,func); } -void* HPM_calloc(size_t num, size_t size, const char *file, int line, const char *func) +static void *HPM_calloc(size_t num, size_t size, const char *file, int line, const char *func) { return iMalloc->calloc(num,size,HPM_file2ptr(file),line,func); } -void* HPM_realloc(void *p, size_t size, const char *file, int line, const char *func) +static void *HPM_realloc(void *p, size_t size, const char *file, int line, const char *func) { return iMalloc->realloc(p,size,HPM_file2ptr(file),line,func); } -void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char *func) +static void *HPM_reallocz(void *p, size_t size, const char *file, int line, const char *func) { return iMalloc->reallocz(p,size,HPM_file2ptr(file),line,func); } -char* HPM_astrdup(const char *p, const char *file, int line, const char *func) +static char *HPM_astrdup(const char *p, const char *file, int line, const char *func) { return iMalloc->astrdup(p,HPM_file2ptr(file),line,func); } @@ -844,7 +845,7 @@ char* HPM_astrdup(const char *p, const char *file, int line, const char *func) * @retval true if a registered plugin was found to handle the entry. * @retval false if no registered plugins could be found. */ -bool hplugins_parse_conf_entry(const char *w1, const char *w2, enum HPluginConfType point) +static bool hplugins_parse_conf_entry(const char *w1, const char *w2, enum HPluginConfType point) { int i; ARR_FIND(0, VECTOR_LENGTH(HPM->config_listeners[point]), i, strcmpi(w1, VECTOR_INDEX(HPM->config_listeners[point], i).key) == 0); @@ -863,7 +864,7 @@ bool hplugins_parse_conf_entry(const char *w1, const char *w2, enum HPluginConfT * @retval true in case of data found * @retval false in case of no data found */ -bool hplugins_get_battle_conf(const char *w1, int *value) +static bool hplugins_get_battle_conf(const char *w1, int *value) { int i; @@ -887,7 +888,7 @@ bool hplugins_get_battle_conf(const char *w1, int *value) * @param imported Whether the current config is imported from another file. * @retval false in case of error. */ -bool hplugins_parse_conf(const struct config_t *config, const char *filename, enum HPluginConfType point, bool imported) +static bool hplugins_parse_conf(const struct config_t *config, const char *filename, enum HPluginConfType point, bool imported) { const struct config_setting_t *setting = NULL; int i, val, type; @@ -940,7 +941,7 @@ bool hplugins_parse_conf(const struct config_t *config, const char *filename, en * @param imported whether the current config is imported from another file. * @retval false in case of error. */ -bool hplugins_parse_battle_conf(const struct config_t *config, const char *filename, bool imported) +static bool hplugins_parse_battle_conf(const struct config_t *config, const char *filename, bool imported) { const struct config_setting_t *setting = NULL; int i, val, type; @@ -985,7 +986,7 @@ bool hplugins_parse_battle_conf(const struct config_t *config, const char *filen * * @param storeptr[in,out] A pointer to the plugin data store. */ -void hplugin_data_store_destroy(struct hplugin_data_store **storeptr) +static void hplugin_data_store_destroy(struct hplugin_data_store **storeptr) { struct hplugin_data_store *store; nullpo_retv(storeptr); @@ -1014,7 +1015,7 @@ void hplugin_data_store_destroy(struct hplugin_data_store **storeptr) * @param storeptr[in,out] A pointer to the data store to initialize. * @param type[in] The store type. */ -void hplugin_data_store_create(struct hplugin_data_store **storeptr, enum HPluginDataTypes type) +static void hplugin_data_store_create(struct hplugin_data_store **storeptr, enum HPluginDataTypes type) { struct hplugin_data_store *store; nullpo_retv(storeptr); @@ -1031,7 +1032,7 @@ void hplugin_data_store_create(struct hplugin_data_store **storeptr, enum HPlugi /** * Called by HPM->DataCheck on a plugins incoming data, ensures data structs in use are matching! **/ -bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, char *name) +static bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, char *name) { unsigned int i, j; @@ -1060,7 +1061,7 @@ bool HPM_DataCheck(struct s_HPMDataCheck *src, unsigned int size, int version, c return true; } -void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, int version) +static void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, int version) { unsigned int i; @@ -1077,12 +1078,12 @@ void HPM_datacheck_init(const struct s_HPMDataCheck *src, unsigned int length, i } } -void HPM_datacheck_final(void) +static void HPM_datacheck_final(void) { db_destroy(datacheck_db); } -void hpm_init(void) +static void hpm_init(void) { int i; datacheck_db = NULL; @@ -1126,7 +1127,7 @@ void hpm_init(void) /** * Releases the retained filenames cache. */ -void hpm_memdown(void) +static void hpm_memdown(void) { /* this memory is handled outside of the server's memory manager and * thus cleared after memory manager goes down */ @@ -1141,7 +1142,7 @@ void hpm_memdown(void) } } -void hpm_final(void) +static void hpm_final(void) { int i; diff --git a/src/common/conf.c b/src/common/conf.c index 841288959..0ad350057 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -29,7 +29,7 @@ #include <libconfig/libconfig.h> /* interface source */ -struct libconfig_interface libconfig_s; +static struct libconfig_interface libconfig_s; struct libconfig_interface *libconfig; /** @@ -44,7 +44,7 @@ struct libconfig_interface *libconfig; * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_load_file(struct config_t *config, const char *config_filename) +static int config_load_file(struct config_t *config, const char *config_filename) { libconfig->init(config); if (!exists(config_filename)) { @@ -63,7 +63,7 @@ int config_load_file(struct config_t *config, const char *config_filename) // // Functions to copy settings from libconfig/contrib // -void config_setting_copy_simple(struct config_setting_t *parent, const struct config_setting_t *src) +static void config_setting_copy_simple(struct config_setting_t *parent, const struct config_setting_t *src) { if (config_setting_is_aggregate(src)) { libconfig->setting_copy_aggregate(parent, src); @@ -92,7 +92,7 @@ void config_setting_copy_simple(struct config_setting_t *parent, const struct co } } -void config_setting_copy_elem(struct config_setting_t *parent, const struct config_setting_t *src) +static void config_setting_copy_elem(struct config_setting_t *parent, const struct config_setting_t *src) { struct config_setting_t *set = NULL; @@ -113,7 +113,7 @@ void config_setting_copy_elem(struct config_setting_t *parent, const struct conf } } -void config_setting_copy_aggregate(struct config_setting_t *parent, const struct config_setting_t *src) +static void config_setting_copy_aggregate(struct config_setting_t *parent, const struct config_setting_t *src) { struct config_setting_t *newAgg; int i, n; @@ -137,7 +137,7 @@ void config_setting_copy_aggregate(struct config_setting_t *parent, const struct } } -int config_setting_copy(struct config_setting_t *parent, const struct config_setting_t *src) +static int config_setting_copy(struct config_setting_t *parent, const struct config_setting_t *src) { if (!config_setting_is_group(parent) && !config_setting_is_list(parent)) return CONFIG_FALSE; @@ -158,7 +158,7 @@ int config_setting_copy(struct config_setting_t *parent, const struct config_set * @return The converted value. * @retval false in case of failure. */ -bool config_setting_get_bool_real(const struct config_setting_t *setting) +static bool config_setting_get_bool_real(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_BOOL) return false; @@ -176,7 +176,7 @@ bool config_setting_get_bool_real(const struct config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_bool_real(const struct config_setting_t *setting, const char *name, bool *value) +static int config_setting_lookup_bool_real(const struct config_setting_t *setting, const char *name, bool *value) { struct config_setting_t *member = config_setting_get_member(setting, name); @@ -199,7 +199,7 @@ int config_setting_lookup_bool_real(const struct config_setting_t *setting, cons * @return The converted value. * @retval 0 in case of failure. */ -uint32 config_setting_get_uint32(const struct config_setting_t *setting) +static uint32 config_setting_get_uint32(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -220,7 +220,7 @@ uint32 config_setting_get_uint32(const struct config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_uint32(const struct config_setting_t *setting, const char *name, uint32 *value) +static int config_setting_lookup_uint32(const struct config_setting_t *setting, const char *name, uint32 *value) { struct config_setting_t *member = config_setting_get_member(setting, name); @@ -243,7 +243,7 @@ int config_setting_lookup_uint32(const struct config_setting_t *setting, const c * @return The converted value. * @retval 0 in case of failure. */ -uint16 config_setting_get_uint16(const struct config_setting_t *setting) +static uint16 config_setting_get_uint16(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -266,7 +266,7 @@ uint16 config_setting_get_uint16(const struct config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_uint16(const struct config_setting_t *setting, const char *name, uint16 *value) +static int config_setting_lookup_uint16(const struct config_setting_t *setting, const char *name, uint16 *value) { struct config_setting_t *member = config_setting_get_member(setting, name); @@ -289,7 +289,7 @@ int config_setting_lookup_uint16(const struct config_setting_t *setting, const c * @return The converted value. * @retval 0 in case of failure. */ -int16 config_setting_get_int16(const struct config_setting_t *setting) +static int16 config_setting_get_int16(const struct config_setting_t *setting) { if (setting == NULL || setting->type != CONFIG_TYPE_INT) return 0; @@ -312,7 +312,7 @@ int16 config_setting_get_int16(const struct config_setting_t *setting) * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_int16(const struct config_setting_t *setting, const char *name, int16 *value) +static int config_setting_lookup_int16(const struct config_setting_t *setting, const char *name, int16 *value) { struct config_setting_t *member = config_setting_get_member(setting, name); @@ -338,7 +338,7 @@ int config_setting_lookup_int16(const struct config_setting_t *setting, const ch * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_setting_lookup_mutable_string(const struct config_setting_t *setting, const char *name, char *out, size_t out_size) +static int config_setting_lookup_mutable_string(const struct config_setting_t *setting, const char *name, char *out, size_t out_size) { const char *str = NULL; @@ -361,7 +361,7 @@ int config_setting_lookup_mutable_string(const struct config_setting_t *setting, * @retval CONFIG_TRUE in case of success. * @retval CONFIG_FALSE in case of failure. */ -int config_lookup_mutable_string(const struct config_t *config, const char *name, char *out, size_t out_size) +static int config_lookup_mutable_string(const struct config_t *config, const char *name, char *out, size_t out_size) { const char *str = NULL; @@ -378,7 +378,7 @@ int config_lookup_mutable_string(const struct config_t *config, const char *name * * @see config_setting_get_int64_real() */ -int64 config_setting_get_int64_real(const struct config_setting_t *setting) +static int64 config_setting_get_int64_real(const struct config_setting_t *setting) { return (int64)config_setting_get_int64(setting); } @@ -388,7 +388,7 @@ int64 config_setting_get_int64_real(const struct config_setting_t *setting) * * @see config_setting_lookup_int64() */ -int config_setting_lookup_int64_real(const struct config_setting_t *setting, const char *name, int64 *value) +static int config_setting_lookup_int64_real(const struct config_setting_t *setting, const char *name, int64 *value) { long long int lli = 0; @@ -405,7 +405,7 @@ int config_setting_lookup_int64_real(const struct config_setting_t *setting, con * * @see config_setting_set_int64() */ -int config_setting_set_int64_real(struct config_setting_t *setting, int64 value) +static int config_setting_set_int64_real(struct config_setting_t *setting, int64 value) { return config_setting_set_int64(setting, (long long int)value); } @@ -415,7 +415,7 @@ int config_setting_set_int64_real(struct config_setting_t *setting, int64 value) * * @see config_setting_get_int64_elem() */ -int64 config_setting_get_int64_elem_real(const struct config_setting_t *setting, int idx) +static int64 config_setting_get_int64_elem_real(const struct config_setting_t *setting, int idx) { return (int64)config_setting_get_int64_elem(setting, idx); } @@ -425,7 +425,7 @@ int64 config_setting_get_int64_elem_real(const struct config_setting_t *setting, * * @see config_setting_set_int64_elem() */ -struct config_setting_t *config_setting_set_int64_elem_real(struct config_setting_t *setting, int idx, int64 value) +static struct config_setting_t *config_setting_set_int64_elem_real(struct config_setting_t *setting, int idx, int64 value) { return config_setting_set_int64_elem(setting, idx, (long long int)value); } @@ -435,7 +435,7 @@ struct config_setting_t *config_setting_set_int64_elem_real(struct config_settin * * @see config_lookup_int64() */ -int config_lookup_int64_real(const struct config_t *config, const char *filepath, int64 *value) +static int config_lookup_int64_real(const struct config_t *config, const char *filepath, int64 *value) { long long int lli = 0; diff --git a/src/common/console.c b/src/common/console.c index e7edd7e1e..55a9815f5 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -53,13 +53,13 @@ # endif #endif -struct console_interface console_s; +static struct console_interface console_s; struct console_interface *console; #ifdef CONSOLE_INPUT -struct console_input_interface console_input_s; -struct spin_lock console_ptlock_s; +static struct console_input_interface console_input_s; +static struct spin_lock console_ptlock_s; -struct { +static struct { char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT]; unsigned short count; } cinput; @@ -68,7 +68,7 @@ struct { /*====================================== * CORE : Display title *--------------------------------------*/ -void display_title(void) +static void display_title(void) { const char *vcstype = sysinfo->vcstype(); @@ -98,14 +98,14 @@ void display_title(void) /** * Shows a license notice as per GNU GPL recommendation. */ -void display_gplnotice(void) +static void display_gplnotice(void) { ShowInfo("Hercules, Copyright (C) 2012-2018, Hercules Dev Team and others.\n"); ShowInfo("Licensed under the GNU General Public License, version 3 or later.\n"); } #ifdef CONSOLE_INPUT -int console_parse_key_pressed(void) +static int console_parse_key_pressed(void) { #ifdef WIN32 return _kbhit(); @@ -131,7 +131,7 @@ int console_parse_key_pressed(void) /** * Stops server **/ -CPCMD_C(exit, server) +static CPCMD_C(exit, server) { if (core->shutdown_callback != NULL) core->shutdown_callback(); @@ -142,7 +142,7 @@ CPCMD_C(exit, server) /** * Displays ERS-related statistics (Entry Reusage System) **/ -CPCMD_C(ers_report, server) +static CPCMD_C(ers_report, server) { ers_report(); } @@ -150,7 +150,7 @@ CPCMD_C(ers_report, server) /** * Displays memory usage **/ -CPCMD_C(mem_report, server) +static CPCMD_C(mem_report, server) { #ifdef USE_MEMMGR memmgr_report(line?atoi(line):0); @@ -160,7 +160,7 @@ CPCMD_C(mem_report, server) /** * Displays command list **/ -CPCMD(help) +static CPCMD(help) { int i; for (i = 0; i < VECTOR_LENGTH(console->input->command_list); i++) { @@ -178,7 +178,7 @@ CPCMD(help) * [Ind/Hercules] * Displays current malloc usage */ -CPCMD_C(malloc_usage, server) +static CPCMD_C(malloc_usage, server) { unsigned int val = (unsigned int)iMalloc->usage(); ShowInfo("malloc_usage: %.2f MB\n",(double)(val)/1024); @@ -188,7 +188,7 @@ CPCMD_C(malloc_usage, server) * Skips an sql update * Usage: sql update skip UPDATE-FILE.sql **/ -CPCMD_C(skip, update) +static CPCMD_C(skip, update) { if( !line ) { ShowDebug("usage example: sql update skip 2013-02-14--16-15.sql\n"); @@ -200,7 +200,7 @@ CPCMD_C(skip, update) /** * Loads console commands list **/ -void console_load_defaults(void) +static void console_load_defaults(void) { /** * Defines a main category. @@ -313,7 +313,7 @@ void console_load_defaults(void) * @param name The command name. * @param func The command callback. */ -void console_parse_create(char *name, CParseFunc func) +static void console_parse_create(char *name, CParseFunc func) { int i; char *tok; @@ -370,7 +370,7 @@ void console_parse_create(char *name, CParseFunc func) * @param cmd The command entry. * @param depth The current tree depth (for display purposes). */ -void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) +static void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) { int i; char msg[CP_CMD_LENGTH * 2]; @@ -394,7 +394,7 @@ void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) * * @param line The input line. */ -void console_parse_sub(char *line) +static void console_parse_sub(char *line) { struct CParseEntry *cmd; char bline[200]; @@ -457,7 +457,7 @@ void console_parse_sub(char *line) ShowError("Is only a category, type '"CL_WHITE"%s help"CL_RESET"' to list its subcommands\n",sublist); } -void console_parse(char *line) +static void console_parse(char *line) { int c, i = 0, len = MAX_CONSOLE_INPUT - 1;/* we leave room for the \0 :P */ @@ -474,7 +474,7 @@ void console_parse(char *line) line[i++] = '\0'; } -void *cThread_main(void *x) +static void *cThread_main(void *x) { while( console->input->ptstate ) {/* loopx */ if( console->input->key_pressed() ) { @@ -501,7 +501,7 @@ void *cThread_main(void *x) return NULL; } -int console_parse_timer(int tid, int64 tick, int id, intptr_t data) +static int console_parse_timer(int tid, int64 tick, int id, intptr_t data) { int i; EnterSpinLock(console->input->ptlock); @@ -514,7 +514,7 @@ int console_parse_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -void console_parse_final(void) +static void console_parse_final(void) { if( console->input->ptstate ) { InterlockedDecrement(&console->input->ptstate); @@ -528,7 +528,7 @@ void console_parse_final(void) } } -void console_parse_init(void) +static void console_parse_init(void) { cinput.count = 0; @@ -548,13 +548,13 @@ void console_parse_init(void) timer->add_interval(timer->gettick() + 1000, console->input->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */ } -void console_setSQL(struct Sql *SQL_handle) +static void console_setSQL(struct Sql *SQL_handle) { console->input->SQL = SQL_handle; } #endif /* CONSOLE_INPUT */ -void console_init(void) +static void console_init(void) { #ifdef CONSOLE_INPUT VECTOR_INIT(console->input->command_list); @@ -564,7 +564,7 @@ void console_init(void) #endif } -void console_final(void) +static void console_final(void) { #ifdef CONSOLE_INPUT console->input->parse_final(); diff --git a/src/common/core.c b/src/common/core.c index 406bb7629..9fd33c4e0 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -80,7 +80,7 @@ // And don't complain to us if the XYZ plugin you installed wiped your hard disk, or worse. // Note: This feature is deprecated, and should not be used. -struct core_interface core_s; +static struct core_interface core_s; struct core_interface *core = &core_s; #ifndef MINICORE // minimalist Core @@ -97,7 +97,7 @@ struct core_interface *core = &core_s; #ifndef POSIX #define compat_signal(signo, func) signal((signo), (func)) #else -sigfunc *compat_signal(int signo, sigfunc *func) +static sigfunc *compat_signal(int signo, sigfunc *func) { struct sigaction sact, oact; @@ -180,7 +180,7 @@ static void sig_proc(int sn) } } -void signals_init (void) +static void signals_init(void) { compat_signal(SIGTERM, sig_proc); compat_signal(SIGINT, sig_proc); @@ -203,7 +203,7 @@ void signals_init (void) * * @retval false if the check didn't pass and the program should be terminated. */ -bool usercheck(void) +static bool usercheck(void) { #ifndef _WIN32 if (sysinfo->is_superuser()) { @@ -247,7 +247,7 @@ bool usercheck(void) return true; } -void core_defaults(void) +static void core_defaults(void) { nullpo_defaults(); #ifndef MINICORE @@ -278,7 +278,7 @@ void core_defaults(void) /** * Returns the source (core or plugin name) for the given command-line argument */ -const char *cmdline_arg_source(struct CmdlineArgData *arg) +static const char *cmdline_arg_source(struct CmdlineArgData *arg) { #ifdef MINICORE return "core"; @@ -299,7 +299,7 @@ const char *cmdline_arg_source(struct CmdlineArgData *arg) * @param options options associated to the command-line argument. @see enum cmdline_options. * @return the success status. */ -bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options) +static bool cmdline_arg_add(unsigned int pluginID, const char *name, char shortname, CmdlineExecFunc func, const char *help, unsigned int options) { struct CmdlineArgData *data = NULL; @@ -363,7 +363,7 @@ static CMDLINEARG(version) * @param argc the program's argc. * @return true if a value for the current argument is available on the command line. */ -bool cmdline_arg_next_value(const char *name, int current_arg, int argc) +static bool cmdline_arg_next_value(const char *name, int current_arg, int argc) { if (current_arg >= argc-1) { ShowError("Missing value for option '%s'.\n", name); @@ -391,7 +391,7 @@ bool cmdline_arg_next_value(const char *name, int current_arg, int argc) * line arguments or handler's failure cause the program to abort. * @return the amount of command line handlers successfully executed. */ -int cmdline_exec(int argc, char **argv, unsigned int options) +static int cmdline_exec(int argc, char **argv, unsigned int options) { int count = 0, i; @@ -444,7 +444,7 @@ int cmdline_exec(int argc, char **argv, unsigned int options) /** * Defines the global command-line arguments. */ -void cmdline_init(void) +static void cmdline_init(void) { #ifdef MINICORE // Minicore has no HPM. This value isn't used, but the arg_add function requires it, so we're (re)defining it here @@ -458,7 +458,7 @@ void cmdline_init(void) cmdline_args_init_local(); } -void cmdline_final(void) +static void cmdline_final(void) { while (VECTOR_LENGTH(cmdline->args_data) > 0) { struct CmdlineArgData *data = &VECTOR_POP(cmdline->args_data); @@ -468,7 +468,7 @@ void cmdline_final(void) VECTOR_CLEAR(cmdline->args_data); } -struct cmdline_interface cmdline_s; +static struct cmdline_interface cmdline_s; struct cmdline_interface *cmdline; void cmdline_defaults(void) @@ -488,7 +488,7 @@ void cmdline_defaults(void) /*====================================== * CORE : MAINROUTINE *--------------------------------------*/ -int main (int argc, char **argv) +int main(int argc, char **argv) { int retval = EXIT_SUCCESS; {// initialize program arguments diff --git a/src/common/db.c b/src/common/db.c index 1ad715f25..c28ad1f7c 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -100,7 +100,7 @@ #include <stdio.h> #include <stdlib.h> -struct db_interface DB_s; +static struct db_interface DB_s; struct db_interface *DB; /***************************************************************************** @@ -358,8 +358,8 @@ static struct db_stats { #endif /* !defined(DB_ENABLE_STATS) */ /* [Ind/Hercules] */ -struct eri *db_iterator_ers; -struct eri *db_alloc_ers; +static struct eri *db_iterator_ers; +static struct eri *db_alloc_ers; /*****************************************************************************\ * (2) Section of private functions used by the database system. * @@ -1250,7 +1250,7 @@ static void db_release_both(union DBKey key, struct DBData data, enum DBReleaseO * @protected * @see struct DBIterator#first() */ -struct DBData *dbit_obj_first(struct DBIterator *self, union DBKey *out_key) +static struct DBData *dbit_obj_first(struct DBIterator *self, union DBKey *out_key) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; @@ -1272,7 +1272,7 @@ struct DBData *dbit_obj_first(struct DBIterator *self, union DBKey *out_key) * @protected * @see struct DBIterator#last() */ -struct DBData *dbit_obj_last(struct DBIterator *self, union DBKey *out_key) +static struct DBData *dbit_obj_last(struct DBIterator *self, union DBKey *out_key) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; @@ -1294,7 +1294,7 @@ struct DBData *dbit_obj_last(struct DBIterator *self, union DBKey *out_key) * @protected * @see struct DBIterator#next() */ -struct DBData *dbit_obj_next(struct DBIterator *self, union DBKey *out_key) +static struct DBData *dbit_obj_next(struct DBIterator *self, union DBKey *out_key) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; struct DBNode *node; @@ -1370,7 +1370,7 @@ struct DBData *dbit_obj_next(struct DBIterator *self, union DBKey *out_key) * @protected * @see struct DBIterator#prev() */ -struct DBData *dbit_obj_prev(struct DBIterator *self, union DBKey *out_key) +static struct DBData *dbit_obj_prev(struct DBIterator *self, union DBKey *out_key) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; struct DBNode *node; @@ -1445,7 +1445,7 @@ struct DBData *dbit_obj_prev(struct DBIterator *self, union DBKey *out_key) * @protected * @see struct DBIterator#exists() */ -bool dbit_obj_exists(struct DBIterator *self) +static bool dbit_obj_exists(struct DBIterator *self) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; @@ -1467,7 +1467,7 @@ bool dbit_obj_exists(struct DBIterator *self) * @see struct DBMap#remove() * @see struct DBIterator#remove() */ -int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) +static int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; struct DBNode *node; @@ -1494,7 +1494,7 @@ int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) * @param self Iterator * @protected */ -void dbit_obj_destroy(struct DBIterator *self) +static void dbit_obj_destroy(struct DBIterator *self) { struct DBIterator_impl *it = (struct DBIterator_impl *)self; @@ -2407,7 +2407,7 @@ static enum DBOptions db_obj_options(struct DBMap *self) * @see #db_default_release() * @see #db_alloc() */ -enum DBOptions db_fix_options(enum DBType type, enum DBOptions options) +static enum DBOptions db_fix_options(enum DBType type, enum DBOptions options) { DB_COUNTSTAT(db_fix_options); switch (type) { @@ -2438,7 +2438,7 @@ enum DBOptions db_fix_options(enum DBType type, enum DBOptions options) * @see #db_int64_cmp() * @see #db_uint64_cmp() */ -DBComparator db_default_cmp(enum DBType type) +static DBComparator db_default_cmp(enum DBType type) { DB_COUNTSTAT(db_default_cmp); switch (type) { @@ -2466,7 +2466,7 @@ DBComparator db_default_cmp(enum DBType type) * @see #db_int64_hash() * @see #db_uint64_hash() */ -DBHasher db_default_hash(enum DBType type) +static DBHasher db_default_hash(enum DBType type) { DB_COUNTSTAT(db_default_hash); switch (type) { @@ -2499,7 +2499,7 @@ DBHasher db_default_hash(enum DBType type) * @see #db_release_both() * @see #db_custom_release() */ -DBReleaser db_default_release(enum DBType type, enum DBOptions options) +static DBReleaser db_default_release(enum DBType type, enum DBOptions options) { DB_COUNTSTAT(db_default_release); options = DB->fix_options(type, options); @@ -2524,7 +2524,7 @@ DBReleaser db_default_release(enum DBType type, enum DBOptions options) * @see #db_release_both() * @see #db_default_release() */ -DBReleaser db_custom_release(enum DBReleaseOption which) +static DBReleaser db_custom_release(enum DBReleaseOption which) { DB_COUNTSTAT(db_custom_release); switch (which) { @@ -2555,7 +2555,7 @@ DBReleaser db_custom_release(enum DBReleaseOption which) * @see struct DBMap_impl * @see #db_fix_options() */ -struct DBMap *db_alloc(const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen) +static struct DBMap *db_alloc(const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen) { struct DBMap_impl *db; unsigned int i; @@ -2629,7 +2629,7 @@ struct DBMap *db_alloc(const char *file, const char *func, int line, enum DBType * @return The key as a DBKey union * @public */ -union DBKey db_i2key(int key) +static union DBKey db_i2key(int key) { union DBKey ret; @@ -2644,7 +2644,7 @@ union DBKey db_i2key(int key) * @return The key as a DBKey union * @public */ -union DBKey db_ui2key(unsigned int key) +static union DBKey db_ui2key(unsigned int key) { union DBKey ret; @@ -2659,7 +2659,7 @@ union DBKey db_ui2key(unsigned int key) * @return The key as a DBKey union * @public */ -union DBKey db_str2key(const char *key) +static union DBKey db_str2key(const char *key) { union DBKey ret; @@ -2674,7 +2674,7 @@ union DBKey db_str2key(const char *key) * @return The key as a DBKey union * @public */ -union DBKey db_i642key(int64 key) +static union DBKey db_i642key(int64 key) { union DBKey ret; @@ -2689,7 +2689,7 @@ union DBKey db_i642key(int64 key) * @return The key as a DBKey union * @public */ -union DBKey db_ui642key(uint64 key) +static union DBKey db_ui642key(uint64 key) { union DBKey ret; @@ -2704,7 +2704,7 @@ union DBKey db_ui642key(uint64 key) * @return The data as a DBData struct * @public */ -struct DBData db_i2data(int data) +static struct DBData db_i2data(int data) { struct DBData ret; @@ -2720,7 +2720,7 @@ struct DBData db_i2data(int data) * @return The data as a DBData struct * @public */ -struct DBData db_ui2data(unsigned int data) +static struct DBData db_ui2data(unsigned int data) { struct DBData ret; @@ -2736,7 +2736,7 @@ struct DBData db_ui2data(unsigned int data) * @return The data as a DBData struct * @public */ -struct DBData db_ptr2data(void *data) +static struct DBData db_ptr2data(void *data) { struct DBData ret; @@ -2753,7 +2753,7 @@ struct DBData db_ptr2data(void *data) * @return Integer value of the data. * @public */ -int db_data2i(struct DBData *data) +static int db_data2i(struct DBData *data) { DB_COUNTSTAT(db_data2i); if (data && DB_DATA_INT == data->type) @@ -2768,7 +2768,7 @@ int db_data2i(struct DBData *data) * @return Unsigned int value of the data. * @public */ -unsigned int db_data2ui(struct DBData *data) +static unsigned int db_data2ui(struct DBData *data) { DB_COUNTSTAT(db_data2ui); if (data && DB_DATA_UINT == data->type) @@ -2783,7 +2783,7 @@ unsigned int db_data2ui(struct DBData *data) * @return Void* value of the data. * @public */ -void *db_data2ptr(struct DBData *data) +static void *db_data2ptr(struct DBData *data) { DB_COUNTSTAT(db_data2ptr); if (data && DB_DATA_PTR == data->type) @@ -2796,7 +2796,7 @@ void *db_data2ptr(struct DBData *data) * @public * @see #db_final(void) */ -void db_init(void) +static void db_init(void) { db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK); @@ -2810,7 +2810,7 @@ void db_init(void) * @public * @see #db_init(void) */ -void db_final(void) +static void db_final(void) { #ifdef DB_ENABLE_STATS DB_COUNTSTAT(db_final); diff --git a/src/common/des.c b/src/common/des.c index 2223f4744..fbd158265 100644 --- a/src/common/des.c +++ b/src/common/des.c @@ -29,7 +29,7 @@ * Implementation of the des interface. */ -struct des_interface des_s; +static struct des_interface des_s; struct des_interface *des; /// Bitmask for accessing individual bits of a byte. @@ -228,7 +228,7 @@ static void des_RoundFunction(struct des_bit64 *src) } /// @copydoc des_interface::decrypt_block() -void des_decrypt_block(struct des_bit64 *block) +static void des_decrypt_block(struct des_bit64 *block) { des_IP(block); des_RoundFunction(block); @@ -236,7 +236,7 @@ void des_decrypt_block(struct des_bit64 *block) } /// @copydoc des_interface::decrypt() -void des_decrypt(unsigned char *data, size_t size) +static void des_decrypt(unsigned char *data, size_t size) { struct des_bit64 *p = (struct des_bit64 *)data; size_t i; diff --git a/src/common/ers.c b/src/common/ers.c index da793db99..e421c47c9 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -309,7 +309,7 @@ static void ers_obj_destroy(ERS *self) aFree(instance); } -void ers_cache_size(ERS *self, unsigned int new_size) +static void ers_cache_size(ERS *self, unsigned int new_size) { struct ers_instance_t *instance = (struct ers_instance_t *)self; diff --git a/src/common/grfio.c b/src/common/grfio.c index ba8a1d161..79154d191 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -68,19 +68,19 @@ enum grf_filelist_type { //#define GRFIO_LOCAL // stores info about every loaded file -struct grf_filelist *filelist = NULL; -int filelist_entrys = 0; -int filelist_maxentry = 0; +static struct grf_filelist *filelist = NULL; +static int filelist_entrys = 0; +static int filelist_maxentry = 0; // stores grf file names -char** gentry_table = NULL; -int gentry_entrys = 0; -int gentry_maxentry = 0; +static char** gentry_table = NULL; +static int gentry_entrys = 0; +static int gentry_maxentry = 0; // the path to the data directory -char data_dir[1024] = ""; +static char data_dir[1024] = ""; -struct grfio_interface grfio_s; +static struct grfio_interface grfio_s; struct grfio_interface *grfio; // little endian char array to uint conversion @@ -273,19 +273,19 @@ static void grf_decode(unsigned char *buf, size_t len, char entry_type, int entr /* Zlib Subroutines */ /// @copydoc grfio_interface::crc32() -unsigned long grfio_crc32(const unsigned char *buf, unsigned int len) +static unsigned long grfio_crc32(const unsigned char *buf, unsigned int len) { return crc32(crc32(0L, Z_NULL, 0), buf, len); } /// @copydoc grfio_interface::decode_zip -int grfio_decode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) +static int grfio_decode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) { return uncompress(dest, dest_len, source, source_len); } /// @copydoc grfio_interface::encode_zip -int grfio_encode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) +static int grfio_encode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) { if (*dest_len == 0) /* [Ind/Hercules] */ *dest_len = compressBound(source_len); @@ -299,7 +299,7 @@ int grfio_encode_zip(void *dest, unsigned long *dest_len, const void *source, un /* File List Subroutines */ /// File list hash table -int filelist_hash[256]; +static int filelist_hash[256]; /** * Initializes the table that holds the first elements of all hash chains @@ -351,7 +351,7 @@ static struct grf_filelist *grfio_filelist_find(const char *fname) } /// @copydoc grfio_interface::find_file() -const char *grfio_find_file(const char *fname) +static const char *grfio_find_file(const char *fname) { struct grf_filelist *flist = grfio_filelist_find(fname); if (flist == NULL) @@ -458,7 +458,7 @@ static void grfio_localpath_create(char *buffer, size_t size, const char *filena } /// @copydoc grfio_interface::reads() -void *grfio_reads(const char *fname, int *size) +static void *grfio_reads(const char *fname, int *size) { struct grf_filelist *entry = grfio_filelist_find(fname); if (entry == NULL || entry->gentry <= 0) { @@ -885,7 +885,7 @@ static int grfio_add(const char *fname) } /// @copydoc grfio_interface::final() -void grfio_final(void) +static void grfio_final(void) { if (filelist != NULL) { int i; @@ -911,7 +911,7 @@ void grfio_final(void) } /// @copydoc grfio_interface::init() -void grfio_init(const char *fname) +static void grfio_init(const char *fname) { FILE *data_conf; int grf_num = 0; diff --git a/src/common/mapindex.c b/src/common/mapindex.c index e79054f72..d5cda5c22 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -33,12 +33,12 @@ #include <stdlib.h> /* mapindex.c interface source */ -struct mapindex_interface mapindex_s; +static struct mapindex_interface mapindex_s; struct mapindex_interface *mapindex; /// Retrieves the map name from 'string' (removing .gat extension if present). /// Result gets placed either into 'buf' or in a static local buffer. -const char* mapindex_getmapname(const char* string, char* output) +static const char *mapindex_getmapname(const char *string, char *output) { static char buf[MAP_NAME_LENGTH]; char* dest = (output != NULL) ? output : buf; @@ -62,7 +62,7 @@ const char* mapindex_getmapname(const char* string, char* output) /// Retrieves the map name from 'string' (adding .gat extension if not already present). /// Result gets placed either into 'buf' or in a static local buffer. -const char* mapindex_getmapname_ext(const char* string, char* output) +static const char *mapindex_getmapname_ext(const char *string, char *output) { static char buf[MAP_NAME_LENGTH_EXT]; char* dest = (output != NULL) ? output : buf; @@ -94,7 +94,7 @@ const char* mapindex_getmapname_ext(const char* string, char* output) /// Adds a map to the specified index /// Returns 1 if successful, 0 otherwise -int mapindex_addmap(int index, const char* name) +static int mapindex_addmap(int index, const char *name) { char map_name[MAP_NAME_LENGTH]; @@ -136,7 +136,7 @@ int mapindex_addmap(int index, const char* name) return index; } -unsigned short mapindex_name2id(const char* name) +static unsigned short mapindex_name2id(const char *name) { int i; char map_name[MAP_NAME_LENGTH]; @@ -150,7 +150,7 @@ unsigned short mapindex_name2id(const char* name) return 0; } -const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const char *func) +static const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const char *func) { if (id >= MAX_MAPINDEX || !mapindex_exists(id)) { ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache. %s:%s:%d\n", id,file,func,line); @@ -159,7 +159,7 @@ const char *mapindex_id2name_sub(uint16 id, const char *file, int line, const ch return mapindex->list[id].name; } -int mapindex_init(void) +static int mapindex_init(void) { FILE *fp; char line[1024]; @@ -198,7 +198,7 @@ int mapindex_init(void) return total; } -bool mapindex_check_default(void) +static bool mapindex_check_default(void) { if (!strdb_iget(mapindex->db, mapindex->default_map)) { ShowError("mapindex_init: MAP_DEFAULT '%s' not found in cache! update mapindex.h MAP_DEFAULT var!!!\n", mapindex->default_map); @@ -207,14 +207,14 @@ bool mapindex_check_default(void) return true; } -void mapindex_removemap(int index) +static void mapindex_removemap(int index) { Assert_retv(index < MAX_MAPINDEX); strdb_remove(mapindex->db, mapindex->list[index].name); mapindex->list[index].name[0] = '\0'; } -void mapindex_final(void) +static void mapindex_final(void) { db_destroy(mapindex->db); } diff --git a/src/common/md5calc.c b/src/common/md5calc.c index 9784bd7b8..3f9ccdc41 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -34,7 +34,7 @@ * Implementation of the md5 interface. */ -struct md5_interface md5_s; +static struct md5_interface md5_s; struct md5_interface *md5; /// Global variable @@ -233,7 +233,7 @@ static void md5_buf2binary(const uint8 *buf, const int buf_size, uint8 *output) } /// @copydoc md5_interface::string() -void md5_string(const char *string, char *output) +static void md5_string(const char *string, char *output) { uint8 digest[16]; @@ -249,7 +249,7 @@ void md5_string(const char *string, char *output) } /// @copydoc md5_interface::salt(); -void md5_salt(int len, char *output) +static void md5_salt(int len, char *output) { int i; Assert_retv(len > 0); diff --git a/src/common/memmgr.c b/src/common/memmgr.c index bdaf61db3..3c645e7fa 100644 --- a/src/common/memmgr.c +++ b/src/common/memmgr.c @@ -31,7 +31,7 @@ #include <stdlib.h> #include <string.h> -struct malloc_interface iMalloc_s; +static struct malloc_interface iMalloc_s; struct malloc_interface *iMalloc; ////////////// Memory Libraries ////////////////// @@ -113,9 +113,7 @@ struct malloc_interface *iMalloc; #error Unsupported OS #endif -#endif - -void* aMalloc_(size_t size, const char *file, int line, const char *func) +static void *aMalloc_(size_t size, const char *file, int line, const char *func) { void *ret = MALLOC(size, file, line, func); // ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size); @@ -126,7 +124,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func) return ret; } -void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *func) +static void *aCalloc_(size_t num, size_t size, const char *file, int line, const char *func) { void *ret = CALLOC(num, size, file, line, func); // ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size); @@ -136,7 +134,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char * } return ret; } -void* aRealloc_(void *p, size_t size, const char *file, int line, const char *func) +static void *aRealloc_(void *p, size_t size, const char *file, int line, const char *func) { void *ret = REALLOC(p, size, file, line, func); // ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size); @@ -147,13 +145,10 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu return ret; } -void* aReallocz_(void *p, size_t size, const char *file, int line, const char *func) +static void *aReallocz_(void *p, size_t size, const char *file, int line, const char *func) { unsigned char *ret = NULL; // ShowMessage("%s:%d: in func %s: aReallocz %p %ld\n",file,line,func,p,size); -#ifdef USE_MEMMGR - ret = REALLOC(p, size, file, line, func); -#else if (p != NULL) { size_t newSize; size_t oldSize = BUFFER_SIZE(p); @@ -166,7 +161,6 @@ void* aReallocz_(void *p, size_t size, const char *file, int line, const char *f if (ret != NULL) memset(ret, 0, BUFFER_SIZE(ret)); } -#endif if (ret == NULL) { ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func); exit(EXIT_FAILURE); @@ -174,7 +168,7 @@ void* aReallocz_(void *p, size_t size, const char *file, int line, const char *f return ret; } -char* aStrdup_(const char *p, const char *file, int line, const char *func) +static char *aStrdup_(const char *p, const char *file, int line, const char *func) { char *ret = STRDUP(p, file, line, func); // ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p); @@ -201,7 +195,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func) * @param func @see ALC_MARK. * @return the copied string. */ -char *aStrndup_(const char *p, size_t size, const char *file, int line, const char *func) +static char *aStrndup_(const char *p, size_t size, const char *file, int line, const char *func) { size_t len = strnlen(p, size); char *ret = MALLOC(len + 1, file, line, func); @@ -214,7 +208,7 @@ char *aStrndup_(const char *p, size_t size, const char *file, int line, const ch return ret; } -void aFree_(void *p, const char *file, int line, const char *func) +static void aFree_(void *p, const char *file, int line, const char *func) { // ShowMessage("%s:%d: in func %s: aFree %p\n",file,line,func,p); if (p) @@ -222,8 +216,7 @@ void aFree_(void *p, const char *file, int line, const char *func) //p = NULL; } - -#ifdef USE_MEMMGR +#else // USE_MEMMGR #if defined(DEBUG) #define DEBUG_MEMMGR @@ -232,21 +225,21 @@ void aFree_(void *p, const char *file, int line, const char *func) /* USE_MEMMGR */ /* -* Memory manager -* able to handle malloc and free efficiently -* Since the complex processing, I might be slightly heavier. -* -* (I'm sorry for the poor description ^ ^;) such as data structures -* Divided into "blocks" of a plurality of memory, "unit" of a plurality of blocks further -* I have to divide. Size of the unit, a plurality of distribution equal to the capacity of one block -* That's what you have. For example, if one unit of 32KB, one block 1 Yu 32Byte -* Knit, or are able to gather 1024, gathered 512 units 64Byte -* I can be or have. (Excluding padding, the unit_head) -* -* Lead-linked list (block_prev, block_next) in each other is the same size block -* Linked list (hash_prev, hash_nect) even among such one in the block with the figure -* I like to have. Thus, reuse of memory no longer needed can be performed efficiently. -*/ + * Memory manager + * able to handle malloc and free efficiently + * Since the complex processing, I might be slightly heavier. + * + * (I'm sorry for the poor description ^ ^;) such as data structures + * Divided into "blocks" of a plurality of memory, "unit" of a plurality of blocks further + * I have to divide. Size of the unit, a plurality of distribution equal to the capacity of one block + * That's what you have. For example, if one unit of 32KB, one block 1 Yu 32Byte + * Knit, or are able to gather 1024, gathered 512 units 64Byte + * I can be or have. (Excluding padding, the unit_head) + * + * Lead-linked list (block_prev, block_next) in each other is the same size block + * Linked list (hash_prev, hash_nect) even among such one in the block with the figure + * I like to have. Thus, reuse of memory no longer needed can be performed efficiently. + */ /* Alignment of the block */ #define BLOCK_ALIGNMENT1 16 @@ -286,8 +279,8 @@ struct unit_head { long checksum; }; -static struct block* hash_unfill[BLOCK_DATA_COUNT1 + BLOCK_DATA_COUNT2 + 1]; -static struct block* block_first, *block_last, block_head; +static struct block *hash_unfill[BLOCK_DATA_COUNT1 + BLOCK_DATA_COUNT2 + 1]; +static struct block *block_first, *block_last, block_head; /* Data for areas that do not use the memory be turned */ struct unit_head_large { @@ -299,8 +292,8 @@ struct unit_head_large { static struct unit_head_large *unit_head_large_first = NULL; -static struct block* block_malloc(unsigned short hash); -static void block_free(struct block* p); +static struct block *block_malloc(unsigned short hash); +static void block_free(struct block *p); static size_t memmgr_usage_bytes; static size_t memmgr_usage_bytes_t; @@ -308,7 +301,7 @@ static size_t memmgr_usage_bytes_t; #define block2unit(p, n) ((struct unit_head*)(&(p)->data[ p->unit_size * (n) ])) #define memmgr_assert(v) do { if(!(v)) { ShowError("Memory manager: assertion '" #v "' failed!\n"); } } while(0) -static unsigned short size2hash( size_t size ) +static unsigned short size2hash(size_t size) { if( size <= BLOCK_DATA_SIZE1 ) { return (unsigned short)(size + BLOCK_ALIGNMENT1 - 1) / BLOCK_ALIGNMENT1; @@ -320,7 +313,7 @@ static unsigned short size2hash( size_t size ) } } -static size_t hash2size( unsigned short hash ) +static size_t hash2size(unsigned short hash) { if( hash <= BLOCK_DATA_COUNT1) { return hash * BLOCK_ALIGNMENT1; @@ -329,7 +322,8 @@ static size_t hash2size( unsigned short hash ) } } -void *mmalloc_(size_t size, const char *file, int line, const char *func) { +static void *mmalloc_(size_t size, const char *file, int line, const char *func) +{ struct block *block; short size_hash = size2hash( size ); struct unit_head *head; @@ -435,14 +429,16 @@ void *mmalloc_(size_t size, const char *file, int line, const char *func) { return (char *)head + sizeof(struct unit_head) - sizeof(long); } -void *mcalloc_(size_t num, size_t size, const char *file, int line, const char *func) { +static void *mcalloc_(size_t num, size_t size, const char *file, int line, const char *func) +{ void *p = iMalloc->malloc(num * size,file,line,func); if (p) memset(p, 0, num * size); return p; } -void *mrealloc_(void *memblock, size_t size, const char *file, int line, const char *func) { +static void *mrealloc_(void *memblock, size_t size, const char *file, int line, const char *func) +{ size_t old_size; if(memblock == NULL) { return iMalloc->malloc(size,file,line,func); @@ -467,7 +463,8 @@ void *mrealloc_(void *memblock, size_t size, const char *file, int line, const c } /* a mrealloc_ clone with the difference it 'z'eroes the newly created memory */ -void *mreallocz_(void *memblock, size_t size, const char *file, int line, const char *func) { +static void *mreallocz_(void *memblock, size_t size, const char *file, int line, const char *func) +{ size_t old_size; void *p = NULL; @@ -497,7 +494,8 @@ void *mreallocz_(void *memblock, size_t size, const char *file, int line, const } -char *mstrdup_(const char *p, const char *file, int line, const char *func) { +static char *mstrdup_(const char *p, const char *file, int line, const char *func) +{ if(p == NULL) { return NULL; } else { @@ -525,7 +523,7 @@ char *mstrdup_(const char *p, const char *file, int line, const char *func) { * @return the copied string. * @retval NULL if the source string is NULL or in case of error. */ -char *mstrndup_(const char *p, size_t size, const char *file, int line, const char *func) +static char *mstrndup_(const char *p, size_t size, const char *file, int line, const char *func) { if (p == NULL) { return NULL; @@ -539,7 +537,8 @@ char *mstrndup_(const char *p, size_t size, const char *file, int line, const ch } -void mfree_(void *ptr, const char *file, int line, const char *func) { +static void mfree_(void *ptr, const char *file, int line, const char *func) +{ struct unit_head *head; if (ptr == NULL) @@ -611,7 +610,7 @@ void mfree_(void *ptr, const char *file, int line, const char *func) { } /* Allocating blocks */ -static struct block* block_malloc(unsigned short hash) +static struct block *block_malloc(unsigned short hash) { struct block *p; if(hash_unfill[0] != NULL) { @@ -668,7 +667,7 @@ static struct block* block_malloc(unsigned short hash) return p; } -static void block_free(struct block* p) +static void block_free(struct block *p) { if( p->unfill_prev ) { if( p->unfill_prev == &block_head) { @@ -686,7 +685,7 @@ static void block_free(struct block* p) hash_unfill[0] = p; } -size_t memmgr_usage (void) +static size_t memmgr_usage(void) { return memmgr_usage_bytes / 1024; } @@ -695,7 +694,8 @@ size_t memmgr_usage (void) static char memmer_logfile[128]; static FILE *log_fp; -static void memmgr_log(char *buf, char *vcsinfo) { +static void memmgr_log(char *buf, char *vcsinfo) +{ if( !log_fp ) { time_t raw; struct tm* t; @@ -718,7 +718,7 @@ static void memmgr_log(char *buf, char *vcsinfo) { /// /// @param ptr Pointer to the memory /// @return true if the memory is active -bool memmgr_verify(void* ptr) +static bool memmgr_verify(void *ptr) { struct block* block = block_first; struct unit_head_large* large = unit_head_large_first; @@ -759,7 +759,7 @@ bool memmgr_verify(void* ptr) return false; } -static void memmgr_final (void) +static void memmgr_final(void) { struct block *block = block_first; struct unit_head_large *large = unit_head_large_first; @@ -815,7 +815,8 @@ static void memmgr_final (void) #endif /* LOG_MEMMGR */ } /* [Ind/Hercules] */ -void memmgr_report (int extra) { +void memmgr_report(int extra) +{ struct block *block = block_first; struct unit_head_large *large = unit_head_large_first; unsigned int count = 0, size = 0; @@ -919,13 +920,13 @@ static void memmgr_init_messages(void) /*====================================== -* Initialize -*-------------------------------------- -*/ + * Initialize + *-------------------------------------- + */ /// Tests the memory for errors and memory leaks. -void malloc_memory_check(void) +static void malloc_memory_check(void) { MEMORY_CHECK(); } @@ -933,7 +934,8 @@ void malloc_memory_check(void) /// Returns true if a pointer is valid. /// The check is best-effort, false positives are possible. -bool malloc_verify_ptr(void* ptr) { +static bool malloc_verify_ptr(void *ptr) +{ #ifdef USE_MEMMGR return memmgr_verify(ptr) && MEMORY_VERIFY(ptr); #else @@ -942,7 +944,8 @@ bool malloc_verify_ptr(void* ptr) { } -size_t malloc_usage (void) { +static size_t malloc_usage(void) +{ #ifdef USE_MEMMGR return memmgr_usage (); #else @@ -950,7 +953,8 @@ size_t malloc_usage (void) { #endif } -void malloc_final (void) { +static void malloc_final(void) +{ #ifdef USE_MEMMGR memmgr_final (); #endif @@ -966,14 +970,14 @@ void malloc_final (void) { * chance to other modules to initialize, in case they want to silence any * status messages, but at the same time require malloc. */ -void malloc_init_messages(void) +static void malloc_init_messages(void) { #ifdef USE_MEMMGR memmgr_init_messages(); #endif } -void malloc_init(void) +static void malloc_init(void) { #ifdef USE_MEMMGR memmgr_usage_bytes_t = 0; @@ -993,7 +997,8 @@ void malloc_init(void) #endif } -void malloc_defaults(void) { +void malloc_defaults(void) +{ iMalloc = &iMalloc_s; iMalloc->init = malloc_init; iMalloc->final = malloc_final; diff --git a/src/common/mutex.c b/src/common/mutex.c index fab1c45c0..dd63d2adc 100644 --- a/src/common/mutex.c +++ b/src/common/mutex.c @@ -39,7 +39,7 @@ * Implementation of the mutex interface. */ -struct mutex_interface mutex_s; +static struct mutex_interface mutex_s; struct mutex_interface *mutex; struct mutex_data { @@ -65,7 +65,7 @@ struct cond_data { /* Mutex */ /// @copydoc mutex_interface::create() -struct mutex_data *mutex_create(void) +static struct mutex_data *mutex_create(void) { struct mutex_data *m = aMalloc(sizeof(struct mutex_data)); if (m == NULL) { @@ -83,7 +83,7 @@ struct mutex_data *mutex_create(void) } /// @copydoc mutex_interface::destroy() -void mutex_destroy(struct mutex_data *m) +static void mutex_destroy(struct mutex_data *m) { nullpo_retv(m); #ifdef WIN32 @@ -96,7 +96,7 @@ void mutex_destroy(struct mutex_data *m) } /// @copydoc mutex_interface::lock() -void mutex_lock(struct mutex_data *m) +static void mutex_lock(struct mutex_data *m) { nullpo_retv(m); #ifdef WIN32 @@ -107,7 +107,7 @@ void mutex_lock(struct mutex_data *m) } /// @copydoc mutex_interface::trylock() -bool mutex_trylock(struct mutex_data *m) +static bool mutex_trylock(struct mutex_data *m) { nullpo_retr(false, m); #ifdef WIN32 @@ -121,7 +121,7 @@ bool mutex_trylock(struct mutex_data *m) } /// @copydoc mutex_interface::unlock() -void mutex_unlock(struct mutex_data *m) +static void mutex_unlock(struct mutex_data *m) { nullpo_retv(m); #ifdef WIN32 @@ -134,7 +134,7 @@ void mutex_unlock(struct mutex_data *m) /* Conditional variable */ /// @copydoc mutex_interface::cond_create() -struct cond_data *cond_create(void) +static struct cond_data *cond_create(void) { struct cond_data *c = aMalloc(sizeof(struct cond_data)); if (c == NULL) { @@ -155,7 +155,7 @@ struct cond_data *cond_create(void) } /// @copydoc mutex_interface::cond_destroy() -void cond_destroy(struct cond_data *c) +static void cond_destroy(struct cond_data *c) { nullpo_retv(c); #ifdef WIN32 @@ -170,7 +170,7 @@ void cond_destroy(struct cond_data *c) } /// @copydoc mutex_interface::cond_wait() -void cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) +static void cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) { #ifdef WIN32 register DWORD ms; @@ -224,7 +224,7 @@ void cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) } /// @copydoc mutex_interface::cond_signal() -void cond_signal(struct cond_data *c) +static void cond_signal(struct cond_data *c) { #ifdef WIN32 # if 0 @@ -245,7 +245,7 @@ void cond_signal(struct cond_data *c) } /// @copydoc mutex_interface::cond_broadcast() -void cond_broadcast(struct cond_data *c) +static void cond_broadcast(struct cond_data *c) { #ifdef WIN32 # if 0 diff --git a/src/common/nullpo.c b/src/common/nullpo.c index 1441ff853..e19f7f846 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -32,7 +32,7 @@ #include <execinfo.h> #endif // HAVE_EXECINFO -struct nullpo_interface nullpo_s; +static struct nullpo_interface nullpo_s; struct nullpo_interface *nullpo; /** @@ -44,7 +44,8 @@ struct nullpo_interface *nullpo; * @param targetname Name of the checked symbol * @param title Message title to display (i.e. failed assertion or nullpo info) */ -void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { +static void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) +{ #ifdef HAVE_EXECINFO void *array[10]; int size; @@ -72,7 +73,8 @@ void assert_report(const char *file, int line, const char *func, const char *tar /** * **/ -void nullpo_defaults(void) { +void nullpo_defaults(void) +{ nullpo = &nullpo_s; nullpo->assert_report = assert_report; } diff --git a/src/common/random.c b/src/common/random.c index 6fbaba91c..9bbe4f86c 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -40,11 +40,11 @@ * Implementation of the random number generator interface. */ -struct rnd_interface rnd_s; +static struct rnd_interface rnd_s; struct rnd_interface *rnd; /// @copydoc rnd_interface::init() -void rnd_init(void) +static void rnd_init(void) { unsigned long seed = (unsigned long)timer->gettick(); seed += (unsigned long)time(NULL); @@ -66,30 +66,30 @@ void rnd_init(void) } /// @copydoc rnd_interface::final() -void rnd_final(void) +static void rnd_final(void) { } /// @copydoc rnd_interface::seed() -void rnd_seed(uint32 seed) +static void rnd_seed(uint32 seed) { init_genrand(seed); } /// @copydoc rnd_interface::random() -int32 rnd_random(void) +static int32 rnd_random(void) { return (int32)genrand_int31(); } /// @copydoc rnd_interface::roll() -uint32 rnd_roll(uint32 dice_faces) +static uint32 rnd_roll(uint32 dice_faces) { return (uint32)(rnd->uniform()*dice_faces); } /// @copydoc rnd_interface::value() -int32 rnd_value(int32 min, int32 max) +static int32 rnd_value(int32 min, int32 max) { if (min >= max) return min; @@ -97,13 +97,13 @@ int32 rnd_value(int32 min, int32 max) } /// @copydoc rnd_interface::uniform() -double rnd_uniform(void) +static double rnd_uniform(void) { return ((uint32)genrand_int32())*(1.0/4294967296.0);// divided by 2^32 } /// @copydoc rnd_interface::uniform53() -double rnd_uniform53(void) +static double rnd_uniform53(void) { return genrand_res53(); } diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 8bcd1b4c7..32d1e7610 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -45,7 +45,7 @@ #define DEBUGLOGPATH "log"PATHSEP_STR"login-server.log" #endif -struct showmsg_interface showmsg_s; +static struct showmsg_interface showmsg_s; struct showmsg_interface *showmsg; /////////////////////////////////////////////////////////////////////////////// @@ -186,7 +186,7 @@ Escape sequences for Select Character Set #define is_console(handle) (FILE_TYPE_CHAR==GetFileType(handle)) /////////////////////////////////////////////////////////////////////////////// -int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) +static int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) { ///////////////////////////////////////////////////////////////// /* XXX Two streams are being used. Disabled to avoid inconsistency [flaviojs] @@ -467,8 +467,9 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) return 0; } -int FPRINTF(HANDLE handle, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -int FPRINTF(HANDLE handle, const char *fmt, ...) { +static int FPRINTF(HANDLE handle, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +static int FPRINTF(HANDLE handle, const char *fmt, ...) +{ int ret; va_list argptr; va_start(argptr, fmt); @@ -488,7 +489,7 @@ int FPRINTF(HANDLE handle, const char *fmt, ...) { #define is_console(file) (0!=isatty(fileno(file))) //vprintf_without_ansiformats -int VFPRINTF(FILE *file, const char *fmt, va_list argptr) +static int VFPRINTF(FILE *file, const char *fmt, va_list argptr) { char *p, *q; NEWBUF(tempbuf); // temporary buffer @@ -584,8 +585,9 @@ int VFPRINTF(FILE *file, const char *fmt, va_list argptr) FREEBUF(tempbuf); return 0; } -int FPRINTF(FILE *file, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -int FPRINTF(FILE *file, const char *fmt, ...) { +static int FPRINTF(FILE *file, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +static int FPRINTF(FILE *file, const char *fmt, ...) +{ int ret; va_list argptr; va_start(argptr, fmt); @@ -601,7 +603,7 @@ int FPRINTF(FILE *file, const char *fmt, ...) { #endif// not _WIN32 -int vShowMessage_(enum msg_type flag, const char *string, va_list ap) +static int vShowMessage_(enum msg_type flag, const char *string, va_list ap) { va_list apcopy; char prefix[100]; @@ -720,7 +722,7 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap) return 0; } -int showmsg_vShowMessage(const char *string, va_list ap) +static int showmsg_vShowMessage(const char *string, va_list ap) { int ret; va_list apcopy; @@ -730,14 +732,17 @@ int showmsg_vShowMessage(const char *string, va_list ap) return ret; } -void showmsg_clearScreen(void) +static void showmsg_clearScreen(void) { #ifndef _WIN32 ShowMessage(CL_CLS); // to prevent empty string passed messages #endif } -int ShowMessage_(enum msg_type flag, const char *string, ...) __attribute__((format(printf, 2, 3))); -int ShowMessage_(enum msg_type flag, const char *string, ...) { + +#if 0 // Unused +static int ShowMessage_(enum msg_type flag, const char *string, ...) __attribute__((format(printf, 2, 3))); +static int ShowMessage_(enum msg_type flag, const char *string, ...) +{ int ret; va_list ap; va_start(ap, string); @@ -745,58 +750,59 @@ int ShowMessage_(enum msg_type flag, const char *string, ...) { va_end(ap); return ret; } +#endif // Unused // direct printf replacement -void showmsg_showMessage(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showMessage(const char *string, ...) +static void showmsg_showMessage(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showMessage(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_NONE, string, ap); va_end(ap); } -void showmsg_showStatus(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showStatus(const char *string, ...) +static void showmsg_showStatus(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showStatus(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_STATUS, string, ap); va_end(ap); } -void showmsg_showSQL(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showSQL(const char *string, ...) +static void showmsg_showSQL(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showSQL(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_SQL, string, ap); va_end(ap); } -void showmsg_showInfo(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showInfo(const char *string, ...) +static void showmsg_showInfo(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showInfo(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_INFORMATION, string, ap); va_end(ap); } -void showmsg_showNotice(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showNotice(const char *string, ...) +static void showmsg_showNotice(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showNotice(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_NOTICE, string, ap); va_end(ap); } -void showmsg_showWarning(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showWarning(const char *string, ...) +static void showmsg_showWarning(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showWarning(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_WARNING, string, ap); va_end(ap); } -void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); -void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) +static void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +static void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) { StringBuf buf; va_list ap; @@ -812,24 +818,24 @@ void showmsg_showConfigWarning(struct config_setting_t *config, const char *stri va_end(ap); StrBuf->Destroy(&buf); } -void showmsg_showDebug(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showDebug(const char *string, ...) +static void showmsg_showDebug(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showDebug(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_DEBUG, string, ap); va_end(ap); } -void showmsg_showError(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showError(const char *string, ...) +static void showmsg_showError(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showError(const char *string, ...) { va_list ap; va_start(ap, string); vShowMessage_(MSG_ERROR, string, ap); va_end(ap); } -void showmsg_showFatalError(const char *string, ...) __attribute__((format(printf, 1, 2))); -void showmsg_showFatalError(const char *string, ...) +static void showmsg_showFatalError(const char *string, ...) __attribute__((format(printf, 1, 2))); +static void showmsg_showFatalError(const char *string, ...) { va_list ap; va_start(ap, string); @@ -837,11 +843,11 @@ void showmsg_showFatalError(const char *string, ...) va_end(ap); } -void showmsg_init(void) +static void showmsg_init(void) { } -void showmsg_final(void) +static void showmsg_final(void) { } diff --git a/src/common/socket.c b/src/common/socket.c index cec366765..290c7a1b3 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -75,19 +75,17 @@ /** * Socket Interface Source **/ -struct socket_interface sockt_s; +static struct socket_interface sockt_s; struct socket_interface *sockt; -struct socket_data **session; - -const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf"; +static const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf"; #ifdef SEND_SHORTLIST // Add a fd to the shortlist so that it'll be recognized as a fd that needs // sending done on it. -void send_shortlist_add_fd(int fd); +static void send_shortlist_add_fd(int fd); // Do pending network sends (and eof handling) from the shortlist. -void send_shortlist_do_sends(void); +static void send_shortlist_do_sends(void); #endif // SEND_SHORTLIST ///////////////////////////////////////////////////////////////////// @@ -123,7 +121,7 @@ static int sock_arr_len = 0; /// /// @param s Socket /// @return Fd or -1 -int sock2fd(SOCKET s) +static int sock2fd(SOCKET s) { int fd; @@ -144,7 +142,7 @@ int sock2fd(SOCKET s) /// /// @param s Socket /// @return New fd or -1 -int sock2newfd(SOCKET s) +static int sock2newfd(SOCKET s) { int fd; @@ -164,7 +162,7 @@ int sock2newfd(SOCKET s) return fd; } -int sAccept(int fd, struct sockaddr* addr, int* addrlen) +static int sAccept(int fd, struct sockaddr *addr, int *addrlen) { SOCKET s; @@ -175,14 +173,14 @@ int sAccept(int fd, struct sockaddr* addr, int* addrlen) return sock2newfd(s); } -int sClose(int fd) +static int sClose(int fd) { int ret = closesocket(fd2sock(fd)); fd2sock(fd) = INVALID_SOCKET; return ret; } -int sSocket(int af, int type, int protocol) +static int sSocket(int af, int type, int protocol) { SOCKET s; @@ -193,7 +191,7 @@ int sSocket(int af, int type, int protocol) return sock2newfd(s); } -char* sErr(int code) +static char *sErr(int code) { static char sbuf[512]; // strerror does not handle socket codes @@ -259,7 +257,7 @@ char* sErr(int code) #ifndef SOCKET_EPOLL // Select based Event Dispatcher: -fd_set readfds; +static fd_set readfds; #else // SOCKET_EPOLL // Epoll based Event Dispatcher: @@ -296,19 +294,19 @@ static time_t socket_data_last_tick = 0; #define WFIFO_MAX (1*1024*1024) #ifdef SEND_SHORTLIST -int send_shortlist_array[FD_SETSIZE];// we only support FD_SETSIZE sockets, limit the array to that -int send_shortlist_count = 0;// how many fd's are in the shortlist -uint32 send_shortlist_set[(FD_SETSIZE+31)/32];// to know if specific fd's are already in the shortlist +static int send_shortlist_array[FD_SETSIZE];// we only support FD_SETSIZE sockets, limit the array to that +static int send_shortlist_count = 0;// how many fd's are in the shortlist +static uint32 send_shortlist_set[(FD_SETSIZE+31)/32];// to know if specific fd's are already in the shortlist #endif // SEND_SHORTLIST static int create_session(int fd, RecvFunc func_recv, SendFunc func_send, ParseFunc func_parse); #ifndef MINICORE - int ip_rules = 1; + static int ip_rules = 1; static int connect_check(uint32 ip); #endif // MINICORE -const char* error_msg(void) +static const char *error_msg(void) { static char buf[512]; int code = sErrno; @@ -319,13 +317,24 @@ const char* error_msg(void) /*====================================== * CORE : Default processing functions *--------------------------------------*/ -int null_recv(int fd) { return 0; } -int null_send(int fd) { return 0; } -int null_parse(int fd) { return 0; } +static int null_recv(int fd) +{ + return 0; +} + +static int null_send(int fd) +{ + return 0; +} + +static int null_parse(int fd) +{ + return 0; +} -ParseFunc default_func_parse = null_parse; +static ParseFunc default_func_parse = null_parse; -void set_defaultparse(ParseFunc defaultparse) +static void set_defaultparse(ParseFunc defaultparse) { default_func_parse = defaultparse; } @@ -333,7 +342,7 @@ void set_defaultparse(ParseFunc defaultparse) /*====================================== * CORE : Socket options *--------------------------------------*/ -void set_nonblocking(int fd, unsigned long yes) +static void set_nonblocking(int fd, unsigned long yes) { // FIONBIO Use with a nonzero argp parameter to enable the nonblocking mode of socket s. // The argp parameter is zero if nonblocking is to be disabled. @@ -347,7 +356,7 @@ void set_nonblocking(int fd, unsigned long yes) * @param fd The socket descriptor * @param opt Optional, additional options to set (Can be NULL). */ -void setsocketopts(int fd, struct hSockOpt *opt) +static void setsocketopts(int fd, struct hSockOpt *opt) { #if defined(WIN32) BOOL yes = TRUE; @@ -409,7 +418,7 @@ void setsocketopts(int fd, struct hSockOpt *opt) /*====================================== * CORE : Socket Sub Function *--------------------------------------*/ -void set_eof(int fd) +static void set_eof(int fd) { if (sockt->session_is_active(fd)) { #ifdef SEND_SHORTLIST @@ -420,7 +429,7 @@ void set_eof(int fd) } } -int recv_to_fifo(int fd) +static int recv_to_fifo(int fd) { ssize_t len; @@ -457,7 +466,7 @@ int recv_to_fifo(int fd) return 0; } -int send_from_fifo(int fd) +static int send_from_fifo(int fd) { ssize_t len; @@ -504,13 +513,13 @@ int send_from_fifo(int fd) } /// Best effort - there's no warranty that the data will be sent. -void flush_fifo(int fd) +static void flush_fifo(int fd) { if(sockt->session[fd] != NULL) sockt->session[fd]->func_send(fd); } -void flush_fifos(void) +static void flush_fifos(void) { int i; for(i = 1; i < sockt->fd_max; i++) @@ -520,7 +529,7 @@ void flush_fifos(void) /*====================================== * CORE : Connection functions *--------------------------------------*/ -int connect_client(int listen_fd) +static int connect_client(int listen_fd) { int fd; struct sockaddr_in client_address; @@ -579,7 +588,7 @@ int connect_client(int listen_fd) return fd; } -int make_listen_bind(uint32 ip, uint16 port) +static int make_listen_bind(uint32 ip, uint16 port) { struct sockaddr_in server_address = { 0 }; int fd; @@ -648,7 +657,7 @@ int make_listen_bind(uint32 ip, uint16 port) return fd; } -int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) +static int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) { struct sockaddr_in remote_address = { 0 }; int fd; @@ -749,7 +758,7 @@ static void delete_session(int fd) } } -int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size) +static int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size) { if (!sockt->session_is_valid(fd)) return 0; @@ -766,7 +775,7 @@ int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size) return 0; } -int realloc_writefifo(int fd, size_t addition) +static int realloc_writefifo(int fd, size_t addition) { size_t newsize; @@ -794,7 +803,7 @@ int realloc_writefifo(int fd, size_t addition) } /// advance the RFIFO cursor (marking 'len' bytes as processed) -int rfifoskip(int fd, size_t len) +static int rfifoskip(int fd, size_t len) { struct socket_data *s; @@ -816,7 +825,7 @@ int rfifoskip(int fd, size_t len) } /// advance the WFIFO cursor (marking 'len' bytes for sending) -int wfifoset(int fd, size_t len) +static int wfifoset(int fd, size_t len) { size_t newreserve; struct socket_data* s; @@ -884,7 +893,7 @@ int wfifoset(int fd, size_t len) return 0; } -int do_sockets(int next) +static int do_sockets(int next) { #ifndef SOCKET_EPOLL fd_set rfd; @@ -1088,7 +1097,7 @@ static int access_debug = 0; static int ddos_count = 10; static int ddos_interval = 3*1000; static int ddos_autoreset = 10*60*1000; -struct DBMap *connect_history = NULL; +static struct DBMap *connect_history = NULL; static int connect_check_(uint32 ip); @@ -1232,7 +1241,7 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) /// Parses the ip address and mask and puts it into acc. /// Returns 1 is successful, 0 otherwise. -int access_ipmask(const char *str, struct access_control *acc) +static int access_ipmask(const char *str, struct access_control *acc) { uint32 ip; uint32 mask; @@ -1288,7 +1297,7 @@ int access_ipmask(const char *str, struct access_control *acc) * * @retval false in case of failure */ -bool access_list_add(struct config_setting_t *setting, const char *list_name, struct access_control_list *access_list) +static bool access_list_add(struct config_setting_t *setting, const char *list_name, struct access_control_list *access_list) { const char *temp = NULL; int i, setting_length; @@ -1321,6 +1330,7 @@ bool access_list_add(struct config_setting_t *setting, const char *list_name, st #endif // MINICORE ////////////////////////////// +#ifndef MINICORE /** * Reads 'socket_configuration/ip_rules' and initializes required variables. * @@ -1330,9 +1340,8 @@ bool access_list_add(struct config_setting_t *setting, const char *list_name, st * * @retval false in case of error. */ -bool socket_config_read_iprules(const char *filename, struct config_t *config, bool imported) +static bool socket_config_read_iprules(const char *filename, struct config_t *config, bool imported) { -#ifndef MINICORE struct config_setting_t *setting = NULL; const char *temp = NULL; @@ -1375,11 +1384,12 @@ bool socket_config_read_iprules(const char *filename, struct config_t *config, b } else { access_list_add(setting, "deny_list", &access_deny); } -#endif // ! MINICORE return true; } +#endif // ! MINICORE +#ifndef MINICORE /** * Reads 'socket_configuration/ddos' and initializes required variables. * @@ -1389,9 +1399,8 @@ bool socket_config_read_iprules(const char *filename, struct config_t *config, b * * @retval false in case of error. */ -bool socket_config_read_ddos(const char *filename, struct config_t *config, bool imported) +static bool socket_config_read_ddos(const char *filename, struct config_t *config, bool imported) { -#ifndef MINICORE struct config_setting_t *setting = NULL; nullpo_retr(false, filename); @@ -1408,9 +1417,9 @@ bool socket_config_read_ddos(const char *filename, struct config_t *config, bool libconfig->setting_lookup_int(setting, "count", &ddos_count); libconfig->setting_lookup_int(setting, "autoreset", &ddos_autoreset); -#endif // ! MINICORE return true; } +#endif // ! MINICORE /** * Reads 'socket_configuration' and initializes required variables. @@ -1420,7 +1429,7 @@ bool socket_config_read_ddos(const char *filename, struct config_t *config, bool * * @retval false in case of error. */ -bool socket_config_read(const char *filename, bool imported) +static bool socket_config_read(const char *filename, bool imported) { struct config_t config; struct config_setting_t *setting = NULL; @@ -1484,7 +1493,7 @@ bool socket_config_read(const char *filename, bool imported) return retval; } -void socket_final(void) +static void socket_final(void) { int i; #ifndef MINICORE @@ -1523,7 +1532,7 @@ void socket_final(void) } /// Closes a socket. -void socket_close(int fd) +static void socket_close(int fd) { if( fd <= 0 ||fd >= FD_SETSIZE ) return;// invalid @@ -1547,7 +1556,7 @@ void socket_close(int fd) /// Retrieve local ips in host byte order. /// Uses loopback is no address is found. -int socket_getips(uint32* ips, int max) +static int socket_getips(uint32 *ips, int max) { int num = 0; @@ -1628,7 +1637,7 @@ int socket_getips(uint32* ips, int max) return num; } -void socket_init(void) +static void socket_init(void) { uint64 rlim_cur = FD_SETSIZE; @@ -1730,18 +1739,18 @@ void socket_init(void) ShowInfo("Server supports up to '"CL_WHITE"%"PRIu64""CL_RESET"' concurrent connections.\n", rlim_cur); } -bool session_is_valid(int fd) +static bool session_is_valid(int fd) { return ( fd > 0 && fd < FD_SETSIZE && sockt->session[fd] != NULL ); } -bool session_is_active(int fd) +static bool session_is_active(int fd) { return ( sockt->session_is_valid(fd) && !sockt->session[fd]->flag.eof ); } // Resolves hostname into a numeric ip. -uint32 host2ip(const char *hostname) +static uint32 host2ip(const char *hostname) { struct hostent* h; nullpo_ret(hostname); @@ -1757,7 +1766,7 @@ uint32 host2ip(const char *hostname) * * @return A pointer to the output string. */ -const char *ip2str(uint32 ip, char *ip_str) +static const char *ip2str(uint32 ip, char *ip_str) { struct in_addr addr; addr.s_addr = htonl(ip); @@ -1765,20 +1774,20 @@ const char *ip2str(uint32 ip, char *ip_str) } // Converts a dot-formatted ip string into a numeric ip. -uint32 str2ip(const char* ip_str) +static uint32 str2ip(const char *ip_str) { return ntohl(inet_addr(ip_str)); } // Reorders bytes from network to little endian (Windows). // Necessary for sending port numbers to the RO client until Gravity notices that they forgot ntohs() calls. -uint16 ntows(uint16 netshort) +static uint16 ntows(uint16 netshort) { return ((netshort & 0xFF) << 8) | ((netshort & 0xFF00) >> 8); } /* [Ind/Hercules] - socket_datasync */ -void socket_datasync(int fd, bool send) +static void socket_datasync(int fd, bool send) { struct { unsigned int length;/* short is not enough for some */ @@ -1845,7 +1854,7 @@ void socket_datasync(int fd, bool send) #ifdef SEND_SHORTLIST // Add a fd to the shortlist so that it'll be recognized as a fd that needs // sending or eof handling. -void send_shortlist_add_fd(int fd) +static void send_shortlist_add_fd(int fd) { int i; int bit; @@ -1872,7 +1881,7 @@ void send_shortlist_add_fd(int fd) } // Do pending network sends and eof handling from the shortlist. -void send_shortlist_do_sends(void) +static void send_shortlist_do_sends(void) { int i; @@ -1928,7 +1937,7 @@ void send_shortlist_do_sends(void) * @retval 0 if it is a WAN IP. * @return the appropriate LAN server address to send, if it is a LAN IP. */ -uint32 socket_lan_subnet_check(uint32 ip, struct s_subnet *info) +static uint32 socket_lan_subnet_check(uint32 ip, struct s_subnet *info) { int i; ARR_FIND(0, VECTOR_LENGTH(sockt->lan_subnets), i, SUBNET_MATCH(ip, VECTOR_INDEX(sockt->lan_subnets, i).ip, VECTOR_INDEX(sockt->lan_subnets, i).mask)); @@ -1952,7 +1961,7 @@ uint32 socket_lan_subnet_check(uint32 ip, struct s_subnet *info) * @retval true if we allow server connections from the given IP. * @retval false otherwise. */ -bool socket_allowed_ip_check(uint32 ip) +static bool socket_allowed_ip_check(uint32 ip) { int i; ARR_FIND(0, VECTOR_LENGTH(sockt->allowed_ips), i, SUBNET_MATCH(ip, VECTOR_INDEX(sockt->allowed_ips, i).ip, VECTOR_INDEX(sockt->allowed_ips, i).mask)); @@ -1968,7 +1977,7 @@ bool socket_allowed_ip_check(uint32 ip) * @retval true if we trust the given IP. * @retval false otherwise. */ -bool socket_trusted_ip_check(uint32 ip) +static bool socket_trusted_ip_check(uint32 ip) { int i; ARR_FIND(0, VECTOR_LENGTH(sockt->trusted_ips), i, SUBNET_MATCH(ip, VECTOR_INDEX(sockt->trusted_ips, i).ip, VECTOR_INDEX(sockt->trusted_ips, i).mask)); @@ -1988,7 +1997,7 @@ bool socket_trusted_ip_check(uint32 ip) * @param[in] groupname Current group name, for output/logging reasons. * @return The amount of entries read, zero in case of errors. */ -int socket_net_config_read_sub(struct config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname) +static int socket_net_config_read_sub(struct config_setting_t *t, struct s_subnet_vector *list, const char *filename, const char *groupname) { int i, len; char ipbuf[64], maskbuf[64]; @@ -2022,7 +2031,7 @@ int socket_net_config_read_sub(struct config_setting_t *t, struct s_subnet_vecto * * @param filename The filename to read from. */ -void socket_net_config_read(const char *filename) +static void socket_net_config_read(const char *filename) { struct config_t network_config; int i; diff --git a/src/common/sql.c b/src/common/sql.c index 6e0e9ba33..0b5b7fa07 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -37,12 +37,12 @@ #include <stdio.h> #include <stdlib.h> // strtoul -void hercules_mysql_error_handler(unsigned int ecode); +static void hercules_mysql_error_handler(unsigned int ecode); -int mysql_reconnect_type = 2; -int mysql_reconnect_count = 1; +static int mysql_reconnect_type = 2; +static int mysql_reconnect_count = 1; -struct sql_interface sql_s; +static struct sql_interface sql_s; struct sql_interface *SQL; /// Sql handle @@ -81,7 +81,7 @@ struct SqlStmt { /////////////////////////////////////////////////////////////////////////////// /// Allocates and initializes a new Sql handle. -struct Sql *Sql_Malloc(void) +static struct Sql *Sql_Malloc(void) { struct Sql *self; @@ -101,7 +101,7 @@ struct Sql *Sql_Malloc(void) static int Sql_P_Keepalive(struct Sql *self); /// Establishes a connection. -int Sql_Connect(struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db) +static int Sql_Connect(struct Sql *self, const char *user, const char *passwd, const char *host, uint16 port, const char *db) { if( self == NULL ) return SQL_ERROR; @@ -124,7 +124,7 @@ int Sql_Connect(struct Sql *self, const char *user, const char *passwd, const ch } /// Retrieves the timeout of the connection. -int Sql_GetTimeout(struct Sql *self, uint32 *out_timeout) +static int Sql_GetTimeout(struct Sql *self, uint32 *out_timeout) { if( self && out_timeout && SQL_SUCCESS == SQL->Query(self, "SHOW VARIABLES LIKE 'wait_timeout'") ) { char* data; @@ -141,7 +141,7 @@ int Sql_GetTimeout(struct Sql *self, uint32 *out_timeout) } /// Retrieves the name of the columns of a table into out_buf, with the separator after each name. -int Sql_GetColumnNames(struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep) +static int Sql_GetColumnNames(struct Sql *self, const char *table, char *out_buf, size_t buf_len, char sep) { char* data; size_t len; @@ -170,7 +170,7 @@ int Sql_GetColumnNames(struct Sql *self, const char *table, char *out_buf, size_ } /// Changes the encoding of the connection. -int Sql_SetEncoding(struct Sql *self, const char *encoding) +static int Sql_SetEncoding(struct Sql *self, const char *encoding) { if( self && mysql_set_character_set(&self->handle, encoding) == 0 ) return SQL_SUCCESS; @@ -178,7 +178,7 @@ int Sql_SetEncoding(struct Sql *self, const char *encoding) } /// Pings the connection. -int Sql_Ping(struct Sql *self) +static int Sql_Ping(struct Sql *self) { if( self && mysql_ping(&self->handle) == 0 ) return SQL_SUCCESS; @@ -220,7 +220,7 @@ static int Sql_P_Keepalive(struct Sql *self) } /// Escapes a string. -size_t Sql_EscapeString(struct Sql *self, char *out_to, const char *from) +static size_t Sql_EscapeString(struct Sql *self, char *out_to, const char *from) { if (self != NULL) return (size_t)mysql_real_escape_string(&self->handle, out_to, from, (unsigned long)strlen(from)); @@ -229,7 +229,7 @@ size_t Sql_EscapeString(struct Sql *self, char *out_to, const char *from) } /// Escapes a string. -size_t Sql_EscapeStringLen(struct Sql *self, char *out_to, const char *from, size_t from_len) +static size_t Sql_EscapeStringLen(struct Sql *self, char *out_to, const char *from, size_t from_len) { if (self != NULL) return (size_t)mysql_real_escape_string(&self->handle, out_to, from, (unsigned long)from_len); @@ -238,8 +238,8 @@ size_t Sql_EscapeStringLen(struct Sql *self, char *out_to, const char *from, siz } /// Executes a query. -int Sql_Query(struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); -int Sql_Query(struct Sql *self, const char *query, ...) +static int Sql_Query(struct Sql *self, const char *query, ...) __attribute__((format(printf, 2, 3))); +static int Sql_Query(struct Sql *self, const char *query, ...) { int res; va_list args; @@ -252,7 +252,7 @@ int Sql_Query(struct Sql *self, const char *query, ...) } /// Executes a query. -int Sql_QueryV(struct Sql *self, const char *query, va_list args) +static int Sql_QueryV(struct Sql *self, const char *query, va_list args) { if( self == NULL ) return SQL_ERROR; @@ -277,7 +277,7 @@ int Sql_QueryV(struct Sql *self, const char *query, va_list args) } /// Executes a query. -int Sql_QueryStr(struct Sql *self, const char *query) +static int Sql_QueryStr(struct Sql *self, const char *query) { if( self == NULL ) return SQL_ERROR; @@ -302,7 +302,7 @@ int Sql_QueryStr(struct Sql *self, const char *query) } /// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE query. -uint64 Sql_LastInsertId(struct Sql *self) +static uint64 Sql_LastInsertId(struct Sql *self) { if (self != NULL) return (uint64)mysql_insert_id(&self->handle); @@ -311,7 +311,7 @@ uint64 Sql_LastInsertId(struct Sql *self) } /// Returns the number of columns in each row of the result. -uint32 Sql_NumColumns(struct Sql *self) +static uint32 Sql_NumColumns(struct Sql *self) { if (self != NULL && self->result != NULL) return (uint32)mysql_num_fields(self->result); @@ -319,7 +319,7 @@ uint32 Sql_NumColumns(struct Sql *self) } /// Returns the number of rows in the result. -uint64 Sql_NumRows(struct Sql *self) +static uint64 Sql_NumRows(struct Sql *self) { if (self != NULL && self->result != NULL) return (uint64)mysql_num_rows(self->result); @@ -327,7 +327,7 @@ uint64 Sql_NumRows(struct Sql *self) } /// Fetches the next row. -int Sql_NextRow(struct Sql *self) +static int Sql_NextRow(struct Sql *self) { if (self != NULL && self->result != NULL) { self->row = mysql_fetch_row(self->result); @@ -343,7 +343,7 @@ int Sql_NextRow(struct Sql *self) } /// Gets the data of a column. -int Sql_GetData(struct Sql *self, size_t col, char **out_buf, size_t *out_len) +static int Sql_GetData(struct Sql *self, size_t col, char **out_buf, size_t *out_len) { if( self && self->row ) { if( col < SQL->NumColumns(self) ) { @@ -359,7 +359,7 @@ int Sql_GetData(struct Sql *self, size_t col, char **out_buf, size_t *out_len) } /// Frees the result of the query. -void Sql_FreeResult(struct Sql *self) +static void Sql_FreeResult(struct Sql *self) { if( self && self->result ) { mysql_free_result(self->result); @@ -370,7 +370,7 @@ void Sql_FreeResult(struct Sql *self) } /// Shows debug information (last query). -void Sql_ShowDebug_(struct Sql *self, const char *debug_file, const unsigned long debug_line) +static void Sql_ShowDebug_(struct Sql *self, const char *debug_file, const unsigned long debug_line) { if( self == NULL ) ShowDebug("at %s:%lu - self is NULL\n", debug_file, debug_line); @@ -381,7 +381,7 @@ void Sql_ShowDebug_(struct Sql *self, const char *debug_file, const unsigned lon } /// Frees a Sql handle returned by Sql_Malloc. -void Sql_Free(struct Sql *self) +static void Sql_Free(struct Sql *self) { if( self ) { @@ -417,7 +417,7 @@ static enum enum_field_types Sql_P_SizeToMysqlIntType(int sz) /// Binds a parameter/result. /// /// @private -static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, void* buffer, size_t buffer_len, unsigned long* out_length, int8* out_is_null) +static int Sql_P_BindSqlDataType(MYSQL_BIND *bind, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, unsigned long *out_length, int8 *out_is_null) { nullpo_retr(SQL_ERROR, bind); memset(bind, 0, sizeof(MYSQL_BIND)); @@ -531,7 +531,7 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, /// Prints debug information about a field (type and length). /// /// @private -static void Sql_P_ShowDebugMysqlFieldInfo(const char* prefix, enum enum_field_types type, int is_unsigned, unsigned long length, const char* length_postfix) +static void Sql_P_ShowDebugMysqlFieldInfo(const char *prefix, enum enum_field_types type, int is_unsigned, unsigned long length, const char *length_postfix) { const char *sign = (is_unsigned ? "UNSIGNED " : ""); const char *type_string = NULL; @@ -588,7 +588,7 @@ static void SqlStmt_P_ShowDebugTruncatedColumn(struct SqlStmt *self, size_t i) } /// Allocates and initializes a new SqlStmt handle. -struct SqlStmt *SqlStmt_Malloc(struct Sql *sql) +static struct SqlStmt *SqlStmt_Malloc(struct Sql *sql) { struct SqlStmt *self; MYSQL_STMT* stmt; @@ -616,8 +616,8 @@ struct SqlStmt *SqlStmt_Malloc(struct Sql *sql) } /// Prepares the statement. -int SqlStmt_Prepare(struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); -int SqlStmt_Prepare(struct SqlStmt *self, const char *query, ...) +static int SqlStmt_Prepare(struct SqlStmt *self, const char *query, ...) __attribute__((format(printf, 2, 3))); +static int SqlStmt_Prepare(struct SqlStmt *self, const char *query, ...) { int res; va_list args; @@ -630,7 +630,7 @@ int SqlStmt_Prepare(struct SqlStmt *self, const char *query, ...) } /// Prepares the statement. -int SqlStmt_PrepareV(struct SqlStmt *self, const char *query, va_list args) +static int SqlStmt_PrepareV(struct SqlStmt *self, const char *query, va_list args) { if( self == NULL ) return SQL_ERROR; @@ -650,7 +650,7 @@ int SqlStmt_PrepareV(struct SqlStmt *self, const char *query, va_list args) } /// Prepares the statement. -int SqlStmt_PrepareStr(struct SqlStmt *self, const char *query) +static int SqlStmt_PrepareStr(struct SqlStmt *self, const char *query) { if( self == NULL ) return SQL_ERROR; @@ -670,7 +670,7 @@ int SqlStmt_PrepareStr(struct SqlStmt *self, const char *query) } /// Returns the number of parameters in the prepared statement. -size_t SqlStmt_NumParams(struct SqlStmt *self) +static size_t SqlStmt_NumParams(struct SqlStmt *self) { if( self ) return (size_t)mysql_stmt_param_count(self->stmt); @@ -679,7 +679,7 @@ size_t SqlStmt_NumParams(struct SqlStmt *self) } /// Binds a parameter to a buffer. -int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len) +static int SqlStmt_BindParam(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, const void *buffer, size_t buffer_len) { if( self == NULL ) return SQL_ERROR; @@ -716,7 +716,7 @@ PRAGMA_GCC46(GCC diagnostic pop) } /// Executes the prepared statement. -int SqlStmt_Execute(struct SqlStmt *self) +static int SqlStmt_Execute(struct SqlStmt *self) { if( self == NULL ) return SQL_ERROR; @@ -741,7 +741,7 @@ int SqlStmt_Execute(struct SqlStmt *self) } /// Returns the number of the AUTO_INCREMENT column of the last INSERT/UPDATE statement. -uint64 SqlStmt_LastInsertId(struct SqlStmt *self) +static uint64 SqlStmt_LastInsertId(struct SqlStmt *self) { if( self ) return (uint64)mysql_stmt_insert_id(self->stmt); @@ -750,7 +750,7 @@ uint64 SqlStmt_LastInsertId(struct SqlStmt *self) } /// Returns the number of columns in each row of the result. -size_t SqlStmt_NumColumns(struct SqlStmt *self) +static size_t SqlStmt_NumColumns(struct SqlStmt *self) { if( self ) return (size_t)mysql_stmt_field_count(self->stmt); @@ -759,7 +759,7 @@ size_t SqlStmt_NumColumns(struct SqlStmt *self) } /// Binds the result of a column to a buffer. -int SqlStmt_BindColumn(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null) +static int SqlStmt_BindColumn(struct SqlStmt *self, size_t idx, enum SqlDataType buffer_type, void *buffer, size_t buffer_len, uint32 *out_length, int8 *out_is_null) { if (self == NULL) return SQL_ERROR; @@ -801,7 +801,7 @@ int SqlStmt_BindColumn(struct SqlStmt *self, size_t idx, enum SqlDataType buffer } /// Returns the number of rows in the result. -uint64 SqlStmt_NumRows(struct SqlStmt *self) +static uint64 SqlStmt_NumRows(struct SqlStmt *self) { if (self != NULL) return (uint64)mysql_stmt_num_rows(self->stmt); @@ -810,7 +810,7 @@ uint64 SqlStmt_NumRows(struct SqlStmt *self) } /// Fetches the next row. -int SqlStmt_NextRow(struct SqlStmt *self) +static int SqlStmt_NextRow(struct SqlStmt *self) { int err; size_t i; @@ -878,14 +878,14 @@ int SqlStmt_NextRow(struct SqlStmt *self) } /// Frees the result of the statement execution. -void SqlStmt_FreeResult(struct SqlStmt *self) +static void SqlStmt_FreeResult(struct SqlStmt *self) { if( self ) mysql_stmt_free_result(self->stmt); } /// Shows debug information (with statement). -void SqlStmt_ShowDebug_(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line) +static void SqlStmt_ShowDebug_(struct SqlStmt *self, const char *debug_file, const unsigned long debug_line) { if( self == NULL ) ShowDebug("at %s:%lu - self is NULL\n", debug_file, debug_line); @@ -896,7 +896,7 @@ void SqlStmt_ShowDebug_(struct SqlStmt *self, const char *debug_file, const unsi } /// Frees a SqlStmt returned by SqlStmt_Malloc. -void SqlStmt_Free(struct SqlStmt *self) +static void SqlStmt_Free(struct SqlStmt *self) { if( self ) { @@ -915,7 +915,7 @@ void SqlStmt_Free(struct SqlStmt *self) } /* receives mysql error codes during runtime (not on first-time-connects) */ -void hercules_mysql_error_handler(unsigned int ecode) +static void hercules_mysql_error_handler(unsigned int ecode) { switch( ecode ) { case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */ @@ -938,7 +938,7 @@ void hercules_mysql_error_handler(unsigned int ecode) * * @retval false in case of error. */ -bool Sql_inter_server_read(const char *filename, bool imported) +static bool Sql_inter_server_read(const char *filename, bool imported) { struct config_t config; const struct config_setting_t *setting = NULL; diff --git a/src/common/strlib.c b/src/common/strlib.c index f0357e4a0..ddb1eb78a 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -32,16 +32,17 @@ #define J_MAX_MALLOC_SIZE 65535 -struct strlib_interface strlib_s; -struct stringbuf_interface stringbuf_s; -struct sv_interface sv_s; +static struct strlib_interface strlib_s; +static struct stringbuf_interface stringbuf_s; +static struct sv_interface sv_s; struct strlib_interface *strlib; struct stringbuf_interface *StrBuf; struct sv_interface *sv; // escapes a string in-place (' -> \' , \ -> \\ , % -> _) -char* jstrescape (char* pt) { +static char *jstrescape(char *pt) +{ //copy from here char *ptr; int i = 0, j = 0; @@ -73,7 +74,7 @@ char* jstrescape (char* pt) { } // escapes a string into a provided buffer -char* jstrescapecpy (char* pt, const char* spt) +static char *jstrescapecpy(char *pt, const char *spt) { //copy from here //WARNING: Target string pt should be able to hold strlen(spt)*2, as each time @@ -108,7 +109,7 @@ char* jstrescapecpy (char* pt, const char* spt) } // escapes exactly 'size' bytes of a string into a provided buffer -int jmemescapecpy (char* pt, const char* spt, int size) +static int jmemescapecpy(char *pt, const char *spt, int size) { //copy from here int i =0, j=0; @@ -135,7 +136,7 @@ int jmemescapecpy (char* pt, const char* spt, int size) } // Function to suppress control characters in a string. -int strlib_remove_control_chars(char *str) +static int strlib_remove_control_chars(char *str) { int i; int change = 0; @@ -152,7 +153,7 @@ int strlib_remove_control_chars(char *str) // Removes characters identified by ISSPACE from the start and end of the string // NOTE: make sure the string is not const!! -char *strlib_trim(char *str) +static char *strlib_trim(char *str) { size_t start; size_t end; @@ -180,7 +181,7 @@ char *strlib_trim(char *str) // Converts one or more consecutive occurrences of the delimiters into a single space // and removes such occurrences from the beginning and end of string // NOTE: make sure the string is not const!! -char *strlib_normalize_name(char *str, const char *delims) +static char *strlib_normalize_name(char *str, const char *delims) { char* in = str; char* out = str; @@ -218,7 +219,7 @@ char *strlib_normalize_name(char *str, const char *delims) //stristr: Case insensitive version of strstr, code taken from //http://www.daniweb.com/code/snippet313.html, Dave Sinkula // -const char *strlib_stristr(const char *haystack, const char *needle) +static const char *strlib_stristr(const char *haystack, const char *needle) { if ( !*needle ) { @@ -246,7 +247,7 @@ const char *strlib_stristr(const char *haystack, const char *needle) return 0; } -char* strlib_strtok_r(char *s1, const char *s2, char **lasts) +static char* strlib_strtok_r(char *s1, const char *s2, char **lasts) { #ifdef __WIN32 char *ret; @@ -269,7 +270,7 @@ char* strlib_strtok_r(char *s1, const char *s2, char **lasts) #endif } -size_t strlib_strnlen(const char *string, size_t maxlen) +static size_t strlib_strnlen(const char *string, size_t maxlen) { // TODO: Verify whether this implementation is still necessary for NetBSD 5.x // and possibly some Solaris versions. @@ -287,7 +288,7 @@ size_t strlib_strnlen(const char *string, size_t maxlen) //---------------------------------------------------- // E-mail check: return 0 (not correct) or 1 (valid). //---------------------------------------------------- -int strlib_e_mail_check(char *email) +static int strlib_e_mail_check(char *email) { char ch; char* last_arobas; @@ -324,7 +325,8 @@ int strlib_e_mail_check(char *email) // Return numerical value of a switch configuration // on/off, yes/no, true/false, number //-------------------------------------------------- -int strlib_config_switch(const char *str) { +static int strlib_config_switch(const char *str) +{ size_t len = strlen(str); if ((len == 2 && strcmpi(str, "on") == 0) || (len == 3 && strcmpi(str, "yes") == 0) @@ -345,7 +347,7 @@ int strlib_config_switch(const char *str) { /// strncpy that always null-terminates the string /// @remark this function will read at most `n` - 1 bytes from `src` (from 0 to `n` - 2) -char *strlib_safestrncpy(char *dst, const char *src, size_t n) +static char *strlib_safestrncpy(char *dst, const char *src, size_t n) { if( n > 0 ) { @@ -366,7 +368,7 @@ char *strlib_safestrncpy(char *dst, const char *src, size_t n) } /// doesn't crash on null pointer -size_t strlib_safestrnlen(const char *string, size_t maxlen) +static size_t strlib_safestrnlen(const char *string, size_t maxlen) { return ( string != NULL ) ? strnlen(string, maxlen) : 0; } @@ -380,8 +382,8 @@ size_t strlib_safestrnlen(const char *string, size_t maxlen) /// @param fmt Format string /// @param ... Format arguments /// @return The size of the string or -1 if the buffer is too small -int strlib_safesnprintf(char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); -int strlib_safesnprintf(char *buf, size_t sz, const char *fmt, ...) +static int strlib_safesnprintf(char *buf, size_t sz, const char *fmt, ...) __attribute__((format(printf, 3, 4))); +static int strlib_safesnprintf(char *buf, size_t sz, const char *fmt, ...) { va_list ap; int ret; @@ -398,7 +400,7 @@ int strlib_safesnprintf(char *buf, size_t sz, const char *fmt, ...) /// Returns the line of the target position in the string. /// Lines start at 1. -int strlib_strline(const char *str, size_t pos) +static int strlib_strline(const char *str, size_t pos) { const char* target; int line; @@ -424,7 +426,7 @@ int strlib_strline(const char *str, size_t pos) /// @param output Output string /// @param input Binary input buffer /// @param count Number of bytes to convert -bool strlib_bin2hex(char *output, const unsigned char *input, size_t count) +static bool strlib_bin2hex(char *output, const unsigned char *input, size_t count) { char toHex[] = "0123456789abcdef"; size_t i; @@ -444,7 +446,7 @@ bool strlib_bin2hex(char *output, const unsigned char *input, size_t count) /// /// @param svstate Parse state /// @return 1 if a field was parsed, 0 if already done, -1 on error. -int sv_parse_next(struct s_svstate* svstate) +static int sv_parse_next(struct s_svstate *svstate) { enum { START_OF_FIELD, @@ -615,7 +617,8 @@ int sv_parse_next(struct s_svstate* svstate) /// @param npos Size of the pos array /// @param opt Options that determine the parsing behavior /// @return Number of fields found in the string or -1 if an error occurred -int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt) { +static int sv_parse(const char *str, int len, int startoff, char delim, int *out_pos, int npos, enum e_svopt opt) +{ struct s_svstate svstate; int count; @@ -665,7 +668,8 @@ int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, i /// @param nfields Size of the field array /// @param opt Options that determine the parsing behavior /// @return Number of fields found in the string or -1 if an error occurred -int sv_split(char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt) { +static int sv_split(char *str, int len, int startoff, char delim, char **out_fields, int nfields, enum e_svopt opt) +{ int pos[1024]; int i; int done; @@ -731,7 +735,8 @@ int sv_split(char* str, int len, int startoff, char delim, char** out_fields, in /// @param len Length of the source string /// @param escapes Extra characters to be escaped /// @return Length of the escaped string -size_t sv_escape_c(char* out_dest, const char* src, size_t len, const char* escapes) { +static size_t sv_escape_c(char *out_dest, const char *src, size_t len, const char *escapes) +{ size_t i; size_t j; @@ -799,7 +804,8 @@ size_t sv_escape_c(char* out_dest, const char* src, size_t len, const char* esca /// @param src Source string /// @param len Length of the source string /// @return Length of the escaped string -size_t sv_unescape_c(char* out_dest, const char* src, size_t len) { +static size_t sv_unescape_c(char *out_dest, const char *src, size_t len) +{ static unsigned char low2hex[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,// 0x0? 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,// 0x1? @@ -880,7 +886,8 @@ size_t sv_unescape_c(char* out_dest, const char* src, size_t len) { } /// Skips a C escape sequence (starting with '\\'). -const char* skip_escaped_c(const char* p) { +static const char *skip_escaped_c(const char *p) +{ if( p && *p == '\\' ) { ++p; switch( *p ) { @@ -918,7 +925,8 @@ const char* skip_escaped_c(const char* p) { /// @param maxcols Maximum number of columns of a valid row /// @param parseproc User-supplied row processing function /// @return true on success, false if file could not be opened -bool sv_readdb(const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, bool (*parseproc)(char* fields[], int columns, int current)) { +static bool sv_readdb(const char *directory, const char *filename, char delim, int mincols, int maxcols, int maxrows, bool (*parseproc)(char *fields[], int columns, int current)) +{ FILE* fp; int lines = 0; int entries = 0; @@ -990,7 +998,8 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc // @author MouseJstr (original) /// Allocates a StringBuf -StringBuf* StringBuf_Malloc(void) { +static StringBuf *StringBuf_Malloc(void) +{ StringBuf* self; CREATE(self, StringBuf, 1); StrBuf->Init(self); @@ -998,14 +1007,16 @@ StringBuf* StringBuf_Malloc(void) { } /// Initializes a previously allocated StringBuf -void StringBuf_Init(StringBuf* self) { +static void StringBuf_Init(StringBuf *self) +{ self->max_ = 1024; self->ptr_ = self->buf_ = (char*)aMalloc(self->max_ + 1); } /// Appends the result of printf to the StringBuf -int StringBuf_Printf(StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -int StringBuf_Printf(StringBuf *self, const char *fmt, ...) { +static int StringBuf_Printf(StringBuf *self, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +static int StringBuf_Printf(StringBuf *self, const char *fmt, ...) +{ int len; va_list ap; @@ -1017,7 +1028,8 @@ int StringBuf_Printf(StringBuf *self, const char *fmt, ...) { } /// Appends the result of vprintf to the StringBuf -int StringBuf_Vprintf(StringBuf* self, const char* fmt, va_list ap) { +static int StringBuf_Vprintf(StringBuf *self, const char *fmt, va_list ap) +{ for(;;) { va_list apcopy; int n, off; @@ -1040,7 +1052,8 @@ int StringBuf_Vprintf(StringBuf* self, const char* fmt, va_list ap) { } /// Appends the contents of another StringBuf to the StringBuf -int StringBuf_Append(StringBuf* self, const StringBuf* sbuf) { +static int StringBuf_Append(StringBuf *self, const StringBuf *sbuf) +{ size_t available = self->max_ - (self->ptr_ - self->buf_); size_t needed = sbuf->ptr_ - sbuf->buf_; @@ -1057,7 +1070,8 @@ int StringBuf_Append(StringBuf* self, const StringBuf* sbuf) { } // Appends str to the StringBuf -int StringBuf_AppendStr(StringBuf* self, const char* str) { +static int StringBuf_AppendStr(StringBuf *self, const char *str) +{ size_t available = self->max_ - (self->ptr_ - self->buf_); size_t needed = strlen(str); @@ -1075,34 +1089,41 @@ int StringBuf_AppendStr(StringBuf* self, const char* str) { } // Returns the length of the data in the Stringbuf -int StringBuf_Length(StringBuf* self) { +static int StringBuf_Length(StringBuf *self) +{ return (int)(self->ptr_ - self->buf_); } /// Returns the data in the StringBuf -char* StringBuf_Value(StringBuf* self) { +static char *StringBuf_Value(StringBuf *self) +{ *self->ptr_ = '\0'; return self->buf_; } /// Clears the contents of the StringBuf -void StringBuf_Clear(StringBuf* self) { +static void StringBuf_Clear(StringBuf *self) +{ self->ptr_ = self->buf_; } /// Destroys the StringBuf -void StringBuf_Destroy(StringBuf* self) { +static void StringBuf_Destroy(StringBuf *self) +{ aFree(self->buf_); self->ptr_ = self->buf_ = 0; self->max_ = 0; } // Frees a StringBuf returned by StringBuf_Malloc -void StringBuf_Free(StringBuf* self) { +static void StringBuf_Free(StringBuf *self) +{ StrBuf->Destroy(self); aFree(self); } -void strlib_defaults(void) { + +void strlib_defaults(void) +{ /* connect */ strlib = &strlib_s; StrBuf = &stringbuf_s; @@ -1116,17 +1137,8 @@ void strlib_defaults(void) { strlib->normalize_name_ = strlib_normalize_name; strlib->stristr_ = strlib_stristr; -#if !(defined(WIN32) && defined(_MSC_VER)) && !defined(HAVE_STRNLEN) strlib->strnlen_ = strlib_strnlen; -#else - strlib->strnlen_ = NULL; -#endif - -#ifdef WIN32 strlib->strtok_r_ = strlib_strtok_r; -#else - strlib->strtok_r_ = NULL; -#endif strlib->e_mail_check_ = strlib_e_mail_check; strlib->config_switch_ = strlib_config_switch; diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 0056aee1e..b8cb2a90a 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -59,8 +59,8 @@ struct sysinfo_private { }; /// sysinfo.c interface source -struct sysinfo_interface sysinfo_s; -struct sysinfo_private sysinfo_p; +static struct sysinfo_interface sysinfo_s; +static struct sysinfo_private sysinfo_p; struct sysinfo_interface *sysinfo; @@ -238,7 +238,7 @@ enum windows_ver_suite { * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_svn_get_revision(char **out) +static bool sysinfo_svn_get_revision(char **out) { // Only include SVN support if detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_SVN || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN @@ -310,7 +310,7 @@ bool sysinfo_svn_get_revision(char **out) * @retval true if a revision was correctly detected. * @retval false if no revision was detected. out is set to NULL in this case. */ -bool sysinfo_git_get_revision(char **out) +static bool sysinfo_git_get_revision(char **out) { // Only include Git support if we detected it, or we're on MSVC #if !defined(SYSINFO_VCSTYPE) || SYSINFO_VCSTYPE == VCSTYPE_GIT || SYSINFO_VCSTYPE == VCSTYPE_UNKNOWN @@ -359,7 +359,7 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); * * Once retrieved, the version string is stored into sysinfo->p->osversion. */ -void sysinfo_osversion_retrieve(void) +static void sysinfo_osversion_retrieve(void) { OSVERSIONINFOEX osvi; StringBuf buf; @@ -611,7 +611,7 @@ typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); * System info is not stored anywhere after retrieval * @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx **/ -void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) +static void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) { PGNSI pGNSI; @@ -629,7 +629,7 @@ void sysinfo_systeminfo_retrieve(LPSYSTEM_INFO info) * Returns number of bytes in a memory page * Only needed when compiling with MSVC **/ -long sysinfo_getpagesize(void) +static long sysinfo_getpagesize(void) { SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -644,7 +644,7 @@ long sysinfo_getpagesize(void) * Once retrieved, the name is stored into sysinfo->p->cpu and the * number of cores in sysinfo->p->cpucores. */ -void sysinfo_cpu_retrieve(void) +static void sysinfo_cpu_retrieve(void) { StringBuf buf; SYSTEM_INFO si; @@ -681,7 +681,7 @@ void sysinfo_cpu_retrieve(void) * * Once retrieved, the name is stored into sysinfo->p->arch. */ -void sysinfo_arch_retrieve(void) +static void sysinfo_arch_retrieve(void) { SYSTEM_INFO si; ZeroMemory(&si, sizeof(SYSTEM_INFO)); @@ -710,7 +710,7 @@ void sysinfo_arch_retrieve(void) * * Once retrieved, the value is stored in sysinfo->p->vcsrevision_src. */ -void sysinfo_vcsrevision_src_retrieve(void) +static void sysinfo_vcsrevision_src_retrieve(void) { if (sysinfo->p->vcsrevision_src != NULL) { aFree(sysinfo->p->vcsrevision_src); @@ -735,7 +735,7 @@ void sysinfo_vcsrevision_src_retrieve(void) * * Once retrieved, the value is stored in sysinfo->p->vcstype_name. */ -void sysinfo_vcstype_name_retrieve(void) +static void sysinfo_vcstype_name_retrieve(void) { if (sysinfo->p->vcstype_name != NULL) { aFree(sysinfo->p->vcstype_name); @@ -765,7 +765,7 @@ void sysinfo_vcstype_name_retrieve(void) * * Output example: "Linux", "Darwin", "Windows", etc. */ -const char *sysinfo_platform(void) +static const char *sysinfo_platform(void) { return sysinfo->p->platform; } @@ -784,7 +784,7 @@ const char *sysinfo_platform(void) * Output example: "Windows 2008 Small Business Server", "OS X 10.8 Mountain Lion", * "Gentoo Base System Release 2.2", "Debian GNU/Linux 6.0.6 (squeeze)", etc. */ -const char *sysinfo_osversion(void) +static const char *sysinfo_osversion(void) { return sysinfo->p->osversion; } @@ -804,7 +804,7 @@ const char *sysinfo_osversion(void) * "Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz", "Intel Core i7", * "x86 CPU, Family 6, Model 54, Stepping 1", etc. */ -const char *sysinfo_cpu(void) +static const char *sysinfo_cpu(void) { return sysinfo->p->cpu; } @@ -818,7 +818,7 @@ const char *sysinfo_cpu(void) * * @return the number of CPU cores. */ -int sysinfo_cpucores(void) +static int sysinfo_cpucores(void) { return sysinfo->p->cpucores; } @@ -836,7 +836,7 @@ int sysinfo_cpucores(void) * * Output example: "x86", "x86_64", "IA-64", "ARM", etc. */ -const char *sysinfo_arch(void) +static const char *sysinfo_arch(void) { return sysinfo->p->arch; } @@ -847,7 +847,7 @@ const char *sysinfo_arch(void) * @retval true if this is a 64 bit build. * @retval false if this isn't a 64 bit build (i.e. it is a 32 bit build). */ -bool sysinfo_is64bit(void) +static bool sysinfo_is64bit(void) { #ifdef _LP64 return true; @@ -866,7 +866,7 @@ bool sysinfo_is64bit(void) * Output example: "Microsoft Visual C++ 2012 (v170050727)", * "Clang v5.0.0", "MinGW32 v3.20", "GCC v4.7.3", etc. */ -const char *sysinfo_compiler(void) +static const char *sysinfo_compiler(void) { return sysinfo->p->compiler; } @@ -882,7 +882,7 @@ const char *sysinfo_compiler(void) * * Output example: "-ggdb -O2 -flto -pipe -ffast-math ..." */ -const char *sysinfo_cflags(void) +static const char *sysinfo_cflags(void) { return sysinfo->p->cflags; } @@ -898,7 +898,7 @@ const char *sysinfo_cflags(void) * * @see VCSTYPE_NONE, VCSTYPE_GIT, VCSTYPE_SVN, VCSTYPE_UNKNOWN */ -int sysinfo_vcstypeid(void) +static int sysinfo_vcstypeid(void) { return sysinfo->p->vcstype; } @@ -916,7 +916,7 @@ int sysinfo_vcstypeid(void) * * Output example: "Git", "SVN", "Exported" */ -const char *sysinfo_vcstype(void) +static const char *sysinfo_vcstype(void) { return sysinfo->p->vcstype_name; } @@ -935,7 +935,7 @@ const char *sysinfo_vcstype(void) * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_src(void) +static const char *sysinfo_vcsrevision_src(void) { return sysinfo->p->vcsrevision_src; } @@ -952,7 +952,7 @@ const char *sysinfo_vcsrevision_src(void) * * Output example: Git: "9128feccf3bddda94a7f8a170305565416815b40", SVN: "17546" */ -const char *sysinfo_vcsrevision_scripts(void) +static const char *sysinfo_vcsrevision_scripts(void) { return sysinfo->p->vcsrevision_scripts; } @@ -961,7 +961,7 @@ const char *sysinfo_vcsrevision_scripts(void) * Reloads the run-time (scripts) VCS revision information. To be used during * script reloads to refresh the cached version. */ -void sysinfo_vcsrevision_reload(void) +static void sysinfo_vcsrevision_reload(void) { if (sysinfo->p->vcsrevision_scripts != NULL) { aFree(sysinfo->p->vcsrevision_scripts); @@ -984,7 +984,7 @@ void sysinfo_vcsrevision_reload(void) * @retval false if the current process is running as regular user, or * in any case under Windows. */ -bool sysinfo_is_superuser(void) +static bool sysinfo_is_superuser(void) { #ifndef _WIN32 if (geteuid() == 0) @@ -996,7 +996,7 @@ bool sysinfo_is_superuser(void) /** * Interface runtime initialization. */ -void sysinfo_init(void) +static void sysinfo_init(void) { sysinfo->p->compiler = SYSINFO_COMPILER; #ifdef WIN32 @@ -1023,7 +1023,7 @@ void sysinfo_init(void) /** * Interface shutdown cleanup. */ -void sysinfo_final(void) +static void sysinfo_final(void) { #ifdef WIN32 // Only need to be free'd in win32, they're #defined elsewhere diff --git a/src/common/thread.c b/src/common/thread.c index 2dc7d2682..605153011 100644 --- a/src/common/thread.c +++ b/src/common/thread.c @@ -49,7 +49,7 @@ * @author Florian Wilkemeyer <fw@f-ws.de> */ -struct thread_interface thread_s; +static struct thread_interface thread_s; struct thread_interface *thread; /// The maximum amount of threads. @@ -70,7 +70,7 @@ struct thread_handle { }; #ifdef HAS_TLS -__thread int g_rathread_ID = -1; +static __thread int g_rathread_ID = -1; #endif // Subystem Code @@ -78,7 +78,7 @@ __thread int g_rathread_ID = -1; static struct thread_handle l_threads[THREADS_MAX]; /// @copydoc thread_interface::init() -void thread_init(void) +static void thread_init(void) { register int i; memset(&l_threads, 0x00, THREADS_MAX * sizeof(struct thread_handle)); @@ -97,7 +97,7 @@ void thread_init(void) } /// @copydoc thread_interface::final() -void thread_final(void) +static void thread_final(void) { register int i; @@ -125,7 +125,7 @@ static void thread_terminated(struct thread_handle *handle) } #ifdef WIN32 -DWORD WINAPI thread_main_redirector(LPVOID p) +static DWORD WINAPI thread_main_redirector(LPVOID p) { #else static void *thread_main_redirector(void *p) @@ -170,13 +170,13 @@ static void *thread_main_redirector(void *p) // API Level /// @copydoc thread_interface::create() -struct thread_handle *thread_create(threadFunc entry_point, void *param) +static struct thread_handle *thread_create(threadFunc entry_point, void *param) { return thread->create_opt(entry_point, param, (1<<23) /*8MB*/, THREADPRIO_NORMAL); } /// @copydoc thread_interface::create_opt() -struct thread_handle *thread_create_opt(threadFunc entry_point, void *param, size_t stack_size, enum thread_priority prio) +static struct thread_handle *thread_create_opt(threadFunc entry_point, void *param, size_t stack_size, enum thread_priority prio) { #ifndef WIN32 pthread_attr_t attr; @@ -226,7 +226,7 @@ struct thread_handle *thread_create_opt(threadFunc entry_point, void *param, siz } /// @copydoc thread_interface::destroy() -void thread_destroy(struct thread_handle *handle) +static void thread_destroy(struct thread_handle *handle) { #ifdef WIN32 if (TerminateThread(handle->hThread, 0) != FALSE) { @@ -244,7 +244,7 @@ void thread_destroy(struct thread_handle *handle) #endif } -struct thread_handle *thread_self(void) +static struct thread_handle *thread_self(void) { #ifdef HAS_TLS struct thread_handle *handle = &l_threads[g_rathread_ID]; @@ -273,7 +273,7 @@ struct thread_handle *thread_self(void) } /// @copydoc thread_interface::get_tid() -int thread_get_tid(void) +static int thread_get_tid(void) { #if defined(HAS_TLS) return g_rathread_ID; @@ -285,7 +285,7 @@ int thread_get_tid(void) } /// @copydoc thread_interface::wait() -bool thread_wait(struct thread_handle *handle, void **out_exit_code) +static bool thread_wait(struct thread_handle *handle, void **out_exit_code) { // Hint: // no thread data cleanup routine call here! @@ -302,20 +302,21 @@ bool thread_wait(struct thread_handle *handle, void **out_exit_code) } /// @copydoc thread_interface::prio_set() -void thread_prio_set(struct thread_handle *handle, enum thread_priority prio) +static void thread_prio_set(struct thread_handle *handle, enum thread_priority prio) { handle->prio = THREADPRIO_NORMAL; //@TODO } /// @copydoc thread_interface::prio_get() -enum thread_priority thread_prio_get(struct thread_handle *handle) +static enum thread_priority thread_prio_get(struct thread_handle *handle) { return handle->prio; } /// @copydoc thread_interface::yield() -void thread_yield(void) { +static void thread_yield(void) +{ #ifdef WIN32 SwitchToThread(); #else diff --git a/src/common/timer.c b/src/common/timer.c index ad11bc18d..d5f9c83d1 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -40,7 +40,7 @@ #include <stdlib.h> #include <string.h> -struct timer_interface timer_s; +static struct timer_interface timer_s; struct timer_interface *timer; // If the server can't handle processing thousands of monsters @@ -54,7 +54,7 @@ static int timer_data_max = 0; static int timer_data_num = 1; // free timers (array) -static int* free_timer_list = NULL; +static int *free_timer_list = NULL; static int free_timer_list_max = 0; static int free_timer_list_pos = 0; @@ -72,20 +72,21 @@ static BHEAP_VAR(int, timer_heap); // server startup time -time_t start_time; +static time_t start_time; /*---------------------------- * Timer debugging *----------------------------*/ -struct timer_func_list { +static struct timer_func_list { struct timer_func_list* next; TimerFunc func; char* name; } *tfl_root = NULL; /// Sets the name of a timer function. -int timer_add_func_list(TimerFunc func, char* name) { +static int timer_add_func_list(TimerFunc func, char *name) +{ struct timer_func_list* tfl; nullpo_ret(func); @@ -108,7 +109,7 @@ int timer_add_func_list(TimerFunc func, char* name) { } /// Returns the name of the timer function. -char* search_timer_func_list(TimerFunc func) +static char *search_timer_func_list(TimerFunc func) { struct timer_func_list* tfl; @@ -124,9 +125,11 @@ char* search_timer_func_list(TimerFunc func) *----------------------------*/ #if defined(ENABLE_RDTSC) -static uint64 RDTSC_BEGINTICK = 0, RDTSC_CLOCK = 0; +static uint64 RDTSC_BEGINTICK = 0; +static uint64 RDTSC_CLOCK = 0; -static __inline uint64 rdtsc_(void) { +static __inline uint64 rdtsc_(void) +{ register union { uint64 qw; uint32 dw[2]; @@ -137,7 +140,8 @@ static __inline uint64 rdtsc_(void) { return t.qw; } -static void rdtsc_calibrate(void){ +static void rdtsc_calibrate(void) +{ uint64 t1, t2; int32 i; @@ -164,7 +168,8 @@ static void rdtsc_calibrate(void){ * platform-abstracted tick retrieval * @return server's current tick */ -static int64 sys_tick(void) { +static int64 sys_tick(void) +{ #if defined(WIN32) // Windows: GetTickCount/GetTickCount64: Return the number of // milliseconds that have elapsed since the system was started. @@ -226,25 +231,28 @@ static int64 sys_tick(void) { static int64 gettick_cache; static int gettick_count = 1; -int64 timer_gettick_nocache(void) { +static int64 timer_gettick_nocache(void) +{ gettick_count = TICK_CACHE; gettick_cache = sys_tick(); return gettick_cache; } -int64 timer_gettick(void) { +static int64 timer_gettick(void) +{ return ( --gettick_count == 0 ) ? gettick_nocache() : gettick_cache; } ////////////////////////////// #else ////////////////////////////// // tick doesn't get cached -int64 timer_gettick_nocache(void) +static int64 timer_gettick_nocache(void) { return sys_tick(); } -int64 timer_gettick(void) { +static int64 timer_gettick(void) +{ return sys_tick(); } ////////////////////////////////////////////////////////////////////////// @@ -256,7 +264,8 @@ int64 timer_gettick(void) { *--------------------------------------*/ /// Adds a timer to the timer_heap -static void push_timer_heap(int tid) { +static void push_timer_heap(int tid) +{ BHEAP_ENSURE(timer_heap, 1, 256); BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap); } @@ -266,7 +275,8 @@ static void push_timer_heap(int tid) { *--------------------------*/ /// Returns a free timer id. -static int acquire_timer(void) { +static int acquire_timer(void) +{ int tid; // select a free timer @@ -299,7 +309,8 @@ static int acquire_timer(void) { /// Starts a new timer that is deleted once it expires (single-use). /// Returns the timer's id. -int timer_add(int64 tick, TimerFunc func, int id, intptr_t data) { +static int timer_add(int64 tick, TimerFunc func, int id, intptr_t data) +{ int tid; nullpo_retr(INVALID_TIMER, func); @@ -328,7 +339,7 @@ int timer_add(int64 tick, TimerFunc func, int id, intptr_t data) { /// Starts a new timer that automatically restarts itself (infinite loop until manually removed). /// Returns the timer's id, or INVALID_TIMER if it fails. -int timer_add_interval(int64 tick, TimerFunc func, int id, intptr_t data, int interval) +static int timer_add_interval(int64 tick, TimerFunc func, int id, intptr_t data, int interval) { int tid; @@ -364,7 +375,8 @@ int timer_add_interval(int64 tick, TimerFunc func, int id, intptr_t data, int in } /// Retrieves internal timer data -const struct TimerData* timer_get(int tid) { +static const struct TimerData *timer_get(int tid) +{ Assert_retr(NULL, tid > 0); return ( tid >= 0 && tid < timer_data_num ) ? &timer_data[tid] : NULL; } @@ -372,7 +384,7 @@ const struct TimerData* timer_get(int tid) { /// Marks a timer specified by 'id' for immediate deletion once it expires. /// Param 'func' is used for debug/verification purposes. /// Returns 0 on success, < 0 on failure. -int timer_do_delete(int tid, TimerFunc func) +static int timer_do_delete(int tid, TimerFunc func) { nullpo_ret(func); @@ -402,7 +414,8 @@ int timer_do_delete(int tid, TimerFunc func) /// Adjusts a timer's expiration time. /// Returns the new tick value, or -1 if it fails. -int64 timer_addtick(int tid, int64 tick) { +static int64 timer_addtick(int tid, int64 tick) +{ if (tid < 1 || tid >= timer_data_num) { ShowError("timer_addtick error : no such timer [%d]\n", tid); Assert_retr(-1, 0); @@ -419,7 +432,7 @@ int64 timer_addtick(int tid, int64 tick) { * @return The new tick value. * @retval -1 in case of failure. */ -int64 timer_settick(int tid, int64 tick) +static int64 timer_settick(int tid, int64 tick) { int i; @@ -461,7 +474,7 @@ int64 timer_settick(int tid, int64 tick) * @param tick The current tick. * @return The value of the smallest non-expired timer (or 1 second if there aren't any). */ -int do_timer(int64 tick) +static int do_timer(int64 tick) { int64 diff = TIMER_MAX_INTERVAL; // return value @@ -515,11 +528,12 @@ int do_timer(int64 tick) return (int)cap_value(diff, TIMER_MIN_INTERVAL, TIMER_MAX_INTERVAL); } -unsigned long timer_get_uptime(void) { +static unsigned long timer_get_uptime(void) +{ return (unsigned long)difftime(time(NULL), start_time); } -void timer_init(void) +static void timer_init(void) { #if defined(ENABLE_RDTSC) rdtsc_calibrate(); @@ -528,7 +542,8 @@ void timer_init(void) time(&start_time); } -void timer_final(void) { +static void timer_final(void) +{ struct timer_func_list *tfl; struct timer_func_list *next; @@ -542,12 +557,14 @@ void timer_final(void) { BHEAP_CLEAR(timer_heap); if (free_timer_list) aFree(free_timer_list); } + /*===================================== -* Default Functions : timer.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void timer_defaults(void) { + * Default Functions : timer.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void timer_defaults(void) +{ timer = &timer_s; /* funcs */ diff --git a/src/common/utils.c b/src/common/utils.c index 44f3087c3..d4c838b56 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -45,11 +45,11 @@ #include <stdlib.h> #include <sys/stat.h> // cache purposes [Ind/Hercules] -struct HCache_interface HCache_s; +static struct HCache_interface HCache_s; struct HCache_interface *HCache; /// Dumps given buffer into file pointed to by a handle. -void WriteDump(FILE* fp, const void* buffer, size_t length) +void WriteDump(FILE *fp, const void *buffer, size_t length) { size_t i; char hex[48+1], ascii[16+1]; @@ -109,7 +109,7 @@ void ShowDump(const void *buffer, size_t length) #ifdef WIN32 -static char* checkpath(char *path, const char *srcpath) +static char *checkpath(char *path, const char *srcpath) { // just make sure the char*path is not const char *p = path; @@ -128,7 +128,7 @@ static char* checkpath(char *path, const char *srcpath) return path; } -void findfile(const char *p, const char *pat, void (func)(const char*)) +void findfile(const char *p, const char *pat, void (func)(const char *)) { WIN32_FIND_DATAA FindFileData; HANDLE hFind; @@ -171,7 +171,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) #define MAX_DIR_PATH 2048 -static char* checkpath(char *path, const char*srcpath) +static char *checkpath(char *path, const char *srcpath) { // just make sure the char*path is not const char *p=path; @@ -190,7 +190,7 @@ static char* checkpath(char *path, const char*srcpath) return path; } -void findfile(const char *p, const char *pat, void (func)(const char*)) +void findfile(const char *p, const char *pat, void (func)(const char *)) { DIR* dir; ///< pointer to the scanned directory. struct dirent* entry; ///< pointer to one directory entry. @@ -238,7 +238,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) } #endif -bool exists(const char* filename) +bool exists(const char *filename) { return !access(filename, F_OK); } @@ -309,14 +309,14 @@ int32 MakeLongLE(int32 val) } // Reads an uint16 in little-endian from the buffer -uint16 GetUShort(const unsigned char* buf) +uint16 GetUShort(const unsigned char *buf) { return ( ((uint16)(buf[0])) ) | ( ((uint16)(buf[1])) << 0x08 ); } // Reads an uint32 in little-endian from the buffer -uint32 GetULong(const unsigned char* buf) +uint32 GetULong(const unsigned char *buf) { return ( ((uint32)(buf[0])) ) | ( ((uint32)(buf[1])) << 0x08 ) @@ -325,13 +325,13 @@ uint32 GetULong(const unsigned char* buf) } // Reads an int32 in little-endian from the buffer -int32 GetLong(const unsigned char* buf) +int32 GetLong(const unsigned char *buf) { return (int32)GetULong(buf); } // Reads a float (32 bits) from the buffer -float GetFloat(const unsigned char* buf) +float GetFloat(const unsigned char *buf) { uint32 val = GetULong(buf); return *((float*)(void*)&val); @@ -426,7 +426,7 @@ int apply_percentrate(int value, int rate, int maxrate) //----------------------------------------------------- // custom timestamp formatting (from eApp) //----------------------------------------------------- -const char* timestamp2string(char* str, size_t size, time_t timestamp, const char* format) +const char *timestamp2string(char *str, size_t size, time_t timestamp, const char *format) { size_t len; nullpo_retr(NULL, str); @@ -436,7 +436,7 @@ const char* timestamp2string(char* str, size_t size, time_t timestamp, const cha } /* [Ind/Hercules] Caching */ -bool HCache_check(const char *file) +static bool HCache_check(const char *file) { struct stat bufa, bufb; FILE *first, *second; @@ -487,7 +487,7 @@ bool HCache_check(const char *file) return true; } -FILE *HCache_open(const char *file, const char *opt) +static FILE *HCache_open(const char *file, const char *opt) { FILE *first; char s_path[255]; @@ -520,7 +520,7 @@ FILE *HCache_open(const char *file, const char *opt) return first; } -void HCache_init(void) +static void HCache_init(void) { struct stat buf; if (stat(SERVER_NAME, &buf) != 0) { diff --git a/src/login/account.c b/src/login/account.c index 6308a73d1..783cf85ea 100644 --- a/src/login/account.c +++ b/src/login/account.c @@ -39,11 +39,11 @@ /// global defines #define ACCOUNT_SQL_DB_VERSION 20110114 -struct account_interface account_s; +static struct account_interface account_s; struct account_interface *account; /// public constructor -AccountDB* account_db_sql(void) +static AccountDB *account_db_sql(void) { AccountDB_SQL* db = (AccountDB_SQL*)aCalloc(1, sizeof(AccountDB_SQL)); @@ -80,7 +80,7 @@ AccountDB* account_db_sql(void) /* ------------------------------------------------------------------------- */ /// establishes database connection -static bool account_db_sql_init(AccountDB* self) +static bool account_db_sql_init(AccountDB *self) { AccountDB_SQL* db = (AccountDB_SQL*)self; struct Sql *sql_handle = NULL; @@ -109,7 +109,7 @@ static bool account_db_sql_init(AccountDB* self) } /// disconnects from database -static void account_db_sql_destroy(AccountDB* self) +static void account_db_sql_destroy(AccountDB *self) { AccountDB_SQL* db = (AccountDB_SQL*)self; @@ -120,7 +120,7 @@ static void account_db_sql_destroy(AccountDB* self) } /// Gets a property from this database. -static bool account_db_sql_get_property(AccountDB* self, const char* key, char* buf, size_t buflen) +static bool account_db_sql_get_property(AccountDB *self, const char *key, char *buf, size_t buflen) { /* TODO: * This functionality is not being used as of now, it was removed in @@ -206,7 +206,7 @@ static bool account_db_sql_get_property(AccountDB* self, const char* key, char* * * @retval false in case of error. */ -bool account_db_read_inter(AccountDB_SQL *db, const char *filename, bool imported) +static bool account_db_read_inter(AccountDB_SQL *db, const char *filename, bool imported) { struct config_t config; struct config_setting_t *setting = NULL; @@ -251,7 +251,7 @@ bool account_db_read_inter(AccountDB_SQL *db, const char *filename, bool importe * * @retval false in case of error. */ -static bool account_db_sql_set_property(AccountDB* self, struct config_t *config, bool imported) +static bool account_db_sql_set_property(AccountDB *self, struct config_t *config, bool imported) { AccountDB_SQL* db = (AccountDB_SQL*)self; struct config_setting_t *setting = NULL; @@ -283,7 +283,7 @@ static bool account_db_sql_set_property(AccountDB* self, struct config_t *config /// create a new account entry /// If acc->account_id is -1, the account id will be auto-generated, /// and its value will be written to acc->account_id if everything succeeds. -static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc) +static bool account_db_sql_create(AccountDB *self, struct mmo_account *acc) { AccountDB_SQL* db = (AccountDB_SQL*)self; struct Sql *sql_handle; @@ -337,7 +337,7 @@ static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc) } /// delete an existing account entry + its regs -static bool account_db_sql_remove(AccountDB* self, const int account_id) +static bool account_db_sql_remove(AccountDB *self, const int account_id) { AccountDB_SQL* db = (AccountDB_SQL*)self; struct Sql *sql_handle; @@ -360,21 +360,21 @@ static bool account_db_sql_remove(AccountDB* self, const int account_id) } /// update an existing account with the provided new data (both account and regs) -static bool account_db_sql_save(AccountDB* self, const struct mmo_account* acc) +static bool account_db_sql_save(AccountDB *self, const struct mmo_account *acc) { AccountDB_SQL* db = (AccountDB_SQL*)self; return account->mmo_auth_tosql(db, acc, false); } /// retrieve data from db and store it in the provided data structure -static bool account_db_sql_load_num(AccountDB* self, struct mmo_account* acc, const int account_id) +static bool account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const int account_id) { AccountDB_SQL* db = (AccountDB_SQL*)self; return account->mmo_auth_fromsql(db, acc, account_id); } /// retrieve data from db and store it in the provided data structure -static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, const char* userid) +static bool account_db_sql_load_str(AccountDB *self, struct mmo_account *acc, const char *userid) { AccountDB_SQL* db = (AccountDB_SQL*)self; struct Sql *sql_handle; @@ -413,9 +413,8 @@ static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, co return account->db_sql_load_num(self, acc, account_id); } - /// Returns a new forward iterator. -static AccountDBIterator* account_db_sql_iterator(AccountDB* self) +static AccountDBIterator *account_db_sql_iterator(AccountDB *self) { AccountDB_SQL* db = (AccountDB_SQL*)self; AccountDBIterator_SQL* iter; @@ -435,15 +434,14 @@ static AccountDBIterator* account_db_sql_iterator(AccountDB* self) /// Destroys this iterator, releasing all allocated memory (including itself). -static void account_db_sql_iter_destroy(AccountDBIterator* self) +static void account_db_sql_iter_destroy(AccountDBIterator *self) { AccountDBIterator_SQL* iter = (AccountDBIterator_SQL*)self; aFree(iter); } - /// Fetches the next account in the database. -static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account* acc) +static bool account_db_sql_iter_next(AccountDBIterator *self, struct mmo_account *acc) { AccountDBIterator_SQL* iter = (AccountDBIterator_SQL*)self; AccountDB_SQL* db; @@ -478,8 +476,7 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account return false; } - -static bool account_mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id) +static bool account_mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, int account_id) { struct Sql *sql_handle; char* data; @@ -524,7 +521,7 @@ static bool account_mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, return true; } -static bool account_mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new) +static bool account_mmo_auth_tosql(AccountDB_SQL *db, const struct mmo_account *acc, bool is_new) { struct Sql *sql_handle; struct SqlStmt *stmt; @@ -619,13 +616,13 @@ static bool account_mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* return result; } -struct Sql *account_db_sql_up(AccountDB* self) +static struct Sql *account_db_sql_up(AccountDB *self) { AccountDB_SQL* db = (AccountDB_SQL*)self; return db ? db->accounts : NULL; } -void account_mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) +static void account_mmo_save_accreg2(AccountDB *self, int fd, int account_id, int char_id) { struct Sql *sql_handle; AccountDB_SQL* db = (AccountDB_SQL*)self; @@ -677,7 +674,7 @@ void account_mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_ } } -void account_mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id) +static void account_mmo_send_accreg2(AccountDB *self, int fd, int account_id, int char_id) { struct Sql *sql_handle; AccountDB_SQL* db = (AccountDB_SQL*)self; @@ -822,7 +819,8 @@ void account_mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_ SQL->FreeResult(sql_handle); } -void account_defaults(void) { +void account_defaults(void) +{ account = &account_s; account->db_sql_up = account_db_sql_up; diff --git a/src/login/ipban.c b/src/login/ipban.c index 140e0dda6..32ee1a19b 100644 --- a/src/login/ipban.c +++ b/src/login/ipban.c @@ -34,12 +34,12 @@ #include <stdlib.h> -struct ipban_interface ipban_s; +static struct ipban_interface ipban_s; struct ipban_interface *ipban; -struct s_ipban_dbs ipbandbs; +static struct s_ipban_dbs ipbandbs; // initialize -void ipban_init(void) +static void ipban_init(void) { ipban->inited = true; @@ -68,7 +68,7 @@ void ipban_init(void) } // finalize -void ipban_final(void) +static void ipban_final(void) { if (!login->config->ipban) return;// ipban disabled @@ -94,7 +94,7 @@ void ipban_final(void) * @retval false in case of error. */ -bool ipban_config_read_inter(const char *filename, bool imported) +static bool ipban_config_read_inter(const char *filename, bool imported) { struct config_t config; struct config_setting_t *setting = NULL; @@ -138,7 +138,7 @@ bool ipban_config_read_inter(const char *filename, bool imported) * * @retval false in case of error. */ -bool ipban_config_read_connection(const char *filename, struct config_t *config, bool imported) +static bool ipban_config_read_connection(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -172,7 +172,7 @@ bool ipban_config_read_connection(const char *filename, struct config_t *config, * * @retval false in case of error. */ -bool ipban_config_read_dynamic(const char *filename, struct config_t *config, bool imported) +static bool ipban_config_read_dynamic(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -203,7 +203,7 @@ bool ipban_config_read_dynamic(const char *filename, struct config_t *config, bo * * @retval false in case of error. */ -bool ipban_config_read(const char *filename, struct config_t *config, bool imported) +static bool ipban_config_read(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; bool retval = true; @@ -234,7 +234,7 @@ bool ipban_config_read(const char *filename, struct config_t *config, bool impor } // check ip against active bans list -bool ipban_check(uint32 ip) +static bool ipban_check(uint32 ip) { uint8* p = (uint8*)&ip; char* data = NULL; @@ -262,7 +262,7 @@ bool ipban_check(uint32 ip) } // log failed attempt -void ipban_log(uint32 ip) +static void ipban_log(uint32 ip) { unsigned long failures; @@ -284,7 +284,8 @@ void ipban_log(uint32 ip) } // remove expired bans -int ipban_cleanup(int tid, int64 tick, int id, intptr_t data) { +static int ipban_cleanup(int tid, int64 tick, int id, intptr_t data) +{ if (!login->config->ipban) return 0;// ipban disabled @@ -294,7 +295,8 @@ int ipban_cleanup(int tid, int64 tick, int id, intptr_t data) { return 0; } -void ipban_defaults(void) { +void ipban_defaults(void) +{ ipban = &ipban_s; ipban->dbs = &ipbandbs; diff --git a/src/login/lclif.c b/src/login/lclif.c index f514932a2..f8fd30105 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -41,13 +41,13 @@ * Implementation of the login client interface. */ -struct lclif_interface lclif_s; -struct lclif_interface_private lclif_p; -struct lclif_interface_dbs lclif_dbs; +static struct lclif_interface lclif_s; +static struct lclif_interface_private lclif_p; +static struct lclif_interface_dbs lclif_dbs; struct lclif_interface *lclif; /// @copydoc lclif_interface::connection_error() -void lclif_connection_error(int fd, uint8 error) +static void lclif_connection_error(int fd, uint8 error) { struct packet_SC_NOTIFY_BAN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); @@ -58,15 +58,15 @@ void lclif_connection_error(int fd, uint8 error) } /// @copydoc lclif_interface_private::parse_CA_CONNECT_INFO_CHANGED() -enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct login_session_data *sd) { return PACKET_VALID; } /// @copydoc lclif_interface_private::parse_CA_EXE_HASHCHECK() -enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) { const struct packet_CA_EXE_HASHCHECK *packet = RP2PTR(fd); sd->has_client_hash = 1; @@ -75,8 +75,8 @@ enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_d } /// @copydoc lclif_interface_private::parse_CA_LOGIN() -enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN *packet = RP2PTR(fd); @@ -94,8 +94,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) } /// @copydoc lclif_interface_private::parse_CA_LOGIN2() -enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN2 *packet = RP2PTR(fd); @@ -110,8 +110,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd } /// @copydoc lclif_interface_private::parse_CA_LOGIN3() -enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN3 *packet = RP2PTR(fd); @@ -128,8 +128,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd } /// @copydoc lclif_interface_private::parse_CA_LOGIN4() -enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN4 *packet = RP2PTR(fd); @@ -146,8 +146,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd } /// @copydoc lclif_interface_private::parse_CA_LOGIN_PCBANG() -enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN_PCBANG *packet = RP2PTR(fd); @@ -168,8 +168,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_da } /// @copydoc lclif_interface_private::parse_CA_LOGIN_HAN() -enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) { const struct packet_CA_LOGIN_HAN *packet = RP2PTR(fd); @@ -191,8 +191,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data } /// @copydoc lclif_interface_private::parse_CA_SSO_LOGIN_REQ() -enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) { const struct packet_CA_SSO_LOGIN_REQ *packet = RP2PTR(fd); int tokenlen = (int)RFIFOREST(fd) - (int)sizeof(*packet); @@ -217,8 +217,8 @@ enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_d } /// @copydoc lclif_interface_private::parse_CA_LOGIN_OTP() -enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) { //const struct packet_CA_LOGIN_OTP *packet = RP2PTR(fd); login->client_login_otp(fd, sd); @@ -226,8 +226,8 @@ enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data } /// @copydoc lclif_interface_private::parse_CA_REQ_HASH() -enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) { memset(sd->md5key, '\0', sizeof(sd->md5key)); sd->md5keylen = (uint16)(12 + rnd() % 4); @@ -238,8 +238,8 @@ enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data * } /// @copydoc lclif_interface_private::parse_CA_CHARSERVERCONNECT() -enum parsefunc_rcode lclif_parse_CA_CHARSERVERCONNECT(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -enum parsefunc_rcode lclif_parse_CA_CHARSERVERCONNECT(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_CA_CHARSERVERCONNECT(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_CHARSERVERCONNECT(int fd, struct login_session_data *sd) { char ip[16]; uint32 ipl = sockt->session[fd]->client_addr; @@ -251,7 +251,7 @@ enum parsefunc_rcode lclif_parse_CA_CHARSERVERCONNECT(int fd, struct login_sessi } /// @copydoc lclif_interface::server_list() -bool lclif_send_server_list(struct login_session_data *sd) +static bool lclif_send_server_list(struct login_session_data *sd) { int server_num = 0, i, n, length; uint32 ip; @@ -309,7 +309,7 @@ bool lclif_send_server_list(struct login_session_data *sd) } /// @copydoc lclif_interface::auth_failed() -void lclif_send_auth_failed(int fd, time_t ban, uint32 error) +static void lclif_send_auth_failed(int fd, time_t ban, uint32 error) { #if PACKETVER_ZERO_NUM >= 20180627 struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL; @@ -333,7 +333,7 @@ void lclif_send_auth_failed(int fd, time_t ban, uint32 error) } /// @copydoc lclif_interface::login_error() -void lclif_send_login_error(int fd, uint8 error) +static void lclif_send_login_error(int fd, uint8 error) { struct packet_AC_REFUSE_LOGIN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); @@ -345,8 +345,8 @@ void lclif_send_login_error(int fd, uint8 error) } /// @copydoc lclif_interface::coding_key() -void lclif_send_coding_key(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -void lclif_send_coding_key(int fd, struct login_session_data *sd) +static void lclif_send_coding_key(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static void lclif_send_coding_key(int fd, struct login_session_data *sd) { struct packet_AC_ACK_HASH *packet = NULL; int16 size = sizeof(*packet) + sd->md5keylen; @@ -360,7 +360,7 @@ void lclif_send_coding_key(int fd, struct login_session_data *sd) } /// @copydoc lclif_interface::parse() -int lclif_parse(int fd) +static int lclif_parse(int fd) { struct login_session_data *sd = NULL; int i; @@ -426,7 +426,7 @@ int lclif_parse(int fd) } /// @copydoc lclif_interface_private::parse_sub() -enum parsefunc_rcode lclif_parse_sub(int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_sub(int fd, struct login_session_data *sd) { int packet_len = (int)RFIFOREST(fd); int16 packet_id = RFIFOW(fd, 0); @@ -474,7 +474,7 @@ enum parsefunc_rcode lclif_parse_sub(int fd, struct login_session_data *sd) } /// @copydoc lclif_interface::packet() -const struct login_packet_db *lclif_packet(int16 packet_id) +static const struct login_packet_db *lclif_packet(int16 packet_id) { if (packet_id == PACKET_ID_CA_CHARSERVERCONNECT) return &lclif->p->dbs->packet_db[0]; @@ -486,7 +486,7 @@ const struct login_packet_db *lclif_packet(int16 packet_id) } /// @copydoc lclif_interface::parse_packet() -enum parsefunc_rcode lclif_parse_packet(const struct login_packet_db *lpd, int fd, struct login_session_data *sd) +static enum parsefunc_rcode lclif_parse_packet(const struct login_packet_db *lpd, int fd, struct login_session_data *sd) { int result; result = (*lpd->pFunc)(fd, sd); @@ -495,7 +495,7 @@ enum parsefunc_rcode lclif_parse_packet(const struct login_packet_db *lpd, int f } /// @copydoc lclif_interface_private::packetdb_loaddb() -void packetdb_loaddb(void) +static void packetdb_loaddb(void) { int i; struct packet { @@ -536,13 +536,13 @@ void packetdb_loaddb(void) } /// @copydoc lclif_interface::init() -void lclif_init(void) +static void lclif_init(void) { lclif->p->packetdb_loaddb(); } /// @copydoc lclif_interface::final() -void lclif_final(void) +static void lclif_final(void) { } diff --git a/src/login/login.c b/src/login/login.c index c78729dd8..d54348834 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -50,17 +50,17 @@ * Implementation of the login interface. */ -struct login_interface login_s; +static struct login_interface login_s; struct login_interface *login; -struct s_login_dbs logindbs; -struct lchrif_interface lchrif_s; +static struct s_login_dbs logindbs; +static struct lchrif_interface lchrif_s; struct lchrif_interface *lchrif; -struct Login_Config login_config_; +static struct Login_Config login_config_; -struct Account_engine account_engine; +static struct Account_engine account_engine; // account database -AccountDB* accounts = NULL; +static AccountDB *accounts = NULL; //----------------------------------------------------- // Auth database @@ -80,7 +80,7 @@ static struct DBData login_create_online_user(union DBKey key, va_list args) return DB->ptr2data(p); } -struct online_login_data* login_add_online_user(int char_server, int account_id) +static struct online_login_data* login_add_online_user(int char_server, int account_id) { struct online_login_data* p; p = idb_ensure(login->online_db, account_id, login->create_online_user); @@ -93,7 +93,7 @@ struct online_login_data* login_add_online_user(int char_server, int account_id) return p; } -void login_remove_online_user(int account_id) +static void login_remove_online_user(int account_id) { struct online_login_data* p; p = (struct online_login_data*)idb_get(login->online_db, account_id); @@ -105,7 +105,8 @@ void login_remove_online_user(int account_id) idb_remove(login->online_db, account_id); } -static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) { +static int login_waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data) +{ struct online_login_data* p = (struct online_login_data*)idb_get(login->online_db, id); if( p != NULL && p->waiting_disconnect == tid && p->account_id == id ) { @@ -150,7 +151,8 @@ static int login_online_data_cleanup_sub(union DBKey key, struct DBData *data, v return 0; } -static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { +static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) +{ login->online_db->foreach(login->online_db, login->online_data_cleanup_sub); return 0; } @@ -159,7 +161,7 @@ static int login_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) //-------------------------------------------------------------------- // Packet send to all char-servers, except one (wos: without our self) //-------------------------------------------------------------------- -int charif_sendallwos(int sfd, uint8* buf, size_t len) +static int charif_sendallwos(int sfd, uint8 *buf, size_t len) { int i, c; @@ -180,7 +182,7 @@ int charif_sendallwos(int sfd, uint8* buf, size_t len) /// Initializes a server structure. -void lchrif_server_init(int id) +static void lchrif_server_init(int id) { Assert_retv(id >= 0 && id < MAX_SERVERS); memset(&login->dbs->server[id], 0, sizeof(login->dbs->server[id])); @@ -189,7 +191,7 @@ void lchrif_server_init(int id) /// Destroys a server structure. -void lchrif_server_destroy(int id) +static void lchrif_server_destroy(int id) { Assert_retv(id >= 0 && id < MAX_SERVERS); if (login->dbs->server[id].fd != -1) @@ -201,7 +203,7 @@ void lchrif_server_destroy(int id) /// Resets all the data related to a server. -void lchrif_server_reset(int id) +static void lchrif_server_reset(int id) { login->online_db->foreach(login->online_db, login->online_db_setoffline, id); //Set all chars from this char server to offline. lchrif->server_destroy(id); @@ -210,7 +212,7 @@ void lchrif_server_reset(int id) /// Called when the connection to Char Server is disconnected. -void lchrif_on_disconnect(int id) +static void lchrif_on_disconnect(int id) { Assert_retv(id >= 0 && id < MAX_SERVERS); ShowStatus("Char-server '%s' has disconnected.\n", login->dbs->server[id].name); @@ -221,7 +223,8 @@ void lchrif_on_disconnect(int id) //----------------------------------------------------- // periodic ip address synchronization //----------------------------------------------------- -static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { +static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) +{ uint8 buf[2]; ShowInfo("IP Sync in progress...\n"); WBUFW(buf,0) = 0x2735; @@ -233,7 +236,7 @@ static int login_sync_ip_addresses(int tid, int64 tick, int id, intptr_t data) { //----------------------------------------------------- // encrypted/unencrypted password check (from eApp) //----------------------------------------------------- -bool login_check_encrypted(const char* str1, const char* str2, const char* passwd) +static bool login_check_encrypted(const char *str1, const char *str2, const char *passwd) { char tmpstr[64+1], md5str[32+1]; @@ -246,7 +249,7 @@ bool login_check_encrypted(const char* str1, const char* str2, const char* passw return (0==strcmp(passwd, md5str)); } -bool login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) +static bool login_check_password(const char *md5key, int passwdenc, const char *passwd, const char *refpass) { nullpo_ret(passwd); nullpo_ret(refpass); @@ -269,12 +272,12 @@ bool login_check_password(const char* md5key, int passwdenc, const char* passwd, * @retval 0 if it is a WAN IP. * @return the appropriate LAN server address to send, if it is a LAN IP. */ -uint32 login_lan_subnet_check(uint32 ip) +static uint32 login_lan_subnet_check(uint32 ip) { return sockt->lan_subnet_check(ip, NULL); } -void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node* node) +static void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 login_id2, uint8 sex, int request_id, struct login_auth_node *node) { WFIFOHEAD(fd,33); WFIFOW(fd,0) = 0x2713; @@ -303,7 +306,7 @@ void login_fromchar_auth_ack(int fd, int account_id, uint32 login_id1, uint32 lo WFIFOSET(fd,33); } -void login_fromchar_parse_auth(int fd, int id, const char *const ip) +static void login_fromchar_parse_auth(int fd, int id, const char *const ip) { struct login_auth_node* node; @@ -339,7 +342,7 @@ void login_fromchar_parse_auth(int fd, int id, const char *const ip) } } -void login_fromchar_parse_update_users(int fd, int id) +static void login_fromchar_parse_update_users(int fd, int id) { int users = RFIFOL(fd,2); RFIFOSKIP(fd,6); @@ -353,7 +356,7 @@ void login_fromchar_parse_update_users(int fd, int id) } } -void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) +static void login_fromchar_parse_request_change_email(int fd, int id, const char *const ip) { struct mmo_account acc; char email[40]; @@ -375,7 +378,7 @@ void login_fromchar_parse_request_change_email(int fd, int id, const char *const } } -void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) +static void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) { WFIFOHEAD(fd,72); WFIFOW(fd,0) = 0x2717; @@ -419,7 +422,7 @@ void login_fromchar_account(int fd, int account_id, struct mmo_account *acc) WFIFOSET(fd,72); } -void login_fromchar_parse_account_data(int fd, int id, const char *const ip) +static void login_fromchar_parse_account_data(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -436,20 +439,20 @@ void login_fromchar_parse_account_data(int fd, int id, const char *const ip) } } -void login_fromchar_pong(int fd) +static void login_fromchar_pong(int fd) { WFIFOHEAD(fd,2); WFIFOW(fd,0) = 0x2718; WFIFOSET(fd,2); } -void login_fromchar_parse_ping(int fd) +static void login_fromchar_parse_ping(int fd) { RFIFOSKIP(fd,2); login->fromchar_pong(fd); } -void login_fromchar_parse_change_email(int fd, int id, const char *const ip) +static void login_fromchar_parse_change_email(int fd, int id, const char *const ip) { struct mmo_account acc; char actual_email[40]; @@ -482,7 +485,7 @@ void login_fromchar_parse_change_email(int fd, int id, const char *const ip) } } -void login_fromchar_account_update_other(int account_id, unsigned int state) +static void login_fromchar_account_update_other(int account_id, unsigned int state) { uint8 buf[11]; WBUFW(buf,0) = 0x2731; @@ -492,7 +495,7 @@ void login_fromchar_account_update_other(int account_id, unsigned int state) charif_sendallwos(-1, buf, 11); } -void login_fromchar_parse_account_update(int fd, int id, const char *const ip) +static void login_fromchar_parse_account_update(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -519,7 +522,7 @@ void login_fromchar_parse_account_update(int fd, int id, const char *const ip) } } -void login_fromchar_ban(int account_id, time_t timestamp) +static void login_fromchar_ban(int account_id, time_t timestamp) { uint8 buf[11]; WBUFW(buf,0) = 0x2731; @@ -529,7 +532,7 @@ void login_fromchar_ban(int account_id, time_t timestamp) charif_sendallwos(-1, buf, 11); } -void login_fromchar_parse_ban(int fd, int id, const char *const ip) +static void login_fromchar_parse_ban(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -579,7 +582,7 @@ void login_fromchar_parse_ban(int fd, int id, const char *const ip) } } -void login_fromchar_change_sex_other(int account_id, char sex) +static void login_fromchar_change_sex_other(int account_id, char sex) { unsigned char buf[7]; WBUFW(buf,0) = 0x2723; @@ -588,7 +591,7 @@ void login_fromchar_change_sex_other(int account_id, char sex) charif_sendallwos(-1, buf, 7); } -void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) +static void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -615,7 +618,7 @@ void login_fromchar_parse_change_sex(int fd, int id, const char *const ip) } } -void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) +static void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -629,7 +632,7 @@ void login_fromchar_parse_account_reg2(int fd, int id, const char *const ip) RFIFOSKIP(fd,RFIFOW(fd,2)); } -void login_fromchar_parse_unban(int fd, int id, const char *const ip) +static void login_fromchar_parse_unban(int fd, int id, const char *const ip) { struct mmo_account acc; @@ -649,19 +652,19 @@ void login_fromchar_parse_unban(int fd, int id, const char *const ip) } } -void login_fromchar_parse_account_online(int fd, int id) +static void login_fromchar_parse_account_online(int fd, int id) { login->add_online_user(id, RFIFOL(fd,2)); RFIFOSKIP(fd,6); } -void login_fromchar_parse_account_offline(int fd) +static void login_fromchar_parse_account_offline(int fd) { login->remove_online_user(RFIFOL(fd,2)); RFIFOSKIP(fd,6); } -void login_fromchar_parse_online_accounts(int fd, int id) +static void login_fromchar_parse_online_accounts(int fd, int id) { uint32 i, users; login->online_db->foreach(login->online_db, login->online_db_setoffline, id); //Set all chars from this char-server offline first @@ -678,7 +681,7 @@ void login_fromchar_parse_online_accounts(int fd, int id) } } -void login_fromchar_parse_request_account_reg2(int fd) +static void login_fromchar_parse_request_account_reg2(int fd) { int account_id = RFIFOL(fd,2); int char_id = RFIFOL(fd,6); @@ -687,21 +690,21 @@ void login_fromchar_parse_request_account_reg2(int fd) account->mmo_send_accreg2(accounts,fd,account_id,char_id); } -void login_fromchar_parse_update_wan_ip(int fd, int id) +static void login_fromchar_parse_update_wan_ip(int fd, int id) { login->dbs->server[id].ip = ntohl(RFIFOL(fd,2)); ShowInfo("Updated IP of Server #%d to %u.%u.%u.%u.\n",id, CONVIP(login->dbs->server[id].ip)); RFIFOSKIP(fd,6); } -void login_fromchar_parse_all_offline(int fd, int id) +static void login_fromchar_parse_all_offline(int fd, int id) { ShowInfo("Setting accounts from char-server %d offline.\n", id); login->online_db->foreach(login->online_db, login->online_db_setoffline, id); RFIFOSKIP(fd,2); } -void login_fromchar_parse_change_pincode(int fd) +static void login_fromchar_parse_change_pincode(int fd) { struct mmo_account acc; @@ -713,7 +716,7 @@ void login_fromchar_parse_change_pincode(int fd) RFIFOSKIP(fd,11); } -bool login_fromchar_parse_wrong_pincode(int fd) +static bool login_fromchar_parse_wrong_pincode(int fd) { struct mmo_account acc; @@ -733,7 +736,7 @@ bool login_fromchar_parse_wrong_pincode(int fd) return false; } -void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) +static void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_group, int map_fd, struct mmo_account *acc) { if (acc) { @@ -773,7 +776,7 @@ void login_fromchar_accinfo(int fd, int account_id, int u_fd, int u_aid, int u_g } } -void login_fromchar_parse_accinfo(int fd) +static void login_fromchar_parse_accinfo(int fd) { struct mmo_account acc; int account_id = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), u_group = RFIFOL(fd, 14), map_fd = RFIFOL(fd, 18); @@ -788,7 +791,7 @@ void login_fromchar_parse_accinfo(int fd) //-------------------------------- // Packet parsing for char-servers //-------------------------------- -int login_parse_fromchar(int fd) +static int login_parse_fromchar(int fd) { int id; uint32 ipl; @@ -992,7 +995,8 @@ int login_parse_fromchar(int fd) //------------------------------------- // Make new account //------------------------------------- -int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) { +static int login_mmo_auth_new(const char *userid, const char *pass, const char sex, const char *last_ip) +{ static int num_regs = 0; // registration counter static int64 new_reg_tick = 0; int64 tick = timer->gettick(); @@ -1054,7 +1058,8 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con // Check/authentication of a connection //----------------------------------------------------- // TODO: Map result values to an enum (or at least document them) -int login_mmo_auth(struct login_session_data* sd, bool isServer) { +static int login_mmo_auth(struct login_session_data *sd, bool isServer) +{ struct mmo_account acc; size_t len; @@ -1191,7 +1196,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) { return -1; // account OK } -void login_kick(struct login_session_data* sd) +static void login_kick(struct login_session_data *sd) { uint8 buf[6]; nullpo_retv(sd); @@ -1200,7 +1205,7 @@ void login_kick(struct login_session_data* sd) charif_sendallwos(-1, buf, 6); } -void login_auth_ok(struct login_session_data* sd) +static void login_auth_ok(struct login_session_data *sd) { int fd = 0; uint32 ip; @@ -1285,7 +1290,7 @@ void login_auth_ok(struct login_session_data* sd) } } -void login_auth_failed(struct login_session_data *sd, int result) +static void login_auth_failed(struct login_session_data *sd, int result) { int fd; uint32 ip; @@ -1336,8 +1341,8 @@ void login_auth_failed(struct login_session_data *sd, int result) lclif->auth_failed(fd, ban_time, result); } -bool login_client_login(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -bool login_client_login(int fd, struct login_session_data *sd) +static bool login_client_login(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static bool login_client_login(int fd, struct login_session_data *sd) { int result; char ip[16]; @@ -1360,8 +1365,8 @@ bool login_client_login(int fd, struct login_session_data *sd) return false; } -bool login_client_login_otp(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); -bool login_client_login_otp(int fd, struct login_session_data *sd) +static bool login_client_login_otp(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static bool login_client_login_otp(int fd, struct login_session_data *sd) { // send ok response with fake token #ifdef PACKETVER_ZERO @@ -1395,8 +1400,8 @@ bool login_client_login_otp(int fd, struct login_session_data *sd) #endif // PACKETVER_ZERO } -void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); -void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) +static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); +static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) { WFIFOHEAD(fd,3); WFIFOW(fd,0) = 0x2711; @@ -1405,8 +1410,8 @@ void login_char_server_connection_status(int fd, struct login_session_data* sd, } // CA_CHARSERVERCONNECT -void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); -void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) +static void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) __attribute__((nonnull (2, 3))); +static void login_parse_request_connection(int fd, struct login_session_data* sd, const char *const ip, uint32 ipl) { char server_name[20]; char message[256]; @@ -1464,7 +1469,7 @@ void login_parse_request_connection(int fd, struct login_session_data* sd, const } } -void login_config_set_defaults(void) +static void login_config_set_defaults(void) { login->config->login_ip = INADDR_ANY; login->config->login_port = 6900; @@ -1503,7 +1508,7 @@ void login_config_set_defaults(void) * * @retval false in case of error. */ -bool login_config_read_inter(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_inter(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; const char *str = NULL; @@ -1543,7 +1548,7 @@ bool login_config_read_inter(const char *filename, struct config_t *config, bool * * @retval false in case of error. */ -bool login_config_read_console(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_console(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -1576,7 +1581,7 @@ bool login_config_read_console(const char *filename, struct config_t *config, bo * * @retval false in case of error. */ -bool login_config_read_log(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_log(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -1604,7 +1609,7 @@ bool login_config_read_log(const char *filename, struct config_t *config, bool i * * @retval false in case of error. */ -bool login_config_read_account(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_account(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; AccountDB *db = login->dbs->account_engine->db; @@ -1639,7 +1644,7 @@ bool login_config_read_account(const char *filename, struct config_t *config, bo /** * Frees login->config->client_hash_nodes **/ -void login_clear_client_hash_nodes(void) +static void login_clear_client_hash_nodes(void) { struct client_hash_node *node = login->config->client_hash_nodes; @@ -1657,7 +1662,7 @@ void login_clear_client_hash_nodes(void) * * @param setting The setting to read from. */ -void login_config_set_md5hash(struct config_setting_t *setting) +static void login_config_set_md5hash(struct config_setting_t *setting) { int i; int count = libconfig->setting_length(setting); @@ -1720,7 +1725,7 @@ void login_config_set_md5hash(struct config_setting_t *setting) * * @retval false in case of error. */ -bool login_config_read_permission_hash(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_permission_hash(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -1745,7 +1750,7 @@ bool login_config_read_permission_hash(const char *filename, struct config_t *co /** * Clears login->config->dnsbl_servers, freeing any allocated memory. */ -void login_clear_dnsbl_servers(void) +static void login_clear_dnsbl_servers(void) { while (VECTOR_LENGTH(login->config->dnsbl_servers) > 0) { aFree(&VECTOR_POP(login->config->dnsbl_servers)); @@ -1758,7 +1763,7 @@ void login_clear_dnsbl_servers(void) * * @param setting The configuration setting to read from. */ -void login_config_set_dnsbl_servers(struct config_setting_t *setting) +static void login_config_set_dnsbl_servers(struct config_setting_t *setting) { int i; int count = libconfig->setting_length(setting); @@ -1790,7 +1795,7 @@ void login_config_set_dnsbl_servers(struct config_setting_t *setting) * * @retval false in case of error. */ -bool login_config_read_permission_blacklist(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_permission_blacklist(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -1821,7 +1826,7 @@ bool login_config_read_permission_blacklist(const char *filename, struct config_ * * @retval false in case of error. */ -bool login_config_read_permission(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_permission(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; bool retval = true; @@ -1858,7 +1863,7 @@ bool login_config_read_permission(const char *filename, struct config_t *config, * * @retval false in case of error. */ -bool login_config_read_users(const char *filename, struct config_t *config, bool imported) +static bool login_config_read_users(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; bool retval = true; @@ -1889,7 +1894,7 @@ bool login_config_read_users(const char *filename, struct config_t *config, bool * * @retval false in case of error. **/ -bool login_config_read(const char *filename, bool imported) +static bool login_config_read(const char *filename, bool imported) { struct config_t config; const char *import = NULL; @@ -1942,7 +1947,7 @@ bool login_config_read(const char *filename, bool imported) * * @retval users count or color id. **/ -uint16 login_convert_users_to_colors(uint16 users) +static uint16 login_convert_users_to_colors(uint16 users) { #if PACKETVER >= 20170726 if (!login->config->send_user_count_description) @@ -2020,13 +2025,14 @@ void do_abort(void) { } -void set_server_type(void) { +void set_server_type(void) +{ SERVER_TYPE = SERVER_TYPE_LOGIN; } /// Called when a terminate signal is received. -void do_shutdown_login(void) +static void do_shutdown_login(void) { if( core->runflag != LOGINSERVER_ST_SHUTDOWN ) { @@ -2091,7 +2097,7 @@ void cmdline_args_init_local(void) //------------------------------ // Login server initialization //------------------------------ -int do_init(int argc, char** argv) +int do_init(int argc, char **argv) { int i; diff --git a/src/login/loginlog.c b/src/login/loginlog.c index bf40d6ed8..19f269ab5 100644 --- a/src/login/loginlog.c +++ b/src/login/loginlog.c @@ -34,13 +34,13 @@ #include <stdlib.h> // exit -struct loginlog_interface loginlog_s; +static struct loginlog_interface loginlog_s; struct loginlog_interface *loginlog; -struct s_loginlog_dbs loginlogdbs; +static struct s_loginlog_dbs loginlogdbs; // Returns the number of failed login attempts by the ip in the last minutes. -unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes) +static unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes) { unsigned long failures = 0; @@ -66,7 +66,7 @@ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes) * Records an event in the login log *---------------------------------------------*/ // TODO: add an enum of rcode values -void loginlog_log(uint32 ip, const char* username, int rcode, const char* message) +static void loginlog_log(uint32 ip, const char *username, int rcode, const char *message) { char esc_username[NAME_LENGTH*2+1]; char esc_message[255*2+1]; @@ -88,7 +88,7 @@ void loginlog_log(uint32 ip, const char* username, int rcode, const char* messag Sql_ShowDebug(loginlog->sql_handle); } -bool loginlog_init(void) +static bool loginlog_init(void) { loginlog->sql_handle = SQL->Malloc(); @@ -107,7 +107,7 @@ bool loginlog_init(void) return true; } -bool loginlog_final(void) +static bool loginlog_final(void) { SQL->Free(loginlog->sql_handle); loginlog->sql_handle = NULL; @@ -124,7 +124,7 @@ bool loginlog_final(void) * * @retval false in case of error. */ -bool loginlog_config_read_names(const char *filename, struct config_t *config, bool imported) +static bool loginlog_config_read_names(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -153,7 +153,7 @@ bool loginlog_config_read_names(const char *filename, struct config_t *config, b * * @retval false in case of error. */ -bool loginlog_config_read_log(const char *filename, struct config_t *config, bool imported) +static bool loginlog_config_read_log(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -188,7 +188,7 @@ bool loginlog_config_read_log(const char *filename, struct config_t *config, boo * * @retval false in case of error. **/ -bool loginlog_config_read(const char *filename, bool imported) +static bool loginlog_config_read(const char *filename, bool imported) { struct config_t config; const char *import = NULL; diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 17b4fd813..e4640d09d 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -104,8 +104,8 @@ struct HPM_atcommand_list { AtCommandFunc func; }; -struct HPM_atcommand_list *atcommand_list = NULL; -unsigned int atcommand_list_items = 0; +static struct HPM_atcommand_list *atcommand_list = NULL; +static unsigned int atcommand_list_items = 0; /** * HPM plugin data store validator sub-handler (map-server) @@ -135,14 +135,16 @@ bool HPM_map_data_store_validate(enum HPluginDataTypes type, struct hplugin_data return false; } -void HPM_map_plugin_load_sub(struct hplugin *plugin) { +void HPM_map_plugin_load_sub(struct hplugin *plugin) +{ plugin->hpi->sql_handle = map->mysql_handle; plugin->hpi->addCommand = atcommand->create; plugin->hpi->addScript = script->addScript; plugin->hpi->addPCGPermission = HPM_map_add_group_permission; } -bool HPM_map_add_atcommand(char *name, AtCommandFunc func) { +bool HPM_map_add_atcommand(char *name, AtCommandFunc func) +{ unsigned int i = 0; for(i = 0; i < atcommand_list_items; i++) { @@ -162,7 +164,8 @@ bool HPM_map_add_atcommand(char *name, AtCommandFunc func) { return true; } -void HPM_map_atcommands(void) { +void HPM_map_atcommands(void) +{ unsigned int i; for(i = 0; i < atcommand_list_items; i++) { @@ -173,7 +176,8 @@ void HPM_map_atcommands(void) { /** * Adds a new group permission to the HPM-provided list **/ -void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask) { +void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask) +{ unsigned char index = pcg->HPMpermissions_count; RECREATE(pcg->HPMpermissions, struct pc_groups_new_permission, ++pcg->HPMpermissions_count); @@ -183,14 +187,16 @@ void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned in pcg->HPMpermissions[index].mask = mask; } -void HPM_map_do_init(void) { +void HPM_map_do_init(void) +{ HPM->load_sub = HPM_map_plugin_load_sub; HPM->data_store_validate_sub = HPM_map_data_store_validate; HPM->datacheck_init(HPMDataCheck, HPMDataCheckLen, HPMDataCheckVer); HPM_shared_symbols(SERVER_TYPE_MAP); } -void HPM_map_do_final(void) { +void HPM_map_do_final(void) +{ if (atcommand_list) aFree(atcommand_list); /** diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4e4508179..2d17f7ae7 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -74,14 +74,15 @@ #include <stdlib.h> #include <string.h> -struct atcommand_interface atcommand_s; +static struct atcommand_interface atcommand_s; struct atcommand_interface *atcommand; static char atcmd_output[CHAT_SIZE_MAX]; static char atcmd_player_name[NAME_LENGTH]; // @commands (script-based) -struct atcmd_binding_data* get_atcommandbind_byname(const char* name) { +static struct atcmd_binding_data *get_atcommandbind_byname(const char *name) +{ int i = 0; nullpo_retr(NULL, name); @@ -93,14 +94,16 @@ struct atcmd_binding_data* get_atcommandbind_byname(const char* name) { return ( i < atcommand->binding_count ) ? atcommand->binding[i] : NULL; } -const char* atcommand_msgsd(struct map_session_data *sd, int msg_number) { +static const char *atcommand_msgsd(struct map_session_data *sd, int msg_number) +{ Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG && atcommand->msg_table[0][msg_number] != NULL); if (!sd || sd->lang_id >= atcommand->max_message_table || !atcommand->msg_table[sd->lang_id][msg_number]) return atcommand->msg_table[0][msg_number]; return atcommand->msg_table[sd->lang_id][msg_number]; } -const char* atcommand_msgfd(int fd, int msg_number) { +static const char *atcommand_msgfd(int fd, int msg_number) +{ struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL; Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG && atcommand->msg_table[0][msg_number] != NULL); if (!sd || sd->lang_id >= atcommand->max_message_table || !atcommand->msg_table[sd->lang_id][msg_number]) @@ -111,7 +114,8 @@ const char* atcommand_msgfd(int fd, int msg_number) { //----------------------------------------------------------- // Return the message string of the specified number by [Yor] //----------------------------------------------------------- -const char* atcommand_msg(int msg_number) { +static const char *atcommand_msg(int msg_number) +{ Assert_retr("??", msg_number >= 0 && msg_number < MAX_MSG); if (atcommand->msg_table[map->default_lang_id][msg_number] != NULL && atcommand->msg_table[map->default_lang_id][msg_number][0] != '\0') return atcommand->msg_table[map->default_lang_id][msg_number]; @@ -129,7 +133,8 @@ const char* atcommand_msg(int msg_number) { * @param[in] allow_override whether to allow duplicate message IDs to override the original value. * @return success state. */ -bool msg_config_read(const char *cfg_name, bool allow_override) { +static bool msg_config_read(const char *cfg_name, bool allow_override) +{ int msg_number; char line[1024], w1[1024], w2[1024]; FILE *fp; @@ -176,7 +181,8 @@ bool msg_config_read(const char *cfg_name, bool allow_override) { /*========================================== * Cleanup Message Data *------------------------------------------*/ -void do_final_msg(void) { +static void do_final_msg(void) +{ int i, j; for(i = 0; i < atcommand->max_message_table; i++) { @@ -194,7 +200,8 @@ void do_final_msg(void) { /** * retrieves the help string associated with a given command. */ -static inline const char* atcommand_help_string(AtCommandInfo *info) { +static inline const char *atcommand_help_string(AtCommandInfo *info) +{ return info->help; } @@ -431,7 +438,8 @@ ACMD(send) /*========================================== * @rura, @warp, @mapmove *------------------------------------------*/ -ACMD(mapmove) { +ACMD(mapmove) +{ char map_name[MAP_NAME_LENGTH_EXT]; unsigned short map_index; short x = 0, y = 0; @@ -486,7 +494,8 @@ ACMD(mapmove) { /*========================================== * Displays where a character is. Corrected version by Silent. [Skotlex] *------------------------------------------*/ -ACMD(where) { +ACMD(where) +{ struct map_session_data* pl_sd; memset(atcmd_player_name, '\0', sizeof atcmd_player_name); @@ -514,7 +523,8 @@ ACMD(where) { /*========================================== * *------------------------------------------*/ -ACMD(jumpto) { +ACMD(jumpto) +{ struct map_session_data *pl_sd = NULL; if (!*message) { @@ -597,7 +607,8 @@ ACMD(jump) * Display list of online characters with * various info. *------------------------------------------*/ -ACMD(who) { +ACMD(who) +{ const struct map_session_data *pl_sd = NULL; struct s_mapiterator *iter = NULL; char player_name[NAME_LENGTH] = ""; @@ -794,7 +805,8 @@ ACMD(save) /*========================================== * *------------------------------------------*/ -ACMD(load) { +ACMD(load) +{ int16 m; m = map->mapindex2mapid(sd->status.save_point.map); @@ -932,7 +944,8 @@ ACMD(option) /*========================================== * *------------------------------------------*/ -ACMD(hide) { +ACMD(hide) +{ if (pc_isinvisible(sd)) { sd->sc.option &= ~OPTION_INVISIBLE; if (sd->disguise != -1 ) @@ -1473,7 +1486,8 @@ ACMD(joblevelup) /*========================================== * @help *------------------------------------------*/ -ACMD(help) { +ACMD(help) +{ const char *command_name = NULL; char *default_command = "help"; AtCommandInfo *tinfo = NULL; @@ -1541,7 +1555,7 @@ ACMD(help) { * Arglist parameters: * - (int) id: If 0, stop any attacks. Otherwise, the target block list id to stop attacking. */ -int atcommand_stopattack(struct block_list *bl,va_list ap) +static int atcommand_stopattack(struct block_list *bl, va_list ap) { struct unit_data *ud = NULL; int id = 0; @@ -1560,7 +1574,7 @@ int atcommand_stopattack(struct block_list *bl,va_list ap) /*========================================== * *------------------------------------------*/ -int atcommand_pvpoff_sub(struct block_list *bl,va_list ap) +static int atcommand_pvpoff_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; nullpo_ret(bl); @@ -1598,7 +1612,7 @@ ACMD(pvpoff) /*========================================== * *------------------------------------------*/ -int atcommand_pvpon_sub(struct block_list *bl,va_list ap) +static int atcommand_pvpon_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; nullpo_ret(bl); @@ -1641,7 +1655,8 @@ ACMD(pvpon) /*========================================== * *------------------------------------------*/ -ACMD(gvgoff) { +ACMD(gvgoff) +{ if (!map->list[sd->bl.m].flag.gvg) { clif->message(fd, msg_fd(fd,162)); // GvG is already Off. @@ -1870,7 +1885,8 @@ ACMD(hair_color) /*========================================== * @go [city_number or city_name] - Updated by Harbin *------------------------------------------*/ -ACMD(go) { +ACMD(go) +{ int town = INT_MAX; // Initialized to INT_MAX instead of -1 to avoid conflicts with those who map [-3:-1] to @memo locations. char map_name[MAP_NAME_LENGTH]; @@ -2100,7 +2116,7 @@ ACMD(monster) /*========================================== * *------------------------------------------*/ -int atkillmonster_sub(struct block_list *bl, va_list ap) +static int atkillmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int flag = va_arg(ap, int); @@ -2118,7 +2134,8 @@ int atkillmonster_sub(struct block_list *bl, va_list ap) return 1; } -ACMD(killmonster) { +ACMD(killmonster) +{ int map_id, drop_flag; char map_name[MAP_NAME_LENGTH_EXT]; @@ -2315,7 +2332,8 @@ ACMD(memo) /*========================================== * *------------------------------------------*/ -ACMD(gat) { +ACMD(gat) +{ int y; memset(atcmd_output, '\0', sizeof(atcmd_output)); @@ -2461,7 +2479,8 @@ ACMD(zeny) /*========================================== * *------------------------------------------*/ -ACMD(param) { +ACMD(param) +{ int i, value = 0, new_value, max; const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" }; short* stats[6]; @@ -2521,7 +2540,8 @@ ACMD(param) { /*========================================== * Stat all by fritz (rewritten by [Yor]) *------------------------------------------*/ -ACMD(stat_all) { +ACMD(stat_all) +{ int index, count, value, max, new_value; short* stats[6]; //we don't use direct initialization because it isn't part of the c standard. @@ -2577,7 +2597,8 @@ ACMD(stat_all) { /*========================================== * *------------------------------------------*/ -ACMD(guildlevelup) { +ACMD(guildlevelup) +{ int level = 0; int16 added_level; struct guild *guild_info; @@ -2766,7 +2787,8 @@ ACMD(petrename) /*========================================== * *------------------------------------------*/ -ACMD(recall) { +ACMD(recall) +{ struct map_session_data *pl_sd = NULL; if (!*message) { @@ -3038,7 +3060,7 @@ ACMD(doommap) /*========================================== * *------------------------------------------*/ -void atcommand_raise_sub(struct map_session_data* sd) +static void atcommand_raise_sub(struct map_session_data *sd) { nullpo_retv(sd); status->revive(&sd->bl, 100, 100); @@ -3336,7 +3358,8 @@ ACMD(breakguild) /*========================================== * *------------------------------------------*/ -ACMD(agitstart) { +ACMD(agitstart) +{ if (map->agit_flag == 1) { clif->message(fd, msg_fd(fd,73)); // War of Emperium is currently in progress. return false; @@ -3352,7 +3375,8 @@ ACMD(agitstart) { /*========================================== * *------------------------------------------*/ -ACMD(agitstart2) { +ACMD(agitstart2) +{ if (map->agit2_flag == 1) { clif->message(fd, msg_fd(fd,404)); // "War of Emperium SE is currently in progress." return false; @@ -3368,7 +3392,8 @@ ACMD(agitstart2) { /*========================================== * *------------------------------------------*/ -ACMD(agitend) { +ACMD(agitend) +{ if (map->agit_flag == 0) { clif->message(fd, msg_fd(fd,75)); // War of Emperium is currently not in progress. return false; @@ -3384,7 +3409,8 @@ ACMD(agitend) { /*========================================== * *------------------------------------------*/ -ACMD(agitend2) { +ACMD(agitend2) +{ if (map->agit2_flag == 0) { clif->message(fd, msg_fd(fd,406)); // "War of Emperium SE is currently not in progress." return false; @@ -3400,7 +3426,8 @@ ACMD(agitend2) { /*========================================== * @mapexit - shuts down the map server *------------------------------------------*/ -ACMD(mapexit) { +ACMD(mapexit) +{ map->do_shutdown(); return true; } @@ -3610,7 +3637,8 @@ ACMD(reloaditemdb) /*========================================== * *------------------------------------------*/ -ACMD(reloadmobdb) { +ACMD(reloadmobdb) +{ mob->reload(); pet->read_db(); homun->reload(); @@ -3639,7 +3667,8 @@ ACMD(reloadskilldb) /*========================================== * @reloadatcommand - reloads conf/atcommand.conf conf/groups.conf *------------------------------------------*/ -ACMD(reloadatcommand) { +ACMD(reloadatcommand) +{ struct config_t run_test; if (!libconfig->load_file(&run_test, "conf/groups.conf")) { @@ -3713,7 +3742,8 @@ ACMD(reloadbattleconf) /*========================================== * @reloadstatusdb - reloads job_db1.txt job_db2.txt job_db2-2.txt refine_db.txt size_fix.txt *------------------------------------------*/ -ACMD(reloadstatusdb) { +ACMD(reloadstatusdb) +{ status->readdb(); clif->message(fd, msg_fd(fd,256)); return true; @@ -3731,7 +3761,8 @@ ACMD(reloadpcdb) /*========================================== * @reloadscript - reloads all scripts (npcs, warps, mob spawns, ...) *------------------------------------------*/ -ACMD(reloadscript) { +ACMD(reloadscript) +{ struct s_mapiterator* iter; struct map_session_data* pl_sd; @@ -4104,7 +4135,8 @@ ACMD(mount_peco) /*========================================== *Spy Commands by Syrus22 *------------------------------------------*/ -ACMD(guildspy) { +ACMD(guildspy) +{ char guild_name[NAME_LENGTH]; struct guild *g; @@ -4143,7 +4175,8 @@ ACMD(guildspy) { /*========================================== * *------------------------------------------*/ -ACMD(partyspy) { +ACMD(partyspy) +{ char party_name[NAME_LENGTH]; struct party_data *p; @@ -4212,7 +4245,8 @@ ACMD(repairall) /*========================================== * @nuke [Valaris] *------------------------------------------*/ -ACMD(nuke) { +ACMD(nuke) +{ struct map_session_data *pl_sd; memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); @@ -4241,7 +4275,8 @@ ACMD(nuke) { /*========================================== * @tonpc *------------------------------------------*/ -ACMD(tonpc) { +ACMD(tonpc) +{ char npcname[NAME_LENGTH+1]; struct npc_data *nd; @@ -4367,7 +4402,8 @@ ACMD(unloadnpc) /*========================================== * time in txt for time command (by [Yor]) *------------------------------------------*/ -char* txt_time(int fd, unsigned int duration) { +static char *txt_time(int fd, unsigned int duration) +{ int days, hours, minutes, seconds; static char temp1[CHAT_SIZE_MAX]; int tlen = 0; @@ -4405,7 +4441,8 @@ char* txt_time(int fd, unsigned int duration) { * @time/@date/@serverdate/@servertime: Display the date/time of the server (by [Yor] * Calculation management of GM modification (@day/@night GM commands) is done *------------------------------------------*/ -ACMD(servertime) { +ACMD(servertime) +{ time_t time_server; // variable for number of seconds (used with time() function) struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ... char temp[CHAT_SIZE_MAX]; @@ -4460,7 +4497,7 @@ ACMD(servertime) { //Added by Coltaro //We're using this function here instead of using time_t so that it only counts player's jail time when he/she's online (and since the idea is to reduce the amount of minutes one by one in status->change_timer...). //Well, using time_t could still work but for some reason that looks like more coding x_x -void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int* minute) +static void get_jail_time(int jailtime, int *year, int *month, int *day, int *hour, int *minute) { const int factor_year = 518400; //12*30*24*60 = 518400 const int factor_month = 43200; //30*24*60 = 43200 @@ -4494,7 +4531,8 @@ void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int * @jail <char_name> by [Yor] * Special warp! No check with nowarp and nowarpto flag *------------------------------------------*/ -ACMD(jail) { +ACMD(jail) +{ struct map_session_data *pl_sd; int x, y; unsigned short m_index; @@ -4547,7 +4585,8 @@ ACMD(jail) { * @unjail/@discharge <char_name> by [Yor] * Special warp! No check with nowarp and nowarpto flag *------------------------------------------*/ -ACMD(unjail) { +ACMD(unjail) +{ struct map_session_data *pl_sd; memset(atcmd_player_name, '\0', sizeof(atcmd_player_name)); @@ -4581,7 +4620,8 @@ ACMD(unjail) { return true; } -ACMD(jailfor) { +ACMD(jailfor) +{ struct map_session_data *pl_sd = NULL; int year, month, day, hour, minute; char * modif_p; @@ -4865,7 +4905,8 @@ ACMD(undisguise) /*========================================== * UndisguiseAll *------------------------------------------*/ -ACMD(undisguiseall) { +ACMD(undisguiseall) +{ struct map_session_data *pl_sd; struct s_mapiterator* iter; @@ -5043,7 +5084,8 @@ ACMD(killer) * @killable by MouseJstr * enable other people killing you *------------------------------------------*/ -ACMD(killable) { +ACMD(killable) +{ sd->state.killable = !sd->state.killable; if (sd->state.killable) { @@ -5059,7 +5101,8 @@ ACMD(killable) { * @skillon by MouseJstr * turn skills on for the map *------------------------------------------*/ -ACMD(skillon) { +ACMD(skillon) +{ map->list[sd->bl.m].flag.noskill = 0; clif->message(fd, msg_fd(fd,244)); return true; @@ -5069,7 +5112,8 @@ ACMD(skillon) { * @skilloff by MouseJstr * Turn skills off on the map *------------------------------------------*/ -ACMD(skilloff) { +ACMD(skilloff) +{ map->list[sd->bl.m].flag.noskill = 1; clif->message(fd, msg_fd(fd,243)); return true; @@ -5079,7 +5123,8 @@ ACMD(skilloff) { * @npcmove by MouseJstr * move a npc *------------------------------------------*/ -ACMD(npcmove) { +ACMD(npcmove) +{ int x = 0, y = 0, m; struct npc_data *nd = 0; @@ -5149,7 +5194,8 @@ ACMD(addwarp) * @follow by [MouseJstr] * Follow a player .. staying no more then 5 spaces away *------------------------------------------*/ -ACMD(follow) { +ACMD(follow) +{ struct map_session_data *pl_sd = NULL; if (!*message) { @@ -5374,7 +5420,8 @@ ACMD(skillid) * @useskill by [MouseJstr] * A way of using skills without having to find them in the skills menu *------------------------------------------*/ -ACMD(useskill) { +ACMD(useskill) +{ struct map_session_data *pl_sd = NULL; struct block_list *bl; uint16 skill_id; @@ -5420,7 +5467,8 @@ ACMD(useskill) { * Debug command to locate new skill IDs. It sends the * three possible skill-effect packets to the area. *------------------------------------------*/ -ACMD(displayskill) { +ACMD(displayskill) +{ struct status_data *st; int64 tick; uint16 skill_id; @@ -5491,7 +5539,8 @@ ACMD(skilltree) } // Hand a ring with partners name on it to this char -void atcommand_getring(struct map_session_data* sd) { +static void atcommand_getring(struct map_session_data *sd) +{ int flag, item_id; struct item item_tmp; nullpo_retv(sd); @@ -5514,7 +5563,8 @@ void atcommand_getring(struct map_session_data* sd) { * @marry by [MouseJstr], fixed by Lupus * Marry two players *------------------------------------------*/ -ACMD(marry) { +ACMD(marry) +{ struct map_session_data *pl_sd = NULL; char player_name[NAME_LENGTH] = ""; @@ -5633,7 +5683,8 @@ ACMD(autotrade) * @changegm by durf (changed by Lupus) * Changes Master of your Guild to a specified guild member *------------------------------------------*/ -ACMD(changegm) { +ACMD(changegm) +{ struct guild *g; struct map_session_data *pl_sd; @@ -5665,7 +5716,8 @@ ACMD(changegm) { * @changeleader by Skotlex * Changes the leader of a party. *------------------------------------------*/ -ACMD(changeleader) { +ACMD(changeleader) +{ if (!message[0]) { clif->message(fd, msg_fd(fd,1185)); // Usage: @changeleader <party_member_name> @@ -5854,7 +5906,8 @@ ACMD(autolootitem) * Credits: * chriser,Aleos *------------------------------------------*/ -ACMD(autoloottype) { +ACMD(autoloottype) +{ uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset enum item_types type = -1; int ITEM_NONE = 0; @@ -5967,8 +6020,8 @@ ACMD(snow) /*========================================== * Cherry tree snowstorm is made to fall. (Sakura) *------------------------------------------*/ -ACMD(sakura) { - +ACMD(sakura) +{ if (map->list[sd->bl.m].flag.sakura) { map->list[sd->bl.m].flag.sakura=0; clif->weather(sd->bl.m); @@ -5984,8 +6037,8 @@ ACMD(sakura) { /*========================================== * Clouds appear. *------------------------------------------*/ -ACMD(clouds) { - +ACMD(clouds) +{ if (map->list[sd->bl.m].flag.clouds) { map->list[sd->bl.m].flag.clouds=0; clif->weather(sd->bl.m); @@ -6002,8 +6055,8 @@ ACMD(clouds) { /*========================================== * Different type of clouds using effect 516 *------------------------------------------*/ -ACMD(clouds2) { - +ACMD(clouds2) +{ if (map->list[sd->bl.m].flag.clouds2) { map->list[sd->bl.m].flag.clouds2=0; clif->weather(sd->bl.m); @@ -6020,8 +6073,8 @@ ACMD(clouds2) { /*========================================== * Fog hangs over. *------------------------------------------*/ -ACMD(fog) { - +ACMD(fog) +{ if (map->list[sd->bl.m].flag.fog) { map->list[sd->bl.m].flag.fog=0; clif->weather(sd->bl.m); @@ -6037,8 +6090,8 @@ ACMD(fog) { /*========================================== * Fallen leaves fall. *------------------------------------------*/ -ACMD(leaves) { - +ACMD(leaves) +{ if (map->list[sd->bl.m].flag.leaves) { map->list[sd->bl.m].flag.leaves=0; clif->weather(sd->bl.m); @@ -6055,8 +6108,8 @@ ACMD(leaves) { /*========================================== * Fireworks appear. *------------------------------------------*/ -ACMD(fireworks) { - +ACMD(fireworks) +{ if (map->list[sd->bl.m].flag.fireworks) { map->list[sd->bl.m].flag.fireworks=0; clif->weather(sd->bl.m); @@ -6164,20 +6217,23 @@ ACMD(mobsearch) * @cleanmap - cleans items on the ground * @cleanarea - cleans items on the ground within an specified area *------------------------------------------*/ -int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) { +static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) +{ nullpo_ret(bl); map->clearflooritem(bl); return 0; } -ACMD(cleanmap) { +ACMD(cleanmap) +{ map->foreachinmap(atcommand->cleanfloor_sub, sd->bl.m, BL_ITEM); clif->message(fd, msg_fd(fd,1221)); // All dropped items have been cleaned up. return true; } -ACMD(cleanarea) { +ACMD(cleanarea) +{ int x0 = 0, y0 = 0, x1 = 0, y1 = 0, n = 0; if (!*message || (n=sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1)) < 1) { @@ -6341,7 +6397,8 @@ ACMD(users) /*========================================== * *------------------------------------------*/ -ACMD(reset) { +ACMD(reset) +{ pc->resetstate(sd); pc->resetskill(sd, PCRESETSKILL_RESYNC); safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,208), sd->status.name); // '%s' skill and stats points reseted! @@ -6424,7 +6481,8 @@ ACMD(adjgroup) * @trade by [MouseJstr] * Open a trade window with a remote player *------------------------------------------*/ -ACMD(trade) { +ACMD(trade) +{ struct map_session_data *pl_sd = NULL; if (!*message) { @@ -6467,7 +6525,8 @@ ACMD(setbattleflag) /*========================================== * @unmute [Valaris] *------------------------------------------*/ -ACMD(unmute) { +ACMD(unmute) +{ struct map_session_data *pl_sd = NULL; if (!*message) { @@ -6518,7 +6577,8 @@ ACMD(uptime) * @changesex <sex> * => Changes one's sex. Argument sex can be 0 or 1, m or f, male or female. *------------------------------------------*/ -ACMD(changesex) { +ACMD(changesex) +{ int i; pc->resetskill(sd, PCRESETSKILL_CHSEX); @@ -6532,7 +6592,8 @@ ACMD(changesex) { /*================================================ * @mute - Mutes a player for a set amount of time *------------------------------------------------*/ -ACMD(mute) { +ACMD(mute) +{ struct map_session_data *pl_sd = NULL; int manner; @@ -6610,7 +6671,8 @@ ACMD(identify) return true; } -ACMD(misceffect) { +ACMD(misceffect) +{ int effect = 0; if (!*message) @@ -6851,7 +6913,8 @@ ACMD(showmobs) /*========================================== * homunculus level up [orn] *------------------------------------------*/ -ACMD(homlevel) { +ACMD(homlevel) +{ struct homun_data *hd; int level = 0; enum homun_type htype; @@ -6922,7 +6985,8 @@ ACMD(homevolution) return true; } -ACMD(hommutate) { +ACMD(hommutate) +{ int homun_id; enum homun_type m_class, m_id; @@ -6951,7 +7015,8 @@ ACMD(hommutate) { /*========================================== * call choosen homunculus [orn] *------------------------------------------*/ -ACMD(makehomun) { +ACMD(makehomun) +{ int homunid; if (!*message) { @@ -7071,7 +7136,8 @@ ACMD(homtalk) /*========================================== * Show homunculus stats *------------------------------------------*/ -ACMD(hominfo) { +ACMD(hominfo) +{ struct homun_data *hd; struct status_data *st; @@ -7331,7 +7397,8 @@ ACMD(whereis) return true; } -ACMD(version) { +ACMD(version) +{ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1296), sysinfo->is64bit() ? 64 : 32, sysinfo->platform()); // Hercules %d-bit for %s clif->message(fd, atcmd_output); safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts) @@ -7343,8 +7410,9 @@ ACMD(version) { /*========================================== * @mutearea by MouseJstr *------------------------------------------*/ -int atcommand_mutearea_sub(struct block_list *bl, va_list ap) -{ // As it is being used [ACMD(mutearea)] there's no need to be a bool, but if there's need to reuse it, it's better to be this way +static int atcommand_mutearea_sub(struct block_list *bl, va_list ap) +{ + // As it is being used [ACMD(mutearea)] there's no need to be a bool, but if there's need to reuse it, it's better to be this way int time, id; struct map_session_data *pl_sd = BL_CAST(BL_PC, bl); @@ -7364,7 +7432,8 @@ int atcommand_mutearea_sub(struct block_list *bl, va_list ap) return 1; } -ACMD(mutearea) { +ACMD(mutearea) +{ int time; if (!*message) { @@ -7579,7 +7648,8 @@ ACMD(fakename) /*========================================== * Ragnarok Resources *------------------------------------------*/ -ACMD(mapflag) { +ACMD(mapflag) +{ #define CHECKFLAG( cmd ) do { if (map->list[ sd->bl.m ].flag.cmd ) clif->message(sd->fd,#cmd);} while(0) #define SETFLAG( cmd ) do { \ if (strcmp( flag_name , #cmd ) == 0) { \ @@ -7767,7 +7837,8 @@ ACMD(invite) return true; } -ACMD(duel) { +ACMD(duel) +{ unsigned int maxpl = 0; if (sd->duel_group > 0) { @@ -7820,7 +7891,8 @@ ACMD(duel) { return true; } -ACMD(leave) { +ACMD(leave) +{ if (sd->duel_group <= 0) { // "Duel: @leave without @duel." clif->message(fd, msg_fd(fd,358)); @@ -7831,7 +7903,8 @@ ACMD(leave) { return true; } -ACMD(accept) { +ACMD(accept) +{ if (!duel->checktime(sd)) { char output[CHAT_SIZE_MAX]; // "Duel: You can take part in duel only one time per %d minutes." @@ -7859,7 +7932,8 @@ ACMD(accept) { return true; } -ACMD(reject) { +ACMD(reject) +{ if (sd->duel_invite <= 0) { // "Duel: @reject without invitation." clif->message(fd, msg_fd(fd,362)); @@ -7929,7 +8003,8 @@ ACMD(cash) } // @clone/@slaveclone/@evilclone <playername> [Valaris] -ACMD(clone) { +ACMD(clone) +{ int x=0,y=0,flag=0,master=0,i=0; struct map_session_data *pl_sd=NULL; @@ -8047,7 +8122,8 @@ ACMD(auction) /*========================================== * Kill Steal Protection *------------------------------------------*/ -ACMD(ksprotection) { +ACMD(ksprotection) +{ if( sd->state.noks ) { sd->state.noks = KSPROTECT_NONE; clif->message(fd, msg_fd(fd,1325)); // [ K.S Protection Inactive ] @@ -8307,7 +8383,8 @@ ACMD(stats) return true; } -ACMD(delitem) { +ACMD(delitem) +{ char item_name[100]; int nameid, amount = 0, total, idx; struct item_data* id; @@ -8368,7 +8445,8 @@ ACMD(delitem) { /*========================================== * Custom Fonts *------------------------------------------*/ -ACMD(font) { +ACMD(font) +{ int font_id; font_id = atoi(message); @@ -8403,7 +8481,7 @@ ACMD(font) { /*========================================== * type: 1 = commands (@), 2 = charcommands (#) *------------------------------------------*/ -void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommandType type) +static void atcommand_commands_sub(struct map_session_data *sd, const int fd, AtCommandType type) { char line_buff[CHATBOX_SIZE]; char* cur = line_buff; @@ -8528,7 +8606,8 @@ ACMD(cashmount) return true; } -ACMD(accinfo) { +ACMD(accinfo) +{ char query[NAME_LENGTH]; if (!*message || strlen(message) > NAME_LENGTH ) { @@ -8657,12 +8736,16 @@ ACMD(set) aFree(data); return true; } -ACMD(reloadquestdb) { + +ACMD(reloadquestdb) +{ quest->reload(); clif->message(fd, msg_fd(fd,1377)); // Quest database has been reloaded. return true; } -ACMD(addperm) { + +ACMD(addperm) +{ int perm_size = pcg->permission_count; bool add = (strcmpi(info->command, "addperm") == 0) ? true : false; int i; @@ -8718,6 +8801,7 @@ ACMD(addperm) { return true; } + ACMD(unloadnpcfile) { if (!*message) { @@ -8733,7 +8817,9 @@ ACMD(unloadnpcfile) } return true; } -ACMD(cart) { + +ACMD(cart) +{ #define MC_CART_MDFY(x,idx) do { \ sd->status.skill[idx].id = (x)?MC_PUSHCART:0; \ sd->status.skill[idx].lv = (x)?1:0; \ @@ -8775,6 +8861,7 @@ ACMD(cart) { return true; #undef MC_CART_MDFY } + /* [Ind/Hercules] */ ACMD(join) { @@ -8818,8 +8905,10 @@ ACMD(join) return true; } + /* [Ind/Hercules] */ -void atcommand_channel_help(int fd, const char *command, bool can_create) { +static void atcommand_channel_help(int fd, const char *command, bool can_create) +{ nullpo_retv(command); safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1404),command); // %s failed. clif->message(fd, atcmd_output); @@ -8869,8 +8958,10 @@ void atcommand_channel_help(int fd, const char *command, bool can_create) { clif->message(fd, msg_fd(fd,1463));// - adds or removes <option name> with <option value> to <channel name> channel } } + /* [Ind/Hercules] */ -ACMD(channel) { +ACMD(channel) +{ struct channel_data *chan; char subcmd[HCS_NAME_LENGTH], sub1[HCS_NAME_LENGTH], sub2[HCS_NAME_LENGTH], sub3[HCS_NAME_LENGTH]; unsigned char k = 0; @@ -9289,8 +9380,10 @@ ACMD(channel) { } return true; } + /* debug only, delete after */ -ACMD(fontcolor) { +ACMD(fontcolor) +{ unsigned char k; if (!*message) { @@ -9322,7 +9415,9 @@ ACMD(fontcolor) { return true; } -ACMD(searchstore){ + +ACMD(searchstore) +{ int val = atoi(message); switch (val) { @@ -9426,10 +9521,12 @@ ACMD(skdebug) clif->message(fd,atcmd_output); return true; } + /** * cooldown-debug **/ -ACMD(cddebug) { +ACMD(cddebug) +{ int i; struct skill_cd* cd = NULL; @@ -9474,7 +9571,8 @@ ACMD(cddebug) { /** * **/ -ACMD(lang) { +ACMD(lang) +{ uint8 i; if (!*message) { @@ -9644,7 +9742,8 @@ ACMD(reloadclans) **/ #define ACMD_DEF(x) { #x, atcommand_ ## x, NULL, NULL, NULL, true } #define ACMD_DEF2(x2, x) { x2, atcommand_ ## x, NULL, NULL, NULL, true } -void atcommand_basecommands(void) { +static void atcommand_basecommands(void) +{ /** * Command reference list, place the base of your commands here **/ @@ -9935,7 +10034,8 @@ void atcommand_basecommands(void) { #undef ACMD_DEF #undef ACMD_DEF2 -bool atcommand_add(char *name, AtCommandFunc func, bool replace) { +static bool atcommand_add(char *name, AtCommandFunc func, bool replace) +{ AtCommandInfo* cmd; nullpo_retr(false, name); @@ -9958,18 +10058,21 @@ bool atcommand_add(char *name, AtCommandFunc func, bool replace) { /*========================================== * Command lookup functions *------------------------------------------*/ -AtCommandInfo* atcommand_exists(const char* name) { +static AtCommandInfo *atcommand_exists(const char *name) +{ return strdb_get(atcommand->db, name); } -AtCommandInfo* get_atcommandinfo_byname(const char *name) { +static AtCommandInfo *get_atcommandinfo_byname(const char *name) +{ AtCommandInfo *cmd; if ((cmd = strdb_get(atcommand->db, name))) return cmd; return NULL; } -const char* atcommand_checkalias(const char *aliasname) { +static const char *atcommand_checkalias(const char *aliasname) +{ AliasInfo *alias_info = NULL; if ((alias_info = (AliasInfo*)strdb_get(atcommand->alias_db, aliasname)) != NULL) return alias_info->command->command; @@ -9977,7 +10080,8 @@ const char* atcommand_checkalias(const char *aliasname) { } /// AtCommand suggestion -void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool is_atcmd_cmd) { +static void atcommand_get_suggestions(struct map_session_data *sd, const char *name, bool is_atcmd_cmd) +{ struct DBIterator *atcommand_iter, *alias_iter; AtCommandInfo* command_info = NULL; AliasInfo* alias_info = NULL; @@ -10058,7 +10162,7 @@ void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bo * @retval true if the message was recognized as atcommand. * @retval false if the message should be considered a non-command message. */ -bool atcommand_exec(const int fd, struct map_session_data *sd, const char *message, bool player_invoked) +static bool atcommand_exec(const int fd, struct map_session_data *sd, const char *message, bool player_invoked) { char params[100], command[100]; char output[CHAT_SIZE_MAX]; @@ -10230,7 +10334,8 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa /*========================================== * *------------------------------------------*/ -void atcommand_config_read(const char* config_filename) { +static void atcommand_config_read(const char *config_filename) +{ struct config_t atcommand_config; struct config_setting_t *aliases = NULL, *help = NULL, *nolog = NULL; const char *symbol = NULL; @@ -10369,7 +10474,7 @@ static inline int atcommand_command_type2idx(AtCommandType type) * Loads permissions for groups to use commands. * */ -void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t **commands_, size_t sz) +static void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t **commands_, size_t sz) { struct DBIterator *iter = db_iterator(atcommand->db); AtCommandInfo *atcmd; @@ -10429,7 +10534,8 @@ void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t ** return; } -bool atcommand_can_use(struct map_session_data *sd, const char *command) { +static bool atcommand_can_use(struct map_session_data *sd, const char *command) +{ AtCommandInfo *acmd_d; struct atcmd_binding_data *bcmd_d; @@ -10446,7 +10552,8 @@ bool atcommand_can_use(struct map_session_data *sd, const char *command) { return false; } -bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtCommandType type) { +static bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtCommandType type) +{ AtCommandInfo *acmd_d; struct atcmd_binding_data *bcmd_d; @@ -10462,7 +10569,9 @@ bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtComm return false; } -bool atcommand_hp_add(char *name, AtCommandFunc func) { + +static bool atcommand_hp_add(char *name, AtCommandFunc func) +{ /* if commands are added after group permissions are thrown in, they end up with no permissions */ /* so we restrict commands to be linked in during boot */ if( core->runflag == MAPSERVER_ST_RUNNING ) { @@ -10476,7 +10585,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) { /** * @see DBApply */ -int atcommand_db_clear_sub(union DBKey key, struct DBData *data, va_list args) +static int atcommand_db_clear_sub(union DBKey key, struct DBData *data, va_list args) { AtCommandInfo *cmd = DB->data2ptr(data); aFree(cmd->at_groups); @@ -10486,7 +10595,8 @@ int atcommand_db_clear_sub(union DBKey key, struct DBData *data, va_list args) return 0; } -void atcommand_db_clear(void) { +static void atcommand_db_clear(void) +{ if( atcommand->db != NULL ) { atcommand->db->destroy(atcommand->db, atcommand->cmd_db_clear_sub); atcommand->db = NULL; @@ -10497,7 +10607,8 @@ void atcommand_db_clear(void) { } } -void atcommand_doload(void) { +static void atcommand_doload(void) +{ if( core->runflag >= MAPSERVER_ST_RUNNING ) atcommand->cmd_db_clear(); if( atcommand->db == NULL ) @@ -10508,12 +10619,14 @@ void atcommand_doload(void) { atcommand->config_read(map->ATCOMMAND_CONF_FILENAME); } -void atcommand_expand_message_table(void) { +static void atcommand_expand_message_table(void) +{ RECREATE(atcommand->msg_table, char **, ++atcommand->max_message_table); CREATE(atcommand->msg_table[atcommand->max_message_table - 1], char *, MAX_MSG); } -void do_init_atcommand(bool minimal) { +static void do_init_atcommand(bool minimal) +{ if (minimal) return; @@ -10524,11 +10637,13 @@ void do_init_atcommand(bool minimal) { atcommand->doload(); } -void do_final_atcommand(void) { +static void do_final_atcommand(void) +{ atcommand->cmd_db_clear(); } -void atcommand_defaults(void) { +void atcommand_defaults(void) +{ atcommand = &atcommand_s; atcommand->db = NULL; diff --git a/src/map/battle.c b/src/map/battle.c index 4d320704a..172f9083f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -59,7 +59,7 @@ #include <string.h> struct Battle_Config battle_config; -struct battle_interface battle_s; +static struct battle_interface battle_s; struct battle_interface *battle; /** @@ -68,7 +68,7 @@ struct battle_interface *battle; * @param bl The bl to check. * @return The current/last skill ID. */ -int battle_getcurrentskill(struct block_list *bl) +static int battle_getcurrentskill(struct block_list *bl) { const struct unit_data *ud; @@ -91,7 +91,8 @@ int battle_getcurrentskill(struct block_list *bl) /*========================================== * Get random targeting enemy *------------------------------------------*/ -int battle_gettargeted_sub(struct block_list *bl, va_list ap) { +static int battle_gettargeted_sub(struct block_list *bl, va_list ap) +{ struct block_list **bl_list; struct unit_data *ud; int target_id; @@ -119,7 +120,8 @@ int battle_gettargeted_sub(struct block_list *bl, va_list ap) { return 0; } -struct block_list* battle_gettargeted(struct block_list *target) { +static struct block_list *battle_gettargeted(struct block_list *target) +{ struct block_list *bl_list[24]; int c = 0; nullpo_retr(NULL, target); @@ -134,7 +136,8 @@ struct block_list* battle_gettargeted(struct block_list *target) { } //Returns the id of the current targeted character of the passed bl. [Skotlex] -int battle_gettarget(struct block_list* bl) { +static int battle_gettarget(struct block_list *bl) +{ nullpo_ret(bl); switch (bl->type) { @@ -149,7 +152,8 @@ int battle_gettarget(struct block_list* bl) { return 0; } -int battle_getenemy_sub(struct block_list *bl, va_list ap) { +static int battle_getenemy_sub(struct block_list *bl, va_list ap) +{ struct block_list **bl_list; struct block_list *target; int *c; @@ -177,7 +181,8 @@ int battle_getenemy_sub(struct block_list *bl, va_list ap) { } // Picks a random enemy of the given type (BL_PC, BL_CHAR, etc) within the range given. [Skotlex] -struct block_list* battle_getenemy(struct block_list *target, int type, int range) { +static struct block_list *battle_getenemy(struct block_list *target, int type, int range) +{ struct block_list *bl_list[24]; int c = 0; @@ -193,7 +198,9 @@ struct block_list* battle_getenemy(struct block_list *target, int type, int rang return bl_list[rnd()%c]; } -int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { + +static int battle_getenemyarea_sub(struct block_list *bl, va_list ap) +{ struct block_list **bl_list, *src; int *c, ignore_id; @@ -223,7 +230,8 @@ int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { } // Pick a random enemy -struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int range, int type, int ignore_id) { +static struct block_list *battle_getenemyarea(struct block_list *src, int x, int y, int range, int type, int ignore_id) +{ struct block_list *bl_list[24]; int c = 0; @@ -239,7 +247,8 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int return bl_list[rnd()%c]; } -int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { +static int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) +{ struct delay_damage *dat = (struct delay_damage *)data; if ( dat ) { @@ -280,7 +289,8 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { return 0; } -int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) { +static int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects) +{ struct delay_damage *dat; struct status_change *sc; struct block_list *d_tbl = NULL; @@ -328,7 +338,8 @@ int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct return 0; } -int battle_attr_ratio(int atk_elem,int def_type, int def_lv) + +static int battle_attr_ratio(int atk_elem, int def_type, int def_lv) { if (atk_elem < ELE_NEUTRAL || atk_elem >= ELE_MAX) return 100; @@ -344,7 +355,7 @@ int battle_attr_ratio(int atk_elem,int def_type, int def_lv) * Added passing of the chars so that the status changes can affect it. [Skotlex] * Note: Passing src/target == NULL is perfectly valid, it skips SC_ checks. *------------------------------------------*/ -int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv) +static int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage, int atk_elem, int def_type, int def_lv) { struct status_change *sc=NULL, *tsc=NULL; int ratio; @@ -438,8 +449,10 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d return damage + (damage * (ratio - 100) / 100); } +// [malufett] //FIXME: Missing documentation for flag, flag2 -int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2){ // [malufett] +static int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, struct weapon_atk *watk, int nk, bool n_ele, short s_ele, short s_ele_, int size, int type, int flag, int flag2) +{ #ifdef RENEWAL int64 damage, eatk = 0; struct status_change *sc; @@ -511,6 +524,7 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u return 0; #endif } + /*========================================== * Calculates the standard damage of a normal attack assuming it hits, * it calculates nothing extra fancy, is needed for magnum breaks WATK_ELEMENT bonus. [Skotlex] @@ -525,7 +539,8 @@ int64 battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, u */ /* 'battle_calc_base_damage' is used on renewal, 'battle_calc_base_damage2' otherwise. */ // FIXME: Missing documentation for flag2 -int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) { +static int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) +{ int64 damage; struct status_data *st = status->get_status_data(src); struct status_change *sc = status->get_sc(src); @@ -562,7 +577,9 @@ int64 battle_calc_base_damage(struct block_list *src, struct block_list *bl, uin return damage; } -int64 battle_calc_base_damage2(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) { + +static int64 battle_calc_base_damage2(struct status_data *st, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag) +{ unsigned int atkmin=0, atkmax=0; short type = 0; int64 damage = 0; @@ -643,7 +660,8 @@ int64 battle_calc_base_damage2(struct status_data *st, struct weapon_atk *wa, st return damage; } -int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, int size, bool ignore){ +static int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, int size, bool ignore) +{ //SizeFix only for players nullpo_retr(damage, sd); if (!(sd->special_state.no_sizefix || (ignore))) @@ -655,7 +673,8 @@ int64 battle_calc_sizefix(struct map_session_data *sd, int64 damage, int type, i * Passive skill damages increases *------------------------------------------*/ // FIXME: type is undocumented -int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,int64 dmg,int type) { +static int64 battle_addmastery(struct map_session_data *sd, struct block_list *target, int64 dmg, int type) +{ int64 damage; struct status_data *st = status->get_status_data(target); int weapon, skill_lv; @@ -767,7 +786,8 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in /*========================================== * Calculates ATK masteries. *------------------------------------------*/ -int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon) { +static int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int div, bool left, bool weapon) +{ int skill2_lv, i; struct status_change *sc; struct map_session_data *sd; @@ -901,14 +921,16 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, return damage; } -void battle_calc_masteryfix_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int64 *damage, int *div, bool *left, bool *weapon) { +static void battle_calc_masteryfix_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int64 *damage, int *div, bool *left, bool *weapon) +{ } /*========================================== * Elemental attribute fix. *------------------------------------------*/ // FIXME: flag is undocumented -int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag){ +static int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int nk, int n_ele, int s_ele, int s_ele_, bool left, int flag) +{ struct status_data *tstatus; nullpo_ret(src); @@ -953,7 +975,8 @@ int64 battle_calc_elefix(struct block_list *src, struct block_list *target, uint #endif return damage; } -int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64 damage, int s_ele, int nk, int flag) { +static int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64 damage, int s_ele, int nk, int flag) +{ #ifdef RENEWAL struct map_session_data *tsd; struct status_data *sstatus; @@ -984,6 +1007,7 @@ int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64 #endif return damage; } + /*========================================== * Calculates card bonuses damage adjustments. * cflag(cardfix flag): @@ -991,7 +1015,8 @@ int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64 * &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON). *------------------------------------------*/ // FIXME: wflag is undocumented -int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag){ +static int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag) +{ struct map_session_data *sd, *tsd; int cardfix = 1000; short t_class, s_class, s_race2, t_race2; @@ -1280,7 +1305,8 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_ * &4 - tdef(Total defense reduction) *------------------------------------------*/ // TODO: Add an enum for flag -int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int flag, int pdef){ +static int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 damage, int flag, int pdef) +{ struct status_data *sstatus, *tstatus; struct map_session_data *sd, *tsd; struct status_change *sc, *tsc; @@ -1468,7 +1494,8 @@ int64 battle_calc_defense(int attack_type, struct block_list *src, struct block_ } // Minstrel/Wanderer number check for chorus skills. -int battle_calc_chorusbonus(struct map_session_data *sd) { +static int battle_calc_chorusbonus(struct map_session_data *sd) +{ int members = 0; if (!sd || !sd->status.party_id) @@ -1484,7 +1511,8 @@ int battle_calc_chorusbonus(struct map_session_data *sd) { } // FIXME: flag is undocumented -int battle_calc_skillratio(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag){ +static int battle_calc_skillratio(int attack_type, struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int skillratio, int flag) +{ int i; struct status_change *sc, *tsc; struct map_session_data *sd, *tsd; @@ -2706,10 +2734,12 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block return skillratio; } -void battle_calc_skillratio_magic_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) { +static void battle_calc_skillratio_magic_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) +{ } -void battle_calc_skillratio_weapon_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) { +static void battle_calc_skillratio_weapon_unknown(int *attack_type, struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *skillratio, int *flag) +{ } /*========================================== @@ -2717,7 +2747,8 @@ void battle_calc_skillratio_weapon_unknown(int *attack_type, struct block_list * * ATK may be MISS, BLOCKED FAIL, reduce, increase, end status... * After this we apply bg/gvg reduction *------------------------------------------*/ -int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv) { +static int64 battle_calc_damage(struct block_list *src, struct block_list *bl, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv) +{ struct map_session_data *s_sd, *t_sd; struct status_change *s_sc, *sc; struct status_change_entry *sce; @@ -3327,7 +3358,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam return damage; } -int64 battle_calc_pc_damage(struct block_list *src, struct block_list *bl, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv) +static int64 battle_calc_pc_damage(struct block_list *src, struct block_list *bl, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv) { int flag = d->flag; @@ -3362,7 +3393,8 @@ int64 battle_calc_pc_damage(struct block_list *src, struct block_list *bl, struc * Calculates BG related damage adjustments. *------------------------------------------*/ // FIXME: flag is undocumented -int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag) { +static int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag) +{ if (!damage) return 0; @@ -3382,7 +3414,8 @@ int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64 * Calculates GVG related damage adjustments. *------------------------------------------*/ // FIXME: flag is undocumented -int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,int div_,uint16 skill_id,uint16 skill_lv,int flag) { +static int64 battle_calc_gvg_damage(struct block_list *src, struct block_list *bl, int64 damage, int div_, uint16 skill_id, uint16 skill_lv, int flag) +{ struct mob_data* md = BL_CAST(BL_MOB, bl); int class_ = status->get_class(bl); @@ -3443,7 +3476,8 @@ int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 /*========================================== * HP/SP drain calculation *------------------------------------------*/ -int battle_calc_drain(int64 damage, int rate, int per) { +static int battle_calc_drain(int64 damage, int rate, int per) +{ int64 diff = 0; if (per && rnd()%1000 < rate) { @@ -3461,7 +3495,7 @@ int battle_calc_drain(int64 damage, int rate, int per) { /*========================================== * Consumes ammo for the given skill. *------------------------------------------*/ -void battle_consume_ammo(struct map_session_data *sd, int skill_id, int lv) +static void battle_consume_ammo(struct map_session_data *sd, int skill_id, int lv) { int qty=1; @@ -3481,7 +3515,8 @@ void battle_consume_ammo(struct map_session_data *sd, int skill_id, int lv) } //Skill Range Criteria -int battle_range_type(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv) { +static int battle_range_type(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv) +{ nullpo_retr(BF_SHORT, src); nullpo_retr(BF_SHORT, target); @@ -3505,7 +3540,9 @@ int battle_range_type(struct block_list *src, struct block_list *target, uint16 return BF_SHORT; return BF_LONG; } -int battle_adjust_skill_damage(int m, unsigned short skill_id) { + +static int battle_adjust_skill_damage(int m, unsigned short skill_id) +{ if( map->list[m].skill_count ) { int i; ARR_FIND(0, map->list[m].skill_count, i, map->list[m].skills[i]->skill_id == skill_id ); @@ -3518,7 +3555,8 @@ int battle_adjust_skill_damage(int m, unsigned short skill_id) { return 0; } -int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) { +static int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) +{ int i; nullpo_ret(sd); if (!sd->skillblown[0].id) @@ -3530,13 +3568,15 @@ int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id) { } return 0; } + //For quick div adjustment. #define damage_div_fix(dmg, div) do { if ((div) > 1) (dmg)*=(div); else if ((div) < 0) (div)*=-1; } while(0) /*========================================== * battle_calc_magic_attack [DracoRPG] *------------------------------------------*/ // FIXME: mflag is undocumented -struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { +static struct Damage battle_calc_magic_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int mflag) +{ int nk; short s_ele = 0; struct map_session_data *sd = NULL; @@ -3873,7 +3913,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list * Calculate Misc damage for skill_id *------------------------------------------*/ // FIXME: mflag is undocumented -struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) { +static struct Damage battle_calc_misc_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int mflag) +{ int temp; short i, nk; short s_ele; @@ -4302,14 +4343,15 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * return md; } -void battle_calc_misc_attack_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *mflag, struct Damage *md) { +static void battle_calc_misc_attack_unknown(struct block_list *src, struct block_list *target, uint16 *skill_id, uint16 *skill_lv, int *mflag, struct Damage *md) +{ } /*========================================== * battle_calc_weapon_attack (by Skotlex) *------------------------------------------*/ // FIXME: wflag is undocumented -struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) +static struct Damage battle_calc_weapon_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int wflag) { short temp=0; short s_ele, s_ele_; @@ -5695,7 +5737,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list /*========================================== * Battle main entry, from skill->attack *------------------------------------------*/ -struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count) +static struct Damage battle_calc_attack(int attack_type, struct block_list *bl, struct block_list *target, uint16 skill_id, uint16 skill_lv, int count) { struct Damage d; struct map_session_data *sd=BL_CAST(BL_PC,bl); @@ -5757,7 +5799,8 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl } //Performs reflect damage (magic (maya) is performed over skill.c). -void battle_reflect_damage(struct block_list *target, struct block_list *src, struct Damage *wd,uint16 skill_id) { +static void battle_reflect_damage(struct block_list *target, struct block_list *src, struct Damage *wd, uint16 skill_id) +{ int64 damage, rdamage = 0, trdamage = 0; struct map_session_data *sd, *tsd; struct status_change *sc; @@ -5965,7 +6008,7 @@ void battle_reflect_damage(struct block_list *target, struct block_list *src, st #undef NORMALIZE_RDAMAGE } -void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss) +static void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss) { struct weapon_data *wd; int type, thp = 0, tsp = 0, rhp = 0, rsp = 0, hp, sp, i; @@ -6023,8 +6066,10 @@ void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rda if (rhp || rsp) status_zap(tbl, rhp, rsp); } + // Deals the same damage to targets in area. [pakpil] -int battle_damage_area(struct block_list *bl, va_list ap) { +static int battle_damage_area(struct block_list *bl, va_list ap) +{ int64 tick; int amotion, dmotion, damage; struct block_list *src; @@ -6058,7 +6103,7 @@ int battle_damage_area(struct block_list *bl, va_list ap) { return 0; } -bool battle_check_arrows(struct map_session_data *sd) +static bool battle_check_arrows(struct map_session_data *sd) { int index = sd->equip_index[EQI_AMMO]; if (index < 0) { @@ -6101,7 +6146,8 @@ bool battle_check_arrows(struct map_session_data *sd) * Do a basic physical attack (call trough unit_attack_timer) *------------------------------------------*/ // FIXME: flag is undocumented -enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, int64 tick, int flag) { +static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_list *target, int64 tick, int flag) +{ struct map_session_data *sd = NULL, *tsd = NULL; struct status_data *sstatus, *tstatus; struct status_change *sc, *tsc; @@ -6411,7 +6457,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t #undef GET_NORMAL_ATTACK #undef GET_NORMAL_ATTACK2 -bool battle_check_undead(int race,int element) +static bool battle_check_undead(int race, int element) { if(battle_config.undead_detect_type == 0) { if(element == ELE_UNDEAD) @@ -6429,7 +6475,7 @@ bool battle_check_undead(int race,int element) } //Returns the upmost level master starting with the given object -struct block_list *battle_get_master(struct block_list *src) +static struct block_list *battle_get_master(struct block_list *src) { struct block_list *prev = NULL; //Used for infinite loop check (master of yourself?) nullpo_retr(NULL, src); @@ -6493,7 +6539,7 @@ struct block_list *battle_get_master(struct block_list *src) * -1: flag fails * 0: Invalid target (non-targetable ever) *------------------------------------------*/ -int battle_check_target( struct block_list *src, struct block_list *target,int flag) +static int battle_check_target(struct block_list *src, struct block_list *target, int flag) { int16 m; //map int state = 0; //Initial state none @@ -6862,11 +6908,12 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return (flag&state)?1:-1; } + /*========================================== * Check if can attack from this range * Basic check then calling path->search for obstacle etc.. *------------------------------------------*/ -bool battle_check_range(struct block_list *src, struct block_list *bl, int range) +static bool battle_check_range(struct block_list *src, struct block_list *bl, int range) { int d; nullpo_retr(false, src); @@ -7325,7 +7372,7 @@ static const struct battle_data { { "features/feature_attendance_endtime",&battle_config.feature_attendance_endtime, 1, 0, 99999999, }, }; -bool battle_set_value_sub(int index, int value) +static bool battle_set_value_sub(int index, int value) { Assert_retr(false, index >= 0); if (value < battle_data[index].min || value > battle_data[index].max) { @@ -7337,7 +7384,7 @@ bool battle_set_value_sub(int index, int value) return true; } -bool battle_set_value(const char *param, const char *value) +static bool battle_set_value(const char *param, const char *value) { int val; int i; @@ -7357,7 +7404,7 @@ bool battle_set_value(const char *param, const char *value) return battle->config_set_value_sub(i, val); } -bool battle_get_value(const char *w1, int *value) +static bool battle_get_value(const char *w1, int *value) { int i; @@ -7376,13 +7423,15 @@ bool battle_get_value(const char *w1, int *value) return false; } -void battle_set_defaults(void) { +static void battle_set_defaults(void) +{ int i; for (i = 0; i < ARRAYLENGTH(battle_data); i++) *battle_data[i].val = battle_data[i].defval; } -void battle_adjust_conf(void) { +static void battle_adjust_conf(void) +{ battle_config.monster_max_aspd = 2000 - battle_config.monster_max_aspd*10; battle_config.max_aspd = 2000 - battle_config.max_aspd*10; battle_config.max_third_aspd = 2000 - battle_config.max_third_aspd*10; @@ -7459,7 +7508,7 @@ void battle_adjust_conf(void) { * @param imported Whether the current config is imported from another file. * @retval false in case of error. */ -bool battle_config_read(const char *filename, bool imported) +static bool battle_config_read(const char *filename, bool imported) { struct config_t config; const struct config_setting_t *setting = NULL; @@ -7526,7 +7575,8 @@ bool battle_config_read(const char *filename, bool imported) return retval; } -void do_init_battle(bool minimal) { +static void do_init_battle(bool minimal) +{ if (minimal) return; @@ -7534,12 +7584,14 @@ void do_init_battle(bool minimal) { timer->add_func_list(battle->delay_damage_sub, "battle_delay_damage_sub"); } -void do_final_battle(void) { +static void do_final_battle(void) +{ ers_destroy(battle->delay_damage_ers); } /* initialize the interface */ -void battle_defaults(void) { +void battle_defaults(void) +{ battle = &battle_s; battle->bc = &battle_config; diff --git a/src/map/battleground.c b/src/map/battleground.c index 834d500fa..4bedc2a00 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -47,16 +47,18 @@ #include <stdio.h> #include <string.h> -struct battleground_interface bg_s; +static struct battleground_interface bg_s; struct battleground_interface *bg; /// Search a BG Team using bg_id -struct battleground_data* bg_team_search(int bg_id) { +static struct battleground_data* bg_team_search(int bg_id) +{ if( !bg_id ) return NULL; return (struct battleground_data *)idb_get(bg->team_db, bg_id); } -struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) { +static struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) +{ int i; nullpo_retr(NULL, bgd); ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd != NULL); @@ -64,7 +66,8 @@ struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) { } /// Deletes BG Team from db -bool bg_team_delete(int bg_id) { +static bool bg_team_delete(int bg_id) +{ int i; struct battleground_data *bgd = bg->team_search(bg_id); @@ -82,7 +85,8 @@ bool bg_team_delete(int bg_id) { } /// Warps a Team -bool bg_team_warp(int bg_id, unsigned short map_index, short x, short y) { +static bool bg_team_warp(int bg_id, unsigned short map_index, short x, short y) +{ int i; struct battleground_data *bgd = bg->team_search(bg_id); if( bgd == NULL ) return false; @@ -91,13 +95,15 @@ bool bg_team_warp(int bg_id, unsigned short map_index, short x, short y) { return true; } -void bg_send_dot_remove(struct map_session_data *sd) { +static void bg_send_dot_remove(struct map_session_data *sd) +{ if( sd && sd->bg_id ) clif->bg_xy_remove(sd); } /// Player joins team -bool bg_team_join(int bg_id, struct map_session_data *sd) { +static bool bg_team_join(int bg_id, struct map_session_data *sd) +{ int i; struct battleground_data *bgd = bg->team_search(bg_id); @@ -135,7 +141,8 @@ bool bg_team_join(int bg_id, struct map_session_data *sd) { } /// Single Player leaves team -int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) { +static int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) +{ int i, bg_id; struct battleground_data *bgd; @@ -185,7 +192,8 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) { } /// Respawn after killed -bool bg_member_respawn(struct map_session_data *sd) { +static bool bg_member_respawn(struct map_session_data *sd) +{ struct battleground_data *bgd; if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bgd = bg->team_search(sd->bg_id)) == NULL ) return false; @@ -197,7 +205,8 @@ bool bg_member_respawn(struct map_session_data *sd) { return true; // Warped } -int bg_create(unsigned short map_index, short rx, short ry, const char *ev, const char *dev) { +static int bg_create(unsigned short map_index, short rx, short ry, const char *ev, const char *dev) +{ struct battleground_data *bgd; bg->team_counter++; @@ -216,7 +225,8 @@ int bg_create(unsigned short map_index, short rx, short ry, const char *ev, cons return bgd->bg_id; } -int bg_team_get_id(struct block_list *bl) { +static int bg_team_get_id(struct block_list *bl) +{ nullpo_ret(bl); switch( bl->type ) { case BL_PC: @@ -265,7 +275,7 @@ int bg_team_get_id(struct block_list *bl) { return 0; } -bool bg_send_message(struct map_session_data *sd, const char *mes) +static bool bg_send_message(struct map_session_data *sd, const char *mes) { struct battleground_data *bgd; @@ -280,7 +290,7 @@ bool bg_send_message(struct map_session_data *sd, const char *mes) /** * @see DBApply */ -int bg_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) +static int bg_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) { struct battleground_data *bgd = DB->data2ptr(data); struct map_session_data *sd; @@ -298,12 +308,14 @@ int bg_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -int bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { +static int bg_send_xy_timer(int tid, int64 tick, int id, intptr_t data) +{ bg->team_db->foreach(bg->team_db, bg->send_xy_timer_sub, tick); return 0; } -enum bg_queue_types bg_str2teamtype (const char *str) { +static enum bg_queue_types bg_str2teamtype(const char *str) +{ char temp[200], *parse; enum bg_queue_types type = BGQT_INVALID; @@ -331,7 +343,8 @@ enum bg_queue_types bg_str2teamtype (const char *str) { return type; } -void bg_config_read(void) { +static void bg_config_read(void) +{ struct config_t bg_conf; struct config_setting_t *data = NULL; const char *config_filename = "conf/battlegrounds.conf"; // FIXME hardcoded name @@ -497,7 +510,8 @@ void bg_config_read(void) { } libconfig->destroy(&bg_conf); } -struct bg_arena *bg_name2arena(const char *name) + +static struct bg_arena *bg_name2arena(const char *name) { int i; nullpo_retr(NULL, name); @@ -517,7 +531,7 @@ struct bg_arena *bg_name2arena(const char *name) * @return the position (starting at 1). * @retval 0 if the queue doesn't exist or the given account ID isn't present in it. */ -int bg_id2pos(int queue_id, int account_id) +static int bg_id2pos(int queue_id, int account_id) { struct script_queue *queue = script->queue(queue_id); if (queue) { @@ -530,7 +544,7 @@ int bg_id2pos(int queue_id, int account_id) return 0; } -void bg_queue_ready_ack(struct bg_arena *arena, struct map_session_data *sd, bool response) +static void bg_queue_ready_ack(struct bg_arena *arena, struct map_session_data *sd, bool response) { nullpo_retv(arena); nullpo_retv(sd); @@ -561,7 +575,8 @@ void bg_queue_ready_ack(struct bg_arena *arena, struct map_session_data *sd, boo } } -void bg_queue_player_cleanup(struct map_session_data *sd) { +static void bg_queue_player_cleanup(struct map_session_data *sd) +{ nullpo_retv(sd); if ( sd->bg_queue.client_has_bg_data ) { if( sd->bg_queue.arena ) @@ -576,7 +591,9 @@ void bg_queue_player_cleanup(struct map_session_data *sd) { sd->bg_queue.client_has_bg_data = 0; sd->bg_queue.type = 0; } -void bg_match_over(struct bg_arena *arena, bool canceled) { + +static void bg_match_over(struct bg_arena *arena, bool canceled) +{ struct script_queue *queue = script->queue(arena->queue_id); int i; @@ -606,7 +623,9 @@ void bg_match_over(struct bg_arena *arena, bool canceled) { /* reset queue */ script->queue_clear(arena->queue_id); } -void bg_begin(struct bg_arena *arena) { + +static void bg_begin(struct bg_arena *arena) +{ struct script_queue *queue = script->queue(arena->queue_id); int i, count = 0; @@ -663,13 +682,16 @@ void bg_begin(struct bg_arena *arena) { npc->event_do(arena->npc_event); } } -int bg_begin_timer(int tid, int64 tick, int id, intptr_t data) { + +static int bg_begin_timer(int tid, int64 tick, int id, intptr_t data) +{ bg->begin(bg->arena[id]); bg->arena[id]->begin_timer = INVALID_TIMER; return 0; } -int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { +static int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) +{ struct s_mapiterator* iter; struct map_session_data* sd; int count = 0; @@ -691,7 +713,8 @@ int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void bg_queue_pregame(struct bg_arena *arena) { +static void bg_queue_pregame(struct bg_arena *arena) +{ struct script_queue *queue; int i; nullpo_retv(arena); @@ -706,13 +729,16 @@ void bg_queue_pregame(struct bg_arena *arena) { } arena->begin_timer = timer->add( timer->gettick() + (arena->pregame_duration*1000), bg->begin_timer, arena->id, 0 ); } -int bg_fillup_timer(int tid, int64 tick, int id, intptr_t data) { + +static int bg_fillup_timer(int tid, int64 tick, int id, intptr_t data) +{ bg->queue_pregame(bg->arena[id]); bg->arena[id]->fillup_timer = INVALID_TIMER; return 0; } -void bg_queue_check(struct bg_arena *arena) { +static void bg_queue_check(struct bg_arena *arena) +{ int count; struct script_queue *queue; nullpo_retv(arena); @@ -729,7 +755,9 @@ void bg_queue_check(struct bg_arena *arena) { arena->fillup_timer = timer->add( timer->gettick() + (arena->fillup_duration*1000), bg->fillup_timer, arena->id, 0 ); } } -void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) { + +static void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) +{ enum BATTLEGROUNDS_QUEUE_ACK result = bg->can_queue(sd,arena,type); struct script_queue *queue = NULL; int i, count = 0; @@ -810,7 +838,9 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q clif->bgqueue_ack(sd,BGQA_SUCCESS,arena->id); bg->queue_check(arena); } -enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) { + +static enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) +{ int tick; unsigned int tsec; @@ -914,7 +944,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ } return BGQA_SUCCESS; } -void do_init_battleground(bool minimal) { + +static void do_init_battleground(bool minimal) +{ if (minimal) return; @@ -927,7 +959,7 @@ void do_init_battleground(bool minimal) { /** * @see DBApply */ -int bg_team_db_final(union DBKey key, struct DBData *data, va_list ap) +static int bg_team_db_final(union DBKey key, struct DBData *data, va_list ap) { struct battleground_data* bgd = DB->data2ptr(data); @@ -936,7 +968,7 @@ int bg_team_db_final(union DBKey key, struct DBData *data, va_list ap) return 0; } -void do_final_battleground(void) +static void do_final_battleground(void) { bg->team_db->destroy(bg->team_db,bg->team_db_final); @@ -949,7 +981,9 @@ void do_final_battleground(void) aFree(bg->arena); } } -void battleground_defaults(void) { + +void battleground_defaults(void) +{ bg = &bg_s; bg->queue_on = false; diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 16c35ff2a..ade2c5bf2 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -35,15 +35,16 @@ #include "common/socket.h" // RBUF* #include "common/strlib.h" // safestrncpy -struct buyingstore_interface buyingstore_s; +static struct buyingstore_interface buyingstore_s; struct buyingstore_interface *buyingstore; /// Returns unique buying store id -unsigned int buyingstore_getuid(void) { +static unsigned int buyingstore_getuid(void) +{ return buyingstore->nextid++; } -bool buyingstore_setup(struct map_session_data* sd, unsigned char slots) +static bool buyingstore_setup(struct map_session_data *sd, unsigned char slots) { nullpo_retr(false, sd); if( !battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0 ) @@ -80,7 +81,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots) return true; } -void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const uint8* itemlist, unsigned int count) +static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsigned char result, const char *storename, const uint8 *itemlist, unsigned int count) { unsigned int i, weight, listidx; @@ -196,7 +197,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha clif->buyingstore_entry(sd); } -void buyingstore_close(struct map_session_data* sd) +static void buyingstore_close(struct map_session_data *sd) { nullpo_retv(sd); if (sd->state.buyingstore) @@ -210,7 +211,7 @@ void buyingstore_close(struct map_session_data* sd) } } -void buyingstore_open(struct map_session_data* sd, int account_id) +static void buyingstore_open(struct map_session_data *sd, int account_id) { struct map_session_data* pl_sd; @@ -240,8 +241,7 @@ void buyingstore_open(struct map_session_data* sd, int account_id) clif->buyingstore_itemlist(sd, pl_sd); } - -void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int buyer_id, const uint8* itemlist, unsigned int count) +static void buyingstore_trade(struct map_session_data *sd, int account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count) { int zeny = 0; unsigned int i, weight, listidx, k; @@ -415,9 +415,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int } } - /// Checks if an item is being bought in given player's buying store. -bool buyingstore_search(struct map_session_data* sd, unsigned short nameid) +static bool buyingstore_search(struct map_session_data *sd, unsigned short nameid) { unsigned int i; @@ -436,10 +435,9 @@ bool buyingstore_search(struct map_session_data* sd, unsigned short nameid) return true; } - /// Searches for all items in a buyingstore, that match given ids, price and possible cards. /// @return Whether or not the search should be continued. -bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s) +static bool buyingstore_searchall(struct map_session_data *sd, const struct s_search_store_search *s) { unsigned int i, idx; struct s_buyingstore_item* it; @@ -484,7 +482,9 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st return true; } -void buyingstore_defaults(void) { + +void buyingstore_defaults(void) +{ buyingstore = &buyingstore_s; buyingstore->nextid = 0; @@ -499,5 +499,4 @@ void buyingstore_defaults(void) { buyingstore->search = buyingstore_search; buyingstore->searchall = buyingstore_searchall; buyingstore->getuid = buyingstore_getuid; - } diff --git a/src/map/channel.c b/src/map/channel.c index 9ec415883..3bb2016d8 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -44,7 +44,7 @@ #include <stdlib.h> #include <string.h> -struct channel_interface channel_s; +static struct channel_interface channel_s; struct channel_interface *channel; static struct Channel_Config channel_config; @@ -56,7 +56,7 @@ static struct Channel_Config channel_config; * @param sd The issuer character, for character-specific channels (i.e. map, ally) * @return a pointer to the channel, or NULL. */ -struct channel_data *channel_search(const char *name, struct map_session_data *sd) +static struct channel_data *channel_search(const char *name, struct map_session_data *sd) { const char *realname = name; if (!realname || !*realname) @@ -95,7 +95,7 @@ struct channel_data *channel_search(const char *name, struct map_session_data *s * @param color The channel chat color. * @return A pointer to the created channel. */ -struct channel_data *channel_create(enum channel_types type, const char *name, unsigned char color) +static struct channel_data *channel_create(enum channel_types type, const char *name, unsigned char color) { struct channel_data *chan; @@ -123,7 +123,7 @@ struct channel_data *channel_create(enum channel_types type, const char *name, u * * @param chan The channel to delete */ -void channel_delete(struct channel_data *chan) +static void channel_delete(struct channel_data *chan) { nullpo_retv(chan); @@ -156,7 +156,7 @@ void channel_delete(struct channel_data *chan) * @param chan The channel to edit. * @param pass The password to set. Pass NULL to remove existing passwords. */ -void channel_set_password(struct channel_data *chan, const char *password) +static void channel_set_password(struct channel_data *chan, const char *password) { nullpo_retv(chan); if (password) @@ -176,7 +176,7 @@ void channel_set_password(struct channel_data *chan, const char *password) * @retval HCS_STATUS_NOPERM if the source character doesn't have enough permissions. * @retval HCS_STATUS_FAIL in case of generic failure. */ -enum channel_operation_status channel_ban(struct channel_data *chan, const struct map_session_data *ssd, struct map_session_data *tsd) +static enum channel_operation_status channel_ban(struct channel_data *chan, const struct map_session_data *ssd, struct map_session_data *tsd) { struct channel_ban_entry *entry = NULL; @@ -215,7 +215,7 @@ enum channel_operation_status channel_ban(struct channel_data *chan, const struc * @retval HCS_STATUS_NOPERM if the source character doesn't have enough permissions. * @retval HCS_STATUS_FAIL in case of generic failure. */ -enum channel_operation_status channel_unban(struct channel_data *chan, const struct map_session_data *ssd, struct map_session_data *tsd) +static enum channel_operation_status channel_unban(struct channel_data *chan, const struct map_session_data *ssd, struct map_session_data *tsd) { nullpo_retr(HCS_STATUS_FAIL, chan); @@ -251,7 +251,7 @@ enum channel_operation_status channel_unban(struct channel_data *chan, const str * @param chan The channel. * @param options The new options set to apply. */ -void channel_set_options(struct channel_data *chan, unsigned int options) +static void channel_set_options(struct channel_data *chan, unsigned int options) { nullpo_retv(chan); @@ -267,7 +267,7 @@ void channel_set_options(struct channel_data *chan, unsigned int options) * * If no source character is specified, it'll send an anonymous message. */ -void channel_send(struct channel_data *chan, struct map_session_data *sd, const char *msg) +static void channel_send(struct channel_data *chan, struct map_session_data *sd, const char *msg) { char message[150]; nullpo_retv(chan); @@ -309,7 +309,7 @@ void channel_send(struct channel_data *chan, struct map_session_data *sd, const * @param sd The character * @param stealth If true, hide join announcements. */ -void channel_join_sub(struct channel_data *chan, struct map_session_data *sd, bool stealth) +static void channel_join_sub(struct channel_data *chan, struct map_session_data *sd, bool stealth) { nullpo_retv(chan); nullpo_retv(sd); @@ -349,7 +349,7 @@ void channel_join_sub(struct channel_data *chan, struct map_session_data *sd, bo * @retval HCS_STATUS_BANNED if the character is in the channel's ban list * @retval HCS_STATUS_FAIL in case of generic error */ -enum channel_operation_status channel_join(struct channel_data *chan, struct map_session_data *sd, const char *password, bool silent) +static enum channel_operation_status channel_join(struct channel_data *chan, struct map_session_data *sd, const char *password, bool silent) { bool stealth = false; @@ -407,7 +407,7 @@ enum channel_operation_status channel_join(struct channel_data *chan, struct map * @param chan The channel to leave * @param sd The character */ -void channel_leave_sub(struct channel_data *chan, struct map_session_data *sd) +static void channel_leave_sub(struct channel_data *chan, struct map_session_data *sd) { unsigned char i; @@ -441,7 +441,7 @@ void channel_leave_sub(struct channel_data *chan, struct map_session_data *sd) * @param chan The channel to leave * @param sd The character */ -void channel_leave(struct channel_data *chan, struct map_session_data *sd) +static void channel_leave(struct channel_data *chan, struct map_session_data *sd) { nullpo_retv(chan); nullpo_retv(sd); @@ -470,7 +470,7 @@ void channel_leave(struct channel_data *chan, struct map_session_data *sd) * * @param sd The target character */ -void channel_quit(struct map_session_data *sd) +static void channel_quit(struct map_session_data *sd) { nullpo_retv(sd); while (sd->channel_count > 0) { @@ -491,7 +491,7 @@ void channel_quit(struct map_session_data *sd) * * @param sd The target character (sd must be non null) */ -void channel_map_join(struct map_session_data *sd) +static void channel_map_join(struct map_session_data *sd) { nullpo_retv(sd); if (sd->state.autotrade || sd->state.standalone) @@ -507,7 +507,7 @@ void channel_map_join(struct map_session_data *sd) channel->join(map->list[sd->bl.m].channel, sd, "", false); } -void channel_irc_join(struct map_session_data *sd) +static void channel_irc_join(struct map_session_data *sd) { struct channel_data *chan = ircbot->channel; @@ -529,7 +529,7 @@ void channel_irc_join(struct map_session_data *sd) * @param g_source Source guild * @param g_ally Allied guild */ -void channel_guild_join_alliance(const struct guild *g_source, const struct guild *g_ally) +static void channel_guild_join_alliance(const struct guild *g_source, const struct guild *g_ally) { struct channel_data *chan; @@ -557,7 +557,7 @@ void channel_guild_join_alliance(const struct guild *g_source, const struct guil * @param g_source Source guild * @param g_ally Former allied guild */ -void channel_guild_leave_alliance(const struct guild *g_source, const struct guild *g_ally) +static void channel_guild_leave_alliance(const struct guild *g_source, const struct guild *g_ally) { struct channel_data *chan; @@ -581,7 +581,7 @@ void channel_guild_leave_alliance(const struct guild *g_source, const struct gui * * @param sd The character (must be non null) */ -void channel_quit_guild(struct map_session_data *sd) +static void channel_quit_guild(struct map_session_data *sd) { unsigned char i; @@ -596,7 +596,7 @@ void channel_quit_guild(struct map_session_data *sd) } } -void read_channels_config(void) +static void read_channels_config(void) { struct config_t channels_conf; struct config_setting_t *chsys = NULL; @@ -826,7 +826,7 @@ void read_channels_config(void) /*========================================== * *------------------------------------------*/ -int do_init_channel(bool minimal) +static int do_init_channel(bool minimal) { if (minimal) return 0; @@ -838,7 +838,7 @@ int do_init_channel(bool minimal) return 0; } -void do_final_channel(void) +static void do_final_channel(void) { struct DBIterator *iter = db_iterator(channel->db); struct channel_data *chan; diff --git a/src/map/chat.c b/src/map/chat.c index 7282c2815..9852131be 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -39,12 +39,12 @@ #include <stdio.h> #include <string.h> -struct chat_interface chat_s; +static struct chat_interface chat_s; struct chat_interface *chat; /// Initializes a chatroom object (common functionality for both pc and npc chatrooms). /// Returns a chatroom object on success, or NULL on failure. -struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level) +static struct chat_data *chat_createchat(struct block_list *bl, const char *title, const char *pass, int limit, bool pub, int trigger, const char *ev, int zeny, int min_level, int max_level) { struct chat_data* cd; nullpo_retr(NULL, bl); @@ -91,7 +91,8 @@ struct chat_data* chat_createchat(struct block_list* bl, const char* title, cons /*========================================== * player chatroom creation *------------------------------------------*/ -bool chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub) { +static bool chat_createpcchat(struct map_session_data *sd, const char *title, const char *pass, int limit, bool pub) +{ struct chat_data* cd; nullpo_ret(sd); nullpo_ret(title); @@ -135,7 +136,8 @@ bool chat_createpcchat(struct map_session_data* sd, const char* title, const cha /*========================================== * join an existing chatroom *------------------------------------------*/ -bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { +static bool chat_joinchat(struct map_session_data *sd, int chatid, const char *pass) +{ struct chat_data* cd; nullpo_ret(sd); @@ -190,7 +192,6 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { return true; } - /*========================================== * Leave a chatroom * Return @@ -199,7 +200,8 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) { * 2: Chat room deleted (chat room empty) * 3: Owner changed (Owner left and a new one as assigned) *------------------------------------------*/ -int chat_leavechat(struct map_session_data* sd, bool kicked) { +static int chat_leavechat(struct map_session_data *sd, bool kicked) +{ struct chat_data* cd; int i; int leavechar; @@ -273,7 +275,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) { * 0: User not found/Missing data * 1: Success *------------------------------------------*/ -bool chat_changechatowner(struct map_session_data* sd, const char* nextownername) { +static bool chat_changechatowner(struct map_session_data *sd, const char *nextownername) +{ struct chat_data* cd; struct map_session_data* tmpsd; int i; @@ -319,7 +322,8 @@ bool chat_changechatowner(struct map_session_data* sd, const char* nextownername * 0: Missing data * 1: Success *------------------------------------------*/ -bool chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub) { +static bool chat_changechatstatus(struct map_session_data *sd, const char *title, const char *pass, int limit, bool pub) +{ struct chat_data* cd; nullpo_ret(sd); @@ -347,7 +351,8 @@ bool chat_changechatstatus(struct map_session_data* sd, const char* title, const * 0: User cannot be kicked (is gm)/Missing data * 1: Success *------------------------------------------*/ -bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { +static bool chat_kickchat(struct map_session_data *sd, const char *kickusername) +{ struct chat_data* cd; int i; @@ -375,7 +380,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) { /*========================================== * Creates a chat room for the npc *------------------------------------------*/ -bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int min_level, int max_level) +static bool chat_createnpcchat(struct npc_data *nd, const char *title, int limit, bool pub, int trigger, const char *ev, int zeny, int min_level, int max_level) { struct chat_data* cd; nullpo_ret(nd); @@ -407,7 +412,8 @@ bool chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool * 0: Missing data * 1: Success *------------------------------------------*/ -bool chat_deletenpcchat(struct npc_data* nd) { +static bool chat_deletenpcchat(struct npc_data *nd) +{ struct chat_data *cd; nullpo_ret(nd); @@ -431,7 +437,7 @@ bool chat_deletenpcchat(struct npc_data* nd) { * 0: Couldn't trigger / Missing data * 1: Success *------------------------------------------*/ -bool chat_triggerevent(struct chat_data *cd) +static bool chat_triggerevent(struct chat_data *cd) { nullpo_ret(cd); @@ -445,7 +451,7 @@ bool chat_triggerevent(struct chat_data *cd) /// Enables the event of the chat room. /// At most, 127 users are needed to trigger the event. -bool chat_enableevent(struct chat_data* cd) +static bool chat_enableevent(struct chat_data *cd) { nullpo_ret(cd); @@ -455,7 +461,7 @@ bool chat_enableevent(struct chat_data* cd) } /// Disables the event of the chat room -bool chat_disableevent(struct chat_data* cd) +static bool chat_disableevent(struct chat_data *cd) { nullpo_ret(cd); @@ -464,7 +470,7 @@ bool chat_disableevent(struct chat_data* cd) } /// Kicks all the users from the chat room. -bool chat_npckickall(struct chat_data* cd) +static bool chat_npckickall(struct chat_data *cd) { nullpo_ret(cd); @@ -479,7 +485,8 @@ bool chat_npckickall(struct chat_data* cd) * Generated by HerculesInterfaceMaker * created by Susu *-------------------------------------*/ -void chat_defaults(void) { +void chat_defaults(void) +{ chat = &chat_s; /* funcs */ diff --git a/src/map/chrif.c b/src/map/chrif.c index 13e88b15b..2aa76ca2d 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -53,7 +53,7 @@ #include <stdlib.h> #include <sys/types.h> -struct chrif_interface chrif_s; +static struct chrif_interface chrif_s; struct chrif_interface *chrif; //Used Packets: @@ -109,18 +109,21 @@ struct chrif_interface *chrif; //This define should spare writing the check in every function. [Skotlex] #define chrif_check(a) do { if(!chrif->isconnected()) return a; } while(0) +#if 0 // Unused /// Resets all the data. -void chrif_reset(void) __attribute__ ((noreturn)); -void chrif_reset(void) +static void chrif_reset(void) __attribute__ ((noreturn)); +static void chrif_reset(void) { // TODO kick everyone out and reset everything [FlavioJS] exit(EXIT_FAILURE); } +#endif // 0 /// 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 chrif_check_shutdown(void) { +static void chrif_check_shutdown(void) +{ if( core->runflag != MAPSERVER_ST_SHUTDOWN ) return; if( db_size(chrif->auth_db) > 0 ) @@ -128,16 +131,19 @@ void chrif_check_shutdown(void) { core->runflag = CORE_ST_STOP; } -struct auth_node* chrif_search(int account_id) { +static struct auth_node* chrif_search(int account_id) +{ return (struct auth_node*)idb_get(chrif->auth_db, account_id); } -struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) { +static struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) +{ struct auth_node *node = chrif->search(account_id); return ( node && node->char_id == char_id && node->state == state ) ? node : NULL; } -bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { +static bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) +{ struct auth_node *node; if ( (node = chrif->auth_check(account_id, char_id, state) ) ) { @@ -165,7 +171,7 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { } //Moves the sd character to the auth_db structure. -bool chrif_sd_to_auth(struct map_session_data *sd, enum sd_state state) +static bool chrif_sd_to_auth(struct map_session_data *sd, enum sd_state state) { struct auth_node *node; @@ -194,7 +200,7 @@ bool chrif_sd_to_auth(struct map_session_data *sd, enum sd_state state) return true; } -bool chrif_auth_logout(struct map_session_data *sd, enum sd_state state) +static bool chrif_auth_logout(struct map_session_data *sd, enum sd_state state) { nullpo_retr(false, sd); if(sd->fd && state == ST_LOGOUT) { //Disassociate player, and free it after saving ack returns. [Skotlex] @@ -207,7 +213,7 @@ bool chrif_auth_logout(struct map_session_data *sd, enum sd_state state) return chrif->sd_to_auth(sd, state); } -bool chrif_auth_finished(struct map_session_data *sd) +static bool chrif_auth_finished(struct map_session_data *sd) { struct auth_node *node; @@ -223,19 +229,22 @@ bool chrif_auth_finished(struct map_session_data *sd) } // sets char-server's user id -void chrif_setuserid(char *id) { +static void chrif_setuserid(char *id) +{ nullpo_retv(id); memcpy(chrif->userid, id, NAME_LENGTH); } // sets char-server's password -void chrif_setpasswd(char *pwd) { +static void chrif_setpasswd(char *pwd) +{ nullpo_retv(pwd); memcpy(chrif->passwd, pwd, NAME_LENGTH); } // security check, prints warning if using default password -void chrif_checkdefaultlogin(void) { +static void chrif_checkdefaultlogin(void) +{ #ifndef BUILDBOT if (strcmp(chrif->userid, "s1")==0 && strcmp(chrif->passwd, "p1")==0) { ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"); @@ -246,7 +255,8 @@ void chrif_checkdefaultlogin(void) { } // sets char-server's ip address -bool chrif_setip(const char* ip) { +static bool chrif_setip(const char *ip) +{ char ip_str[16]; nullpo_retr(false, ip); @@ -263,12 +273,14 @@ bool chrif_setip(const char* ip) { } // sets char-server's port number -void chrif_setport(uint16 port) { +static void chrif_setport(uint16 port) +{ chrif->port = port; } // says whether the char-server is connected or not -int chrif_isconnected(void) { +static int chrif_isconnected(void) +{ return (chrif->fd > 0 && sockt->session[chrif->fd] != NULL && chrif->state == 2); } @@ -278,7 +290,8 @@ int chrif_isconnected(void) { * Flag = 2: Character is changing map-servers *------------------------------------------*/ // TODO: Flag enum -bool chrif_save(struct map_session_data *sd, int flag) { +static bool chrif_save(struct map_session_data *sd, int flag) +{ nullpo_ret(sd); pc->makesavestatus(sd); @@ -331,7 +344,8 @@ bool chrif_save(struct map_session_data *sd, int flag) { } // connects to char-server (plaintext) -void chrif_connect(int fd) { +static void chrif_connect(int fd) +{ ShowStatus("Logging in to char server...\n"); WFIFOHEAD(fd,60); WFIFOW(fd,0) = 0x2af8; @@ -344,7 +358,8 @@ void chrif_connect(int fd) { } // sends maps to char-server -void chrif_sendmap(int fd) { +static void chrif_sendmap(int fd) +{ int i; ShowStatus("Sending maps to char server...\n"); @@ -359,7 +374,8 @@ void chrif_sendmap(int fd) { } // receive maps from some other map-server (relayed via char-server) -void chrif_recvmap(int fd) { +static void chrif_recvmap(int fd) +{ int i, j; uint32 ip = ntohl(RFIFOL(fd,4)); uint16 port = ntohs(RFIFOW(fd,8)); @@ -375,7 +391,8 @@ void chrif_recvmap(int fd) { } // remove specified maps (used when some other map-server disconnects) -void chrif_removemap(int fd) { +static void chrif_removemap(int fd) +{ int i, j; uint32 ip = RFIFOL(fd,4); uint16 port = RFIFOW(fd,8); @@ -390,13 +407,15 @@ void chrif_removemap(int fd) { } // received after a character has been "final saved" on the char-server -void chrif_save_ack(int fd) { +static void chrif_save_ack(int fd) +{ chrif->auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT); chrif->check_shutdown(); } // request to move a character between mapservers -bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) { +static bool chrif_changemapserver(struct map_session_data *sd, uint32 ip, uint16 port) +{ nullpo_ret(sd); if (chrif->other_mapserver_count < 1) {//No other map servers are online! @@ -427,7 +446,8 @@ bool chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) /// map-server change request acknowledgment (positive or negative) /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W -bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) { +static bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) +{ struct auth_node *node; if ( !( node = chrif->auth_check(account_id, char_id, ST_MAPCHANGE) ) ) @@ -448,7 +468,8 @@ bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int /*========================================== * *------------------------------------------*/ -void chrif_connectack(int fd) { +static void chrif_connectack(int fd) +{ static bool char_init_done = false; if (RFIFOB(fd,2)) { @@ -476,7 +497,7 @@ void chrif_connectack(int fd) { /** * @see DBApply */ -int chrif_reconnect(union DBKey key, struct DBData *data, va_list ap) +static int chrif_reconnect(union DBKey key, struct DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); @@ -509,7 +530,8 @@ int chrif_reconnect(union DBKey key, struct DBData *data, va_list ap) } /// Called when all the connection steps are completed. -void chrif_on_ready(void) { +static void chrif_on_ready(void) +{ static bool once = false; ShowStatus("Map Server is now online.\n"); @@ -540,7 +562,7 @@ void chrif_on_ready(void) { /*========================================== * *------------------------------------------*/ -void chrif_sendmapack(int fd) +static void chrif_sendmapack(int fd) { if (RFIFOB(fd,2)) { ShowFatalError("chrif : send map list to char server failed %d\n", RFIFOB(fd,2)); @@ -555,7 +577,7 @@ void chrif_sendmapack(int fd) /*========================================== * Request sc_data from charserver [Skotlex] *------------------------------------------*/ -bool chrif_scdata_request(int account_id, int char_id) +static bool chrif_scdata_request(int account_id, int char_id) { #ifdef ENABLE_SC_SAVING chrif_check(false); @@ -572,7 +594,8 @@ bool chrif_scdata_request(int account_id, int char_id) /*========================================== * Request auth confirmation *------------------------------------------*/ -void chrif_authreq(struct map_session_data *sd, bool hstandalone) { +static void chrif_authreq(struct map_session_data *sd, bool hstandalone) +{ struct auth_node *node= chrif->search(sd->bl.id); nullpo_retv(sd); @@ -596,7 +619,8 @@ void chrif_authreq(struct map_session_data *sd, bool hstandalone) { /*========================================== * Auth confirmation ack *------------------------------------------*/ -void chrif_authok(int fd) { +static void chrif_authok(int fd) +{ int account_id, group_id, char_id; uint32 login_id1,login_id2; time_t expiration_time; @@ -658,7 +682,9 @@ void chrif_authok(int fd) { } // client authentication failed -void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (but is available) */ +static void chrif_authfail(int fd) +{ + /* HELLO WORLD. ip in RFIFOL 15 is not being used (but is available) */ int account_id, char_id; uint32 login_id1; char sex; @@ -687,7 +713,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( * This can still happen (client times out while waiting for char to confirm auth data) * @see DBApply */ -int auth_db_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) +static int auth_db_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); @@ -712,7 +738,8 @@ int auth_db_cleanup_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -int auth_db_cleanup(int tid, int64 tick, int id, intptr_t data) { +static int auth_db_cleanup(int tid, int64 tick, int id, intptr_t data) +{ chrif_check(0); chrif->auth_db->foreach(chrif->auth_db, chrif->auth_db_cleanup_sub); return 0; @@ -721,7 +748,8 @@ int auth_db_cleanup(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Request char selection *------------------------------------------*/ -bool chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) { +static bool chrif_charselectreq(struct map_session_data *sd, uint32 s_ip) +{ nullpo_ret(sd); if( !sd->bl.id || !sd->login_id1 ) @@ -744,7 +772,8 @@ bool chrif_charselectreq(struct map_session_data* sd, uint32 s_ip) { /*========================================== * Search Char trough id on char serv *------------------------------------------*/ -bool chrif_searchcharid(int char_id) { +static bool chrif_searchcharid(int char_id) +{ if( !char_id ) return false; @@ -762,7 +791,8 @@ bool chrif_searchcharid(int char_id) { /*========================================== * Change Email *------------------------------------------*/ -bool chrif_changeemail(int id, const char *actual_email, const char *new_email) { +static bool chrif_changeemail(int id, const char *actual_email, const char *new_email) +{ if (battle_config.etc_log) ShowInfo("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n", id, actual_email, new_email); @@ -795,7 +825,7 @@ bool chrif_changeemail(int id, const char *actual_email, const char *new_email) * charunban { n/a } * changecharsex { <sex>.b } -- use chrif_changesex *------------------------------------------*/ -bool chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) +static bool chrif_char_ask_name(int acc, const char *character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) { nullpo_retr(false, character_name); chrif_check(false); @@ -826,7 +856,7 @@ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short ope * @param change_account Whether to change the per-account sex. * @retval true. */ -bool chrif_changesex(struct map_session_data *sd, bool change_account) +static bool chrif_changesex(struct map_session_data *sd, bool change_account) { nullpo_retr(false, sd); chrif_check(false); @@ -855,7 +885,8 @@ bool chrif_changesex(struct map_session_data *sd, bool change_account) * type of operation: @see chrif_char_ask_name * type of answer: @see hz_char_ask_name_answer *------------------------------------------*/ -bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, uint16 answer) { +static bool chrif_char_ask_name_answer(int acc, const char *player_name, uint16 type, uint16 answer) +{ struct map_session_data* sd; char action[25]; char output[256]; @@ -893,7 +924,8 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u /*========================================== * Request char server to change sex of char (modified by Yor) *------------------------------------------*/ -void chrif_changedsex(int fd) { +static void chrif_changedsex(int fd) +{ int acc = RFIFOL(fd,2); //int sex = RFIFOL(fd,6); // Dead store. Uncomment if needed again. @@ -910,10 +942,12 @@ void chrif_changedsex(int fd) { // of this process, but there's no need to perform map-server specific response // as everything should been changed through char-server [Panikon] } + /*========================================== * Request Char Server to Divorce Players *------------------------------------------*/ -bool chrif_divorce(int partner_id1, int partner_id2) { +static bool chrif_divorce(int partner_id1, int partner_id2) +{ chrif_check(false); WFIFOHEAD(chrif->fd,10); @@ -929,7 +963,8 @@ bool chrif_divorce(int partner_id1, int partner_id2) { * Divorce players * only used if 'partner_id' is offline *------------------------------------------*/ -bool chrif_divorceack(int char_id, int partner_id) { +static bool chrif_divorceack(int char_id, int partner_id) +{ struct map_session_data* sd; int i; @@ -952,10 +987,12 @@ bool chrif_divorceack(int char_id, int partner_id) { return true; } + /*========================================== * Removes Baby from parents *------------------------------------------*/ -void chrif_deadopt(int father_id, int mother_id, int child_id) { +static void chrif_deadopt(int father_id, int mother_id, int child_id) +{ struct map_session_data* sd; int idx = skill->get_index(WE_CALLBABY); @@ -980,7 +1017,8 @@ void chrif_deadopt(int father_id, int mother_id, int child_id) { /*========================================== * Disconnection of a player (account or char has been banned of has a status, from login or char server) by [Yor] *------------------------------------------*/ -void chrif_idbanned(int fd) { +static void chrif_idbanned(int fd) +{ int id; struct map_session_data *sd; @@ -1027,7 +1065,8 @@ void chrif_idbanned(int fd) { //Disconnect the player out of the game, simple packet //packet.w AID.L WHY.B 2+4+1 = 7byte -int chrif_disconnectplayer(int fd) { +static int chrif_disconnectplayer(int fd) +{ struct map_session_data* sd; int account_id = RFIFOL(fd, 2); @@ -1062,7 +1101,7 @@ int chrif_disconnectplayer(int fd) { /*========================================== * Request/Receive top 10 Fame character list *------------------------------------------*/ -int chrif_updatefamelist(struct map_session_data *sd) +static int chrif_updatefamelist(struct map_session_data *sd) { int type; @@ -1084,7 +1123,8 @@ int chrif_updatefamelist(struct map_session_data *sd) return 0; } -bool chrif_buildfamelist(void) { +static bool chrif_buildfamelist(void) +{ chrif_check(false); WFIFOHEAD(chrif->fd,2); @@ -1094,7 +1134,8 @@ bool chrif_buildfamelist(void) { return true; } -void chrif_recvfamelist(int fd) { +static void chrif_recvfamelist(int fd) +{ int num, size; int total = 0, len = 8; @@ -1128,7 +1169,8 @@ void chrif_recvfamelist(int fd) { /// fame ranking update confirmation /// R 2b22 <table>.B <index>.B <value>.L -int chrif_updatefamelist_ack(int fd) { +static int chrif_updatefamelist_ack(int fd) +{ struct fame_list* list; uint8 index; @@ -1148,8 +1190,9 @@ int chrif_updatefamelist_ack(int fd) { return 1; } -bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the player and sends it to the char-server for saving. [Skotlex] - +//parses the sc_data of the player and sends it to the char-server for saving. [Skotlex] +static bool chrif_save_scdata(struct map_session_data *sd) +{ #ifdef ENABLE_SC_SAVING int i, count=0; int64 tick; @@ -1203,8 +1246,8 @@ bool chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of th } //Retrieve and load sc_data for a player. [Skotlex] -bool chrif_load_scdata(int fd) { - +static bool chrif_load_scdata(int fd) +{ #ifdef ENABLE_SC_SAVING struct map_session_data *sd; int aid, cid, i, count; @@ -1241,7 +1284,8 @@ bool chrif_load_scdata(int fd) { * Send rates to char server [Wizputer] * S 2b16 <base rate>.L <job rate>.L <drop rate>.L *------------------------------------------*/ -bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) { +static bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) +{ chrif_check(false); WFIFOHEAD(chrif->fd,14); @@ -1256,7 +1300,8 @@ bool chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) { /*========================================= * Tell char-server character disconnected [Wizputer] *-----------------------------------------*/ -bool chrif_char_offline_nsd(int account_id, int char_id) { +static bool chrif_char_offline_nsd(int account_id, int char_id) +{ chrif_check(false); WFIFOHEAD(chrif->fd,10); @@ -1271,7 +1316,8 @@ bool chrif_char_offline_nsd(int account_id, int char_id) { /*========================================= * Tell char-server to reset all chars offline [Wizputer] *-----------------------------------------*/ -bool chrif_flush(void) { +static bool chrif_flush(void) +{ chrif_check(false); sockt->set_nonblocking(chrif->fd, 0); @@ -1284,7 +1330,8 @@ bool chrif_flush(void) { /*========================================= * Tell char-server to reset all chars offline [Wizputer] *-----------------------------------------*/ -bool chrif_char_reset_offline(void) { +static bool chrif_char_reset_offline(void) +{ chrif_check(false); WFIFOHEAD(chrif->fd,2); @@ -1297,7 +1344,8 @@ bool chrif_char_reset_offline(void) { /*========================================= * Tell char-server character is online [Wizputer]. Look like unused. *-----------------------------------------*/ -bool chrif_char_online(struct map_session_data *sd) { +static bool chrif_char_online(struct map_session_data *sd) +{ chrif_check(false); nullpo_retr(false, sd); @@ -1311,7 +1359,8 @@ bool chrif_char_online(struct map_session_data *sd) { } /// Called when the connection to Char Server is disconnected. -void chrif_on_disconnect(void) { +static void chrif_on_disconnect(void) +{ if( chrif->connected != 1 ) ShowWarning("Connection to Char Server lost.\n\n"); chrif->connected = 0; @@ -1323,7 +1372,8 @@ void chrif_on_disconnect(void) { timer->add(timer->gettick() + 1000, chrif->check_connect_char_server, 0, 0); } -void chrif_update_ip(int fd) { +static void chrif_update_ip(int fd) +{ uint32 new_ip; WFIFOHEAD(fd,6); @@ -1344,15 +1394,20 @@ void chrif_update_ip(int fd) { } // pings the charserver ( since on-demand flag.ping was introduced, shouldn't this be dropped? only wasting traffic and processing [Ind]) -void chrif_keepalive(int fd) { +static void chrif_keepalive(int fd) +{ WFIFOHEAD(fd,2); WFIFOW(fd,0) = 0x2b23; WFIFOSET(fd,2); } -void chrif_keepalive_ack(int fd) { + +static void chrif_keepalive_ack(int fd) +{ sockt->session[fd]->flag.ping = 0;/* reset ping state, we received a packet */ } -void chrif_skillid2idx(int fd) { + +static void chrif_skillid2idx(int fd) +{ int i, count = 0; if( fd == 0 ) fd = chrif->fd; @@ -1373,10 +1428,12 @@ void chrif_skillid2idx(int fd) { WFIFOSET(fd,4 + (count * 4)); } + /*========================================== * *------------------------------------------*/ -int chrif_parse(int fd) { +static int chrif_parse(int fd) +{ int packet_len, cmd; // only process data from the char-server @@ -1470,7 +1527,8 @@ int chrif_parse(int fd) { return 0; } -int send_usercount_tochar(int tid, int64 tick, int id, intptr_t data) { +static int send_usercount_tochar(int tid, int64 tick, int id, intptr_t data) +{ chrif_check(-1); WFIFOHEAD(chrif->fd,4); @@ -1484,7 +1542,8 @@ int send_usercount_tochar(int tid, int64 tick, int id, intptr_t data) { * timerFunction * Send to char the number of client connected to map *------------------------------------------*/ -bool send_users_tochar(void) { +static bool send_users_tochar(void) +{ int users = 0, i = 0; const struct map_session_data *sd; struct s_mapiterator *iter; @@ -1515,7 +1574,8 @@ bool send_users_tochar(void) { * timerFunction * Check the connection to char server, (if it down) *------------------------------------------*/ -int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { +static int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) +{ static int displayed = 0; if ( chrif->fd <= 0 || sockt->session[chrif->fd] == NULL ) { if ( !displayed ) { @@ -1549,7 +1609,7 @@ int check_connect_char_server(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Asks char server to remove friend_id from the friend list of char_id *------------------------------------------*/ -bool chrif_removefriend(int char_id, int friend_id) +static bool chrif_removefriend(int char_id, int friend_id) { chrif_check(false); @@ -1564,7 +1624,7 @@ bool chrif_removefriend(int char_id, int friend_id) /** * Sends a single scdata for saving into char server, meant to ensure integrity of duration-less conditions **/ -void chrif_save_scdata_single(int account_id, int char_id, short type, struct status_change_entry *sce) +static void chrif_save_scdata_single(int account_id, int char_id, short type, struct status_change_entry *sce) { if( !chrif->isconnected() ) return; @@ -1583,10 +1643,11 @@ void chrif_save_scdata_single(int account_id, int char_id, short type, struct st WFIFOSET(chrif->fd, 28); } + /** * Sends a single scdata deletion request into char server, meant to ensure integrity of duration-less conditions **/ -void chrif_del_scdata_single(int account_id, int char_id, short type) +static void chrif_del_scdata_single(int account_id, int char_id, short type) { if( !chrif->isconnected() ) { ShowError("MAYDAY! failed to delete status %d from CID:%d/AID:%d\n",type,char_id,account_id); @@ -1606,7 +1667,7 @@ void chrif_del_scdata_single(int account_id, int char_id, short type) /** * @see DBApply */ -int auth_db_final(union DBKey key, struct DBData *data, va_list ap) +static int auth_db_final(union DBKey key, struct DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); @@ -1628,7 +1689,7 @@ int auth_db_final(union DBKey key, struct DBData *data, va_list ap) /*========================================== * Destructor *------------------------------------------*/ -void do_final_chrif(void) +static void do_final_chrif(void) { if( chrif->fd != -1 ) { sockt->close(chrif->fd); @@ -1643,7 +1704,8 @@ void do_final_chrif(void) /*========================================== * *------------------------------------------*/ -void do_init_chrif(bool minimal) { +static void do_init_chrif(bool minimal) +{ if (minimal) return; @@ -1669,7 +1731,8 @@ void do_init_chrif(bool minimal) { * Generated by HerculesInterfaceMaker * created by Susu *-------------------------------------*/ -void chrif_defaults(void) { +void chrif_defaults(void) +{ const int packet_len_table[CHRIF_PACKET_LEN_TABLE_SIZE] = { // U - used, F - free 60, 3, -1, 27, 10, -1, 6, -1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff 6, -1, 18, 7, -1, 39, 30, 10, // 2b00-2b07: U->2b00, U->2b01, U->2b02, U->2b03, U->2b04, U->2b05, U->2b06, U->2b07 diff --git a/src/map/clan.c b/src/map/clan.c index 7aa9be5d4..3d5c70eb1 100644 --- a/src/map/clan.c +++ b/src/map/clan.c @@ -52,7 +52,7 @@ #include <stdlib.h> #include <string.h> -struct clan_interface clan_s; +static struct clan_interface clan_s; struct clan_interface *clan; /** @@ -61,7 +61,7 @@ struct clan_interface *clan; * @param clan_id Clan ID * @return struct clan* */ -struct clan *clan_search(int clan_id) +static struct clan *clan_search(int clan_id) { if (clan_id <= 0) { return NULL; @@ -75,7 +75,7 @@ struct clan *clan_search(int clan_id) * @param name Clan Name * @return struct clan* */ -struct clan *clan_searchname(const char *name) +static struct clan *clan_searchname(const char *name) { struct clan *c; struct DBIterator *iter; @@ -98,7 +98,7 @@ struct clan *clan_searchname(const char *name) * @param (struct clan *) c clan structure * @return (struct map_session_data *) */ -struct map_session_data *clan_getonlinesd(struct clan *c) +static struct map_session_data *clan_getonlinesd(struct clan *c) { int i; nullpo_retr(NULL, c); @@ -114,7 +114,7 @@ struct map_session_data *clan_getonlinesd(struct clan *c) * @param char_id Player's Char ID * @return int */ -int clan_getindex(const struct clan *c, int char_id) +static int clan_getindex(const struct clan *c, int char_id) { int i; nullpo_retr(INDEX_NOT_FOUND, c); @@ -130,7 +130,7 @@ int clan_getindex(const struct clan *c, int char_id) /** * Starts clan buff */ -void clan_buff_start(struct map_session_data *sd, struct clan *c) +static void clan_buff_start(struct map_session_data *sd, struct clan *c) { nullpo_retv(sd); nullpo_retv(c); @@ -146,7 +146,7 @@ void clan_buff_start(struct map_session_data *sd, struct clan *c) /** * Ends clan buff */ -void clan_buff_end(struct map_session_data *sd, struct clan *c) +static void clan_buff_end(struct map_session_data *sd, struct clan *c) { nullpo_retv(sd); nullpo_retv(c); @@ -165,7 +165,7 @@ void clan_buff_end(struct map_session_data *sd, struct clan *c) * @param clan_id Clan which will add this player * @return bool */ -bool clan_join(struct map_session_data *sd, int clan_id) +static bool clan_join(struct map_session_data *sd, int clan_id) { struct clan *c; struct clan_member m; @@ -230,7 +230,7 @@ bool clan_join(struct map_session_data *sd, int clan_id) * * @param sd Player Data */ -void clan_member_online(struct map_session_data *sd, bool first) +static void clan_member_online(struct map_session_data *sd, bool first) { struct clan *c; int i, inactivity; @@ -329,7 +329,7 @@ void clan_member_online(struct map_session_data *sd, bool first) /** * Re-join a player on its clan */ -int clan_rejoin(struct map_session_data *sd, va_list ap) +static int clan_rejoin(struct map_session_data *sd, va_list ap) { nullpo_ret(sd); @@ -344,7 +344,7 @@ int clan_rejoin(struct map_session_data *sd, va_list ap) /** * Removes Player from clan */ -bool clan_leave(struct map_session_data *sd, bool first) +static bool clan_leave(struct map_session_data *sd, bool first) { int i; struct clan *c; @@ -388,7 +388,7 @@ bool clan_leave(struct map_session_data *sd, bool first) * * @param (struct map_session_data *) sd Player Data */ -void clan_member_offline(struct map_session_data *sd) +static void clan_member_offline(struct map_session_data *sd) { struct clan *c; int i; @@ -415,7 +415,7 @@ void clan_member_offline(struct map_session_data *sd) /** * Sends a message to the whole clan */ -bool clan_send_message(struct map_session_data *sd, const char *mes) +static bool clan_send_message(struct map_session_data *sd, const char *mes) { int len; nullpo_retr(false, sd); @@ -437,7 +437,7 @@ bool clan_send_message(struct map_session_data *sd, const char *mes) /** * Clan receive a message, will be displayed to whole clan */ -void clan_recv_message(struct clan *c, const char *mes, int len) +static void clan_recv_message(struct clan *c, const char *mes, int len) { clif->clan_message(c, mes, len); } @@ -445,7 +445,7 @@ void clan_recv_message(struct clan *c, const char *mes, int len) /** * Set constants for each clan */ -void clan_set_constants(void) +static void clan_set_constants(void) { struct DBIterator *iter = db_iterator(clan->db); struct clan *c; @@ -460,7 +460,7 @@ void clan_set_constants(void) /** * Returns the clan_id of bl */ -int clan_get_id(const struct block_list *bl) +static int clan_get_id(const struct block_list *bl) { nullpo_ret(bl); @@ -515,7 +515,7 @@ int clan_get_id(const struct block_list *bl) /** * Checks every clan player and remove those who are inactive */ -int clan_inactivity_kick(int tid, int64 tick, int id, intptr_t data) +static int clan_inactivity_kick(int tid, int64 tick, int id, intptr_t data) { struct clan *c = NULL; int i; @@ -553,7 +553,7 @@ int clan_inactivity_kick(int tid, int64 tick, int id, intptr_t data) /** * Timeout for the request of offline kick */ -int clan_request_kickoffline(int tid, int64 tick, int id, intptr_t data) +static int clan_request_kickoffline(int tid, int64 tick, int id, intptr_t data) { struct clan *c = NULL; @@ -577,7 +577,7 @@ int clan_request_kickoffline(int tid, int64 tick, int id, intptr_t data) /** * Timeout of the request for counting members */ -int clan_request_membercount(int tid, int64 tick, int id, intptr_t data) +static int clan_request_membercount(int tid, int64 tick, int id, intptr_t data) { struct clan *c = NULL; @@ -606,12 +606,12 @@ int clan_request_membercount(int tid, int64 tick, int id, intptr_t data) * @param[in] n Ordinal number of the entry, to be displayed in case of validation errors. * @param[in] source Source of the entry (file name), to be displayed in case of validation errors. */ -void clan_read_db_additional_fields(struct clan *entry, struct config_setting_t *t, int n, const char *source) +static void clan_read_db_additional_fields(struct clan *entry, struct config_setting_t *t, int n, const char *source) { // do nothing. plugins can do own work } -void clan_read_buffs(struct clan *c, struct config_setting_t *buff, const char *source) +static void clan_read_buffs(struct clan *c, struct config_setting_t *buff, const char *source) { struct clan_buff *b; const char *str = NULL; @@ -647,7 +647,7 @@ void clan_read_buffs(struct clan *c, struct config_setting_t *buff, const char * * validation errors. * @return int. */ -int clan_read_db_sub(struct config_setting_t *settings, const char *source, bool reload) +static int clan_read_db_sub(struct config_setting_t *settings, const char *source, bool reload) { int total, s, valid = 0; @@ -895,7 +895,7 @@ int clan_read_db_sub(struct config_setting_t *settings, const char *source, bool * @param settings The Settings Group from config file. * @param source File name. */ -void clan_read_db(struct config_setting_t *settings, const char *source, bool reload) +static void clan_read_db(struct config_setting_t *settings, const char *source, bool reload) { struct config_setting_t *clans; @@ -918,7 +918,7 @@ void clan_read_db(struct config_setting_t *settings, const char *source, bool re * * @param bool clear Whether to clear clan->db before reading clans */ -bool clan_config_read(bool reload) +static bool clan_config_read(bool reload) { struct config_t clan_conf; struct config_setting_t *settings = NULL; @@ -979,7 +979,7 @@ bool clan_config_read(bool reload) * @param source Source of the entry (file name), to be displayed in * case of validation errors. */ -void clan_config_read_additional_settings(struct config_setting_t *settings, const char *source) +static void clan_config_read_additional_settings(struct config_setting_t *settings, const char *source) { // do nothing. plugins can do own work } @@ -987,7 +987,7 @@ void clan_config_read_additional_settings(struct config_setting_t *settings, con /** * Reloads Clan DB */ -void clan_reload(void) +static void clan_reload(void) { clan->config_read(true); } @@ -995,7 +995,7 @@ void clan_reload(void) /** * */ -void do_init_clan(bool minimal) +static void do_init_clan(bool minimal) { clan->db = idb_alloc(DB_OPT_RELEASE_DATA); @@ -1009,7 +1009,7 @@ void do_init_clan(bool minimal) /** * */ -void do_final_clan(void) +static void do_final_clan(void) { struct DBIterator *iter = db_iterator(clan->db); struct clan *c; diff --git a/src/map/clif.c b/src/map/clif.c index bae079f3e..adc7562e1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -77,10 +77,10 @@ #include <stdarg.h> #include <time.h> -struct clif_interface clif_s; +static struct clif_interface clif_s; struct clif_interface *clif; -struct s_packet_db packet_db[MAX_PACKET_DB + 1]; +static struct s_packet_db packet_db[MAX_PACKET_DB + 1]; /* re-usable */ static struct packet_itemlist_normal itemlist_normal; @@ -96,7 +96,8 @@ static struct packet_npc_market_open npcmarket_open; //#define DUMP_INVALID_PACKET //Converts item type in case of pet eggs. -static inline int itemtype(int type) { +static inline int itemtype(int type) +{ switch( type ) { #if PACKETVER >= 20080827 case IT_WEAPON: @@ -111,7 +112,8 @@ static inline int itemtype(int type) { } } -static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsigned char dir) { +static inline void WBUFPOS(uint8 *p, unsigned short pos, short x, short y, unsigned char dir) +{ p += pos; p[0] = (uint8)(x>>2); p[1] = (uint8)((x<<6) | ((y>>4)&0x3f)); @@ -119,7 +121,8 @@ static inline void WBUFPOS(uint8* p, unsigned short pos, short x, short y, unsig } // client-side: x0+=sx0*0.0625-0.5 and y0+=sy0*0.0625-0.5 -static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { +static inline void WBUFPOS2(uint8 *p, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) +{ p += pos; p[0] = (uint8)(x0>>2); p[1] = (uint8)((x0<<6) | ((y0>>4)&0x3f)); @@ -130,16 +133,19 @@ static inline void WBUFPOS2(uint8* p, unsigned short pos, short x0, short y0, sh } #if 0 // Currently unused -static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) { +static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsigned char dir) +{ WBUFPOS(WFIFOP(fd,pos), 0, x, y, dir); } #endif // 0 -static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { +static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) +{ WBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } -static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) { +static inline void RBUFPOS(const uint8 *p, unsigned short pos, short *x, short *y, unsigned char *dir) +{ p += pos; if( x ) { @@ -155,12 +161,14 @@ static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* } } -static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) { +static inline void RFIFOPOS(int fd, unsigned short pos, short *x, short *y, unsigned char *dir) +{ RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); } #if 0 // currently unused -static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { +static inline void RBUFPOS2(const uint8 *p, unsigned short pos, short *x0, short *y0, short *x1, short *y1, unsigned char *sx0, unsigned char *sy0) +{ p += pos; if( x0 ) { @@ -187,13 +195,15 @@ static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short sy0[0] = ( p[5] & 0x0f ) >> 0; } } -static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) { + +static inline void RFIFOPOS2(int fd, unsigned short pos, short *x0, short *y0, short *x1, short *y1, unsigned char *sx0, unsigned char *sy0) +{ RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } #endif // 0 //To identify disguised characters. -bool clif_isdisguised(struct block_list* bl) +static bool clif_isdisguised(struct block_list *bl) { struct map_session_data *sd = BL_CAST(BL_PC, bl); if (sd == NULL || sd->disguise == -1) @@ -204,7 +214,8 @@ bool clif_isdisguised(struct block_list* bl) /*========================================== * Ip setting of map-server *------------------------------------------*/ -bool clif_setip(const char* ip) { +static bool clif_setip(const char *ip) +{ char ip_str[16]; nullpo_retr(false, ip); clif->map_ip = sockt->host2ip(ip); @@ -218,7 +229,8 @@ bool clif_setip(const char* ip) { return true; } -bool clif_setbindip(const char* ip) { +static bool clif_setbindip(const char *ip) +{ nullpo_retr(false, ip); clif->bind_ip = sockt->host2ip(ip); if ( clif->bind_ip ) { @@ -234,30 +246,35 @@ bool clif_setbindip(const char* ip) { * Sets map port to 'port' * is run from map.c upon loading map server configuration *------------------------------------------*/ -void clif_setport(uint16 port) +static void clif_setport(uint16 port) { clif->map_port = port; } +#if 0 // Unused function /*========================================== * Returns map server IP *------------------------------------------*/ -uint32 clif_getip(void) +static uint32 clif_getip(void) { return clif->map_ip; } +#endif // 0 +#if 0 // Unused function /*========================================== * Returns map port which is set by clif_setport() *------------------------------------------*/ -uint16 clif_getport(void) +static uint16 clif_getport(void) { return clif->map_port; } +#endif // 0 + /*========================================== * Updates server ip resolution and returns it *------------------------------------------*/ -uint32 clif_refresh_ip(void) +static uint32 clif_refresh_ip(void) { uint32 new_ip = sockt->host2ip(clif->map_ip_str); if ( new_ip && new_ip != clif->map_ip ) { @@ -268,7 +285,7 @@ uint32 clif_refresh_ip(void) return 0; } -unsigned char clif_bl_type(struct block_list *bl) +static unsigned char clif_bl_type(struct block_list *bl) { #if PACKETVER >= 20071106 struct view_data *vd; @@ -327,7 +344,8 @@ unsigned char clif_bl_type(struct block_list *bl) * - AREA_WOS (AREA WITHOUT SELF) : Not run for self * - AREA_CHAT_WOC : Everyone in the area of your chat without a chat *------------------------------------------*/ -int clif_send_sub(struct block_list *bl, va_list ap) { +static int clif_send_sub(struct block_list *bl, va_list ap) +{ struct block_list *src_bl; struct map_session_data *sd; void *buf; @@ -383,7 +401,7 @@ int clif_send_sub(struct block_list *bl, va_list ap) { return clif->send_actual(fd, buf, len); } -int clif_send_actual(int fd, void *buf, int len) +static int clif_send_actual(int fd, void *buf, int len) { nullpo_retr(0, buf); WFIFOHEAD(fd, len); @@ -407,7 +425,8 @@ int clif_send_actual(int fd, void *buf, int len) * Packet Delegation (called on all packets that require data to be sent to more than one client) * functions that are sent solely to one use whose ID it posses use WFIFOSET *------------------------------------------*/ -bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target type) { +static bool clif_send(const void *buf, int len, struct block_list *bl, enum send_target type) +{ int i; struct map_session_data *sd, *tsd; struct party_data *p = NULL; @@ -694,7 +713,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target /// Notifies the client, that it's connection attempt was accepted. /// 0073 <start time>.L <position>.3B <x size>.B <y size>.B (ZC_ACCEPT_ENTER) /// 02eb <start time>.L <position>.3B <x size>.B <y size>.B <font>.W (ZC_ACCEPT_ENTER2) -void clif_authok(struct map_session_data *sd) +static void clif_authok(struct map_session_data *sd) { struct packet_authok p; @@ -722,7 +741,7 @@ void clif_authok(struct map_session_data *sd) /// 2 = mobile - out of available time /// 3 = mobile - already logged in /// 4 = mobile - waiting state -void clif_authrefuse(int fd, uint8 error_code) +static void clif_authrefuse(int fd, uint8 error_code) { WFIFOHEAD(fd,packet_len(0x74)); WFIFOW(fd,0) = 0x74; @@ -765,7 +784,7 @@ void clif_authrefuse(int fd, uint8 error_code) /// 115 = You are in game connection ban period. /// ? = disconnected -> MsgStringTable[3] // TODO: type enum -void clif_authfail_fd(int fd, int type) +static void clif_authfail_fd(int fd, int type) { if (!fd || !sockt->session[fd] || sockt->session[fd]->func_parse != clif->parse) //clif_authfail should only be invoked on players! return; @@ -783,7 +802,8 @@ void clif_authfail_fd(int fd, int type) /// type: /// 1 = disconnect, char-select /// ? = nothing -void clif_charselectok(int id, uint8 ok) { +static void clif_charselectok(int id, uint8 ok) +{ struct map_session_data* sd; int fd; @@ -800,7 +820,8 @@ void clif_charselectok(int id, uint8 ok) { /// Makes an item appear on the ground. /// 009e <id>.L <name id>.W <identified>.B <x>.W <y>.W <subX>.B <subY>.B <amount>.W (ZC_ITEM_FALL_ENTRY) /// 084b (ZC_ITEM_FALL_ENTRY4) -void clif_dropflooritem(struct flooritem_data* fitem) { +static void clif_dropflooritem(struct flooritem_data *fitem) +{ struct packet_dropflooritem p; int view; @@ -835,7 +856,7 @@ void clif_dropflooritem(struct flooritem_data* fitem) { /// Makes an item disappear from the ground. /// 00a1 <id>.L (ZC_ITEM_DISAPPEAR) -void clif_clearflooritem(struct flooritem_data *fitem, int fd) +static void clif_clearflooritem(struct flooritem_data *fitem, int fd) { unsigned char buf[16]; @@ -861,7 +882,7 @@ void clif_clearflooritem(struct flooritem_data *fitem, int fd) /// 2 = logged out /// 3 = teleport /// 4 = trickdead -void clif_clearunit_single(int id, clr_type type, int fd) +static void clif_clearunit_single(int id, clr_type type, int fd) { WFIFOHEAD(fd, packet_len(0x80)); WFIFOW(fd,0) = 0x80; @@ -878,7 +899,7 @@ void clif_clearunit_single(int id, clr_type type, int fd) /// 2 = logged out /// 3 = teleport /// 4 = trickdead -void clif_clearunit_area(struct block_list* bl, clr_type type) +static void clif_clearunit_area(struct block_list *bl, clr_type type) { unsigned char buf[8]; @@ -899,14 +920,16 @@ void clif_clearunit_area(struct block_list* bl, clr_type type) /// Used to make monsters with player-sprites disappear after dying /// like normal monsters, because the client does not remove those /// automatically. -int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { +static int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) +{ struct block_list *bl = (struct block_list *)data; clif->clearunit_area(bl, (clr_type) id); ers_free(clif->delay_clearunit_ers,bl); return 0; } -void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { +static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 tick) +{ struct block_list *tbl; nullpo_retv(bl); @@ -916,7 +939,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, int64 tick) { } /// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand) -void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand) +static void clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand) { nullpo_retv(sd); nullpo_retv(rhand); @@ -956,7 +979,8 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un } //To make the assignation of the level based on limits clearer/easier. [Skotlex] -static int clif_setlevel_sub(int lv) { +static int clif_setlevel_sub(int lv) +{ if( lv < battle_config.max_lv ) { ; } else if( lv < battle_config.aura_lv ) { @@ -968,7 +992,8 @@ static int clif_setlevel_sub(int lv) { return lv; } -static int clif_setlevel(struct block_list* bl) { +static int clif_setlevel(struct block_list *bl) +{ int lv = status->get_lv(bl); nullpo_retr(0, bl); if( battle_config.client_limit_unit_lv&bl->type ) @@ -981,8 +1006,10 @@ static int clif_setlevel(struct block_list* bl) { } return lv; } + /* for 'packetver < 20091103' 0x78 non-pc-looking unit handling */ -void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +static void clif_set_unit_idle2(struct block_list *bl, struct map_session_data *tsd, enum send_target target) +{ #if PACKETVER < 20091103 struct map_session_data* sd; struct status_change* sc = status->get_sc(bl); @@ -1034,10 +1061,12 @@ void clif_set_unit_idle2(struct block_list* bl, struct map_session_data *tsd, en return; #endif } + /*========================================== * Prepares 'unit standing' packet *------------------------------------------*/ -void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enum send_target target) { +static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *tsd, enum send_target target) +{ struct map_session_data* sd; struct status_change* sc = status->get_sc(bl); struct view_data* vd = status->get_viewdata(bl); @@ -1143,8 +1172,10 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu } } + /* for 'packetver < 20091103' 0x7c non-pc-looking unit handling */ -void clif_spawn_unit2(struct block_list* bl, enum send_target target) { +static void clif_spawn_unit2(struct block_list *bl, enum send_target target) +{ #if PACKETVER < 20091103 struct map_session_data* sd; struct status_change* sc = status->get_sc(bl); @@ -1190,7 +1221,9 @@ void clif_spawn_unit2(struct block_list* bl, enum send_target target) { return; #endif } -void clif_spawn_unit(struct block_list* bl, enum send_target target) { + +static void clif_spawn_unit(struct block_list *bl, enum send_target target) +{ struct map_session_data* sd; struct status_change* sc = status->get_sc(bl); struct view_data* vd = status->get_viewdata(bl); @@ -1301,7 +1334,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { /*========================================== * Prepares 'unit walking' packet *------------------------------------------*/ -void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, struct unit_data* ud, enum send_target target) { +static void clif_set_unit_walking(struct block_list *bl, struct map_session_data *tsd, struct unit_data *ud, enum send_target target) +{ struct map_session_data* sd; struct status_change* sc = status->get_sc(bl); struct view_data* vd = status->get_viewdata(bl); @@ -1402,7 +1436,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, /// 01b0 <id>.L <type>.B <value>.L /// type: /// unused -void clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd) +static void clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd) { nullpo_retv(bl); @@ -1424,7 +1458,8 @@ void clif_class_change(struct block_list *bl, int class_, int type, struct map_s /// Notifies the client of an object's spirits. /// 01d0 <id>.L <amount>.W (ZC_SPIRITS) /// 01e1 <id>.L <amount>.W (ZC_SPIRITS2) -void clif_spiritball_single(int fd, struct map_session_data *sd) { +static void clif_spiritball_single(int fd, struct map_session_data *sd) +{ nullpo_retv(sd); WFIFOHEAD(fd, packet_len(0x1e1)); WFIFOW(fd,0)=0x1e1; @@ -1436,7 +1471,7 @@ void clif_spiritball_single(int fd, struct map_session_data *sd) { /*========================================== * Kagerou/Oboro amulet spirit *------------------------------------------*/ -void clif_charm_single(int fd, struct map_session_data *sd) +static void clif_charm_single(int fd, struct map_session_data *sd) { #if PACKETVER >= 20110809 nullpo_retv(sd); @@ -1453,7 +1488,8 @@ void clif_charm_single(int fd, struct map_session_data *sd) * Run when player changes map / refreshes * Tells its client to display all weather settings being used by this map *------------------------------------------*/ -void clif_weather_check(struct map_session_data *sd) { +static void clif_weather_check(struct map_session_data *sd) +{ int16 m; int fd; @@ -1478,10 +1514,11 @@ void clif_weather_check(struct map_session_data *sd) { if (map->list[m].flag.leaves) clif->specialeffect_single(&sd->bl, 333, fd); } + /** * Run when the weather on a map changes, throws all players in map id 'm' to clif_weather_check function **/ -void clif_weather(int16 m) +static void clif_weather(int16 m) { struct s_mapiterator* iter; struct map_session_data *sd=NULL; @@ -1493,10 +1530,11 @@ void clif_weather(int16 m) } mapit->free(iter); } + /** * Main function to spawn a unit on the client (player/mob/pet/etc) **/ -bool clif_spawn(struct block_list *bl) +static bool clif_spawn(struct block_list *bl) { struct view_data *vd; @@ -1574,7 +1612,8 @@ bool clif_spawn(struct block_list *bl) /// Sends information about owned homunculus to the client (ZC_PROPERTY_HOMUN). [orn] /// 022e <name>.24B <modified>.B <level>.W <hunger>.W <intimacy>.W <equip id>.W <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W <hp>.W <max hp>.W <sp>.W <max sp>.W <exp>.L <max exp>.L <skill points>.W <atk range>.W -void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { +static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) +{ struct status_data *hstatus; unsigned char buf[128]; enum homun_type htype; @@ -1675,7 +1714,7 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) /// 2 = hunger /// 3 = accessory? /// ? = ignored -void clif_send_homdata(struct map_session_data *sd, int state, int param) +static void clif_send_homdata(struct map_session_data *sd, int state, int param) { int fd; @@ -1696,7 +1735,8 @@ void clif_send_homdata(struct map_session_data *sd, int state, int param) } /// Prepares and sends homun related information [orn] -void clif_homskillinfoblock(struct map_session_data *sd) { +static void clif_homskillinfoblock(struct map_session_data *sd) +{ struct homun_data *hd; int fd; int i,j; @@ -1737,7 +1777,9 @@ void clif_homskillinfoblock(struct map_session_data *sd) { return; } -void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { //[orn] +//[orn] +static void clif_homskillup(struct map_session_data *sd, uint16 skill_id) +{ struct homun_data *hd; int fd, idx; nullpo_retv(sd); @@ -1757,7 +1799,7 @@ void clif_homskillup(struct map_session_data *sd, uint16 skill_id) { //[orn] WFIFOSET(fd,packet_len(0x239)); } -void clif_hom_food(struct map_session_data *sd,int foodid,int fail) +static void clif_hom_food(struct map_session_data *sd, int foodid, int fail) { int fd; nullpo_retv(sd); @@ -1774,7 +1816,7 @@ void clif_hom_food(struct map_session_data *sd,int foodid,int fail) /// Notifies the client, that it is walking (ZC_NOTIFY_PLAYERMOVE). /// 0087 <walk start time>.L <walk data>.6B -void clif_walkok(struct map_session_data *sd) +static void clif_walkok(struct map_session_data *sd) { int fd; @@ -1787,7 +1829,8 @@ void clif_walkok(struct map_session_data *sd) WFIFOSET(fd,packet_len(0x87)); } -void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) { +static void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *ud) +{ #ifdef ANTI_MAYAP_CHEAT struct status_change *sc = NULL; #endif @@ -1841,7 +1884,7 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u /// Notifies clients in an area, that an other visible object is walking (ZC_NOTIFY_PLAYERMOVE). /// 0086 <id>.L <walk data>.6B <walk start time>.L /// Note: unit must not be self -void clif_move(struct unit_data *ud) +static void clif_move(struct unit_data *ud) { unsigned char buf[16]; struct view_data *vd; @@ -1895,7 +1938,8 @@ void clif_move(struct unit_data *ud) /*========================================== * Delays the map->quit of a player after they are disconnected. [Skotlex] *------------------------------------------*/ -int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { +static int clif_delayquit(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = NULL; //Remove player from map server @@ -1907,7 +1951,8 @@ int clif_delayquit(int tid, int64 tick, int id, intptr_t data) { /*========================================== * *------------------------------------------*/ -void clif_quitsave(int fd, struct map_session_data *sd) { +static void clif_quitsave(int fd, struct map_session_data *sd) +{ nullpo_retv(sd); if (!battle_config.prevent_logout || DIFF_TICK(timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) @@ -1923,7 +1968,8 @@ void clif_quitsave(int fd, struct map_session_data *sd) { /// Notifies the client of a position change to coordinates on given map (ZC_NPCACK_MAPMOVE). /// 0091 <map name>.16B <x>.W <y>.W -void clif_changemap(struct map_session_data *sd, short m, int x, int y) { +static void clif_changemap(struct map_session_data *sd, short m, int x, int y) +{ int fd; nullpo_retv(sd); fd = sd->fd; @@ -1938,7 +1984,7 @@ void clif_changemap(struct map_session_data *sd, short m, int x, int y) { /// Notifies the client of a position change (on air ship) to coordinates on given map (ZC_AIRSHIP_MAPMOVE). /// 0A4B <map name>.16B <x>.W <y>.W -void clif_changemap_airship(struct map_session_data *sd, short m, int x, int y) +static void clif_changemap_airship(struct map_session_data *sd, short m, int x, int y) { #if PACKETVER_MAIN_NUM >= 20180620 || PACKETVER_RE_NUM >= 20180321 || PACKETVER_ZERO_NUM >= 20171027 // [4144] this packet is not used yet by kro, but it here @@ -1958,7 +2004,8 @@ void clif_changemap_airship(struct map_session_data *sd, short m, int x, int y) /// Notifies the client of a position change to coordinates on given map, which is on another map-server (ZC_NPCACK_SERVERMOVE). /// 0092 <map name>.16B <x>.W <y>.W <ip>.L <port>.W /// 0ac7 <map name>.16B <x>.W <y>.W <ip>.L <port>.W <zero>.128B -void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { +static void clif_changemapserver(struct map_session_data *sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) +{ int fd; #if PACKETVER >= 20170315 const int cmd = 0xac7; @@ -1980,7 +2027,7 @@ void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, /// Notifies the client of a position change (with air ship) to coordinates on given map, which is on another map-server (ZC_NPCACK_SERVERMOVE). /// 0a4c <map name>.16B <x>.W <y>.W <ip>.L <port>.W -void clif_changemapserver_airship(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) +static void clif_changemapserver_airship(struct map_session_data *sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) { #if (PACKETVER_MAIN_NUM >= 20180620) || (PACKETVER_RE_NUM >= 20180321) || (PACKETVER_ZERO_NUM >= 20171027) // [4144] this packet is not used yet by kro, but it here @@ -2000,7 +2047,7 @@ void clif_changemapserver_airship(struct map_session_data* sd, unsigned short ma #endif } -void clif_blown(struct block_list *bl) +static void clif_blown(struct block_list *bl) { //Aegis packets says fixpos, but it's unsure whether slide works better or not. nullpo_retv(bl); @@ -2012,7 +2059,8 @@ void clif_blown(struct block_list *bl) /// isn't walkable, the char doesn't move at all. If the char is /// sitting it will stand up (ZC_STOPMOVE). /// 0088 <id>.L <x>.W <y>.W -void clif_fixpos(struct block_list *bl) { +static void clif_fixpos(struct block_list *bl) +{ unsigned char buf[10]; nullpo_retv(bl); @@ -2031,7 +2079,7 @@ void clif_fixpos(struct block_list *bl) { /// Displays the buy/sell dialog of an NPC shop (ZC_SELECT_DEALTYPE). /// 00c4 <shop id>.L -void clif_npcbuysell(struct map_session_data* sd, int id) +static void clif_npcbuysell(struct map_session_data *sd, int id) { int fd; @@ -2046,7 +2094,8 @@ void clif_npcbuysell(struct map_session_data* sd, int id) /// Presents list of items, that can be bought in an NPC shop (ZC_PC_PURCHASE_ITEMLIST). /// 00c6 <packet len>.W { <price>.L <discount price>.L <item type>.B <name id>.W }* -void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { +static void clif_buylist(struct map_session_data *sd, struct npc_data *nd) +{ struct npc_item_list *shop = NULL; unsigned short shop_size = 0; int fd,i,c; @@ -2088,7 +2137,7 @@ void clif_buylist(struct map_session_data *sd, struct npc_data *nd) { /// Presents list of items, that can be sold to an NPC shop (ZC_PC_SELL_ITEMLIST). /// 00c7 <packet len>.W { <index>.W <price>.L <overcharge price>.L }* -void clif_selllist(struct map_session_data *sd) +static void clif_selllist(struct map_session_data *sd) { int fd,i,c=0,val; @@ -2131,7 +2180,7 @@ void clif_selllist(struct map_session_data *sd) /// - set npcid of dialog window (0 by default) /// - if set to clear on next mes, clear contents /// - append this text -void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) +static void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) { int fd, slen; #ifdef SCRIPT_MES_STRIP_LINEBREAK @@ -2176,7 +2225,7 @@ void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) /// - 00B9 <npcid of dialog window>.L /// - set to clear on next mes /// - remove 'next' button -void clif_scriptnext(struct map_session_data *sd, int npcid) +static void clif_scriptnext(struct map_session_data *sd, int npcid) { int fd; @@ -2204,7 +2253,7 @@ void clif_scriptnext(struct map_session_data *sd, int npcid) /// - close the dialog window /// - close the menu window /// - 0146 <npcid of dialog window>.L -void clif_scriptclose(struct map_session_data *sd, int npcid) +static void clif_scriptclose(struct map_session_data *sd, int npcid) { int fd; @@ -2220,7 +2269,8 @@ void clif_scriptclose(struct map_session_data *sd, int npcid) /*========================================== * *------------------------------------------*/ -void clif_sendfakenpc(struct map_session_data *sd, int npcid) { +static void clif_sendfakenpc(struct map_session_data *sd, int npcid) +{ unsigned char *buf; int fd; @@ -2263,7 +2313,7 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) { /// WARNING: the 'cancel' button closes other windows besides the dialog window and the menu window. /// Which suggests their have intertwined behavior. (probably the mouse targeting) /// TODO investigate behavior of other windows [FlavioJS] -void clif_scriptmenu(struct map_session_data *sd, int npcid, const char *mes) +static void clif_scriptmenu(struct map_session_data *sd, int npcid, const char *mes) { int fd, slen; struct block_list *bl = NULL; @@ -2299,7 +2349,8 @@ void clif_scriptmenu(struct map_session_data *sd, int npcid, const char *mes) /// - if npcid exists in the client: /// - 0143 <npcid of inputnum window>.L <atoi(text)>.L /// - close inputnum window -void clif_scriptinput(struct map_session_data *sd, int npcid) { +static void clif_scriptinput(struct map_session_data *sd, int npcid) +{ int fd; struct block_list *bl = NULL; @@ -2328,7 +2379,8 @@ void clif_scriptinput(struct map_session_data *sd, int npcid) { /// - if npcid is 0 or npcid exists in the client: /// - 01d5 <packetlen>.W <npcid of inputstr window>.L <text>.?B /// - close inputstr window -void clif_scriptinputstr(struct map_session_data *sd, int npcid) { +static void clif_scriptinputstr(struct map_session_data *sd, int npcid) +{ int fd; struct block_list *bl = NULL; @@ -2356,7 +2408,7 @@ void clif_scriptinputstr(struct map_session_data *sd, int npcid) { /// 2 = remove mark /// color: /// 0x00RRGGBB -void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) +static void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color) { int fd; @@ -2384,7 +2436,7 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in /// 3 = middle of screen, inside a movable window /// 4 = middle of screen, movable with a close button, chrome-less /// 255 = hide -void clif_cutin(struct map_session_data* sd, const char* image, int type) +static void clif_cutin(struct map_session_data *sd, const char *image, int type) { int fd; @@ -2401,7 +2453,8 @@ void clif_cutin(struct map_session_data* sd, const char* image, int type) /*========================================== * Fills in card data from the given item and into the buffer. [Skotlex] *------------------------------------------*/ -void clif_addcards(unsigned char* buf, struct item* item) { +static void clif_addcards(unsigned char *buf, struct item *item) +{ int i=0,j; nullpo_retv(buf); if( item == NULL ) { //Blank data @@ -2451,7 +2504,8 @@ void clif_addcards(unsigned char* buf, struct item* item) { WBUFW(buf,6) = item->card[i]; } -void clif_addcards2(unsigned short *cards, struct item* item) { +static void clif_addcards2(unsigned short *cards, struct item *item) +{ int i=0,j; nullpo_retv(cards); if( item == NULL ) { //Blank data @@ -2509,7 +2563,7 @@ void clif_addcards2(unsigned short *cards, struct item* item) { * @param buf[in,out] The buffer to write to. The pointer must be valid and initialized. * @param item[in] The source item. */ - int clif_add_item_options(struct ItemOptions *buf, const struct item *it) +static int clif_add_item_options(struct ItemOptions *buf, const struct item *it) { int i = 0, j = 0, total_options = 0; @@ -2542,7 +2596,7 @@ void clif_addcards2(unsigned short *cards, struct item* item) { /// 0990 <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W (ZC_ITEM_PICKUP_ACK_V5) /// 0a0c <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W (ZC_ITEM_PICKUP_ACK_V6) /// 0a37 <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W <favorite>.B <view id>.W (ZC_ITEM_PICKUP_ACK_V7) -void clif_additem(struct map_session_data *sd, int n, int amount, int fail) +static void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { struct packet_additem p; nullpo_retv(sd); @@ -2596,7 +2650,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) /// Notifies the client, that an inventory item was deleted or dropped (ZC_ITEM_THROW_ACK). /// 00af <index>.W <amount>.W -void clif_dropitem(struct map_session_data *sd,int n,int amount) +static void clif_dropitem(struct map_session_data *sd, int n, int amount) { int fd; @@ -2613,7 +2667,7 @@ void clif_dropitem(struct map_session_data *sd,int n,int amount) /// Notifies the client, that an inventory item was deleted (ZC_DELETE_ITEM_FROM_BODY). /// 07fa <delete type>.W <index>.W <amount>.W /// delete type: @see enum delitem_reason -void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) +static void clif_delitem(struct map_session_data *sd, int n, int amount, short reason) { #if PACKETVER < 20091117 clif->dropitem(sd,n,amount); @@ -2637,7 +2691,8 @@ void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) // Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet // armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point. // look like unused, not adding checks -void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip) { +static void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip) +{ if (id->view_id > 0) WBUFW(buf,n)=id->view_id; else @@ -2659,7 +2714,7 @@ void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data * } -void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *it, struct item_data *id, int eqp_pos) +static void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *it, struct item_data *id, int eqp_pos) { nullpo_retv(p); nullpo_retv(it); @@ -2710,7 +2765,8 @@ void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *it, struc #endif } -void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) { +static void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, struct item_data *id) +{ nullpo_retv(p); nullpo_retv(i); nullpo_retv(id); @@ -2746,7 +2802,8 @@ void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item *i, stru #endif } -void clif_inventorylist(struct map_session_data *sd) { +static void clif_inventorylist(struct map_session_data *sd) +{ int i, normal = 0, equip = 0; nullpo_retv(sd); @@ -2789,7 +2846,8 @@ void clif_inventorylist(struct map_session_data *sd) { } //Required when items break/get-repaired. Only sends equippable item list. -void clif_equiplist(struct map_session_data *sd) { +static void clif_equiplist(struct map_session_data *sd) +{ int i, equip = 0; nullpo_retv(sd); @@ -2820,7 +2878,8 @@ void clif_equiplist(struct map_session_data *sd) { #endif } -void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length) { +static void clif_storagelist(struct map_session_data *sd, struct item *items, int items_length) +{ int i = 0; struct item_data *id; @@ -2868,7 +2927,8 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items } -void clif_cartlist(struct map_session_data *sd) { +static void clif_cartlist(struct map_session_data *sd) +{ int i, normal = 0, equip = 0; struct item_data *id; @@ -2905,7 +2965,7 @@ void clif_cartlist(struct map_session_data *sd) { /// Client behavior: /// Closes the cart storage and removes all it's items from memory. /// The Num & Weight values of the cart are left untouched and the cart is NOT removed. -void clif_clearcart(int fd) +static void clif_clearcart(int fd) { WFIFOHEAD(fd, packet_len(0x12b)); WFIFOW(fd,0) = 0x12b; @@ -2915,7 +2975,7 @@ void clif_clearcart(int fd) /// Guild XY locators (ZC_NOTIFY_POSITION_TO_GUILDM) [Valaris] /// 01eb <account id>.L <x>.W <y>.W -void clif_guild_xy(struct map_session_data *sd) +static void clif_guild_xy(struct map_session_data *sd) { unsigned char buf[10]; @@ -2931,7 +2991,7 @@ void clif_guild_xy(struct map_session_data *sd) /*========================================== * Sends x/y dot to a single fd. [Skotlex] *------------------------------------------*/ -void clif_guild_xy_single(int fd, struct map_session_data *sd) +static void clif_guild_xy_single(int fd, struct map_session_data *sd) { if( sd->bg_id ) return; @@ -2946,7 +3006,7 @@ void clif_guild_xy_single(int fd, struct map_session_data *sd) } // Guild XY locators [Valaris] -void clif_guild_xy_remove(struct map_session_data *sd) +static void clif_guild_xy_remove(struct map_session_data *sd) { unsigned char buf[10]; @@ -2962,7 +3022,7 @@ void clif_guild_xy_remove(struct map_session_data *sd) /*========================================== * *------------------------------------------*/ -int clif_hpmeter_sub(struct block_list *bl, va_list ap) +static int clif_hpmeter_sub(struct block_list *bl, va_list ap) { #if PACKETVER < 20100126 const int cmd = 0x106; @@ -3004,7 +3064,8 @@ int clif_hpmeter_sub(struct block_list *bl, va_list ap) * Server tells all players that are allowed to view HP bars * and are nearby 'sd' that 'sd' hp bar was updated. *------------------------------------------*/ -int clif_hpmeter(struct map_session_data *sd) { +static int clif_hpmeter(struct map_session_data *sd) +{ nullpo_ret(sd); map->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd); return 0; @@ -3018,7 +3079,7 @@ int clif_hpmeter(struct map_session_data *sd) { /// 013a <atk range>.W (ZC_ATTACK_RANGE) /// 0141 <status id>.L <base status>.L <plus status>.L (ZC_COUPLESTATUS) /// TODO: Extract individual packets. -void clif_updatestatus(struct map_session_data *sd,int type) +static void clif_updatestatus(struct map_session_data *sd, int type) { int fd,len; @@ -3274,7 +3335,7 @@ void clif_updatestatus(struct map_session_data *sd,int type) /// Notifies client of a parameter change of an another player (ZC_PAR_CHANGE_USER). /// 01ab <account id>.L <var id>.W <value>.L -void clif_changestatus(struct map_session_data* sd,int type,int val) +static void clif_changestatus(struct map_session_data *sd, int type, int val) { unsigned char buf[12]; @@ -3298,7 +3359,7 @@ void clif_changestatus(struct map_session_data* sd,int type,int val) } /// Updates sprite/style properties of an object. -void clif_changelook(struct block_list *bl,int type,int val) +static void clif_changelook(struct block_list *bl, int type, int val) { struct map_session_data* sd; struct status_change* sc; @@ -3451,14 +3512,14 @@ void clif_changelook(struct block_list *bl,int type,int val) } //Sends a change-base-look packet required for traps as they are triggered. -void clif_changetraplook(struct block_list *bl,int val) +static void clif_changetraplook(struct block_list *bl, int val) { clif->sendlook(bl, bl->id, LOOK_BASE, val, 0, AREA); } /// 00c3 <id>.L <type>.B <value>.B (ZC_SPRITE_CHANGE) /// 01d7 <id>.L <type>.B <value>.L (ZC_SPRITE_CHANGE2) -void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) +static void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, enum send_target target) { unsigned char buf[32]; #if PACKETVER < 4 @@ -3478,7 +3539,7 @@ void clif_sendlook(struct block_list *bl, int id, int type, int val, int val2, e } //For the stupid cloth-dye bug. Resends the given view data to the area specified by bl. -void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target) +static void clif_refreshlook(struct block_list *bl, int id, int type, int val, enum send_target target) { clif->sendlook(bl, id, type, val, 0, target); } @@ -3488,7 +3549,8 @@ void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_ta /// <int>.B <need int>.B <dex>.B <need dex>.B <luk>.B <need luk>.B <atk>.W <atk2>.W /// <matk min>.W <matk max>.W <def>.W <def2>.W <mdef>.W <mdef2>.W <hit>.W /// <flee>.W <flee2>.W <crit>.W <aspd>.W <aspd2>.W -void clif_initialstatus(struct map_session_data *sd) { +static void clif_initialstatus(struct map_session_data *sd) +{ int fd, mdef2; unsigned char *buf; @@ -3548,7 +3610,7 @@ void clif_initialstatus(struct map_session_data *sd) { /// Marks an ammunition item in inventory as equipped (ZC_EQUIP_ARROW). /// 013c <index>.W -void clif_arrowequip(struct map_session_data *sd,int val) +static void clif_arrowequip(struct map_session_data *sd, int val) { int fd; @@ -3573,7 +3635,7 @@ void clif_arrowequip(struct map_session_data *sd,int val) /// 3 = assassin, baby_assassin, assassin_cross => MsgStringTable[1040]="You have equipped throwing daggers." /// gunslinger => MsgStringTable[1175]="Bullets have been equipped." /// NOT ninja => MsgStringTable[245]="Ammunition has been equipped." -void clif_arrow_fail(struct map_session_data *sd,int type) +static void clif_arrow_fail(struct map_session_data *sd, int type) { int fd; @@ -3588,7 +3650,7 @@ void clif_arrow_fail(struct map_session_data *sd,int type) /// Presents a list of items, that can be processed by Arrow Crafting (ZC_MAKINGARROW_LIST). /// 01ad <packet len>.W { <name id>.W }* -void clif_arrow_create_list(struct map_session_data *sd) +static void clif_arrow_create_list(struct map_session_data *sd) { int i, c; int fd; @@ -3627,7 +3689,7 @@ void clif_arrow_create_list(struct map_session_data *sd) /// result: /// 0 = failure /// 1 = success -void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) +static void clif_statusupack(struct map_session_data *sd, int type, int ok, int val) { int fd; @@ -3645,7 +3707,8 @@ void clif_statusupack(struct map_session_data *sd,int type,int ok,int val) /// Notifies the client about the result of a request to equip an item (ZC_REQ_WEAR_EQUIP_ACK). /// 00aa <index>.W <equip location>.W <result>.B /// 00aa <index>.W <equip location>.W <view id>.W <result>.B (PACKETVER >= 20100629) -void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_ITEM_ACK result) { +static void clif_equipitemack(struct map_session_data *sd, int n, int pos, enum e_EQUIP_ITEM_ACK result) +{ struct packet_equipitem_ack p; nullpo_retv(sd); @@ -3666,7 +3729,8 @@ void clif_equipitemack(struct map_session_data *sd,int n,int pos,enum e_EQUIP_IT /// Notifies the client about the result of a request to take off an item (ZC_REQ_TAKEOFF_EQUIP_ACK). /// 00ac <index>.W <equip location>.W <result>.B -void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUIP_ITEM_ACK result) { +static void clif_unequipitemack(struct map_session_data *sd, int n, int pos, enum e_UNEQUIP_ITEM_ACK result) +{ struct packet_unequipitem_ack p; nullpo_retv(sd); @@ -3692,7 +3756,7 @@ void clif_unequipitemack(struct map_session_data *sd,int n,int pos,enum e_UNEQUI /// 7 = base level up (super novice) /// 8 = job level up (super novice) /// 9 = base level up (taekwon) -void clif_misceffect(struct block_list* bl,int type) +static void clif_misceffect(struct block_list *bl, int type) { unsigned char buf[32]; @@ -3708,7 +3772,7 @@ void clif_misceffect(struct block_list* bl,int type) /// Notifies clients in the area of a state change. /// 0119 <id>.L <body state>.W <health state>.W <effect state>.W <pk mode>.B (ZC_STATE_CHANGE) /// 0229 <id>.L <body state>.W <health state>.W <effect state>.L <pk mode>.B (ZC_STATE_CHANGE3) -void clif_changeoption(struct block_list* bl) +static void clif_changeoption(struct block_list *bl) { unsigned char buf[32]; struct status_change *sc; @@ -3759,7 +3823,8 @@ void clif_changeoption(struct block_list* bl) /// Displays status change effects on NPCs/monsters (ZC_NPC_SHOWEFST_UPDATE). /// 028a <id>.L <effect state>.L <level>.L <showEFST>.L -void clif_changeoption2(struct block_list* bl) { +static void clif_changeoption2(struct block_list *bl) +{ unsigned char buf[20]; struct status_change *sc; @@ -3786,7 +3851,7 @@ void clif_changeoption2(struct block_list* bl) { /// Notifies the client about the result of an item use request. /// 00a8 <index>.W <amount>.W <result>.B (ZC_USE_ITEM_ACK) /// 01c8 <index>.W <name id>.W <id>.L <amount>.W <result>.B (ZC_USE_ITEM_ACK2) -void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok) +static void clif_useitemack(struct map_session_data *sd, int index, int amount, bool ok) { nullpo_retv(sd); @@ -3832,7 +3897,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok) /// 1 = Room limit exceeded /// 2 = Same room already exists // TODO: Flag enum -void clif_createchat(struct map_session_data* sd, int flag) +static void clif_createchat(struct map_session_data *sd, int flag) { int fd; @@ -3852,7 +3917,7 @@ void clif_createchat(struct map_session_data* sd, int flag) /// 1 = public /// 2 = arena (npc waiting room) /// 3 = PK zone (non-clickable) -void clif_dispchat(struct chat_data *cd, int fd) +static void clif_dispchat(struct chat_data *cd, int fd) { unsigned char buf[128]; uint8 type; @@ -3892,7 +3957,7 @@ void clif_dispchat(struct chat_data *cd, int fd) /// 1 = public /// 2 = arena (npc waiting room) /// 3 = PK zone (non-clickable) -void clif_changechatstatus(struct chat_data *cd) +static void clif_changechatstatus(struct chat_data *cd) { unsigned char buf[128]; uint8 type; @@ -3921,7 +3986,7 @@ void clif_changechatstatus(struct chat_data *cd) /// Removes the chatroom (ZC_DESTROY_ROOM). /// 00d8 <chat id>.L -void clif_clearchat(struct chat_data *cd,int fd) +static void clif_clearchat(struct chat_data *cd, int fd) { unsigned char buf[32]; @@ -3949,7 +4014,7 @@ void clif_clearchat(struct chat_data *cd,int fd) /// 5 = too low level /// 6 = too high level /// 7 = unsuitable job class -void clif_joinchatfail(struct map_session_data *sd,int flag) +static void clif_joinchatfail(struct map_session_data *sd, int flag) { int fd; @@ -3968,7 +4033,7 @@ void clif_joinchatfail(struct map_session_data *sd,int flag) /// role: /// 0 = owner (menu) /// 1 = normal -void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) +static void clif_joinchatok(struct map_session_data *sd, struct chat_data *cd) { int fd; int i,t; @@ -4004,7 +4069,7 @@ void clif_joinchatok(struct map_session_data *sd,struct chat_data* cd) /// Notifies clients in a chat about a new member (ZC_MEMBER_NEWENTRY). /// 00dc <users>.W <name>.24B -void clif_addchat(struct chat_data* cd,struct map_session_data *sd) +static void clif_addchat(struct chat_data *cd, struct map_session_data *sd) { unsigned char buf[32]; @@ -4022,7 +4087,7 @@ void clif_addchat(struct chat_data* cd,struct map_session_data *sd) /// role: /// 0 = owner (menu) /// 1 = normal -void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) +static void clif_changechatowner(struct chat_data *cd, struct map_session_data *sd) { unsigned char buf[64]; @@ -4045,7 +4110,7 @@ void clif_changechatowner(struct chat_data* cd, struct map_session_data* sd) /// flag: /// 0 = left /// 1 = kicked -void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag) +static void clif_leavechat(struct chat_data *cd, struct map_session_data *sd, bool flag) { unsigned char buf[32]; @@ -4063,7 +4128,7 @@ void clif_leavechat(struct chat_data* cd, struct map_session_data* sd, bool flag /// Opens a trade request window from char 'name'. /// 00e5 <nick>.24B (ZC_REQ_EXCHANGE_ITEM) /// 01f4 <nick>.24B <charid>.L <baselvl>.W (ZC_REQ_EXCHANGE_ITEM2) -void clif_traderequest(struct map_session_data *sd, const char *name) +static void clif_traderequest(struct map_session_data *sd, const char *name) { int fd; #if PACKETVER >= 6 @@ -4102,7 +4167,7 @@ void clif_traderequest(struct map_session_data *sd, const char *name) /// 3 = Accept /// 4 = Cancel /// 5 = Busy -void clif_tradestart(struct map_session_data *sd, uint8 type) +static void clif_tradestart(struct map_session_data *sd, uint8 type) { int fd; #if PACKETVER >= 6 @@ -4132,7 +4197,7 @@ void clif_tradestart(struct map_session_data *sd, uint8 type) /// Notifies the client about an item from other player in current trade. /// 00e9 <amount>.L <nameid>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_EXCHANGE_ITEM) /// 080f <nameid>.W <item type>.B <amount>.L <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_EXCHANGE_ITEM2) -void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd, int index, int amount) +static void clif_tradeadditem(struct map_session_data *sd, struct map_session_data *tsd, int index, int amount) { int fd; unsigned char *buf; @@ -4200,7 +4265,7 @@ void clif_tradeadditem(struct map_session_data* sd, struct map_session_data* tsd /// 0 = success /// 1 = overweight /// 2 = trade canceled -void clif_tradeitemok(struct map_session_data* sd, int index, int fail) +static void clif_tradeitemok(struct map_session_data *sd, int index, int fail) { int fd; nullpo_retv(sd); @@ -4218,7 +4283,7 @@ void clif_tradeitemok(struct map_session_data* sd, int index, int fail) /// who: /// 0 = self /// 1 = other player -void clif_tradedeal_lock(struct map_session_data* sd, int fail) +static void clif_tradedeal_lock(struct map_session_data *sd, int fail) { int fd; nullpo_retv(sd); @@ -4232,7 +4297,7 @@ void clif_tradedeal_lock(struct map_session_data* sd, int fail) /// Notifies the client about the trade being canceled (ZC_CANCEL_EXCHANGE_ITEM). /// 00ee -void clif_tradecancelled(struct map_session_data* sd) +static void clif_tradecancelled(struct map_session_data *sd) { int fd; nullpo_retv(sd); @@ -4248,7 +4313,7 @@ void clif_tradecancelled(struct map_session_data* sd) /// result: /// 0 = success /// 1 = failure -void clif_tradecompleted(struct map_session_data* sd, int fail) +static void clif_tradecompleted(struct map_session_data *sd, int fail) { int fd; nullpo_retv(sd); @@ -4265,7 +4330,7 @@ void clif_tradecompleted(struct map_session_data* sd, int fail) /// NOTE: Unknown purpose. Items are not removed until the window is /// refreshed (ex. by putting another item in there). /// unused -void clif_tradeundo(struct map_session_data* sd) +static void clif_tradeundo(struct map_session_data *sd) { int fd; @@ -4278,7 +4343,7 @@ void clif_tradeundo(struct map_session_data* sd) /// Updates storage total amount (ZC_NOTIFY_STOREITEM_COUNTINFO). /// 00f2 <current count>.W <max count>.W -void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_amount) +static void clif_updatestorageamount(struct map_session_data *sd, int amount, int max_amount) { int fd; @@ -4295,7 +4360,7 @@ void clif_updatestorageamount(struct map_session_data* sd, int amount, int max_a /// Notifies the client of an item being added to the storage. /// 00f4 <index>.W <amount>.L <nameid>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_ITEM_TO_STORE) /// 01c4 <index>.W <amount>.L <nameid>.W <type>.B <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_ITEM_TO_STORE2) -void clif_storageitemadded(struct map_session_data* sd, struct item* i, int index, int amount) +static void clif_storageitemadded(struct map_session_data *sd, struct item *i, int index, int amount) { int view,fd; int offset = 0; @@ -4326,7 +4391,7 @@ void clif_storageitemadded(struct map_session_data* sd, struct item* i, int inde /// Notifies the client of an item being deleted from the storage (ZC_DELETE_ITEM_FROM_STORE). /// 00f6 <index>.W <amount>.L -void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) +static void clif_storageitemremoved(struct map_session_data *sd, int index, int amount) { int fd; @@ -4343,7 +4408,7 @@ void clif_storageitemremoved(struct map_session_data* sd, int index, int amount) /// Closes storage (ZC_CLOSE_STORE). /// 00f8 -void clif_storageclose(struct map_session_data* sd) +static void clif_storageclose(struct map_session_data *sd) { int fd; @@ -4358,7 +4423,8 @@ void clif_storageclose(struct map_session_data* sd) /*========================================== * Server tells 'sd' player client the abouts of 'dstsd' player *------------------------------------------*/ -void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* dstsd) { +static void clif_getareachar_pc(struct map_session_data *sd, struct map_session_data *dstsd) +{ struct block_list *d_bl; int i; @@ -4398,7 +4464,8 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds clif->devotion(d_bl, sd); } -void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { +static void clif_getareachar_unit(struct map_session_data *sd, struct block_list *bl) +{ struct unit_data *ud; struct view_data *vd; @@ -4499,7 +4566,8 @@ static inline int clif_calc_delay(int type, int div, int damage, int delay) /*========================================== * Estimates walk delay based on the damage criteria. [Skotlex] *------------------------------------------*/ -int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, int div_) { +static int clif_calc_walkdelay(struct block_list *bl, int delay, int type, int damage, int div_) +{ if (type == 4 || type == 9 || damage <=0) return 0; @@ -4523,7 +4591,8 @@ int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int damage, i /// 08c8 <src ID>.L <dst ID>.L <server tick>.L <src speed>.L <dst speed>.L <damage>.L <IsSPDamage>.B <div>.W <type>.B <damage2>.L (ZC_NOTIFY_ACT2) /// type: @see enum battle_dmg_type /// for BDT_NORMAL: [ damage: total damage, div: amount of hits, damage2: assassin dual-wield damage ] -int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) { +static int clif_damage(struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type, int64 in_damage2) +{ struct packet_damage p; struct status_change *sc; #if PACKETVER < 20071113 @@ -4602,7 +4671,7 @@ int clif_damage(struct block_list* src, struct block_list* dst, int sdelay, int /*========================================== * src picks up dst *------------------------------------------*/ -void clif_takeitem(struct block_list* src, struct block_list* dst) +static void clif_takeitem(struct block_list *src, struct block_list *dst) { //clif->damage(src,dst,0,0,0,0,BDT_PICKUP,0); unsigned char buf[32]; @@ -4621,7 +4690,7 @@ void clif_takeitem(struct block_list* src, struct block_list* dst) /*========================================== * inform clients in area that `bl` is sitting *------------------------------------------*/ -void clif_sitting(struct block_list* bl) +static void clif_sitting(struct block_list *bl) { unsigned char buf[32]; nullpo_retv(bl); @@ -4640,7 +4709,7 @@ void clif_sitting(struct block_list* bl) /*========================================== * inform clients in area that `bl` is standing *------------------------------------------*/ -void clif_standing(struct block_list* bl) +static void clif_standing(struct block_list *bl) { unsigned char buf[32]; nullpo_retv(bl); @@ -4658,7 +4727,8 @@ void clif_standing(struct block_list* bl) /// Inform client(s) about a map-cell change (ZC_UPDATE_MAPINFO). /// 0192 <x>.W <y>.W <type>.W <map name>.16B -void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) { +static void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_target target) +{ unsigned char buf[32]; WBUFW(buf,0) = 0x192; @@ -4683,7 +4753,8 @@ void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_targe /// Notifies the client about an item on floor (ZC_ITEM_ENTRY). /// 009d <id>.L <name id>.W <identified>.B <x>.W <y>.W <amount>.W <subX>.B <subY>.B -void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fitem) { +static void clif_getareachar_item(struct map_session_data *sd, struct flooritem_data *fitem) +{ int view,fd; nullpo_retv(sd); @@ -4706,7 +4777,8 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi WFIFOSET(fd,packet_len(0x9d)); } -void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) { +static void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send_target target) +{ struct packet_graffiti_entry p; nullpo_retv(bl); @@ -4730,7 +4802,8 @@ void clif_graffiti_entry(struct block_list *bl, struct skill_unit *su, enum send /// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2) /// 08c7 <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.B <range>.W <visible>.B (ZC_SKILL_ENTRY3) /// 099f <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.W <visible>.B (ZC_SKILL_ENTRY4) -void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) { +static void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, enum send_target target) +{ struct packet_skill_entry p; nullpo_retv(bl); nullpo_retv(su); @@ -4784,7 +4857,8 @@ void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *su, en /*========================================== * Server tells client to remove unit of id 'unit->bl.id' *------------------------------------------*/ -void clif_clearchar_skillunit(struct skill_unit *su, int fd) { +static void clif_clearchar_skillunit(struct skill_unit *su, int fd) +{ nullpo_retv(su); WFIFOHEAD(fd,packet_len(0x120)); @@ -4798,7 +4872,8 @@ void clif_clearchar_skillunit(struct skill_unit *su, int fd) { /// Removes a skill unit (ZC_SKILL_DISAPPEAR). /// 0120 <id>.L -void clif_skill_delunit(struct skill_unit *su) { +static void clif_skill_delunit(struct skill_unit *su) +{ unsigned char buf[16]; nullpo_retv(su); @@ -4811,7 +4886,7 @@ void clif_skill_delunit(struct skill_unit *su) { /// Sent when an object gets ankle-snared (ZC_SKILL_UPDATE). /// 01ac <id>.L /// Only affects units with class [139,153] client-side. -void clif_skillunit_update(struct block_list* bl) +static void clif_skillunit_update(struct block_list *bl) { unsigned char buf[6]; nullpo_retv(bl); @@ -4825,7 +4900,8 @@ void clif_skillunit_update(struct block_list* bl) /*========================================== * *------------------------------------------*/ -int clif_getareachar(struct block_list* bl,va_list ap) { +static int clif_getareachar(struct block_list *bl, va_list ap) +{ struct map_session_data *sd; nullpo_ret(bl); @@ -4854,7 +4930,7 @@ int clif_getareachar(struct block_list* bl,va_list ap) { /*========================================== * tbl has gone out of view-size of bl *------------------------------------------*/ -int clif_outsight(struct block_list *bl,va_list ap) +static int clif_outsight(struct block_list *bl, va_list ap) { struct block_list *tbl; struct view_data *vd; @@ -4911,7 +4987,7 @@ int clif_outsight(struct block_list *bl,va_list ap) /*========================================== * tbl has come into view of bl *------------------------------------------*/ -int clif_insight(struct block_list *bl,va_list ap) +static int clif_insight(struct block_list *bl, va_list ap) { struct block_list *tbl; struct map_session_data *sd, *tsd; @@ -4944,7 +5020,7 @@ int clif_insight(struct block_list *bl,va_list ap) /// Updates whole skill tree (ZC_SKILLINFO_LIST). /// 010f <packet len>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradable>.B }* -void clif_skillinfoblock(struct map_session_data *sd) +static void clif_skillinfoblock(struct map_session_data *sd) { int fd; int i,len,id; @@ -5000,7 +5076,7 @@ void clif_skillinfoblock(struct map_session_data *sd) /// Adds new skill to the skill tree (ZC_ADD_SKILL). /// 0111 <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradable>.B -void clif_addskill(struct map_session_data *sd, int id) +static void clif_addskill(struct map_session_data *sd, int id) { int fd, skill_lv, idx = skill->get_index(id); @@ -5036,7 +5112,7 @@ void clif_addskill(struct map_session_data *sd, int id) /// Deletes a skill from the skill tree (ZC_SKILLINFO_DELETE). /// 0441 <skill id>.W -void clif_deleteskill(struct map_session_data *sd, int id) +static void clif_deleteskill(struct map_session_data *sd, int id) { #if PACKETVER >= 20081217 int fd; @@ -5059,7 +5135,7 @@ void clif_deleteskill(struct map_session_data *sd, int id) /// flag: /// 0: guild call /// 1: player call -void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) +static void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, int flag) { int fd; nullpo_retv(sd); @@ -5082,7 +5158,7 @@ void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, in /// Updates a skill in the skill tree (ZC_SKILLINFO_UPDATE2). /// 07e1 <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <upgradable>.B -void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) +static void clif_skillinfo(struct map_session_data *sd, int skill_id, int inf) { const int fd = sd->fd; int idx = skill->get_index(skill_id); @@ -5127,7 +5203,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) /// is disposable: /// 0 = yellow chat text "[src name] will use skill [skill name]." /// 1 = no text -void clif_useskill(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int casttime) +static void clif_useskill(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int casttime) { #if PACKETVER < 20091124 const int cmd = 0x13e; @@ -5164,7 +5240,7 @@ void clif_useskill(struct block_list* bl, int src_id, int dst_id, int dst_x, int /// Notifies clients in area, that an object canceled casting (ZC_DISPEL). /// 01b9 <id>.L -void clif_skillcastcancel(struct block_list* bl) +static void clif_skillcastcancel(struct block_list *bl) { unsigned char buf[16]; @@ -5198,7 +5274,7 @@ void clif_skillcastcancel(struct block_list* bl) /// if(result!=0) doesn't display any of the previous messages /// Note: when this packet is received an unknown flag is always set to 0, /// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS] -void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype) +static void clif_skill_fail(struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype) { int fd; @@ -5234,7 +5310,7 @@ void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_f /// Skill cooldown display icon (ZC_SKILL_POSTDELAY). /// 043d <skill ID>.W <tick>.L -void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) +static void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int duration) { #if PACKETVER>=20081112 int fd; @@ -5253,7 +5329,8 @@ void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned /// Skill attack effect and damage. /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL) /// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2) -int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) { +static int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 in_damage, int div, uint16 skill_id, uint16 skill_lv, int type) +{ unsigned char buf[64]; struct status_change *sc; int damage; @@ -5354,7 +5431,8 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst, int64 tick /// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION). /// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B #if 0 -int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int damage, int div, uint16 skill_id, uint16 skill_lv, int type) { +static int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int damage, int div, uint16 skill_id, uint16 skill_lv, int type) +{ unsigned char buf[64]; struct status_change *sc; @@ -5411,7 +5489,7 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tic /// Non-damaging skill effect. /// 011a <skill id>.W <skill lv>.W <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL) /// 09cb <skill id>.W <skill lv>.L <dst id>.L <src id>.L <result>.B (ZC_USE_SKILL2) -int clif_skill_nodamage(struct block_list *src, struct block_list *dst, uint16 skill_id, int heal, int fail) +static int clif_skill_nodamage(struct block_list *src, struct block_list *dst, uint16 skill_id, int heal, int fail) { unsigned char buf[32]; short offset = 0; @@ -5455,7 +5533,8 @@ int clif_skill_nodamage(struct block_list *src, struct block_list *dst, uint16 s /// Non-damaging ground skill effect (ZC_NOTIFY_GROUNDSKILL). /// 0117 <skill id>.W <src id>.L <level>.W <x>.W <y>.W <tick>.L -void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) { +static void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick) +{ unsigned char buf[32]; nullpo_retv(src); @@ -5478,7 +5557,7 @@ void clif_skill_poseffect(struct block_list *src, uint16 skill_id, int val, int /// Presents a list of available warp destinations (ZC_WARPLIST). /// 011c <skill id>.W { <map name>.16B }*4 -void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) +static void clif_skill_warppoint(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) { int fd; @@ -5515,7 +5594,7 @@ void clif_skill_warppoint(struct map_session_data* sd, uint16 skill_id, uint16 s /// /// @param sd Who receives the message /// @param type What message -void clif_skill_memomessage(struct map_session_data* sd, int type) +static void clif_skill_memomessage(struct map_session_data *sd, int type) { int fd; @@ -5538,7 +5617,7 @@ void clif_skill_memomessage(struct map_session_data* sd, int type) /// /// @param sd Who receives the message /// @param type What message -void clif_skill_mapinfomessage(struct map_session_data *sd, int type) +static void clif_skill_mapinfomessage(struct map_session_data *sd, int type) { int fd; @@ -5554,7 +5633,8 @@ void clif_skill_mapinfomessage(struct map_session_data *sd, int type) /// Displays Sense (WZ_ESTIMATION) information window (ZC_MONSTER_INFO). /// 018c <class>.W <level>.W <size>.W <hp>.L <def>.W <race>.W <mdef>.W <element>.W /// <water%>.B <earth%>.B <fire%>.B <wind%>.B <poison%>.B <holy%>.B <shadow%>.B <ghost%>.B <undead%>.B -void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { +static void clif_skill_estimation(struct map_session_data *sd, struct block_list *dst) +{ struct status_data *dstatus; unsigned char buf[64]; int i;//, fix; @@ -5591,7 +5671,7 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { /// 018d <packet len>.W { <name id>.W { <material id>.W }*3 }* /// material id: /// unused by the client -void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int trigger) +static void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id, int trigger) { int i,c,view,fd; nullpo_retv(sd); @@ -5637,7 +5717,7 @@ void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id , int /// 4 = GN_MIX_COOKING /// 5 = GN_MAKEBOMB /// 6 = GN_S_PHARMACY -void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) +static void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type) { int fd; int i, c; @@ -5691,7 +5771,8 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id } } -void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { +static void clif_status_change_notick(struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3) +{ struct packet_sc_notick p; struct map_session_data *sd; @@ -5719,7 +5800,8 @@ void clif_status_change_notick(struct block_list *bl,int type,int flag,int tick, /// 08ff <id>.L <index>.W <remain msec>.L { <val>.L }*3 (PACKETVER >= 20111108) /// 0983 <index>.W <id>.L <state>.B <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618) /// 0984 <id>.L <index>.W <total msec>.L <remain msec>.L { <val>.L }*3 (PACKETVER >= 20120618) -void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3) { +static void clif_status_change(struct block_list *bl, int type, int flag, int tick, int val1, int val2, int val3) +{ struct packet_status_change p; struct map_session_data *sd; @@ -5755,7 +5837,7 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val /// Send message (modified by [Yor]) (ZC_NOTIFY_PLAYERCHAT). /// 008e <packet len>.W <message>.?B -void clif_displaymessage(const int fd, const char *mes) +static void clif_displaymessage(const int fd, const char *mes) { nullpo_retv(mes); @@ -5780,7 +5862,8 @@ void clif_displaymessage(const int fd, const char *mes) } } -void clif_displaymessage2(const int fd, const char* mes) { +static void clif_displaymessage2(const int fd, const char *mes) +{ nullpo_retv(mes); //Scrapped, as these are shared by disconnected players =X [Skotlex] @@ -5812,9 +5895,11 @@ void clif_displaymessage2(const int fd, const char* mes) { aFree(message); } } + /* oh noo! another version of 0x8e! */ -void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); -void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { +static void clif_displaymessage_sprintf(const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); +static void clif_displaymessage_sprintf(const int fd, const char *mes, ...) +{ va_list ap; nullpo_retv(mes); @@ -5846,9 +5931,10 @@ void clif_displaymessage_sprintf(const int fd, const char *mes, ...) { WFIFOSET(fd, 5 + len); } } + /// Send broadcast message in yellow or blue without font formatting (ZC_BROADCAST). /// 009a <packet len>.W <message>.?B -void clif_broadcast(struct block_list *bl, const char *mes, int len, int type, enum send_target target) +static void clif_broadcast(struct block_list *bl, const char *mes, int len, int type, enum send_target target) { int lp = (type&BC_COLOR_MASK) ? 4 : 0; unsigned char *buf = NULL; @@ -5872,7 +5958,7 @@ void clif_broadcast(struct block_list *bl, const char *mes, int len, int type, e * Displays a message on a 'bl' to all it's nearby clients * Used by npc_globalmessage *------------------------------------------*/ -void clif_GlobalMessage(struct block_list *bl, const char *message) +static void clif_GlobalMessage(struct block_list *bl, const char *message) { char buf[256]; int len; @@ -5897,7 +5983,7 @@ void clif_GlobalMessage(struct block_list *bl, const char *message) /// Send broadcast message with font formatting (ZC_BROADCAST2). /// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B -void clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) +static void clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) { unsigned char *buf; @@ -5923,7 +6009,7 @@ void clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned i /// 5 = HP (SP_HP) /// 7 = SP (SP_SP) /// ? = ignored -void clif_heal(int fd, int type, int val) +static void clif_heal(int fd, int type, int val) { #if PACKETVER < 20150513 short cmd = 0x13d; @@ -5947,7 +6033,7 @@ void clif_heal(int fd, int type, int val) /// 0148 <id>.L <type>.W /// type: /// ignored -void clif_resurrection(struct block_list *bl,int type) +static void clif_resurrection(struct block_list *bl, int type) { unsigned char buf[16]; @@ -5971,7 +6057,7 @@ void clif_resurrection(struct block_list *bl,int type) /// Sets the map property (ZC_NOTIFY_MAPPROPERTY). /// 0199 <type>.W -void clif_map_property(struct map_session_data* sd, enum map_property property) +static void clif_map_property(struct map_session_data *sd, enum map_property property) { int fd; @@ -5986,7 +6072,8 @@ void clif_map_property(struct map_session_data* sd, enum map_property property) /// Set the map type (ZC_NOTIFY_MAPPROPERTY2). /// 01d6 <type>.W -void clif_map_type(struct map_session_data* sd, enum map_type type) { +static void clif_map_type(struct map_session_data *sd, enum map_type type) +{ int fd; nullpo_retv(sd); @@ -6001,7 +6088,7 @@ void clif_map_type(struct map_session_data* sd, enum map_type type) { /// Updates PvP ranking (ZC_NOTIFY_RANKING). /// 019a <id>.L <ranking>.L <total>.L // FIXME: missing documentation for the 'type' parameter -void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) +static void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum, int type) { nullpo_retv(sd); @@ -6034,7 +6121,7 @@ void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type) /*========================================== * *------------------------------------------*/ -void clif_map_property_mapall(int mapid, enum map_property property) +static void clif_map_property_mapall(int mapid, enum map_property property) { struct block_list bl; unsigned char buf[16]; @@ -6053,7 +6140,7 @@ void clif_map_property_mapall(int mapid, enum map_property property) /// 0 = success /// 1 = failure /// 2 = downgrade -void clif_refine(int fd, int fail, int index, int val) +static void clif_refine(int fd, int fail, int index, int val) { WFIFOHEAD(fd,packet_len(0x188)); WFIFOW(fd,0)=0x188; @@ -6070,7 +6157,7 @@ void clif_refine(int fd, int fail, int index, int val) /// 1 = "weapon upgraded: %s" MsgStringTable[912] in rgb(0,205,205) /// 2 = "cannot upgrade %s until you level up the upgrade weapon skill" MsgStringTable[913] in rgb(255,200,200) /// 3 = "you lack the item %s to upgrade the weapon" MsgStringTable[914] in rgb(255,200,200) -void clif_upgrademessage(int fd, int result, int item_id) +static void clif_upgrademessage(int fd, int result, int item_id) { WFIFOHEAD(fd,packet_len(0x223)); WFIFOW(fd,0)=0x223; @@ -6082,7 +6169,7 @@ void clif_upgrademessage(int fd, int result, int item_id) /// Whisper is transmitted to the destination player (ZC_WHISPER). /// 0097 <packet len>.W <nick>.24B <message>.?B /// 0097 <packet len>.W <nick>.24B <isAdmin>.L <message>.?B (PACKETVER >= 20091104) -void clif_wis_message(int fd, const char *nick, const char *mes, int mes_len) +static void clif_wis_message(int fd, const char *nick, const char *mes, int mes_len) { #if PACKETVER >= 20091104 struct map_session_data *ssd = NULL; @@ -6117,7 +6204,8 @@ void clif_wis_message(int fd, const char *nick, const char *mes, int mes_len) /// 1 = target character is not logged in /// 2 = ignored by target /// 3 = everyone ignored by target -void clif_wis_end(int fd, int flag) { +static void clif_wis_end(int fd, int flag) +{ struct map_session_data *sd = sockt->session_is_valid(fd) ? sockt->session[fd]->session_data : NULL; struct packet_wis_end p; @@ -6136,7 +6224,7 @@ void clif_wis_end(int fd, int flag) { /// Returns character name requested by char_id (ZC_ACK_REQNAME_BYGID). /// 0194 <char id>.L <name>.24B /// 0af7 <flag>.W <char id>.L <name>.24B -void clif_solved_charname(int fd, int charid, const char* name) +static void clif_solved_charname(int fd, int charid, const char *name) { nullpo_retv(name); #if PACKETVER_MAIN_NUM >= 20180307 || PACKETVER_RE_NUM >= 20180221 || PACKETVER_ZERO_NUM >= 20180328 @@ -6162,7 +6250,7 @@ void clif_solved_charname(int fd, int charid, const char* name) /// Presents a list of items that can be carded/composed (ZC_ITEMCOMPOSITION_LIST). /// 017b <packet len>.W { <name id>.W }* -void clif_use_card(struct map_session_data *sd,int idx) +static void clif_use_card(struct map_session_data *sd, int idx) { int i, c; int fd; @@ -6195,7 +6283,7 @@ void clif_use_card(struct map_session_data *sd,int idx) /// result: /// 0 = success /// 1 = failure -void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag) +static void clif_insert_card(struct map_session_data *sd, int idx_equip, int idx_card, int flag) { int fd; @@ -6212,7 +6300,7 @@ void clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int /// Presents a list of items that can be identified (ZC_ITEMIDENTIFY_LIST). /// 0177 <packet len>.W { <name id>.W }* -void clif_item_identify_list(struct map_session_data *sd) +static void clif_item_identify_list(struct map_session_data *sd) { int i,c; int fd; @@ -6240,7 +6328,7 @@ void clif_item_identify_list(struct map_session_data *sd) /// Notifies the client about the result of a item identify request (ZC_ACK_ITEMIDENTIFY). /// 0179 <index>.W <result>.B -void clif_item_identified(struct map_session_data *sd,int idx,int flag) +static void clif_item_identified(struct map_session_data *sd, int idx, int flag) { int fd; @@ -6256,7 +6344,7 @@ void clif_item_identified(struct map_session_data *sd,int idx,int flag) /// Presents a list of items that can be repaired (ZC_REPAIRITEMLIST). /// 01fc <packet len>.W { <index>.W <name id>.W <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* -void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv) +static void clif_item_repair_list(struct map_session_data *sd, struct map_session_data *dstsd, int lv) { int i,c; int fd; @@ -6295,7 +6383,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data * /// result: /// 0 = Item repair success. /// 1 = Item repair failure. -void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) +static void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag) { int fd; @@ -6313,7 +6401,7 @@ void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) /// Displays a message, that an equipment got damaged (ZC_EQUIPITEM_DAMAGED). /// 02bb <equip location>.W <account id>.L -void clif_item_damaged(struct map_session_data* sd, unsigned short position) +static void clif_item_damaged(struct map_session_data *sd, unsigned short position) { int fd; @@ -6329,7 +6417,7 @@ void clif_item_damaged(struct map_session_data* sd, unsigned short position) /// Presents a list of weapon items that can be refined [Taken from jAthena] (ZC_NOTIFY_WEAPONITEMLIST). /// 0221 <packet len>.W { <index>.W <name id>.W <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* -void clif_item_refine_list(struct map_session_data *sd) +static void clif_item_refine_list(struct map_session_data *sd) { int i,c; int fd; @@ -6365,7 +6453,7 @@ void clif_item_refine_list(struct map_session_data *sd) /// Notification of an auto-casted skill (ZC_AUTORUN_SKILL). /// 0147 <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradeable>.B -void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv) +static void clif_item_skill(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { int fd; @@ -6387,7 +6475,7 @@ void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv /// Adds an item to character's cart. /// 0124 <index>.W <amount>.L <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_ITEM_TO_CART) /// 01c5 <index>.W <amount>.L <name id>.W <type>.B <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_ITEM_TO_CART2) -void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) +static void clif_cart_additem(struct map_session_data *sd, int n, int amount, int fail) { int view,fd; unsigned char *buf; @@ -6424,7 +6512,7 @@ void clif_cart_additem(struct map_session_data *sd,int n,int amount,int fail) /// Deletes an item from character's cart (ZC_DELETE_ITEM_FROM_CART). /// 0125 <index>.W <amount>.L -void clif_cart_delitem(struct map_session_data *sd,int n,int amount) +static void clif_cart_delitem(struct map_session_data *sd, int n, int amount) { int fd; @@ -6443,7 +6531,7 @@ void clif_cart_delitem(struct map_session_data *sd,int n,int amount) /// 012d <num>.W /// num: /// number of allowed item slots -void clif_openvendingreq(struct map_session_data* sd, int num) +static void clif_openvendingreq(struct map_session_data *sd, int num) { int fd; @@ -6458,7 +6546,7 @@ void clif_openvendingreq(struct map_session_data* sd, int num) /// Displays a vending board to target/area (ZC_STORE_ENTRY). /// 0131 <owner id>.L <message>.80B -void clif_showvendingboard(struct block_list* bl, const char* message, int fd) +static void clif_showvendingboard(struct block_list *bl, const char *message, int fd) { unsigned char buf[128]; @@ -6479,7 +6567,7 @@ void clif_showvendingboard(struct block_list* bl, const char* message, int fd) /// Removes a vending board from screen (ZC_DISAPPEAR_ENTRY). /// 0132 <owner id>.L -void clif_closevendingboard(struct block_list* bl, int fd) +static void clif_closevendingboard(struct block_list *bl, int fd) { unsigned char buf[16]; @@ -6499,7 +6587,8 @@ void clif_closevendingboard(struct block_list* bl, int fd) /// Sends a list of items in a shop. /// R 0133 <packet len>.W <owner id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC) /// R 0800 <packet len>.W <owner id>.L <unique id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC2) -void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { +static void clif_vendinglist(struct map_session_data *sd, unsigned int id, struct s_vending *vending_items) +{ int i,fd; int count; struct map_session_data* vsd; @@ -6569,7 +6658,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven /// 5 = "cannot use an npc shop while in a trade" /// 6 = Because the store information was incorrect the item was not purchased. /// 7 = No sales information. -void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail) +static void clif_buyvending(struct map_session_data *sd, int index, int amount, int fail) { int fd; @@ -6586,7 +6675,8 @@ void clif_buyvending(struct map_session_data* sd, int index, int amount, int fai /// Shop creation success (ZC_PC_PURCHASE_MYITEMLIST). /// 0136 <packet len>.W <owner id>.L { <price>.L <index>.W <amount>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* -void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { +static void clif_openvending(struct map_session_data *sd, int id, struct s_vending *vending_items) +{ int i,fd; int count; @@ -6636,7 +6726,7 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven /// Inform merchant that someone has bought an item. /// 0137 <index>.W <amount>.W (ZC_DELETEITEM_FROM_MCSTORE). /// 09e5 <index>.W <amount>.W <GID>.L <Date>.L <zeny>.L (ZC_DELETEITEM_FROM_MCSTORE2). -void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny) +static void clif_vendingreport(struct map_session_data *sd, int index, int amount, uint32 char_id, int zeny) { int fd; #if PACKETVER < 20141016 // TODO : not sure for client date [Napster] @@ -6669,7 +6759,7 @@ void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint /// 2 = MsgStringTable[79]="already in a party" /// 3 = cannot organize parties on this map /// ? = nothing -void clif_party_created(struct map_session_data *sd,int result) +static void clif_party_created(struct map_session_data *sd, int result) { int fd; @@ -6689,7 +6779,7 @@ void clif_party_created(struct map_session_data *sd,int result) /// state: /// 0 = connected /// 1 = disconnected -void clif_party_member_info(struct party_data *p, struct map_session_data *sd) +static void clif_party_member_info(struct party_data *p, struct map_session_data *sd) { int i; struct PACKET_ZC_ADD_MEMBER_TO_GROUP packet; @@ -6735,7 +6825,7 @@ void clif_party_member_info(struct party_data *p, struct map_session_data *sd) /// state: /// 0 = connected /// 1 = disconnected -void clif_party_info(struct party_data* p, struct map_session_data *sd) +static void clif_party_info(struct party_data *p, struct map_session_data *sd) { struct PACKET_ZC_GROUP_LIST *packet; struct map_session_data* party_sd = NULL; @@ -6781,7 +6871,7 @@ void clif_party_info(struct party_data* p, struct map_session_data *sd) /// Updates the job and level of a party member /// 0abd <account id>.L <job>.W <level>.W -void clif_party_job_and_level(struct map_session_data *sd) +static void clif_party_job_and_level(struct map_session_data *sd) { // [4144] packet 0xabd added in client in 2017-02-15 because this probably it can works for clients older than 20170502 #if PACKETVER >= 20170502 @@ -6803,7 +6893,7 @@ void clif_party_job_and_level(struct map_session_data *sd) /// flag: /// 0 = allow party invites /// 1 = auto-deny party invites -void clif_partyinvitationstate(struct map_session_data* sd) +static void clif_partyinvitationstate(struct map_session_data *sd) { int fd; nullpo_retv(sd); @@ -6818,7 +6908,7 @@ void clif_partyinvitationstate(struct map_session_data* sd) /// Party invitation request. /// 00fe <party id>.L <party name>.24B (ZC_REQ_JOIN_GROUP) /// 02c6 <party id>.L <party name>.24B (ZC_PARTY_JOIN_REQ) -void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) +static void clif_party_invite(struct map_session_data *sd, struct map_session_data *tsd) { #if PACKETVER < 20070821 const int cmd = 0xfe; @@ -6855,7 +6945,7 @@ void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) /// result=7 : char is not online or doesn't exist -> MsgStringTable[71] (since 20070904) /// result=8 : (%s) TODO instance related? -> MsgStringTable[1388] (since 20080527) /// return=9 : TODO map prohibits party joining? -> MsgStringTable[1871] (since 20110205) -void clif_party_inviteack(struct map_session_data* sd, const char* nick, int result) +static void clif_party_inviteack(struct map_session_data *sd, const char *nick, int result) { int fd; nullpo_retv(sd); @@ -6895,7 +6985,7 @@ void clif_party_inviteack(struct map_session_data* sd, const char* nick, int res /// flag: /// 0 = send to party /// 1 = send to sd -void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag) +static void clif_party_option(struct party_data *p, struct map_session_data *sd, int flag) { unsigned char buf[16]; #if PACKETVER < 20090603 @@ -6932,7 +7022,7 @@ void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag /// 1 = expel /// 2 = cannot leave party on this map /// 3 = cannot expel from party on this map -void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int account_id, const char* name, int flag) +static void clif_party_withdraw(struct party_data *p, struct map_session_data *sd, int account_id, const char *name, int flag) { unsigned char buf[64]; @@ -6962,7 +7052,7 @@ void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int /// Party chat message (ZC_NOTIFY_CHAT_PARTY). /// 0109 <packet len>.W <account id>.L <message>.?B -void clif_party_message(struct party_data *p, int account_id, const char *mes, int len) +static void clif_party_message(struct party_data *p, int account_id, const char *mes, int len) { struct map_session_data *sd; int i; @@ -6993,7 +7083,7 @@ void clif_party_message(struct party_data *p, int account_id, const char *mes, i /// Updates the position of a party member on the minimap (ZC_NOTIFY_POSITION_TO_GROUPM). /// 0107 <account id>.L <x>.W <y>.W -void clif_party_xy(struct map_session_data *sd) +static void clif_party_xy(struct map_session_data *sd) { unsigned char buf[16]; @@ -7009,7 +7099,7 @@ void clif_party_xy(struct map_session_data *sd) /*========================================== * Sends x/y dot to a single fd. [Skotlex] *------------------------------------------*/ -void clif_party_xy_single(int fd, struct map_session_data *sd) +static void clif_party_xy_single(int fd, struct map_session_data *sd) { nullpo_retv(sd); WFIFOHEAD(fd,packet_len(0x107)); @@ -7023,7 +7113,7 @@ void clif_party_xy_single(int fd, struct map_session_data *sd) /// Updates HP bar of a party member. /// 0106 <account id>.L <hp>.W <max hp>.W (ZC_NOTIFY_HP_TO_GROUPM) /// 080e <account id>.L <hp>.L <max hp>.L (ZC_NOTIFY_HP_TO_GROUPM_R2) -void clif_party_hp(struct map_session_data *sd) +static void clif_party_hp(struct map_session_data *sd) { unsigned char buf[16]; #if PACKETVER < 20100126 @@ -7054,7 +7144,7 @@ void clif_party_hp(struct map_session_data *sd) /*========================================== * Sends HP bar to a single fd. [Skotlex] *------------------------------------------*/ -void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) +static void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) { #if PACKETVER < 20100126 const int cmd = 0x106; @@ -7082,7 +7172,7 @@ void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp) /// Notifies the client, that it's attack target is too far (ZC_ATTACK_FAILURE_FOR_DISTANCE). /// 0139 <target id>.L <target x>.W <target y>.W <x>.W <y>.W <atk range>.W -void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) +static void clif_movetoattack(struct map_session_data *sd, struct block_list *bl) { int fd; @@ -7108,7 +7198,7 @@ void clif_movetoattack(struct map_session_data *sd,struct block_list *bl) /// 1 = failure /// 2 = success (alchemist) /// 3 = failure (alchemist) -void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) +static void clif_produceeffect(struct map_session_data *sd, int flag, int nameid) { int view,fd; @@ -7128,7 +7218,7 @@ void clif_produceeffect(struct map_session_data* sd,int flag,int nameid) /// Initiates the pet taming process (ZC_START_CAPTURE). /// 019e -void clif_catch_process(struct map_session_data *sd) +static void clif_catch_process(struct map_session_data *sd) { int fd; @@ -7144,7 +7234,7 @@ void clif_catch_process(struct map_session_data *sd) /// 01a0 <result>.B /// 0 = failure /// 1 = success -void clif_pet_roulette(struct map_session_data *sd,int data) +static void clif_pet_roulette(struct map_session_data *sd, int data) { int fd; @@ -7159,7 +7249,8 @@ void clif_pet_roulette(struct map_session_data *sd,int data) /// Presents a list of pet eggs that can be hatched (ZC_PETEGG_LIST). /// 01a6 <packet len>.W { <index>.W }* -void clif_sendegg(struct map_session_data *sd) { +static void clif_sendegg(struct map_session_data *sd) +{ int i, n, fd; nullpo_retv(sd); @@ -7199,7 +7290,7 @@ void clif_sendegg(struct map_session_data *sd) { /// 5 = hairstyle /// /// If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player. -void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int type, int param) +static void clif_send_petdata(struct map_session_data *sd, struct pet_data *pd, int type, int param) { uint8 buf[16]; nullpo_retv(pd); @@ -7216,7 +7307,7 @@ void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int typ /// Pet's base data (ZC_PROPERTY_PET). /// 01a2 <name>.24B <renamed>.B <level>.W <hunger>.W <intimacy>.W <accessory id>.W <class>.W -void clif_send_petstatus(struct map_session_data *sd) +static void clif_send_petstatus(struct map_session_data *sd) { int fd; struct s_pet *p; @@ -7244,7 +7335,7 @@ void clif_send_petstatus(struct map_session_data *sd) /// 01aa <id>.L <data>.L /// data: /// @see CZ_PET_ACT. -void clif_pet_emotion(struct pet_data *pd,int param) +static void clif_pet_emotion(struct pet_data *pd, int param) { unsigned char buf[16]; @@ -7273,7 +7364,7 @@ void clif_pet_emotion(struct pet_data *pd,int param) /// result: /// 0 = failure /// 1 = success -void clif_pet_food(struct map_session_data *sd,int foodid,int fail) +static void clif_pet_food(struct map_session_data *sd, int foodid, int fail) { int fd; @@ -7289,7 +7380,7 @@ void clif_pet_food(struct map_session_data *sd,int foodid,int fail) /// Presents a list of skills that can be auto-spelled (ZC_AUTOSPELLLIST). /// 01cd { <skill id>.L }*7 -void clif_autospell(struct map_session_data *sd,uint16 skill_lv) +static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) { int fd; @@ -7335,7 +7426,7 @@ void clif_autospell(struct map_session_data *sd,uint16 skill_lv) /// Devotion's visual effect (ZC_DEVOTIONLIST). /// 01cf <devoter id>.L { <devotee id>.L }*5 <max distance>.W -void clif_devotion(struct block_list *src, struct map_session_data *tsd) +static void clif_devotion(struct block_list *src, struct map_session_data *tsd) { unsigned char buf[56]; @@ -7386,7 +7477,8 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) * 01d0 <id>.L <amount>.W (ZC_SPIRITS) * 01e1 <id>.L <amount>.W (ZC_SPIRITS2) *------------------------------------------*/ -void clif_spiritball(struct block_list *bl) { +static void clif_spiritball(struct block_list *bl) +{ unsigned char buf[16]; struct map_session_data *sd = BL_CAST(BL_PC,bl); struct homun_data *hd = BL_CAST(BL_HOM,bl); @@ -7405,7 +7497,7 @@ void clif_spiritball(struct block_list *bl) { /// Notifies clients in area of a character's combo delay (ZC_COMBODELAY). /// 01d2 <account id>.L <delay>.L -void clif_combo_delay(struct block_list *bl,int wait) +static void clif_combo_delay(struct block_list *bl, int wait) { unsigned char buf[32]; @@ -7422,7 +7514,7 @@ void clif_combo_delay(struct block_list *bl,int wait) /// flag: /// 0 = inactive /// 1 = active -void clif_bladestop(struct block_list *src, int dst_id, int active) +static void clif_bladestop(struct block_list *src, int dst_id, int active) { unsigned char buf[32]; @@ -7438,7 +7530,7 @@ void clif_bladestop(struct block_list *src, int dst_id, int active) /// MVP effect (ZC_MVP). /// 010c <account id>.L -void clif_mvp_effect(struct map_session_data *sd) +static void clif_mvp_effect(struct map_session_data *sd) { unsigned char buf[16]; @@ -7451,7 +7543,7 @@ void clif_mvp_effect(struct map_session_data *sd) /// MVP item reward message (ZC_MVP_GETTING_ITEM). /// 010a <name id>.W -void clif_mvp_item(struct map_session_data *sd,int nameid) +static void clif_mvp_item(struct map_session_data *sd, int nameid) { int view,fd; @@ -7469,7 +7561,7 @@ void clif_mvp_item(struct map_session_data *sd,int nameid) /// MVP EXP reward message (ZC_MVP_GETTING_SPECIAL_EXP). /// 010b <exp>.L -void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) +static void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { #if PACKETVER >= 20131223 // Kro removed this packet [Napster] if (battle_config.mvp_exp_reward_message) { @@ -7495,7 +7587,7 @@ void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) /// /// "You are the MVP, but cannot obtain the reward because /// you are overweight." -void clif_mvp_noitem(struct map_session_data* sd) +static void clif_mvp_noitem(struct map_session_data *sd) { int fd = sd->fd; @@ -7511,7 +7603,7 @@ void clif_mvp_noitem(struct map_session_data* sd) /// 1 = "You are already in a Guild." /// 2 = "That Guild Name already exists." /// 3 = "You need the necessary item to create a Guild." -void clif_guild_created(struct map_session_data *sd,int flag) +static void clif_guild_created(struct map_session_data *sd, int flag) { int fd; @@ -7527,7 +7619,7 @@ void clif_guild_created(struct map_session_data *sd,int flag) /// Notifies the client that it is belonging to a guild (ZC_UPDATE_GDID). /// 016c <guild id>.L <emblem id>.L <mode>.L <ismaster>.B <inter sid>.L <guild name>.24B /// mode: @see enum guild_permission -void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) +static void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) { int ps,fd; nullpo_retv(sd); @@ -7552,7 +7644,7 @@ void clif_guild_belonginfo(struct map_session_data *sd, struct guild *g) /// status: /// 0 = offline /// 1 = online -void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) +static void clif_guild_memberlogin_notice(struct guild *g, int idx, int flag) { unsigned char buf[64]; struct map_session_data* sd; @@ -7589,7 +7681,7 @@ void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) // At next time the client would always show the message. // The function sends all the statuses in the single packet // to economize traffic. [LuzZza] -void clif_guild_send_onlineinfo(struct map_session_data *sd) +static void clif_guild_send_onlineinfo(struct map_session_data *sd) { struct guild *g; unsigned char buf[14*128]; @@ -7628,7 +7720,7 @@ void clif_guild_send_onlineinfo(struct map_session_data *sd) /// &0x10 = Expulsion list /// &0x40 = Unknown (GMENUFLAG_ALLGUILDLIST) /// &0x80 = Notice -void clif_guild_masterormember(struct map_session_data *sd) +static void clif_guild_masterormember(struct map_session_data *sd) { int fd; @@ -7644,7 +7736,7 @@ void clif_guild_masterormember(struct map_session_data *sd) /// Guild basic information (Territories [Valaris]) /// 0150 <guild id>.L <level>.L <member num>.L <member max>.L <exp>.L <max exp>.L <points>.L <honor>.L <virtue>.L <emblem id>.L <name>.24B <master name>.24B <manage land>.16B (ZC_GUILD_INFO) /// 01b6 <guild id>.L <level>.L <member num>.L <member max>.L <exp>.L <max exp>.L <points>.L <honor>.L <virtue>.L <emblem id>.L <name>.24B <master name>.24B <manage land>.16B <zeny>.L (ZC_GUILD_INFO2) -void clif_guild_basicinfo(struct map_session_data *sd) +static void clif_guild_basicinfo(struct map_session_data *sd) { int fd; struct guild *g; @@ -7690,7 +7782,7 @@ void clif_guild_basicinfo(struct map_session_data *sd) /// Guild alliance and opposition list (ZC_MYGUILD_BASIC_INFO). /// 014c <packet len>.W { <relation>.L <guild id>.L <guild name>.24B }* -void clif_guild_allianceinfo(struct map_session_data *sd) +static void clif_guild_allianceinfo(struct map_session_data *sd) { int fd,i,c; struct guild *g; @@ -7722,7 +7814,7 @@ void clif_guild_allianceinfo(struct map_session_data *sd) /// 1 = online /// memo: /// probably member's self-introduction (unused, no client UI/packets for editing it) -void clif_guild_memberlist(struct map_session_data *sd) +static void clif_guild_memberlist(struct map_session_data *sd) { int fd; int i,c; @@ -7772,7 +7864,8 @@ void clif_guild_memberlist(struct map_session_data *sd) /// Guild position name information (ZC_POSITION_ID_NAME_INFO). /// 0166 <packet len>.W { <position id>.L <position name>.24B }* -void clif_guild_positionnamelist(struct map_session_data *sd) { +static void clif_guild_positionnamelist(struct map_session_data *sd) +{ int i,fd; struct guild *g; @@ -7796,7 +7889,8 @@ void clif_guild_positionnamelist(struct map_session_data *sd) { /// mode: @see enum guild_permission /// ranking: /// TODO -void clif_guild_positioninfolist(struct map_session_data *sd) { +static void clif_guild_positioninfolist(struct map_session_data *sd) +{ int i,fd; struct guild *g; @@ -7823,7 +7917,7 @@ void clif_guild_positioninfolist(struct map_session_data *sd) { /// mode: @see enum guild_permission /// ranking: /// TODO -void clif_guild_positionchanged(struct guild *g,int idx) +static void clif_guild_positionchanged(struct guild *g, int idx) { // FIXME: This packet is intended to update the clients after a // commit of position info changes, not sending one packet per @@ -7848,7 +7942,7 @@ void clif_guild_positionchanged(struct guild *g,int idx) /// Notifies clients in a guild about updated member position assignments (ZC_ACK_REQ_CHANGE_MEMBERS). /// 0156 <packet len>.W { <account id>.L <char id>.L <position id>.L }* -void clif_guild_memberpositionchanged(struct guild *g,int idx) +static void clif_guild_memberpositionchanged(struct guild *g, int idx) { // FIXME: This packet is intended to update the clients after a // commit of member position assignment changes, not sending one @@ -7871,7 +7965,7 @@ void clif_guild_memberpositionchanged(struct guild *g,int idx) /// Sends emblems bitmap data to the client that requested it (ZC_GUILD_EMBLEM_IMG). /// 0152 <packet len>.W <guild id>.L <emblem id>.L <emblem data>.?B -void clif_guild_emblem(struct map_session_data *sd,struct guild *g) +static void clif_guild_emblem(struct map_session_data *sd, struct guild *g) { int fd; nullpo_retv(sd); @@ -7892,7 +7986,7 @@ void clif_guild_emblem(struct map_session_data *sd,struct guild *g) /// Sends update of the guild id/emblem id to everyone in the area (ZC_CHANGE_GUILD). /// 01b4 <id>.L <guild id>.L <emblem id>.W -void clif_guild_emblem_area(struct block_list* bl) +static void clif_guild_emblem_area(struct block_list *bl) { uint8 buf[12]; @@ -7909,7 +8003,7 @@ void clif_guild_emblem_area(struct block_list* bl) /// Sends guild skills (ZC_GUILD_SKILLINFO). /// 0162 <packet len>.W <skill points>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradeable>.B }* -void clif_guild_skillinfo(struct map_session_data* sd) +static void clif_guild_skillinfo(struct map_session_data *sd) { int fd; struct guild* g; @@ -7948,7 +8042,7 @@ void clif_guild_skillinfo(struct map_session_data* sd) /// Sends guild notice to client (ZC_GUILD_NOTICE). /// 016f <subject>.60B <notice>.120B -void clif_guild_notice(struct map_session_data* sd, struct guild* g) +static void clif_guild_notice(struct map_session_data *sd, struct guild *g) { int fd; @@ -7972,7 +8066,7 @@ void clif_guild_notice(struct map_session_data* sd, struct guild* g) /// Guild invite (ZC_REQ_JOIN_GUILD). /// 016a <guild id>.L <guild name>.24B -void clif_guild_invite(struct map_session_data *sd,struct guild *g) +static void clif_guild_invite(struct map_session_data *sd, struct guild *g) { int fd; @@ -7994,7 +8088,7 @@ void clif_guild_invite(struct map_session_data *sd,struct guild *g) /// 1 = Offer rejected. /// 2 = Offer accepted. /// 3 = Guild full. -void clif_guild_inviteack(struct map_session_data *sd,int flag) +static void clif_guild_inviteack(struct map_session_data *sd, int flag) { int fd; @@ -8009,7 +8103,7 @@ void clif_guild_inviteack(struct map_session_data *sd,int flag) /// Notifies clients of a guild of a leaving member (ZC_ACK_LEAVE_GUILD). /// 015a <char name>.24B <reason>.40B -void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes) +static void clif_guild_leave(struct map_session_data *sd, const char *name, const char *mes) { unsigned char buf[128]; @@ -8024,7 +8118,7 @@ void clif_guild_leave(struct map_session_data *sd,const char *name,const char *m /// Notifies clients of a guild of an expelled member. /// 015c <char name>.24B <reason>.40B <account name>.24B (ZC_ACK_BAN_GUILD) /// 0839 <char name>.24B <reason>.40B (ZC_ACK_BAN_GUILD_SSO) -void clif_guild_expulsion(struct map_session_data* sd, const char* name, const char* mes, int account_id) +static void clif_guild_expulsion(struct map_session_data *sd, const char *name, const char *mes, int account_id) { unsigned char buf[128]; #if PACKETVER < 20100803 @@ -8049,7 +8143,8 @@ void clif_guild_expulsion(struct map_session_data* sd, const char* name, const c /// Guild expulsion list (ZC_BAN_LIST). /// 0163 <packet len>.W { <char name>.24B <account name>.24B <reason>.40B }* /// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803) -void clif_guild_expulsionlist(struct map_session_data* sd) { +static void clif_guild_expulsionlist(struct map_session_data *sd) +{ #if PACKETVER < 20100803 const int offset = NAME_LENGTH*2+40; #else @@ -8090,7 +8185,7 @@ void clif_guild_expulsionlist(struct map_session_data* sd) { /// Guild chat message (ZC_GUILD_CHAT). /// 017f <packet len>.W <message>.?B -void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) +static void clif_guild_message(struct guild *g, int account_id, const char *mes, int len) {// TODO: account_id is not used, candidate for deletion? [Ai4rei] struct map_session_data *sd; uint8 buf[256]; @@ -8114,7 +8209,7 @@ void clif_guild_message(struct guild *g,int account_id,const char *mes,int len) /// Request for guild alliance (ZC_REQ_ALLY_GUILD). /// 0171 <inviter account id>.L <guild name>.24B -void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name) +static void clif_guild_reqalliance(struct map_session_data *sd, int account_id, const char *name) { int fd; @@ -8138,7 +8233,7 @@ void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const cha /// 3 = They have too any alliances. /// 4 = You have too many alliances. /// 5 = Alliances are disabled. -void clif_guild_allianceack(struct map_session_data *sd,int flag) +static void clif_guild_allianceack(struct map_session_data *sd, int flag) { int fd; @@ -8156,7 +8251,7 @@ void clif_guild_allianceack(struct map_session_data *sd,int flag) /// relation: /// 0 = Ally /// 1 = Enemy -void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) +static void clif_guild_delalliance(struct map_session_data *sd, int guild_id, int flag) { int fd; @@ -8179,7 +8274,7 @@ void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag) /// 1 = Guild has too many Antagonists. /// 2 = Already set as an Antagonist. /// 3 = Antagonists are disabled. -void clif_guild_oppositionack(struct map_session_data *sd,int flag) +static void clif_guild_oppositionack(struct map_session_data *sd, int flag) { int fd; @@ -8194,8 +8289,8 @@ void clif_guild_oppositionack(struct map_session_data *sd,int flag) /// Adds alliance or opposition (ZC_ADD_RELATED_GUILD). /// 0185 <relation>.L <guild id>.L <guild name>.24B -/* -void clif_guild_allianceadded(struct guild *g,int idx) +#if 0 +static void clif_guild_allianceadded(struct guild *g, int idx) { unsigned char buf[64]; WBUFW(buf,0)=0x185; @@ -8204,14 +8299,14 @@ void clif_guild_allianceadded(struct guild *g,int idx) memcpy(WBUFP(buf,10),g->alliance[idx].name,NAME_LENGTH); clif->send(buf,packet_len(0x185),guild->getavailablesd(g),GUILD); } -*/ +#endif // 0 /// Notifies the client about the result of a guild break (ZC_ACK_DISORGANIZE_GUILD_RESULT). /// 015e <reason>.L /// 0 = success /// 1 = invalid key (guild name, @see clif_parse_GuildBreak) /// 2 = there are still members in the guild -void clif_guild_broken(struct map_session_data *sd,int flag) +static void clif_guild_broken(struct map_session_data *sd, int flag) { int fd; @@ -8228,7 +8323,7 @@ void clif_guild_broken(struct map_session_data *sd,int flag) /// 00c0 <id>.L <type>.B /// type: /// enum emotion_type -void clif_emotion(struct block_list *bl,int type) +static void clif_emotion(struct block_list *bl, int type) { unsigned char buf[8]; @@ -8242,7 +8337,7 @@ void clif_emotion(struct block_list *bl,int type) /// Displays the contents of a talkiebox trap (ZC_TALKBOX_CHATCONTENTS). /// 0191 <id>.L <contents>.80B -void clif_talkiebox(struct block_list* bl, const char* talkie) +static void clif_talkiebox(struct block_list *bl, const char *talkie) { unsigned char buf[MESSAGE_SIZE+6]; nullpo_retv(bl); @@ -8256,7 +8351,7 @@ void clif_talkiebox(struct block_list* bl, const char* talkie) /// Displays wedding effect centered on an object (ZC_CONGRATULATION). /// 01ea <id>.L -void clif_wedding_effect(struct block_list *bl) +static void clif_wedding_effect(struct block_list *bl) { unsigned char buf[6]; @@ -8269,7 +8364,8 @@ void clif_wedding_effect(struct block_list *bl) /// Notifies the client of the name of the partner character (ZC_COUPLENAME). /// 01e6 <partner name>.24B -void clif_callpartner(struct map_session_data *sd) { +static void clif_callpartner(struct map_session_data *sd) +{ unsigned char buf[26]; nullpo_retv(sd); @@ -8294,8 +8390,8 @@ void clif_callpartner(struct map_session_data *sd) { /// Initiates the partner "taming" process [DracoRPG] (ZC_START_COUPLE). /// 01e4 /// This packet while still implemented by the client is no longer being officially used. -/* -void clif_marriage_process(struct map_session_data *sd) +#if 0 +static void clif_marriage_process(struct map_session_data *sd) { int fd; nullpo_retv(sd); @@ -8305,11 +8401,11 @@ void clif_marriage_process(struct map_session_data *sd) WFIFOW(fd,0)=0x1e4; WFIFOSET(fd,packet_len(0x1e4)); } -*/ +#endif // 0 /// Notice of divorce (ZC_DIVORCE). /// 0205 <partner name>.24B -void clif_divorced(struct map_session_data* sd, const char* name) +static void clif_divorced(struct map_session_data *sd, const char *name) { int fd; nullpo_retv(sd); @@ -8324,8 +8420,8 @@ void clif_divorced(struct map_session_data* sd, const char* name) /// Marriage proposal (ZC_REQ_COUPLE). /// 01e2 <account id>.L <char id>.L <char name>.24B /// This packet while still implemented by the client is no longer being officially used. -/* -void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_session_data* ssd) +#if 0 +static void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_session_data *ssd) { nullpo_retv(sd); @@ -8336,12 +8432,12 @@ void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_sess safestrncpy(WFIFOP(fd,10), ssd->status.name, NAME_LENGTH); WFIFOSET(fd, packet_len(0x1e2)); } -*/ +#endif // 0 /*========================================== * Displays a message using the guild-chat colors to the specified targets. [Skotlex] *------------------------------------------*/ -void clif_disp_message(struct block_list *src, const char *mes, enum send_target target) +static void clif_disp_message(struct block_list *src, const char *mes, enum send_target target) { unsigned char buf[256]; int len; @@ -8370,7 +8466,7 @@ void clif_disp_message(struct block_list *src, const char *mes, enum send_target /// result: /// 0 = failure /// 1 = success -void clif_GM_kickack(struct map_session_data *sd, int result) +static void clif_GM_kickack(struct map_session_data *sd, int result) { int fd; @@ -8383,7 +8479,8 @@ void clif_GM_kickack(struct map_session_data *sd, int result) WFIFOSET(fd, packet_len(0xcd)); } -void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { +static void clif_GM_kick(struct map_session_data *sd, struct map_session_data *tsd) +{ int fd; nullpo_retv(tsd); @@ -8407,7 +8504,7 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) { /// 3 = "Chat Block has been applied by GM due to your ill-mannerous action." /// 4 = "Automated Chat Block has been applied due to Anti-Spam System." /// 5 = "You got a good point from %s." -void clif_manner_message(struct map_session_data* sd, uint32 type) +static void clif_manner_message(struct map_session_data *sd, uint32 type) { int fd; nullpo_retv(sd); @@ -8424,7 +8521,7 @@ void clif_manner_message(struct map_session_data* sd, uint32 type) /// type: /// 0 = positive (unmute) /// 1 = negative (mute) -void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, uint8 type) +static void clif_GM_silence(struct map_session_data *sd, struct map_session_data *tsd, uint8 type) { int fd; nullpo_retv(sd); @@ -8447,7 +8544,8 @@ void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, /// 0 = success /// 1 = failure /// 2 = too many blocks -void clif_wisexin(struct map_session_data *sd,int type,int flag) { +static void clif_wisexin(struct map_session_data *sd, int type, int flag) +{ int fd; nullpo_retv(sd); @@ -8468,7 +8566,8 @@ void clif_wisexin(struct map_session_data *sd,int type,int flag) { /// result: /// 0 = success /// 1 = failure -void clif_wisall(struct map_session_data *sd,int type,int flag) { +static void clif_wisall(struct map_session_data *sd, int type, int flag) +{ int fd; nullpo_retv(sd); @@ -8483,7 +8582,7 @@ void clif_wisall(struct map_session_data *sd,int type,int flag) { /// Play a BGM! [Rikter/Yommy] (ZC_PLAY_NPC_BGM). /// 07fe <bgm>.24B -void clif_playBGM(struct map_session_data* sd, const char* name) +static void clif_playBGM(struct map_session_data *sd, const char *name) { int fd; @@ -8509,7 +8608,7 @@ void clif_playBGM(struct map_session_data* sd, const char* name) /// npc id: /// The acoustic direction of the sound is determined by the /// relative position of the NPC to the player (3D sound). -void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const char* name, int type) +static void clif_soundeffect(struct map_session_data *sd, struct block_list *bl, const char *name, int type) { int fd; @@ -8527,7 +8626,7 @@ void clif_soundeffect(struct map_session_data* sd, struct block_list* bl, const WFIFOSET(fd,packet_len(0x1d3)); } -void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum send_target coverage) +static void clif_soundeffectall(struct block_list *bl, const char *name, int type, enum send_target coverage) { unsigned char buf[40]; @@ -8546,7 +8645,7 @@ void clif_soundeffectall(struct block_list* bl, const char* name, int type, enum /// 01f3 <id>.L <effect id>.L /// effect id: /// @see doc/effect_list.txt -void clif_specialeffect(struct block_list* bl, int type, enum send_target target) +static void clif_specialeffect(struct block_list *bl, int type, enum send_target target) { unsigned char buf[24]; @@ -8566,7 +8665,8 @@ void clif_specialeffect(struct block_list* bl, int type, enum send_target target } } -void clif_specialeffect_single(struct block_list* bl, int type, int fd) { +static void clif_specialeffect_single(struct block_list *bl, int type, int fd) +{ nullpo_retv(bl); WFIFOHEAD(fd,10); WFIFOW(fd,0) = 0x1f3; @@ -8581,7 +8681,7 @@ void clif_specialeffect_single(struct block_list* bl, int type, int fd) { /// @see doc/effect_list.txt /// num data: /// effect-dependent value -void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, send_target target) +static void clif_specialeffect_value(struct block_list *bl, int effect_id, int num, send_target target) { uint8 buf[14]; @@ -8606,7 +8706,7 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen * @param color Message color (RGB format: 0xRRGGBB) * @param msg Message text */ -void clif_messagecolor_self(int fd, uint32 color, const char *msg) +static void clif_messagecolor_self(int fd, uint32 color, const char *msg) { int msg_len; @@ -8632,7 +8732,7 @@ void clif_messagecolor_self(int fd, uint32 color, const char *msg) * @param color Message color (RGB format: 0xRRGGBB) * @param msg Message text */ -void clif_messagecolor(struct block_list *bl, uint32 color, const char *msg) +static void clif_messagecolor(struct block_list *bl, uint32 color, const char *msg) { int msg_len; uint8 buf[256]; @@ -8662,7 +8762,7 @@ void clif_messagecolor(struct block_list *bl, uint32 color, const char *msg) * Should only be used in cases where the client closed the * storage window without server's consent **/ -void clif_refresh_storagewindow(struct map_session_data *sd) +static void clif_refresh_storagewindow(struct map_session_data *sd) { nullpo_retv(sd); // Notify the client that the storage is open @@ -8689,7 +8789,7 @@ void clif_refresh_storagewindow(struct map_session_data *sd) } // refresh the client's screen, getting rid of any effects -void clif_refresh(struct map_session_data *sd) +static void clif_refresh(struct map_session_data *sd) { nullpo_retv(sd); @@ -8754,7 +8854,7 @@ void clif_refresh(struct map_session_data *sd) /// Updates the object's (bl) name on client. /// 0095 <id>.L <char name>.24B (ZC_ACK_REQNAME) /// 0195 <id>.L <char name>.24B <party name>.24B <guild name>.24B <position name>.24B (ZC_ACK_REQNAMEALL) -void clif_charnameack (int fd, struct block_list *bl) +static void clif_charnameack(int fd, struct block_list *bl) { unsigned char buf[103]; int cmd = 0x95; @@ -8888,7 +8988,7 @@ void clif_charnameack (int fd, struct block_list *bl) //Used to update when a char leaves a party/guild. [Skotlex] //Needed because when you send a 0x95 packet, the client will not remove the cached party/guild info that is not sent. -void clif_charnameupdate (struct map_session_data *ssd) +static void clif_charnameupdate(struct map_session_data *ssd) { unsigned char buf[103]; int cmd = 0x195, ps = -1; @@ -8946,7 +9046,7 @@ void clif_charnameupdate (struct map_session_data *ssd) /// Visually moves(instant) a character to x,y. The char moves even /// when the target cell isn't walkable. If the char is sitting it /// stays that way. -void clif_slide(struct block_list *bl, int x, int y) +static void clif_slide(struct block_list *bl, int x, int y) { unsigned char buf[10]; nullpo_retv(bl); @@ -8965,7 +9065,7 @@ void clif_slide(struct block_list *bl, int x, int y) /// Public chat message (ZC_NOTIFY_CHAT). lordalfa/Skotlex - used by @me as well /// 008d <packet len>.W <id>.L <message>.?B -void clif_disp_overhead(struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl) +static void clif_disp_overhead(struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl) { char buf[CHAT_SIZE_MAX + (int)sizeof(struct PACKET_ZC_NOTIFY_CHAT)]; int max_len = CHAT_SIZE_MAX - (int)sizeof(struct PACKET_ZC_NOTIFY_CHAT); @@ -8997,7 +9097,7 @@ void clif_disp_overhead(struct block_list *bl, const char *mes, enum send_target } } -void clif_notify_playerchat(struct block_list *bl, const char *mes) +static void clif_notify_playerchat(struct block_list *bl, const char *mes) { char buf[CHAT_SIZE_MAX + (int)sizeof(struct PACKET_ZC_NOTIFY_PLAYERCHAT)]; int max_len = CHAT_SIZE_MAX - (int)sizeof(struct PACKET_ZC_NOTIFY_PLAYERCHAT); @@ -9023,7 +9123,7 @@ void clif_notify_playerchat(struct block_list *bl, const char *mes) * Minimap fix [Kevin] * Remove dot from minimap *--------------------------*/ -void clif_party_xy_remove(struct map_session_data *sd) +static void clif_party_xy_remove(struct map_session_data *sd) { unsigned char buf[16]; nullpo_retv(sd); @@ -9049,7 +9149,7 @@ void clif_party_xy_remove(struct map_session_data *sd) /// 0x20 = HIT/Flee +50 (PA_GOSPEL) /// 0x28 = Full strip failed because of coating (ST_FULLSTRIP) /// ? = nothing -void clif_gospel_info(struct map_session_data *sd, int type) +static void clif_gospel_info(struct map_session_data *sd, int type) { int fd; @@ -9090,7 +9190,7 @@ void clif_gospel_info(struct map_session_data *sd, int type) /// 22 = [Collector Rank] Target Item : <monster_id used as item id> /// 30 = [Sun, Moon and Stars Angel] Designed places and monsters have been reset. /// 40 = Target HP : <monster_id used as HP> -void clif_starskill(struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result) +static void clif_starskill(struct map_session_data *sd, const char *mapname, int monster_id, unsigned char star, unsigned char result) { int fd; @@ -9111,7 +9211,7 @@ void clif_starskill(struct map_session_data* sd, const char* mapname, int monste * Info about Star Gladiator save map [Komurka] * type: 1: Information, 0: Map registered *------------------------------------------*/ -void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsigned char type) +static void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type) { char mapname[MAP_NAME_LENGTH_EXT]; @@ -9125,7 +9225,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig * Info about Star Gladiator hate mob [Komurka] * type: 1: Register mob, 0: Information. *------------------------------------------*/ -void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) +static void clif_hate_info(struct map_session_data *sd, unsigned char hate_level, int class_, unsigned char type) { if( pc->db_checkid(class_) ) { clif->starskill(sd, pc->job_name(class_), class_, hate_level, type ? 10 : 11); @@ -9139,7 +9239,7 @@ void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int cl /*========================================== * Info about TaeKwon Do TK_MISSION mob [Skotlex] *------------------------------------------*/ -void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress) +static void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress) { clif->starskill(sd, mob->db(mob_id)->jname, mob_id, progress, 20); } @@ -9147,7 +9247,7 @@ void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char pr /*========================================== * Feel/Hate reset (thanks to Rayce) [Skotlex] *------------------------------------------*/ -void clif_feel_hate_reset(struct map_session_data *sd) +static void clif_feel_hate_reset(struct map_session_data *sd) { clif->starskill(sd, "", 0, 0, 30); } @@ -9160,7 +9260,7 @@ void clif_feel_hate_reset(struct map_session_data *sd) /// value: /// 0 = disabled /// 1 = enabled -void clif_zc_config(struct map_session_data* sd, enum CZ_CONFIG type, int flag) +static void clif_zc_config(struct map_session_data *sd, enum CZ_CONFIG type, int flag) { int fd; nullpo_retv(sd); @@ -9178,7 +9278,7 @@ void clif_zc_config(struct map_session_data* sd, enum CZ_CONFIG type, int flag) /// open equip window: /// 0 = disabled /// 1 = enabled -void clif_equpcheckbox(struct map_session_data* sd) +static void clif_equpcheckbox(struct map_session_data *sd) { int fd; nullpo_retv(sd); @@ -9195,7 +9295,8 @@ void clif_equpcheckbox(struct map_session_data* sd) /// 02d7 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (ZC_EQUIPWIN_MICROSCOPE, PACKETVER >= 20100629) /// 0859 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (ZC_EQUIPWIN_MICROSCOPE2, PACKETVER >= 20101124) /// 0859 <packet len>.W <name>.24B <class>.W <hairstyle>.W <bottom-viewid>.W <mid-viewid>.W <up-viewid>.W <robe>.W <haircolor>.W <cloth-dye>.W <gender>.B {equip item}.28B* (ZC_EQUIPWIN_MICROSCOPE2, PACKETVER >= 20110111) -void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* tsd) { +static void clif_viewequip_ack(struct map_session_data *sd, struct map_session_data *tsd) +{ int i, equip = 0; nullpo_retv(sd); @@ -9239,7 +9340,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts * @param sd The target character. * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) */ -void clif_msgtable(struct map_session_data* sd, enum clif_messages msg_id) +static void clif_msgtable(struct map_session_data *sd, enum clif_messages msg_id) { int fd; nullpo_retv(sd); @@ -9260,7 +9361,7 @@ void clif_msgtable(struct map_session_data* sd, enum clif_messages msg_id) * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) * @param value The value to fill %d. */ -void clif_msgtable_num(struct map_session_data *sd, enum clif_messages msg_id, int value) +static void clif_msgtable_num(struct map_session_data *sd, enum clif_messages msg_id, int value) { #if PACKETVER >= 20090805 int fd; @@ -9287,7 +9388,7 @@ void clif_msgtable_num(struct map_session_data *sd, enum clif_messages msg_id, i * @param skill_id ID of the skill to display. * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) */ -void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, enum clif_messages msg_id) +static void clif_msgtable_skill(struct map_session_data *sd, uint16 skill_id, enum clif_messages msg_id) { int fd; @@ -9302,13 +9403,13 @@ void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, enum clif } /** -* Displays a format string from msgstringtable.txt with a %s value (ZC_FORMATSTRING_MSG). -* -* @param sd The target character. -* @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) -* @param value The value to fill %s. -*/ -void clif_msgtable_str(struct map_session_data *sd, enum clif_messages msg_id, const char *value) + * Displays a format string from msgstringtable.txt with a %s value (ZC_FORMATSTRING_MSG). + * + * @param sd The target character. + * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) + * @param value The value to fill %s. + */ +static void clif_msgtable_str(struct map_session_data *sd, enum clif_messages msg_id, const char *value) { int message_len; int len; @@ -9332,13 +9433,13 @@ void clif_msgtable_str(struct map_session_data *sd, enum clif_messages msg_id, c } /** -* Displays a format string from msgstringtable.txt with a color (ZC_MSG_COLOR). -* -* @param sd The target character. -* @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) -* @param color The color to use -*/ -void clif_msgtable_color(struct map_session_data *sd, enum clif_messages msg_id, uint32 color) + * Displays a format string from msgstringtable.txt with a color (ZC_MSG_COLOR). + * + * @param sd The target character. + * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) + * @param color The color to use + */ +static void clif_msgtable_color(struct map_session_data *sd, enum clif_messages msg_id, uint32 color) { struct PACKET_ZC_MSG_COLOR p; @@ -9363,7 +9464,7 @@ void clif_msgtable_color(struct map_session_data *sd, enum clif_messages msg_id, * @retval NULL if the validation failed, the messages was a command or the * character can't send chat messages. out_buf shan't be used. */ -const char *clif_process_chat_message(struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int out_buflen) +static const char *clif_process_chat_message(struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int out_buflen) { const char *srcname = NULL, *srcmessage = NULL, *message = NULL; int textlen = 0, namelen = 0, messagelen = 0; @@ -9434,7 +9535,7 @@ const char *clif_process_chat_message(struct map_session_data *sd, const struct * character can't send chat messages. out_name and out_message * shan't be used. */ -bool clif_process_whisper_message(struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen) +static bool clif_process_whisper_message(struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen) { int namelen = 0, messagelen = 0; @@ -9485,7 +9586,7 @@ bool clif_process_whisper_message(struct map_session_data *sd, const struct pack return true; } -void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) +static void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) { struct DBIterator *iter; struct map_session_data *user; @@ -9520,7 +9621,7 @@ void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, ch dbi_destroy(iter); } -void clif_channel_msg2(struct channel_data *chan, char *msg) +static void clif_channel_msg2(struct channel_data *chan, char *msg) { struct DBIterator *iter; struct map_session_data *user; @@ -9552,7 +9653,7 @@ void clif_channel_msg2(struct channel_data *chan, char *msg) // TODO: [4144] same packet with login server. need somehow use one function for both servers // 3 - Rejected by server -void clif_auth_error(int fd, int errorCode) +static void clif_auth_error(int fd, int errorCode) { struct packet_ZC_REFUSE_LOGIN p; const int len = sizeof(p); @@ -9575,7 +9676,8 @@ void clif_auth_error(int fd, int errorCode) /// 0072 <account id>.L <char id>.L <auth code>.L <client time>.L <gender>.B (CZ_ENTER) /// 0436 <account id>.L <char id>.L <auth code>.L <client time>.L <gender>.B (CZ_ENTER2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { +static void clif_parse_WantToConnection(int fd, struct map_session_data *sd) +{ struct block_list* bl; struct auth_node* node; int cmd, account_id, char_id, login_id1, sex; @@ -9643,10 +9745,11 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { chrif->authreq(sd,false); } -void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Notification from the client, that it has finished map loading and is about to display player's character (CZ_NOTIFY_ACTORINIT). /// 007d -void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { +static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) +{ bool first_time = false; if(sd->bl.prev != NULL) @@ -10019,7 +10122,8 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { /// Server's tick (ZC_NOTIFY_TIME). /// 007f <time>.L -void clif_notify_time(struct map_session_data* sd, int64 time) { +static void clif_notify_time(struct map_session_data *sd, int64 time) +{ int fd; nullpo_retv(sd); @@ -10031,12 +10135,12 @@ void clif_notify_time(struct map_session_data* sd, int64 time) { WFIFOSET(fd,packet_len(0x7f)); } -void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TickSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request for server's tick. /// 007e <client tick>.L (CZ_REQUEST_TIME) /// 0360 <client tick>.L (CZ_REQUEST_TIME2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_TickSend(int fd, struct map_session_data *sd) +static void clif_parse_TickSend(int fd, struct map_session_data *sd) { sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); @@ -10048,7 +10152,8 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) /// 07d9 { <is skill>.B <id>.L <count>.W }*36 (ZC_SHORTCUT_KEY_LIST_V2, PACKETVER >= 20090603) /// 07d9 { <is skill>.B <id>.L <count>.W }*38 (ZC_SHORTCUT_KEY_LIST_V2, PACKETVER >= 20090617) /// 0a00 <rotate>.B { <is skill>.B <id>.L <count>.W }*38 (ZC_SHORTCUT_KEY_LIST_V3, PACKETVER >= 20141022) -void clif_hotkeys_send(struct map_session_data *sd) { +static void clif_hotkeys_send(struct map_session_data *sd) +{ #ifdef HOTKEY_SAVING struct packet_hotkey p; int i; @@ -10066,17 +10171,18 @@ void clif_hotkeys_send(struct map_session_data *sd) { #endif } -void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) +static void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) { int cmd = RFIFOW(fd, 0); sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); } -void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update a position on the hotkey bar (CZ_SHORTCUT_KEY_CHANGE). /// 02ba <index>.W <is skill>.B <id>.L <count>.W -void clif_parse_Hotkey(int fd, struct map_session_data *sd) { +static void clif_parse_Hotkey(int fd, struct map_session_data *sd) +{ #ifdef HOTKEY_SAVING unsigned short idx; int cmd; @@ -10093,7 +10199,7 @@ void clif_parse_Hotkey(int fd, struct map_session_data *sd) { /// Displays cast-like progress bar (ZC_PROGRESS). /// 02f0 <color>.L <time>.L -void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned int second) +static void clif_progressbar(struct map_session_data *sd, unsigned int color, unsigned int second) { int fd; @@ -10109,7 +10215,7 @@ void clif_progressbar(struct map_session_data * sd, unsigned int color, unsigned /// Removes an ongoing progress bar (ZC_PROGRESS_CANCEL). /// 02f2 -void clif_progressbar_abort(struct map_session_data * sd) +static void clif_progressbar_abort(struct map_session_data *sd) { int fd; @@ -10122,14 +10228,14 @@ void clif_progressbar_abort(struct map_session_data * sd) } /** -* Displays cast-like progress bar on a unit. -* 09d1 <id>.L <color>.L <time>.L -* -* @param bl Source block list. -* @param color Message color (RGB format: 0xRRGGBB). -* @param time Time in seconds. -*/ -void clif_progressbar_unit(struct block_list *bl, uint32 color, uint32 time) + * Displays cast-like progress bar on a unit. + * 09d1 <id>.L <color>.L <time>.L + * + * @param bl Source block list. + * @param color Message color (RGB format: 0xRRGGBB). + * @param time Time in seconds. + */ +static void clif_progressbar_unit(struct block_list *bl, uint32 color, uint32 time) { #if PACKETVER >= 20130821 struct ZC_PROGRESS_ACTOR p; @@ -10145,10 +10251,10 @@ void clif_progressbar_unit(struct block_list *bl, uint32 color, uint32 time) #endif } -void clif_parse_progressbar(int fd, struct map_session_data * sd) __attribute__((nonnull (2))); +static void clif_parse_progressbar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Notification from the client, that the progress bar has reached 100% (CZ_PROGRESS). /// 02f1 -void clif_parse_progressbar(int fd, struct map_session_data * sd) +static void clif_parse_progressbar(int fd, struct map_session_data *sd) { int npc_id = sd->progressbar.npc_id; @@ -10159,12 +10265,12 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd) npc->scriptcont(sd, npc_id, false); } -void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_WalkToXY(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to walk to a certain position on the current map. /// 0085 <dest>.3B (CZ_REQUEST_MOVE) /// 035f <dest>.3B (CZ_REQUEST_MOVE2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_WalkToXY(int fd, struct map_session_data *sd) +static void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { short x, y; @@ -10199,7 +10305,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) /// 0 = disconnect (quit) /// 1 = cannot disconnect (wait 10 seconds) /// ? = ignored -void clif_disconnect_ack(struct map_session_data* sd, short result) +static void clif_disconnect_ack(struct map_session_data *sd, short result) { int fd; @@ -10212,12 +10318,12 @@ void clif_disconnect_ack(struct map_session_data* sd, short result) WFIFOSET(fd,packet_len(0x18b)); } -void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_QuitGame(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to disconnect from server (CZ_REQ_DISCONNECT). /// 018a <type>.W /// type: /// 0 = quit -void clif_parse_QuitGame(int fd, struct map_session_data *sd) +static void clif_parse_QuitGame(int fd, struct map_session_data *sd) { /* Rovert's prevent logout option fixed [Valaris] */ if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC__INVISIBILITY] && !sd->sc.data[SC_SUHIDE] && @@ -10229,12 +10335,13 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) } } -void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Requesting unit's name. /// 0094 <id>.L (CZ_REQNAME) /// 0368 <id>.L (CZ_REQNAME2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { +static void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) +{ int id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); struct block_list* bl; //struct status_change *sc; @@ -10267,7 +10374,8 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { clif->charnameack(fd, bl); } -int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { +static int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data * sd; if( (sd = map->id2sd(id)) ) { sd->fontcolor_tid = INVALID_TIMER; @@ -10289,8 +10397,8 @@ int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) { * @param fd The incoming file descriptor. * @param sd The related character. */ -void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) +static void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { const struct packet_chat_message *packet = NULL; char full_message[CHAT_SIZE_MAX + NAME_LENGTH + 3 + 1]; @@ -10381,11 +10489,11 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) map->foreachinrange(npc_chat->sub, &sd->bl, AREA_SIZE, BL_NPC, full_message, strlen(full_message), &sd->bl); } -void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MapMove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /mm /mapmove (as @rura GM command) (CZ_MOVETO_MAP). /// Request to warp to a map on given coordinates. /// 0140 <map name>.16B <x>.W <y>.W -void clif_parse_MapMove(int fd, struct map_session_data *sd) +static void clif_parse_MapMove(int fd, struct map_session_data *sd) { char command[MAP_NAME_LENGTH_EXT+25]; char map_name[MAP_NAME_LENGTH_EXT]; @@ -10410,7 +10518,7 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd) /// 5 = southeast /// 6 = east /// 7 = northeast -void clif_changed_dir(struct block_list *bl, enum send_target target) +static void clif_changed_dir(struct block_list *bl, enum send_target target) { unsigned char buf[64]; @@ -10429,12 +10537,12 @@ void clif_changed_dir(struct block_list *bl, enum send_target target) } } -void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ChangeDir(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change own body and head direction. /// 009b <head dir>.W <dir>.B (CZ_CHANGE_DIRECTION) /// 0361 <head dir>.W <dir>.B (CZ_CHANGE_DIRECTION2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_ChangeDir(int fd, struct map_session_data *sd) +static void clif_parse_ChangeDir(int fd, struct map_session_data *sd) { unsigned char headdir, dir; @@ -10445,12 +10553,12 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) clif->changed_dir(&sd->bl, AREA_WOS); } -void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Emotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to show an emotion (CZ_REQ_EMOTION). /// 00bf <type>.B /// type: /// @see enum emotion_type -void clif_parse_Emotion(int fd, struct map_session_data *sd) +static void clif_parse_Emotion(int fd, struct map_session_data *sd) { int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); @@ -10480,7 +10588,8 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) /// Amount of currently online players, reply to /w /who (ZC_USER_COUNT). /// 00c2 <count>.L -void clif_user_count(struct map_session_data* sd, int count) { +static void clif_user_count(struct map_session_data *sd, int count) +{ int fd; nullpo_retv(sd); @@ -10492,15 +10601,16 @@ void clif_user_count(struct map_session_data* sd, int count) { WFIFOSET(fd,packet_len(0xc2)); } -void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /w /who (CZ_REQ_USER_COUNT). /// Request to display amount of currently connected players. /// 00c1 -void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { +static void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) +{ clif->user_count(sd, map->getusers()); } -void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) +static void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, int target_id, int64 tick) { nullpo_retv(sd); if (pc_isdead(sd)) { @@ -10611,7 +10721,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, } } -void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request for an action. /// 0089 <target id>.L <action>.B (CZ_REQUEST_ACT) /// 0437 <target id>.L <action>.B (CZ_REQUEST_ACT2) @@ -10623,7 +10733,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) __attribute__ /// 7 = continuous attack /// 12 = (touch skill?) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_ActionRequest(int fd, struct map_session_data *sd) +static void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { clif->pActionRequest_sub(sd, RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), @@ -10632,13 +10742,14 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) ); } -void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Restart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Response to the death/system menu (CZ_RESTART). /// 00b2 <type>.B /// type: /// 0 = restart (respawn) /// 1 = char-select (disconnect) -void clif_parse_Restart(int fd, struct map_session_data *sd) { +static void clif_parse_Restart(int fd, struct map_session_data *sd) +{ switch(RFIFOB(fd,2)) { case 0x00: pc->respawn(sd,CLR_OUTSIGHT); @@ -10668,8 +10779,8 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) { * @param fd The incoming file descriptor. * @param sd The related character. */ -void clif_parse_WisMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_WisMessage(int fd, struct map_session_data* sd) +static void clif_parse_WisMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_WisMessage(int fd, struct map_session_data *sd) { struct map_session_data* dstsd; int i; @@ -10786,11 +10897,11 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) clif->wis_message(dstsd->fd, sd->status.name, message, (int)strlen(message)); } -void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /b /nb (CZ_BROADCAST). /// Request to broadcast a message on whole server. /// 0099 <packet len>.W <text>.?B 00 -void clif_parse_Broadcast(int fd, struct map_session_data *sd) +static void clif_parse_Broadcast(int fd, struct map_session_data *sd) { const char commandname[] = "kami"; char command[sizeof commandname + 2 + CHAT_SIZE_MAX] = ""; // '@' command + ' ' + message + NUL @@ -10809,12 +10920,12 @@ void clif_parse_Broadcast(int fd, struct map_session_data *sd) atcommand->exec(fd, sd, command, true); } -void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TakeItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to pick up an item. /// 009f <id>.L (CZ_ITEM_PICKUP) /// 0362 <id>.L (CZ_ITEM_PICKUP2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_TakeItem(int fd, struct map_session_data *sd) +static void clif_parse_TakeItem(int fd, struct map_session_data *sd) { int map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); struct flooritem_data *fitem = map->id2fi(map_object_id); @@ -10851,12 +10962,12 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) clif->additem(sd,0,0,6); } -void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_DropItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to drop an item. /// 00a2 <index>.W <amount>.W (CZ_ITEM_THROW) /// 0363 <index>.W <amount>.W (CZ_ITEM_THROW2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_DropItem(int fd, struct map_session_data *sd) +static void clif_parse_DropItem(int fd, struct map_session_data *sd) { int item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; int item_amount = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); @@ -10887,12 +10998,12 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) clif->dropitem(sd, item_index, 0); } -void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UseItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to use an item. /// 00a7 <index>.W <account id>.L (CZ_USE_ITEM) /// 0439 <index>.W <account id>.L (CZ_USE_ITEM2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_UseItem(int fd, struct map_session_data *sd) +static void clif_parse_UseItem(int fd, struct map_session_data *sd) { int n; @@ -10914,11 +11025,11 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck. } -void clif_parse_EquipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_EquipItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to equip an item (CZ_REQ_WEAR_EQUIP). /// 00a9 <index>.W <position>.W /// 0998 <index>.W <position>.L -void clif_parse_EquipItem(int fd,struct map_session_data *sd) +static void clif_parse_EquipItem(int fd, struct map_session_data *sd) { const struct packet_equip_item *p = RP2PTR(fd); int index = 0; @@ -10962,10 +11073,10 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) pc->equipitem(sd, index, p->wearLocation); } -void clif_parse_UnequipItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UnequipItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to take off an equip (CZ_REQ_TAKEOFF_EQUIP). /// 00ab <index>.W -void clif_parse_UnequipItem(int fd,struct map_session_data *sd) +static void clif_parse_UnequipItem(int fd, struct map_session_data *sd) { int index; @@ -10989,12 +11100,12 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd) pc->unequipitem(sd,index, PCUNEQUIPITEM_RECALC); } -void clif_parse_NpcClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcClicked(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to start a conversation with an NPC (CZ_CONTACTNPC). /// 0090 <id>.L <type>.B /// type: /// 1 = click -void clif_parse_NpcClicked(int fd,struct map_session_data *sd) +static void clif_parse_NpcClicked(int fd, struct map_session_data *sd) { struct block_list *bl; @@ -11033,13 +11144,13 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) } } -void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Selection between buy/sell was made (CZ_ACK_SELECT_DEALTYPE). /// 00c5 <id>.L <type>.B /// type: /// 0 = buy /// 1 = sell -void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) +static void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) { if (sd->state.trading) return; @@ -11053,7 +11164,8 @@ void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) /// 1 = "You do not have enough zeny." /// 2 = "You are over your Weight Limit." /// 3 = "Out of the maximum capacity, you have too many items." -void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { +static void clif_npc_buy_result(struct map_session_data *sd, unsigned char result) +{ int fd; nullpo_retv(sd); @@ -11064,10 +11176,10 @@ void clif_npc_buy_result(struct map_session_data* sd, unsigned char result) { WFIFOSET(fd,packet_len(0xca)); } -void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_NpcBuyListSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to buy chosen items from npc shop (CZ_PC_PURCHASE_ITEMLIST). /// 00c8 <packet len>.W { <amount>.W <name id>.W }* -void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) +static void clif_parse_NpcBuyListSend(int fd, struct map_session_data *sd) { int n = ((int)RFIFOW(fd,2)-4) / 4; int result; @@ -11104,7 +11216,8 @@ void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd) /// result: /// 0 = "The deal has successfully completed." /// 1 = "The deal has failed." -void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { +static void clif_npc_sell_result(struct map_session_data *sd, unsigned char result) +{ int fd; nullpo_retv(sd); @@ -11115,10 +11228,10 @@ void clif_npc_sell_result(struct map_session_data* sd, unsigned char result) { WFIFOSET(fd,packet_len(0xcb)); } -void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcSellListSend(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to sell chosen items to npc shop (CZ_PC_SELL_ITEMLIST). /// 00c9 <packet len>.W { <index>.W <amount>.W }* -void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) +static void clif_parse_NpcSellListSend(int fd, struct map_session_data *sd) { int fail=0,n; @@ -11153,13 +11266,13 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) clif->npc_sell_result(sd, fail); } -void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_CreateChatRoom(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Chatroom creation request (CZ_CREATE_CHATROOM). /// 00d5 <packet len>.W <limit>.W <type>.B <passwd>.8B <title>.?B /// type: /// 0 = private /// 1 = public -void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) +static void clif_parse_CreateChatRoom(int fd, struct map_session_data *sd) { int len = (int)RFIFOW(fd, 2) - 15; int limit; @@ -11198,10 +11311,10 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) chat->create_pc_chat(sd, s_title, s_password, limit, pub); } -void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ChatAddMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Chatroom join request (CZ_REQ_ENTER_ROOM). /// 00d9 <chat ID>.L <passwd>.8B -void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) +static void clif_parse_ChatAddMember(int fd, struct map_session_data *sd) { int chatid = RFIFOL(fd,2); const char *password = RFIFOP(fd,6); // not zero-terminated @@ -11209,13 +11322,13 @@ void clif_parse_ChatAddMember(int fd, struct map_session_data* sd) chat->join(sd,chatid,password); } -void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Chatroom properties adjustment request (CZ_CHANGE_CHATROOM). /// 00de <packet len>.W <limit>.W <type>.B <passwd>.8B <title>.?B /// type: /// 0 = private /// 1 = public -void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) +static void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data *sd) { int len = (int)RFIFOW(fd, 2) - 15; int limit; @@ -11239,29 +11352,29 @@ void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) chat->change_status(sd, s_title, s_password, limit, pub); } -void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ChangeChatOwner(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change the chat room ownership (CZ_REQ_ROLE_CHANGE). /// 00e0 <role>.L <nick>.24B /// role: /// 0 = owner /// 1 = normal -void clif_parse_ChangeChatOwner(int fd, struct map_session_data* sd) +static void clif_parse_ChangeChatOwner(int fd, struct map_session_data *sd) { chat->change_owner(sd, RFIFOP(fd,6)); // non null terminated } -void clif_parse_KickFromChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_KickFromChat(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to expel a player from chat room (CZ_REQ_EXPEL_MEMBER). /// 00e2 <name>.24B -void clif_parse_KickFromChat(int fd,struct map_session_data *sd) +static void clif_parse_KickFromChat(int fd, struct map_session_data *sd) { chat->kick(sd, RFIFOP(fd,2)); // non null terminated } -void clif_parse_ChatLeave(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ChatLeave(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to leave the current chatroom (CZ_EXIT_ROOM). /// 00e3 -void clif_parse_ChatLeave(int fd, struct map_session_data* sd) +static void clif_parse_ChatLeave(int fd, struct map_session_data *sd) { chat->leave(sd, false); } @@ -11269,7 +11382,8 @@ void clif_parse_ChatLeave(int fd, struct map_session_data* sd) //Handles notifying asker and rejecter of what has just occurred. //Type is used to determine the correct msg_txt to use: //0: -void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { +static void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) +{ const char* msg; char output[256]; nullpo_retv(src); @@ -11281,10 +11395,11 @@ void clif_noask_sub(struct map_session_data *src, struct map_session_data *targe clif_disp_onlyself(target, output); } -void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeRequest(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to begin a trade (CZ_REQ_EXCHANGE_ITEM). /// 00e4 <account id>.L -void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { +static void clif_parse_TradeRequest(int fd, struct map_session_data *sd) +{ struct map_session_data *t_sd; t_sd = map->id2sd(RFIFOL(fd,2)); @@ -11306,21 +11421,21 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { trade->request(sd,t_sd); } -void clif_parse_TradeAck(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to a trade request (CZ_ACK_EXCHANGE_ITEM). /// 00e6 <result>.B /// result: /// 3 = accepted /// 4 = rejected -void clif_parse_TradeAck(int fd,struct map_session_data *sd) +static void clif_parse_TradeAck(int fd, struct map_session_data *sd) { trade->ack(sd,RFIFOB(fd,2)); } -void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeAddItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add an item to current trade (CZ_ADD_EXCHANGE_ITEM). /// 00e8 <index>.W <amount>.L -void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) +static void clif_parse_TradeAddItem(int fd, struct map_session_data *sd) { short index = RFIFOW(fd,2); int amount = RFIFOL(fd,4); @@ -11331,42 +11446,43 @@ void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) trade->additem(sd, index, (short)amount); } -void clif_parse_TradeOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeOk(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to lock items in current trade (CZ_CONCLUDE_EXCHANGE_ITEM). /// 00eb -void clif_parse_TradeOk(int fd,struct map_session_data *sd) +static void clif_parse_TradeOk(int fd, struct map_session_data *sd) { trade->ok(sd); } -void clif_parse_TradeCancel(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeCancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to cancel current trade (CZ_CANCEL_EXCHANGE_ITEM). /// 00ed -void clif_parse_TradeCancel(int fd,struct map_session_data *sd) +static void clif_parse_TradeCancel(int fd, struct map_session_data *sd) { trade->cancel(sd); } -void clif_parse_TradeCommit(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_TradeCommit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to commit current trade (CZ_EXEC_EXCHANGE_ITEM). /// 00ef -void clif_parse_TradeCommit(int fd,struct map_session_data *sd) +static void clif_parse_TradeCommit(int fd, struct map_session_data *sd) { trade->commit(sd); } -void clif_parse_StopAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_StopAttack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to stop chasing/attacking an unit (CZ_CANCEL_LOCKON). /// 0118 -void clif_parse_StopAttack(int fd,struct map_session_data *sd) +static void clif_parse_StopAttack(int fd, struct map_session_data *sd) { pc_stop_attack(sd); } -void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from inventory to cart (CZ_MOVE_ITEM_FROM_BODY_TO_CART). /// 0126 <index>.W <amount>.L -void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { +static void clif_parse_PutItemToCart(int fd, struct map_session_data *sd) +{ int flag = 0; if (pc_istrading(sd)) return; @@ -11378,20 +11494,20 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) { } } -void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GetItemFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from cart to inventory (CZ_MOVE_ITEM_FROM_CART_TO_BODY). /// 0127 <index>.W <amount>.L -void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) +static void clif_parse_GetItemFromCart(int fd, struct map_session_data *sd) { if (!pc_iscarton(sd)) return; pc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); } -void clif_parse_RemoveOption(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RemoveOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to remove cart/falcon/peco/dragon (CZ_REQ_CARTOFF). /// 012a -void clif_parse_RemoveOption(int fd,struct map_session_data *sd) +static void clif_parse_RemoveOption(int fd, struct map_session_data *sd) { if (pc_isridingpeco(sd) || pc_isfalcon(sd) || pc_isridingdragon(sd) || pc_ismadogear(sd)) { // priority to remove this option before we can clear cart @@ -11406,10 +11522,10 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd) } } -void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ChangeCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change cart's visual look (CZ_REQ_CHANGECART). /// 01af <num>.W -void clif_parse_ChangeCart(int fd, struct map_session_data *sd) +static void clif_parse_ChangeCart(int fd, struct map_session_data *sd) {// TODO: State tracking? int type; @@ -11445,7 +11561,7 @@ void clif_parse_ChangeCart(int fd, struct map_session_data *sd) /// Request to select cart's visual look for new cart design (CZ_SELECTCART). /// 0980 <identity>.L <type>.B -void clif_parse_SelectCart(int fd, struct map_session_data *sd) +static void clif_parse_SelectCart(int fd, struct map_session_data *sd) { #if PACKETVER >= 20150805 // RagexeRE int type; @@ -11462,7 +11578,7 @@ void clif_parse_SelectCart(int fd, struct map_session_data *sd) #endif } -void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_StatusUp(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to increase status (CZ_STATUS_CHANGE). /// 00bb <status id>.W <amount>.B /// status id: @@ -11470,7 +11586,8 @@ void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonn /// amount: /// Old clients send always 1 for this, even when using /str+ and the like. /// Newer clients (2013-12-23 and newer) send the correct amount. -void clif_parse_StatusUp(int fd,struct map_session_data *sd) { +static void clif_parse_StatusUp(int fd, struct map_session_data *sd) +{ int increase_amount; increase_amount = RFIFOB(fd,4); @@ -11482,15 +11599,16 @@ void clif_parse_StatusUp(int fd,struct map_session_data *sd) { pc->statusup(sd, RFIFOW(fd,2), increase_amount); } -void clif_parse_SkillUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SkillUp(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to increase level of a skill (CZ_UPGRADE_SKILLLEVEL). /// 0112 <skill id>.W -void clif_parse_SkillUp(int fd,struct map_session_data *sd) +static void clif_parse_SkillUp(int fd, struct map_session_data *sd) { pc->skillup(sd,RFIFOW(fd,2)); } -void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { +static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) +{ int lv; nullpo_retv(sd); @@ -11520,7 +11638,8 @@ void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_dat unit->skilluse_id(&hd->bl, target_id, skill_id, skill_lv); } -void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { +static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) +{ int lv; nullpo_retv(sd); if( !hd ) @@ -11548,7 +11667,8 @@ void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_da unit->skilluse_pos(&hd->bl, x, y, skill_id, skill_lv); } -void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { +static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) +{ int lv; nullpo_retv(sd); @@ -11570,7 +11690,8 @@ void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_ses unit->skilluse_id(&md->bl, target_id, skill_id, skill_lv); } -void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) { +static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo) +{ int lv; nullpo_retv(sd); if( !md ) @@ -11593,12 +11714,12 @@ void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_se unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); } -void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to use a targeted skill. /// 0113 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL) /// 0438 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { uint16 skill_id, skill_lv; int tmp, target_id; @@ -11708,7 +11829,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) /*========================================== * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location *------------------------------------------*/ -void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) +static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) { int64 tick = timer->gettick(); @@ -11789,12 +11910,12 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski } } -void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to use a ground skill. /// 0116 <skill lv>.W <skill id>.W <x>.W <y>.W (CZ_USE_SKILL_TOGROUND) /// 0366 <skill lv>.W <skill id>.W <x>.W <y>.W (CZ_USE_SKILL_TOGROUND2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) +static void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { if (pc_cant_act(sd)) return; @@ -11810,12 +11931,12 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) ); } -void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to use a ground skill with text. /// 0190 <skill lv>.W <skill id>.W <x>.W <y>.W <contents>.80B (CZ_USE_SKILL_TOGROUND_WITHTALKBOX) /// 0367 <skill lv>.W <skill id>.W <x>.W <y>.W <contents>.80B (CZ_USE_SKILL_TOGROUND_WITHTALKBOX2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) +static void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) { if (pc_cant_act(sd)) return; @@ -11831,10 +11952,10 @@ void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) ); } -void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_UseSkillMap(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to map selection dialog (CZ_SELECT_WARPPOINT). /// 011b <skill id>.W <map name>.16B -void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) +static void clif_parse_UseSkillMap(int fd, struct map_session_data *sd) { uint16 skill_id = RFIFOW(fd,2); char map_name[MAP_NAME_LENGTH]; @@ -11855,19 +11976,19 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) skill->castend_map(sd,skill_id,map_name); } -void clif_parse_RequestMemo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RequestMemo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to set a memo on current map (CZ_REMEMBER_WARPPOINT). /// 011d -void clif_parse_RequestMemo(int fd,struct map_session_data *sd) +static void clif_parse_RequestMemo(int fd, struct map_session_data *sd) { if (!pc_isdead(sd)) pc->memo(sd,-1); } -void clif_parse_ProduceMix(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ProduceMix(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to pharmacy item selection dialog (CZ_REQMAKINGITEM). /// 018e <name id>.W { <material id>.W }*3 -void clif_parse_ProduceMix(int fd,struct map_session_data *sd) +static void clif_parse_ProduceMix(int fd, struct map_session_data *sd) { switch( sd->menuskill_id ) { case -1: @@ -11889,7 +12010,7 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Cooking(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to mixing item selection dialog (CZ_REQ_MAKINGITEM). /// 025b <mk type>.W <name id>.W /// mk type: @@ -11899,7 +12020,8 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) __attribute__((nonnu /// 4 = GN_MIX_COOKING /// 5 = GN_MAKEBOMB /// 6 = GN_S_PHARMACY -void clif_parse_Cooking(int fd,struct map_session_data *sd) { +static void clif_parse_Cooking(int fd, struct map_session_data *sd) +{ int type = RFIFOW(fd,2); int nameid = RFIFOW(fd,4); int amount = sd->menuskill_val2?sd->menuskill_val2:1; @@ -11917,10 +12039,10 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { clif_menuskill_clear(sd); } -void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RepairItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to repair weapon item selection dialog (CZ_REQ_ITEMREPAIR). /// 01fd <index>.W <name id>.W <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W -void clif_parse_RepairItem(int fd, struct map_session_data *sd) +static void clif_parse_RepairItem(int fd, struct map_session_data *sd) { if (sd->menuskill_id != BS_REPAIRWEAPON) return; @@ -11934,10 +12056,10 @@ void clif_parse_RepairItem(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to refine weapon item selection dialog (CZ_REQ_WEAPONREFINE). /// 0222 <index>.L -void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) +static void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) { int idx; @@ -11956,7 +12078,7 @@ void clif_parse_WeaponRefine(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to script menu dialog (CZ_CHOOSE_MENU). /// 00b8 <npc id>.L <choice>.B /// choice: @@ -11964,7 +12086,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) __attribute__( /// 255 = cancel /// NOTE: If there were more than 254 items in the list, choice /// overflows to choice%256. -void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) +static void clif_parse_NpcSelectMenu(int fd, struct map_session_data *sd) { int npc_id = RFIFOL(fd,2); uint8 select = RFIFOB(fd,6); @@ -11986,18 +12108,18 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) npc->scriptcont(sd,npc_id, false); } -void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcNextClicked(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// NPC dialog 'next' click (CZ_REQ_NEXT_SCRIPT). /// 00b9 <npc id>.L -void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) +static void clif_parse_NpcNextClicked(int fd, struct map_session_data *sd) { npc->scriptcont(sd,RFIFOL(fd,2), false); } -void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcAmountInput(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// NPC numeric input dialog value (CZ_INPUT_EDITDLG). /// 0143 <npc id>.L <value>.L -void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) +static void clif_parse_NpcAmountInput(int fd, struct map_session_data *sd) { int npcid = RFIFOL(fd,2); int amount = RFIFOL(fd,6); @@ -12009,10 +12131,10 @@ void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd) npc->scriptcont(sd, npcid, false); } -void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_NpcStringInput(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// NPC text input dialog value (CZ_INPUT_EDITDLGSTR). /// 01d5 <packet len>.W <npc id>.L <string>.?B -void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) +static void clif_parse_NpcStringInput(int fd, struct map_session_data *sd) { int len = RFIFOW(fd, 2); // [4144] can't confirm exact client version. At least >= correct for 20150513 @@ -12034,10 +12156,10 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) npc->scriptcont(sd, npcid, false); } -void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NpcCloseClicked(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// NPC dialog 'close' click (CZ_CLOSE_DIALOG). /// 0146 <npc id>.L -void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) +static void clif_parse_NpcCloseClicked(int fd, struct map_session_data *sd) { if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex] return; @@ -12045,12 +12167,12 @@ void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) npc->scriptcont(sd, RFIFOL(fd,2), true); } -void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ItemIdentify(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to identify item selection dialog (CZ_REQ_ITEMIDENTIFY). /// 0178 <index>.W /// index: /// -1 = cancel -void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) +static void clif_parse_ItemIdentify(int fd, struct map_session_data *sd) { short idx = RFIFOW(fd,2); @@ -12068,7 +12190,7 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) /// Identifying item with right-click (CZ_REQ_ONECLICK_ITEMIDENTIFY). /// 0A35 <index>.W -void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) +static void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) { int cmd = RFIFOW(fd,0); short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; @@ -12082,10 +12204,10 @@ void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd) skill->identify(sd, idx); } -void clif_parse_SelectArrow(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SelectArrow(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to arrow crafting item selection dialog (CZ_REQ_MAKINGARROW). /// 01ae <name id>.W -void clif_parse_SelectArrow(int fd,struct map_session_data *sd) +static void clif_parse_SelectArrow(int fd, struct map_session_data *sd) { if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. @@ -12114,10 +12236,10 @@ void clif_parse_SelectArrow(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_AutoSpell(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_AutoSpell(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to SA_AUTOSPELL skill selection dialog (CZ_SELECTAUTOSPELL). /// 01ce <skill id>.L -void clif_parse_AutoSpell(int fd,struct map_session_data *sd) +static void clif_parse_AutoSpell(int fd, struct map_session_data *sd) { uint16 skill_id = RFIFOL(fd,2); @@ -12133,42 +12255,44 @@ void clif_parse_AutoSpell(int fd,struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_UseCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_UseCard(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to display item carding/composition list (CZ_REQ_ITEMCOMPOSITION_LIST). /// 017a <card index>.W -void clif_parse_UseCard(int fd,struct map_session_data *sd) +static void clif_parse_UseCard(int fd, struct map_session_data *sd) { clif->use_card(sd,RFIFOW(fd,2)-2); } -void clif_parse_InsertCard(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_InsertCard(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to carding/composing item selection dialog (CZ_REQ_ITEMCOMPOSITION). /// 017c <card index>.W <equip index>.W -void clif_parse_InsertCard(int fd,struct map_session_data *sd) +static void clif_parse_InsertCard(int fd, struct map_session_data *sd) { pc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); } -void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SolveCharName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request of character's name by char ID. /// 0193 <char id>.L (CZ_REQNAME_BYGID) /// 0369 <char id>.L (CZ_REQNAME_BYGID2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { +static void clif_parse_SolveCharName(int fd, struct map_session_data *sd) +{ int charid; charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); map->reqnickdb(sd, charid); } -void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ResetChar(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /resetskill /resetstate (CZ_RESET). /// Request to reset stats or skills. /// 0197 <type>.W /// type: /// 0 = state /// 1 = skill -void clif_parse_ResetChar(int fd, struct map_session_data *sd) { +static void clif_parse_ResetChar(int fd, struct map_session_data *sd) +{ char cmd[15]; if( RFIFOW(fd,2) ) @@ -12179,11 +12303,11 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) { atcommand->exec(fd, sd, cmd, true); } -void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /lb /nlb (CZ_LOCALBROADCAST). /// Request to broadcast a message on current map. /// 019c <packet len>.W <text>.?B -void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) +static void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) { const char commandname[] = "lkami"; char command[sizeof commandname + 2 + CHAT_SIZE_MAX] = ""; // '@' + command + ' ' + message + NUL @@ -12202,12 +12326,12 @@ void clif_parse_LocalBroadcast(int fd, struct map_session_data *sd) atcommand->exec(fd, sd, command, true); } -void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from inventory to storage. /// 00f3 <index>.W <amount>.L (CZ_MOVE_ITEM_FROM_BODY_TO_STORE) /// 0364 <index>.W <amount>.L (CZ_MOVE_ITEM_FROM_BODY_TO_STORE2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) +static void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) { int item_index, item_amount; @@ -12225,12 +12349,12 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) gstorage->add(sd, item_index, item_amount); } -void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MoveFromKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from storage to inventory. /// 00f5 <index>.W <amount>.L (CZ_MOVE_ITEM_FROM_STORE_TO_BODY) /// 0365 <index>.W <amount>.L (CZ_MOVE_ITEM_FROM_STORE_TO_BODY2) /// There are various variants of this packet, some of them have padding between fields. -void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) +static void clif_parse_MoveFromKafra(int fd, struct map_session_data *sd) { int item_index, item_amount; @@ -12243,10 +12367,10 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) gstorage->get(sd, item_index, item_amount); } -void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from cart to storage (CZ_MOVE_ITEM_FROM_CART_TO_STORE). /// 0129 <index>.W <amount>.L -void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) +static void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) { if( sd->state.vending ) return; @@ -12259,10 +12383,10 @@ void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd) gstorage->addfromcart(sd, RFIFOW(fd,2) - 2, RFIFOL(fd,4)); } -void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move an item from storage to cart (CZ_MOVE_ITEM_FROM_STORE_TO_CART). /// 0128 <index>.W <amount>.L -void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) +static void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) { if( sd->state.vending ) return; @@ -12275,10 +12399,10 @@ void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd) gstorage->gettocart(sd, RFIFOW(fd,2)-1, RFIFOL(fd,4)); } -void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CloseKafra(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to close storage (CZ_CLOSE_STORE). /// 00f7 -void clif_parse_CloseKafra(int fd, struct map_session_data *sd) +static void clif_parse_CloseKafra(int fd, struct map_session_data *sd) { if( sd->state.storage_flag == STORAGE_FLAG_NORMAL ) storage->close(sd); @@ -12286,6 +12410,7 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) gstorage->close(sd); } +#if 0 // Unused function /// Displays kafra storage password dialog (ZC_REQ_STORE_PASSWORD). /// 023a <info>.W /// info: @@ -12294,7 +12419,7 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) /// 8 = too many wrong passwords /// ? = ignored /// NOTE: This packet is only available on certain non-kRO clients. -void clif_storagepassword(struct map_session_data* sd, short info) +static void clif_storagepassword(struct map_session_data *sd, short info) { int fd; @@ -12305,19 +12430,21 @@ void clif_storagepassword(struct map_session_data* sd, short info) WFIFOW(fd,2) = info; WFIFOSET(fd,packet_len(0x23a)); } +#endif // 0 -void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_StoragePassword(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to the kafra storage password dialog (CZ_ACK_STORE_PASSWORD). /// 023b <type>.W <password>.16B <new password>.16B /// type: /// 2 = change password /// 3 = check password /// NOTE: This packet is only available on certain non-kRO clients. -void clif_parse_StoragePassword(int fd, struct map_session_data *sd) +static void clif_parse_StoragePassword(int fd, struct map_session_data *sd) { //TODO } +#if 0 // Unused function /// Result of kafra storage password validation (ZC_RESULT_STORE_PASSWORD). /// 023c <result>.W <error count>.W /// result: @@ -12328,7 +12455,7 @@ void clif_parse_StoragePassword(int fd, struct map_session_data *sd) /// 8 = too many wrong passwords /// ? = ignored /// NOTE: This packet is only available on certain non-kRO clients. -void clif_storagepassword_result(struct map_session_data* sd, short result, short error_count) +static void clif_storagepassword_result(struct map_session_data *sd, short result, short error_count) { int fd; @@ -12340,12 +12467,13 @@ void clif_storagepassword_result(struct map_session_data* sd, short result, shor WFIFOW(fd,4) = error_count; WFIFOSET(fd,packet_len(0x23c)); } +#endif // 0 -void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CreateParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Party creation request /// 00f9 <party name>.24B (CZ_MAKE_GROUP) /// 01e8 <party name>.24B <item pickup rule>.B <item share rule>.B (CZ_MAKE_GROUP2) -void clif_parse_CreateParty(int fd, struct map_session_data *sd) +static void clif_parse_CreateParty(int fd, struct map_session_data *sd) { char name[NAME_LENGTH]; @@ -12364,8 +12492,8 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) party->create(sd,name,0,0); } -void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CreateParty2(int fd, struct map_session_data *sd) +static void clif_parse_CreateParty2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CreateParty2(int fd, struct map_session_data *sd) { char name[NAME_LENGTH]; int item1 = RFIFOB(fd,26); @@ -12386,11 +12514,12 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) party->create(sd,name,item1,item2); } -void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Party invitation request /// 00fc <account id>.L (CZ_REQ_JOIN_GROUP) /// 02c4 <char name>.24B (CZ_PARTY_JOIN_REQ) -void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { +static void clif_parse_PartyInvite(int fd, struct map_session_data *sd) +{ struct map_session_data *t_sd; if(map->list[sd->bl.m].flag.partylock) { @@ -12409,8 +12538,8 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { party->invite(sd, t_sd); } -void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +static void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) { struct map_session_data *t_sd; char name[NAME_LENGTH]; @@ -12433,28 +12562,29 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) party->invite(sd, t_sd); } -void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ReplyPartyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Party invitation reply /// 00ff <party id>.L <flag>.L (CZ_JOIN_GROUP) /// 02c7 <party id>.L <flag>.B (CZ_PARTY_JOIN_REQ_ACK) /// flag: /// 0 = reject /// 1 = accept -void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) +static void clif_parse_ReplyPartyInvite(int fd, struct map_session_data *sd) { party->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); } -void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +static void clif_parse_ReplyPartyInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ReplyPartyInvite2(int fd, struct map_session_data *sd) { party->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); } -void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_LeaveParty(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to leave party (CZ_REQ_LEAVE_GROUP). /// 0100 -void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { +static void clif_parse_LeaveParty(int fd, struct map_session_data *sd) +{ if(map->list[sd->bl.m].flag.partylock) { // Party locked. clif->message(fd, msg_fd(fd,227)); // Party modification is disabled in this map. @@ -12463,10 +12593,11 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd) { party->leave(sd); } -void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to expel a party member (CZ_REQ_EXPEL_GROUP_MEMBER). /// 0103 <account id>.L <char name>.24B -void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { +static void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) +{ if(map->list[sd->bl.m].flag.partylock) { // Party locked. clif->message(fd, msg_fd(fd,227)); // Party modification is disabled in this map. @@ -12475,11 +12606,11 @@ void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { party->removemember(sd, RFIFOL(fd,2), RFIFOP(fd,6)); } -void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change party options. /// 0102 <exp share rule>.L (CZ_CHANGE_GROUPEXPOPTION) /// 07d7 <exp share rule>.L <item pickup rule>.B <item share rule>.B (CZ_GROUPINFO_CHANGE_V2) -void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) +static void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) { struct party_data *p; int i; @@ -12516,8 +12647,8 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) * @param fd The incoming file descriptor. * @param sd The related character. */ -void clif_parse_PartyMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_PartyMessage(int fd, struct map_session_data *sd) +static void clif_parse_PartyMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyMessage(int fd, struct map_session_data *sd) { const struct packet_chat_message *packet = RP2PTR(fd); char message[CHAT_SIZE_MAX + NAME_LENGTH + 3 + 1]; @@ -12528,20 +12659,21 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) party->send_message(sd, message); } -void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyChangeLeader(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Changes Party Leader (CZ_CHANGE_GROUP_MASTER). /// 07da <account id>.L -void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { +static void clif_parse_PartyChangeLeader(int fd, struct map_session_data *sd) +{ party->changeleader(sd, map->id2sd(RFIFOL(fd,2))); } -void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Party Booking in KRO [Spiria] /// /// Request to register a party booking advertisement (CZ_PARTY_BOOKING_REQ_REGISTER). /// 0802 <level>.W <map id>.W { <job>.W }*6 -void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data *sd) { #ifndef PARTY_RECRUIT short level = RFIFOW(fd,2); @@ -12564,7 +12696,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) /// 0 = success /// 1 = failure /// 2 = already registered -void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +static void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) { #ifndef PARTY_RECRUIT int fd; @@ -12580,10 +12712,10 @@ void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) #endif } -void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to search for party booking advertisement (CZ_PARTY_BOOKING_REQ_SEARCH). /// 0804 <level>.W <map id>.W <job>.W <last index>.L <result count>.W -void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data *sd) { #ifndef PARTY_RECRUIT short level = RFIFOW(fd,2); @@ -12603,7 +12735,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) /// more results: /// 0 = no /// 1 = yes -void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result) +static void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info **results, int count, bool more_result) { #ifndef PARTY_RECRUIT int i, j; @@ -12631,10 +12763,10 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, #endif } -void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete own party booking advertisement (CZ_PARTY_BOOKING_REQ_DELETE). /// 0806 -void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data *sd) { #ifndef PARTY_RECRUIT if(party->booking_delete(sd)) @@ -12651,7 +12783,7 @@ void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) /// 1 = success (auto-removed expired ad) /// 2 = failure /// 3 = nothing registered -void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +static void clif_PartyBookingDeleteAck(struct map_session_data *sd, int flag) { #ifndef PARTY_RECRUIT int fd; @@ -12667,10 +12799,10 @@ void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) #endif } -void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update party booking advertisement (CZ_PARTY_BOOKING_REQ_UPDATE). /// 0808 { <job>.W }*6 -void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data *sd) { #ifndef PARTY_RECRUIT short job[PARTY_BOOKING_JOBS]; @@ -12687,7 +12819,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) /// Notification about new party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_INSERT). /// 0809 <index>.L <char name>.24B <expire time>.L <level>.W <map id>.W { <job>.W }*6 -void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +static void clif_PartyBookingInsertNotify(struct map_session_data *sd, struct party_booking_ad_info *pb_ad) { #ifndef PARTY_RECRUIT int i; @@ -12713,7 +12845,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo /// Notification about updated party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_UPDATE). /// 080a <index>.L { <job>.W }*6 -void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +static void clif_PartyBookingUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info *pb_ad) { #ifndef PARTY_RECRUIT int i; @@ -12734,7 +12866,7 @@ void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_boo /// Notification about deleted party booking advertisement (ZC_PARTY_BOOKING_NOTIFY_DELETE). /// 080b <index>.L -void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +static void clif_PartyBookingDeleteNotify(struct map_session_data *sd, int index) { #ifndef PARTY_RECRUIT uint8 buf[6]; @@ -12749,13 +12881,13 @@ void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) #endif } -void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Modified version of Party Booking System for 2012-04-10 or 2012-04-18 (RagexeRE). /// Code written by mkbu95, Spiria, Yommy and Ind /// Request to register a party booking advertisement (CZ_PARTY_RECRUIT_REQ_REGISTER). /// 08e5 <level>.W <notice>.37B -void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT short level = RFIFOW(fd,2); @@ -12772,7 +12904,7 @@ void clif_parse_PartyRecruitRegisterReq(int fd, struct map_session_data* sd) /// more results: /// 0 = no /// 1 = yes -void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result) +static void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info **results, int count, bool more_result) { #ifdef PARTY_RECRUIT int i; @@ -12807,7 +12939,7 @@ void clif_PartyRecruitSearchAck(int fd, struct party_booking_ad_info** results, /// 0 = success /// 1 = failure /// 2 = already registered -void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) +static void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) { #ifdef PARTY_RECRUIT int fd; @@ -12823,10 +12955,10 @@ void clif_PartyRecruitRegisterAck(struct map_session_data *sd, int flag) #endif } -void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to search for party booking advertisement (CZ_PARTY_RECRUIT_REQ_SEARCH). /// 08e7 <level>.W <map id>.W <last index>.L <result count>.W -void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT short level = RFIFOW(fd, 2); @@ -12840,10 +12972,10 @@ void clif_parse_PartyRecruitSearchReq(int fd, struct map_session_data* sd) #endif } -void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete own party booking advertisement (CZ_PARTY_RECRUIT_REQ_DELETE). /// 08e9 -void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) +static void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT if(party->booking_delete(sd)) @@ -12860,7 +12992,7 @@ void clif_parse_PartyRecruitDeleteReq(int fd, struct map_session_data* sd) /// 1 = success (auto-removed expired ad) /// 2 = failure /// 3 = nothing registered -void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) +static void clif_PartyRecruitDeleteAck(struct map_session_data *sd, int flag) { #ifdef PARTY_RECRUIT int fd; @@ -12876,10 +13008,10 @@ void clif_PartyRecruitDeleteAck(struct map_session_data* sd, int flag) #endif } -void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update party booking advertisement (CZ_PARTY_RECRUIT_REQ_UPDATE). /// 08eb <notice>.37B -void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) +static void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT const char *notice = RFIFOP(fd, 2); @@ -12892,7 +13024,7 @@ void clif_parse_PartyRecruitUpdateReq(int fd, struct map_session_data *sd) /// Notification about new party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_INSERT). /// 08ec <index>.L <expire time>.L <char name>.24B <level>.W <notice>.37B -void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +static void clif_PartyRecruitInsertNotify(struct map_session_data *sd, struct party_booking_ad_info *pb_ad) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+6+24+4+37+1]; @@ -12915,7 +13047,7 @@ void clif_PartyRecruitInsertNotify(struct map_session_data* sd, struct party_boo /// Notification about updated party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_UPDATE). /// 08ed <index>.L <notice>.37B -void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +static void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info *pb_ad) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+37+1]; @@ -12934,7 +13066,7 @@ void clif_PartyRecruitUpdateNotify(struct map_session_data *sd, struct party_boo /// Notification about deleted party booking advertisement (ZC_PARTY_RECRUIT_NOTIFY_DELETE). /// 08ee <index>.L -void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) +static void clif_PartyRecruitDeleteNotify(struct map_session_data *sd, int index) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+1]; @@ -12949,10 +13081,10 @@ void clif_PartyRecruitDeleteNotify(struct map_session_data* sd, int index) #endif } -void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add to filtering list (PARTY_RECRUIT_ADD_FILTERLINGLIST). /// 08ef <index>.L -void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT int index = RFIFOL(fd, 2); @@ -12963,10 +13095,10 @@ void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd #endif } -void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to remove from filtering list (PARTY_RECRUIT_SUB_FILTERLINGLIST). /// 08f0 <GID>.L -void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT int gid = RFIFOL(fd, 2); @@ -12977,10 +13109,10 @@ void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd #endif } -void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to recruit volunteer (PARTY_RECRUIT_REQ_VOLUNTEER). /// 08f1 <index>.L -void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT int index = RFIFOL(fd, 2); @@ -12993,7 +13125,7 @@ void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) /// Request volunteer information (PARTY_RECRUIT_VOLUNTEER_INFO). /// 08f2 <AID>.L <job>.L <level>.W <char name>.24B -void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +static void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned char buf[2+4+4+2+24+1]; @@ -13013,31 +13145,31 @@ void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) #if 0 //Disabled for now. Needs more info. /// 08f3 <packet type>.W <cost>.L -void clif_PartyBookingPersonalSetting(int fd, struct map_session_data *sd) +static void clif_PartyBookingPersonalSetting(int fd, struct map_session_data *sd) { } -void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08f4 <target GID>.L -void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd) { } -void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08f5 <packet len>.W -void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd) { } -void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08f6 <money>.L <map name>.16B -void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd) +static void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd) { } -void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08f7 <result>.B -void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) { } @@ -13048,15 +13180,15 @@ void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) /// REASON_REFUSE = 0x2 /// REASON_NOT_PARTY_MEMBER = 0x3 /// REASON_ETC = 0x4 -void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) +static void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) { } #endif //if 0 -void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08f9 <refuse AID>.L -void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned int aid = RFIFOL(fd, 2); @@ -13067,9 +13199,9 @@ void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) #endif } -void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08fa <index>.L -void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) +static void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned char buf[2+6]; @@ -13083,9 +13215,9 @@ void clif_PartyBookingRefuseVolunteer(unsigned int aid, struct map_session_data #endif } -void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// 08fb <index>.L -void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +static void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) { #ifdef PARTY_RECRUIT int index = RFIFOL(fd, 2); @@ -13097,7 +13229,7 @@ void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) } /// 0909 <index>.L -void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +static void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+1]; @@ -13113,7 +13245,7 @@ void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) } /// 090b <gid>.L <char name>.24B -void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +static void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+24+1]; @@ -13130,7 +13262,7 @@ void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) } /// 090c <gid>.L <char name>.24B -void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +static void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) { #ifdef PARTY_RECRUIT unsigned char buf[2+6+24+1]; @@ -13148,28 +13280,28 @@ void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) #if 0 /// 091c <aid>.L -void clif_PartyBookingCancelVolunteerToPM(struct map_session_data *sd) +static void clif_PartyBookingCancelVolunteerToPM(struct map_session_data *sd) { } /// 0971 <pm_aid>.L -void clif_PartyBookingRefuseVolunteerToPM(struct map_session_data *sd) +static void clif_PartyBookingRefuseVolunteerToPM(struct map_session_data *sd) { } #endif //if 0 -void clif_parse_CloseVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_CloseVending(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to close own vending (CZ_REQ_CLOSESTORE). /// 012e -void clif_parse_CloseVending(int fd, struct map_session_data* sd) +static void clif_parse_CloseVending(int fd, struct map_session_data *sd) { vending->close(sd); } -void clif_parse_VendingListReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_VendingListReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to open a vending shop (CZ_REQ_BUY_FROMMC). /// 0130 <account id>.L -void clif_parse_VendingListReq(int fd, struct map_session_data* sd) +static void clif_parse_VendingListReq(int fd, struct map_session_data *sd) { if( sd->npc_id ) {// using an NPC return; @@ -13177,10 +13309,10 @@ void clif_parse_VendingListReq(int fd, struct map_session_data* sd) vending->list(sd,RFIFOL(fd,2)); } -void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PurchaseReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Shop item(s) purchase request (CZ_PC_PURCHASE_ITEMLIST_FROMMC). /// 0134 <packet len>.W <account id>.L { <amount>.W <index>.W }* -void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) +static void clif_parse_PurchaseReq(int fd, struct map_session_data *sd) { int len = (int)RFIFOW(fd, 2) - 8; int id; @@ -13198,10 +13330,10 @@ void clif_parse_PurchaseReq(int fd, struct map_session_data* sd) sd->vended_id = 0; } -void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PurchaseReq2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Shop item(s) purchase request (CZ_PC_PURCHASE_ITEMLIST_FROMMC2). /// 0801 <packet len>.W <account id>.L <unique id>.L { <amount>.W <index>.W }* -void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) +static void clif_parse_PurchaseReq2(int fd, struct map_session_data *sd) { int len = (int)RFIFOW(fd, 2) - 12; int aid; @@ -13220,14 +13352,15 @@ void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd) sd->vended_id = 0; } -void clif_parse_OpenVending(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_OpenVending(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Confirm or cancel the shop preparation window. /// 012f <packet len>.W <shop name>.80B { <index>.W <amount>.W <price>.L }* (CZ_REQ_OPENSTORE) /// 01b2 <packet len>.W <shop name>.80B <result>.B { <index>.W <amount>.W <price>.L }* (CZ_REQ_OPENSTORE2) /// result: /// 0 = canceled /// 1 = open -void clif_parse_OpenVending(int fd, struct map_session_data* sd) { +static void clif_parse_OpenVending(int fd, struct map_session_data *sd) +{ int len = (int)RFIFOW(fd, 2) - 85; const char *message; bool flag; @@ -13260,10 +13393,10 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) { vending->open(sd, message, data, len/8); } -void clif_parse_CreateGuild(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CreateGuild(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Guild creation request (CZ_REQ_MAKE_GUILD). /// 0165 <char id>.L <guild name>.24B -void clif_parse_CreateGuild(int fd,struct map_session_data *sd) +static void clif_parse_CreateGuild(int fd, struct map_session_data *sd) { char name[NAME_LENGTH]; safestrncpy(name, RFIFOP(fd,6), NAME_LENGTH); @@ -13276,15 +13409,15 @@ void clif_parse_CreateGuild(int fd,struct map_session_data *sd) guild->create(sd, name); } -void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request for guild window interface permissions (CZ_REQ_GUILD_MENUINTERFACE). /// 014d -void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) +static void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) { clif->guild_masterormember(sd); } -void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request for guild window information (CZ_REQ_GUILD_MENU). /// 014f <type>.L /// type: @@ -13295,7 +13428,7 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) __attribut /// 4 = expulsion list /// 5 = unknown (GM_ALLGUILDLIST) /// 6 = notice -void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) +static void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) { if( !sd->status.guild_id && !sd->bg_id ) return; @@ -13325,10 +13458,10 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) } } -void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update guild positions (CZ_REG_CHANGE_GUILD_POSITIONINFO). /// 0161 <packet len>.W { <position id>.L <mode>.L <ranking>.L <pay rate>.L <name>.24B }* -void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) +static void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) { int i; int count = (RFIFOW(fd, 2) - 4) / 40; @@ -13342,10 +13475,10 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) } } -void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update the position of guild members (CZ_REQ_CHANGE_MEMBERPOS). /// 0155 <packet len>.W { <account id>.L <char id>.L <position id>.L }* -void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) +static void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) { int i; int len = RFIFOW(fd, 2); @@ -13369,10 +13502,10 @@ void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) } } -void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildRequestEmblem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request for guild emblem data (CZ_REQ_GUILD_EMBLEM_IMG). /// 0151 <guild id>.L -void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) +static void clif_parse_GuildRequestEmblem(int fd, struct map_session_data *sd) { struct guild* g; int guild_id = RFIFOL(fd,2); @@ -13382,7 +13515,8 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) } /// Validates data of a guild emblem (compressed bitmap) -bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { +static bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) +{ enum e_bitmapconst { RGBTRIPLE_SIZE = 3, // sizeof(RGBTRIPLE) RGBQUAD_SIZE = 4, // sizeof(RGBQUAD) @@ -13506,10 +13640,10 @@ bool clif_validate_emblem(const uint8 *emblem, unsigned long emblem_len) { return true; } -void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildChangeEmblem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to update the guild emblem (CZ_REGISTER_GUILD_EMBLEM_IMG). /// 0153 <packet len>.W <emblem data>.?B -void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) +static void clif_parse_GuildChangeEmblem(int fd, struct map_session_data *sd) { unsigned int emblem_len = RFIFOW(fd,2)-4; const uint8* emblem = RFIFOP(fd,4); @@ -13526,10 +13660,10 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) guild->change_emblem(sd, emblem_len, (const char*)emblem); } -void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_GuildChangeNotice(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Guild notice update request (CZ_GUILD_NOTICE). /// 016e <guild id>.L <msg1>.60B <msg2>.120B -void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) +static void clif_parse_GuildChangeNotice(int fd, struct map_session_data *sd) { int guild_id = RFIFOL(fd,2); char *msg1 = NULL, *msg2 = NULL; @@ -13551,7 +13685,8 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) } // Helper function for guild invite functions -bool clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { +static bool clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) +{ if ( t_sd == NULL )// not online or does not exist return false; @@ -13577,20 +13712,21 @@ bool clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_sessi return true; } -void clif_parse_GuildInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Guild invite request (CZ_REQ_JOIN_GUILD). /// 0168 <account id>.L <inviter account id>.L <inviter char id>.L -void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { +static void clif_parse_GuildInvite(int fd, struct map_session_data *sd) +{ struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); if (!clif_sub_guild_invite(fd, sd, t_sd)) return; } -void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Guild invite request (/guildinvite) (CZ_REQ_JOIN_GUILD2). /// 0916 <char name>.24B -void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +static void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) { char nick[NAME_LENGTH]; struct map_session_data *t_sd = NULL; @@ -13601,21 +13737,22 @@ void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) clif_sub_guild_invite(fd, sd, t_sd); } -void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildReplyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to guild invitation (CZ_JOIN_GUILD). /// 016b <guild id>.L <answer>.L /// answer: /// 0 = refuse /// 1 = accept -void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) +static void clif_parse_GuildReplyInvite(int fd, struct map_session_data *sd) { guild->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); } -void clif_parse_GuildLeave(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildLeave(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to leave guild (CZ_REQ_LEAVE_GUILD). /// 0159 <guild id>.L <account id>.L <char id>.L <reason>.40B -void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { +static void clif_parse_GuildLeave(int fd, struct map_session_data *sd) +{ if(map->list[sd->bl.m].flag.guildlock) { clif->message(fd, msg_fd(fd,228)); // Guild modification is disabled in this map. return; @@ -13628,10 +13765,11 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) { guild->leave(sd,RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOP(fd,14)); } -void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildExpulsion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to expel a member of a guild (CZ_REQ_BAN_GUILD). /// 015b <guild id>.L <account id>.L <char id>.L <reason>.40B -void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { +static void clif_parse_GuildExpulsion(int fd, struct map_session_data *sd) +{ if( map->list[sd->bl.m].flag.guildlock || sd->bg_id ) { clif->message(fd, msg_fd(fd,228)); // Guild modification is disabled in this map. return; @@ -13649,8 +13787,8 @@ void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { * @param fd The incoming file descriptor. * @param sd The related character. */ -void clif_parse_GuildMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_GuildMessage(int fd, struct map_session_data *sd) +static void clif_parse_GuildMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildMessage(int fd, struct map_session_data *sd) { const struct packet_chat_message *packet = RP2PTR(fd); char message[CHAT_SIZE_MAX + NAME_LENGTH + 3 + 1]; @@ -13664,10 +13802,11 @@ void clif_parse_GuildMessage(int fd, struct map_session_data *sd) guild->send_message(sd, message); } -void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Guild alliance request (CZ_REQ_ALLY_GUILD). /// 0170 <account id>.L <inviter account id>.L <inviter char id>.L -void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { +static void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) +{ struct map_session_data *t_sd; if(!sd->state.gmaster_flag) @@ -13689,24 +13828,25 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { guild->reqalliance(sd,t_sd); } -void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to a guild alliance request (CZ_ALLY_GUILD). /// 0172 <inviter account id>.L <answer>.L /// answer: /// 0 = refuse /// 1 = accept -void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) +static void clif_parse_GuildReplyAlliance(int fd, struct map_session_data *sd) { guild->reply_reqalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); } -void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete a guild alliance or opposition (CZ_REQ_DELETE_RELATED_GUILD). /// 0183 <opponent guild id>.L <relation>.L /// relation: /// 0 = Ally /// 1 = Enemy -void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { +static void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) +{ if(!sd->state.gmaster_flag) return; @@ -13717,10 +13857,11 @@ void clif_parse_GuildDelAlliance(int fd, struct map_session_data *sd) { guild->delalliance(sd,RFIFOL(fd,2),RFIFOL(fd,6)); } -void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to set a guild as opposition (CZ_REQ_HOSTILE_GUILD). /// 0180 <account id>.L -void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { +static void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) +{ struct map_session_data *t_sd; if(!sd->state.gmaster_flag) @@ -13742,13 +13883,13 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) { guild->opposition(sd,t_sd); } -void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GuildBreak(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete own guild (CZ_REQ_DISORGANIZE_GUILD). /// 015d <key>.40B /// key: /// now guild name; might have been (intended) email, since the /// field name and size is same as the one in CH_DELETE_CHAR. -void clif_parse_GuildBreak(int fd, struct map_session_data *sd) +static void clif_parse_GuildBreak(int fd, struct map_session_data *sd) { char key[40]; if( map->list[sd->bl.m].flag.guildlock ) { @@ -13762,7 +13903,7 @@ void clif_parse_GuildBreak(int fd, struct map_session_data *sd) /// Pet /// -void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke a pet menu action (CZ_COMMAND_PET). /// 01a1 <type>.B /// type: @@ -13771,23 +13912,23 @@ void clif_parse_PetMenu(int fd, struct map_session_data *sd) __attribute__((nonn /// 2 = performance /// 3 = return to egg /// 4 = unequip accessory -void clif_parse_PetMenu(int fd, struct map_session_data *sd) +static void clif_parse_PetMenu(int fd, struct map_session_data *sd) { pet->menu(sd,RFIFOB(fd,2)); } -void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CatchPet(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Attempt to tame a monster (CZ_TRYCAPTURE_MONSTER). /// 019f <id>.L -void clif_parse_CatchPet(int fd, struct map_session_data *sd) +static void clif_parse_CatchPet(int fd, struct map_session_data *sd) { pet->catch_process2(sd,RFIFOL(fd,2)); } -void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SelectEgg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to pet incubator egg selection dialog (CZ_SELECT_PETEGG). /// 01a7 <index>.W -void clif_parse_SelectEgg(int fd, struct map_session_data *sd) +static void clif_parse_SelectEgg(int fd, struct map_session_data *sd) { if (sd->menuskill_id != SA_TAMINGMONSTER || sd->menuskill_val != -1) { return; @@ -13796,7 +13937,7 @@ void clif_parse_SelectEgg(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); } -void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to display pet's emotion/talk (CZ_PET_ACT). /// 01a9 <data>.L /// data: @@ -13821,24 +13962,24 @@ void clif_parse_SendEmotion(int fd, struct map_session_data *sd) __attribute__(( /// 2 = satisfied (noting) /// 3 = stuffed (full) /// 4 = full (so_full) -void clif_parse_SendEmotion(int fd, struct map_session_data *sd) +static void clif_parse_SendEmotion(int fd, struct map_session_data *sd) { if(sd->pd) clif->pet_emotion(sd->pd,RFIFOL(fd,2)); } -void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ChangePetName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change pet's name (CZ_RENAME_PET). /// 01a5 <name>.24B -void clif_parse_ChangePetName(int fd, struct map_session_data *sd) +static void clif_parse_ChangePetName(int fd, struct map_session_data *sd) { pet->change_name(sd, RFIFOP(fd,2)); } -void clif_parse_pet_evolution(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to Evolve the pet (CZ_PET_EVOLUTION) [Dastgir/Hercules] /// 09fb <Length>.W <EvolvedPetEggID>.W {<index>.W <amount>.W}*items -void clif_parse_pet_evolution(int fd, struct map_session_data *sd) +static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) { const struct PACKET_CZ_PET_EVOLUTION *p = RP2PTR(fd); int i = 0, idx, petIndex; @@ -13935,7 +14076,8 @@ void clif_parse_pet_evolution(int fd, struct map_session_data *sd) * Result of Pet Evolution (ZC_PET_EVOLUTION_RESULT) * 0x9fc <Result>.L */ -void clif_pet_evolution_result(int fd, enum pet_evolution_result result) { +static void clif_pet_evolution_result(int fd, enum pet_evolution_result result) +{ #if PACKETVER >= 20140122 WFIFOHEAD(fd, packet_len(0x9fc)); WFIFOW(fd, 0) = 0x9fc; @@ -13944,12 +14086,13 @@ void clif_pet_evolution_result(int fd, enum pet_evolution_result result) { #endif } -void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMKick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /kill (CZ_DISCONNECT_CHARACTER). /// Request to disconnect a character. /// 00cc <account id>.L /// NOTE: Also sent when using GM right click menu "(name) force to quit" -void clif_parse_GMKick(int fd, struct map_session_data *sd) { +static void clif_parse_GMKick(int fd, struct map_session_data *sd) +{ struct block_list *target; int tid; @@ -14003,17 +14146,18 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) { } } -void clif_parse_GMKickAll(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_GMKickAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /killall (CZ_DISCONNECT_ALL_CHARACTER). /// Request to disconnect all characters. /// 00ce -void clif_parse_GMKickAll(int fd, struct map_session_data* sd) { +static void clif_parse_GMKickAll(int fd, struct map_session_data *sd) +{ char cmd[15]; sprintf(cmd,"%ckickall",atcommand->at_symbol); atcommand->exec(fd, sd, cmd, true); } -void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /remove (CZ_REMOVE_AID). /// Request to warp to a character with given login ID. /// 01ba <account name>.24B @@ -14021,7 +14165,7 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd) __attribute__((nonn /// /shift (CZ_SHIFT). /// Request to warp to a character with given name. /// 01bb <char name>.24B -void clif_parse_GMShift(int fd, struct map_session_data *sd) +static void clif_parse_GMShift(int fd, struct map_session_data *sd) { // FIXME: remove is supposed to receive account name for clients prior 20100803RE char player_name[NAME_LENGTH]; @@ -14033,11 +14177,12 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd) atcommand->exec(fd, sd, command, true); } -void clif_parse_GMRemove2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_GMRemove2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /remove (CZ_REMOVE_AID_SSO). /// Request to warp to a character with given account ID. /// 0843 <account id>.L -void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { +static void clif_parse_GMRemove2(int fd, struct map_session_data *sd) +{ int account_id; struct map_session_data* pl_sd; @@ -14049,7 +14194,7 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd) { } } -void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /recall (CZ_RECALL). /// Request to summon a player with given login ID to own position. /// 01bc <account name>.24B @@ -14057,7 +14202,7 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd) __attribute__((non /// /summon (CZ_RECALL_GID). /// Request to summon a player with given name to own position. /// 01bd <char name>.24B -void clif_parse_GMRecall(int fd, struct map_session_data *sd) +static void clif_parse_GMRecall(int fd, struct map_session_data *sd) { // FIXME: recall is supposed to receive account name for clients prior 20100803RE char player_name[NAME_LENGTH]; @@ -14069,11 +14214,12 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd) atcommand->exec(fd, sd, command, true); } -void clif_parse_GMRecall2(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_GMRecall2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /recall (CZ_RECALL_SSO). /// Request to summon a player with given account ID to own position. /// 0842 <account id>.L -void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { +static void clif_parse_GMRecall2(int fd, struct map_session_data *sd) +{ int account_id; struct map_session_data* pl_sd; @@ -14085,7 +14231,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd) { } } -void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /item /monster (CZ_ITEM_CREATE). /// Request to execute GM commands. /// usage: @@ -14099,7 +14245,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) __attribute /// /item agitinvest - reset current global agit investments.(not yet implemented) /// 013f <item/mob name>.24B /// 09ce <item/mob name>.100B [Ind/Yommy<3] -void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) +static void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) { const struct packet_gm_monster_item *p = RP2PTR(fd); int i, count; @@ -14155,12 +14301,13 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) } } -void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMHide(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /hide (CZ_CHANGE_EFFECTSTATE). /// 019d <effect state>.L /// effect state: /// TODO: Any OPTION_* ? -void clif_parse_GMHide(int fd, struct map_session_data *sd) { +static void clif_parse_GMHide(int fd, struct map_session_data *sd) +{ char cmd[6]; sprintf(cmd,"%chide",atcommand->at_symbol); @@ -14168,14 +14315,15 @@ void clif_parse_GMHide(int fd, struct map_session_data *sd) { atcommand->exec(fd, sd, cmd, true); } -void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMReqNoChat(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to adjust player's manner points (CZ_REQ_GIVE_MANNER_POINT). /// 0149 <account id>.L <type>.B <value>.W /// type: /// 0 = positive points /// 1 = negative points /// 2 = self mute (+10 minutes) -void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { +static void clif_parse_GMReqNoChat(int fd, struct map_session_data *sd) +{ int id, type, value; struct map_session_data *dstsd; char command[NAME_LENGTH+15]; @@ -14222,11 +14370,11 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) { atcommand->exec(fd, sd, command, true); } -void clif_parse_GMRc(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_GMRc(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /rc (CZ_REQ_GIVE_MANNER_BYNAME). /// GM adjustment of a player's manner value by -60. /// 0212 <char name>.24B -void clif_parse_GMRc(int fd, struct map_session_data* sd) +static void clif_parse_GMRc(int fd, struct map_session_data *sd) { char command[NAME_LENGTH+15]; char name[NAME_LENGTH]; @@ -14239,7 +14387,8 @@ void clif_parse_GMRc(int fd, struct map_session_data* sd) /// Result of request to resolve account name (ZC_ACK_ACCOUNTNAME). /// 01e0 <account id>.L <account name>.24B -void clif_account_name(struct map_session_data* sd, int account_id, const char* accname) { +static void clif_account_name(struct map_session_data *sd, int account_id, const char *accname) +{ int fd; nullpo_retv(sd); @@ -14251,10 +14400,10 @@ void clif_account_name(struct map_session_data* sd, int account_id, const char* WFIFOSET(fd,packet_len(0x1e0)); } -void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// GM requesting account name (for right-click gm menu) (CZ_REQ_ACCOUNTNAME). /// 01df <account id>.L -void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) +static void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) { int account_id = RFIFOL(fd,2); @@ -14262,14 +14411,15 @@ void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd) clif->account_name(sd, account_id, ""); // insert account name here >_< } -void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /changemaptype <x> <y> <type> (CZ_CHANGE_MAPTYPE). /// GM single cell type change request. /// 0198 <x>.W <y>.W <type>.W /// type: /// 0 = not walkable /// 1 = walkable -void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { +static void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) +{ int x,y,type; if (!pc_has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE)) @@ -14284,14 +14434,14 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) { //FIXME: once players leave the map, the client 'forgets' this information. } -void clif_parse_PMIgnore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PMIgnore(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /in /ex (CZ_SETTING_WHISPER_PC). /// Request to allow/deny whispers from a nick. /// 00cf <nick>.24B <type>.B /// type: /// 0 = (/ex nick) deny speech from nick /// 1 = (/in nick) allow speech from nick -void clif_parse_PMIgnore(int fd, struct map_session_data* sd) +static void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { char nick[NAME_LENGTH]; uint8 type; @@ -14338,14 +14488,14 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd) clif->wisexin(sd, type, 0); // success } -void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /inall /exall (CZ_SETTING_WHISPER_STATE). /// Request to allow/deny all whispers. /// 00d0 <type>.B /// type: /// 0 = (/exall) deny all speech /// 1 = (/inall) allow all speech -void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) +static void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) { int type = RFIFOB(fd,2), flag; @@ -14376,7 +14526,8 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd) /// Whisper ignore list (ZC_WHISPER_LIST). /// 00d4 <packet len>.W { <char name>.24B }* -void clif_PMIgnoreList(struct map_session_data* sd) { +static void clif_PMIgnoreList(struct map_session_data *sd) +{ int i, fd; nullpo_retv(sd); @@ -14392,18 +14543,18 @@ void clif_PMIgnoreList(struct map_session_data* sd) { WFIFOSET(fd,WFIFOW(fd,2)); } -void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PMIgnoreList(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Whisper ignore list request (CZ_REQ_WHISPER_LIST). /// 00d3 -void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd) +static void clif_parse_PMIgnoreList(int fd, struct map_session_data *sd) { clif->PMIgnoreList(sd); } -void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke the /doridori recovery bonus (CZ_DORIDORI). /// 01e7 -void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) +static void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) { if (sd->state.doridori) return; @@ -14420,7 +14571,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) } } -void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke the effect of super novice's guardian angel prayer (CZ_CHOPOKGI). /// 01ed /// Note: This packet is caused by 7 lines of any text, followed by @@ -14429,7 +14580,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) __at /// "Dear angel, can you hear my voice?" /// "I am" (space separated player name) "Super Novice~" /// "Help me out~ Please~ T_T" -void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) +static void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) { /* [Ind/Hercules] */ /* game client is currently broken on this (not sure the packetver range) */ @@ -14458,7 +14609,8 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) /// state: /// 0 = online /// 1 = offline -void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online) { +static void clif_friendslist_toggle(struct map_session_data *sd, int account_id, int char_id, int online) +{ int i, fd; nullpo_retv(sd); @@ -14483,7 +14635,7 @@ void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int cha } //Sub-function called from clif_foreachclient to toggle friends on/off [Skotlex] -int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) +static int clif_friendslist_toggle_sub(struct map_session_data *sd, va_list ap) { int account_id, char_id, online; account_id = va_arg(ap, int); @@ -14496,7 +14648,7 @@ int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) /// Sends the whole friends list (ZC_FRIENDS_LIST). /// 0201 <packet len>.W { <account id>.L <char id>.L <name>.24B }* /// 0201 <packet len>.W { <account id>.L <char id>.L }* -void clif_friendslist_send(struct map_session_data *sd) +static void clif_friendslist_send(struct map_session_data *sd) { int i = 0, n, fd = sd->fd; @@ -14535,7 +14687,7 @@ void clif_friendslist_send(struct map_session_data *sd) /// 1 = MsgStringTable[822]="(%s) does not want to be friends with you." /// 2 = MsgStringTable[819]="Your Friend List is full." /// 3 = MsgStringTable[820]="(%s)'s Friend List is full." -void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) +static void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type) { int fd; nullpo_retv(sd); @@ -14554,7 +14706,8 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat /// Asks a player for permission to be added as friend (ZC_REQ_ADD_FRIENDS). /// 0207 <req account id>.L <req char id>.L <req char name>.24B -void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name) { +static void clif_friendlist_req(struct map_session_data *sd, int account_id, int char_id, const char *name) +{ int fd; nullpo_retv(sd); @@ -14567,10 +14720,10 @@ void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_i WFIFOSET(fd,packet_len(0x207)); } -void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add a player as friend (CZ_ADD_FRIENDS). /// 0202 <name>.24B -void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) +static void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) { struct map_session_data *f_sd; int i; @@ -14618,14 +14771,14 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) clif->friendlist_req(f_sd, sd->status.account_id, sd->status.char_id, sd->status.name); } -void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to a friend add request (CZ_ACK_REQ_ADD_FRIENDS). /// 0208 <inviter account id>.L <inviter char id>.L <result>.B /// 0208 <inviter account id>.L <inviter char id>.L <result>.L (PACKETVER >= 6) /// result: /// 0 = rejected /// 1 = accepted -void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) +static void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) { struct map_session_data *f_sd; int account_id; @@ -14686,10 +14839,10 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) } } -void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete a friend (CZ_DELETE_FRIENDS). /// 0203 <account id>.L <char id>.L -void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) +static void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) { struct map_session_data *f_sd = NULL; int account_id, char_id; @@ -14752,7 +14905,8 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) /// /pvpinfo list (ZC_ACK_PVPPOINT). /// 0210 <char id>.L <account id>.L <win point>.L <lose point>.L <point>.L -void clif_PVPInfo(struct map_session_data* sd) { +static void clif_PVPInfo(struct map_session_data *sd) +{ int fd; nullpo_retv(sd); @@ -14767,10 +14921,10 @@ void clif_PVPInfo(struct map_session_data* sd) { WFIFOSET(fd, packet_len(0x210)); } -void clif_parse_PVPInfo(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_PVPInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /pvpinfo (CZ_REQ_PVPPOINT). /// 020f <char id>.L <account id>.L -void clif_parse_PVPInfo(int fd,struct map_session_data *sd) +static void clif_parse_PVPInfo(int fd, struct map_session_data *sd) { // TODO: Is there a way to use this on an another player (char/acc id)? clif->PVPInfo(sd); @@ -14779,7 +14933,8 @@ void clif_parse_PVPInfo(int fd,struct map_session_data *sd) /// Ranking list /// ranking pointlist { <name>.24B <point>.L }*10 -void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { +static void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) +{ const char* name; struct fame_list* list; int i; @@ -14812,7 +14967,7 @@ void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { } /// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING) -void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) +static void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { #if PACKETVER >= 20120502 int fd; @@ -14835,11 +14990,12 @@ void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) #endif } -void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ranklist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* * 097c <type> (CZ_REQ_RANKING) * */ -void clif_parse_ranklist(int fd, struct map_session_data *sd) { +static void clif_parse_ranklist(int fd, struct map_session_data *sd) +{ int16 type = RFIFOW(fd, 2); //type switch( type ) { @@ -14852,7 +15008,7 @@ void clif_parse_ranklist(int fd, struct map_session_data *sd) { } // 097e <RankingType>.W <point>.L <TotalPoint>.L (ZC_UPDATE_RANKING_POINT) -void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) +static void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { #if PACKETVER < 20120502 switch( type ) { @@ -14878,7 +15034,8 @@ void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type t /// /blacksmith list (ZC_BLACKSMITH_RANK). /// 0219 { <name>.24B }*10 { <point>.L }*10 -void clif_blacksmith(struct map_session_data* sd) { +static void clif_blacksmith(struct map_session_data *sd) +{ int fd; nullpo_retv(sd); @@ -14889,16 +15046,18 @@ void clif_blacksmith(struct map_session_data* sd) { WFIFOSET(fd, packet_len(0x219)); } -void clif_parse_Blacksmith(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Blacksmith(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /blacksmith (CZ_BLACKSMITH_RANK). /// 0217 -void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { +static void clif_parse_Blacksmith(int fd, struct map_session_data *sd) +{ clif->blacksmith(sd); } /// Notification about backsmith points (ZC_BLACKSMITH_POINT). /// 021b <points>.L <total points>.L -void clif_fame_blacksmith(struct map_session_data *sd, int points) { +static void clif_fame_blacksmith(struct map_session_data *sd, int points) +{ int fd; nullpo_retv(sd); @@ -14912,7 +15071,8 @@ void clif_fame_blacksmith(struct map_session_data *sd, int points) { /// /alchemist list (ZC_ALCHEMIST_RANK). /// 021a { <name>.24B }*10 { <point>.L }*10 -void clif_alchemist(struct map_session_data* sd) { +static void clif_alchemist(struct map_session_data *sd) +{ int fd; nullpo_retv(sd); @@ -14923,16 +15083,18 @@ void clif_alchemist(struct map_session_data* sd) { WFIFOSET(fd, packet_len(0x21a)); } -void clif_parse_Alchemist(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Alchemist(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /alchemist (CZ_ALCHEMIST_RANK). /// 0218 -void clif_parse_Alchemist(int fd,struct map_session_data *sd) { +static void clif_parse_Alchemist(int fd, struct map_session_data *sd) +{ clif->alchemist(sd); } /// Notification about alchemist points (ZC_ALCHEMIST_POINT). /// 021c <points>.L <total points>.L -void clif_fame_alchemist(struct map_session_data *sd, int points) { +static void clif_fame_alchemist(struct map_session_data *sd, int points) +{ int fd; nullpo_retv(sd); @@ -14946,7 +15108,8 @@ void clif_fame_alchemist(struct map_session_data *sd, int points) { /// /taekwon list (ZC_TAEKWON_RANK). /// 0226 { <name>.24B }*10 { <point>.L }*10 -void clif_taekwon(struct map_session_data* sd) { +static void clif_taekwon(struct map_session_data *sd) +{ int fd; nullpo_retv(sd); @@ -14957,16 +15120,18 @@ void clif_taekwon(struct map_session_data* sd) { WFIFOSET(fd, packet_len(0x226)); } -void clif_parse_Taekwon(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Taekwon(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /taekwon (CZ_TAEKWON_RANK). /// 0225 -void clif_parse_Taekwon(int fd,struct map_session_data *sd) { +static void clif_parse_Taekwon(int fd, struct map_session_data *sd) +{ clif->taekwon(sd); } /// Notification about taekwon points (ZC_TAEKWON_POINT). /// 0224 <points>.L <total points>.L -void clif_fame_taekwon(struct map_session_data *sd, int points) { +static void clif_fame_taekwon(struct map_session_data *sd, int points) +{ int fd; nullpo_retv(sd); @@ -14980,7 +15145,8 @@ void clif_fame_taekwon(struct map_session_data *sd, int points) { /// /pk list (ZC_KILLER_RANK). /// 0238 { <name>.24B }*10 { <point>.L }*10 -void clif_ranking_pk(struct map_session_data* sd) { +static void clif_ranking_pk(struct map_session_data *sd) +{ int i, fd; nullpo_retv(sd); @@ -14994,21 +15160,22 @@ void clif_ranking_pk(struct map_session_data* sd) { WFIFOSET(fd, packet_len(0x238)); } -void clif_parse_RankingPk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RankingPk(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /pk (CZ_KILLER_RANK). /// 0237 -void clif_parse_RankingPk(int fd,struct map_session_data *sd) { +static void clif_parse_RankingPk(int fd, struct map_session_data *sd) +{ clif->ranking_pk(sd); } -void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_FeelSaveOk(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// SG Feel save OK [Komurka] (CZ_AGREE_STARPLACE). /// 0254 <which>.B /// which: /// 0 = sun /// 1 = moon /// 2 = star -void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) +static void clif_parse_FeelSaveOk(int fd, struct map_session_data *sd) { int i; if (sd->menuskill_id != SG_FEEL) @@ -15034,7 +15201,7 @@ void clif_parse_FeelSaveOk(int fd,struct map_session_data *sd) /// 0 = sun /// 1 = moon /// 2 = star -void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) +static void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) { nullpo_retv(sd); WFIFOHEAD(fd,packet_len(0x253)); @@ -15045,18 +15212,18 @@ void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv) sd->menuskill_val = skill_lv; } -void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change homunculus' name (CZ_RENAME_MER). /// 0231 <name>.24B -void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) +static void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) { homun->change_name(sd, RFIFOP(fd,2)); } -void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to warp/move homunculus/mercenary to it's owner (CZ_REQUEST_MOVETOOWNER). /// 0234 <id>.L -void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) +static void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) { int id = RFIFOL(fd,2); // Mercenary or Homunculus struct block_list *bl = NULL; @@ -15074,10 +15241,10 @@ void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) unit->walktoxy(bl, ud->to_x, ud->to_y, 4); } -void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to move homunculus/mercenary (CZ_REQUEST_MOVENPC). /// 0232 <id>.L <position data>.3B -void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) +static void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) { int id = RFIFOL(fd,2); // Mercenary or Homunculus struct block_list *bl = NULL; @@ -15095,12 +15262,12 @@ void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) unit->walktoxy(bl, x, y, 4); } -void clif_parse_HomAttack(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HomAttack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to do an action with homunculus/mercenary (CZ_REQUEST_ACTNPC). /// 0233 <id>.L <target id>.L <action>.B /// action: /// always 0 -void clif_parse_HomAttack(int fd,struct map_session_data *sd) +static void clif_parse_HomAttack(int fd, struct map_session_data *sd) { struct block_list *bl = NULL; int id = RFIFOL(fd,2), @@ -15117,7 +15284,7 @@ void clif_parse_HomAttack(int fd,struct map_session_data *sd) unit->attack(bl, target_id, action_type != 0); } -void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke a homunculus menu action (CZ_COMMAND_MER). /// 022d <type>.W <command>.B /// type: @@ -15126,7 +15293,8 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) __attribute__((nonn /// 0 = homunculus information /// 1 = feed /// 2 = delete -void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] +static void clif_parse_HomMenu(int fd, struct map_session_data *sd) +{ //[orn] int cmd; cmd = RFIFOW(fd,0); @@ -15137,10 +15305,11 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] homun->menu(sd,RFIFOB(fd,packet_db[cmd].pos[1])); } -void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_AutoRevive(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to resurrect oneself using Token of Siegfried (CZ_STANDING_RESURRECTION). /// 0292 -void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { +static void clif_parse_AutoRevive(int fd, struct map_session_data *sd) +{ int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); int hpsp = 100; @@ -15172,7 +15341,8 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { /// <itemdefPower>.W <plusdefPower>.W <mdefPower>.W <plusmdefPower>.W /// <hitSuccessValue>.W <avoidSuccessValue>.W <plusAvoidSuccessValue>.W /// <criticalSuccessValue>.W <ASPD>.W <plusASPD>.W -void clif_check(int fd, struct map_session_data* pl_sd) { +static void clif_check(int fd, struct map_session_data *pl_sd) +{ nullpo_retv(pl_sd); WFIFOHEAD(fd,packet_len(0x214)); WFIFOW(fd, 0) = 0x214; @@ -15205,11 +15375,11 @@ void clif_check(int fd, struct map_session_data* pl_sd) { WFIFOSET(fd,packet_len(0x214)); } -void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Check(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// /check (CZ_REQ_STATUS_GM). /// Request character's status values. /// 0213 <char name>.24B -void clif_parse_Check(int fd, struct map_session_data *sd) +static void clif_parse_Check(int fd, struct map_session_data *sd) { char charname[NAME_LENGTH]; struct map_session_data* pl_sd; @@ -15235,7 +15405,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd) /// result: /// 0 = success /// 1 = failure -void clif_Mail_setattachment(int fd, int index, uint8 flag) +static void clif_Mail_setattachment(int fd, int index, uint8 flag) { WFIFOHEAD(fd,packet_len(0x255)); WFIFOW(fd,0) = 0x255; @@ -15250,7 +15420,7 @@ void clif_Mail_setattachment(int fd, int index, uint8 flag) /// 0 = success /// 1 = failure /// 2 = too many items -void clif_Mail_getattachment(int fd, uint8 flag) +static void clif_Mail_getattachment(int fd, uint8 flag) { WFIFOHEAD(fd,packet_len(0x245)); WFIFOW(fd,0) = 0x245; @@ -15263,7 +15433,7 @@ void clif_Mail_getattachment(int fd, uint8 flag) /// result: /// 0 = success /// 1 = recipient does not exist -void clif_Mail_send(int fd, bool fail) +static void clif_Mail_send(int fd, bool fail) { WFIFOHEAD(fd,packet_len(0x249)); WFIFOW(fd,0) = 0x249; @@ -15276,7 +15446,7 @@ void clif_Mail_send(int fd, bool fail) /// result: /// 0 = success /// 1 = failure -void clif_Mail_delete(int fd, int mail_id, short fail) +static void clif_Mail_delete(int fd, int mail_id, short fail) { WFIFOHEAD(fd, packet_len(0x257)); WFIFOW(fd,0) = 0x257; @@ -15290,7 +15460,7 @@ void clif_Mail_delete(int fd, int mail_id, short fail) /// result: /// 0 = success /// 1 = failure -void clif_Mail_return(int fd, int mail_id, short fail) +static void clif_Mail_return(int fd, int mail_id, short fail) { WFIFOHEAD(fd,packet_len(0x274)); WFIFOW(fd,0) = 0x274; @@ -15301,7 +15471,7 @@ void clif_Mail_return(int fd, int mail_id, short fail) /// Notification about new mail (ZC_MAIL_RECEIVE). /// 024a <mail id>.L <title>.40B <sender>.24B -void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) +static void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) { nullpo_retv(sender); nullpo_retv(title); @@ -15318,7 +15488,7 @@ void clif_Mail_new(int fd, int mail_id, const char *sender, const char *title) /// type: /// 0 = open /// 1 = close -void clif_Mail_window(int fd, int flag) +static void clif_Mail_window(int fd, int flag) { WFIFOHEAD(fd,packet_len(0x260)); WFIFOW(fd,0) = 0x260; @@ -15331,7 +15501,7 @@ void clif_Mail_window(int fd, int flag) /// read: /// 0 = unread /// 1 = read -void clif_Mail_refreshinbox(struct map_session_data *sd) +static void clif_Mail_refreshinbox(struct map_session_data *sd) { int fd = sd->fd; struct mail_data *md; @@ -15368,10 +15538,10 @@ void clif_Mail_refreshinbox(struct map_session_data *sd) } } -void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Mail inbox list request (CZ_MAIL_GET_LIST). /// 023f -void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) +static void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) { struct mail_data* md = &sd->mail.inbox; @@ -15388,7 +15558,7 @@ void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd) /// 0242 <packet len>.W <mail id>.L <title>.40B <sender>.24B <time>.L <zeny>.L /// <amount>.L <name id>.W <item type>.W <identified>.B <damaged>.B <refine>.B /// <card1>.W <card2>.W <card3>.W <card4>.W <message>.?B -void clif_Mail_read(struct map_session_data *sd, int mail_id) +static void clif_Mail_read(struct map_session_data *sd, int mail_id) { int i, fd = sd->fd; @@ -15451,10 +15621,10 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id) } } -void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_read(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to open a mail (CZ_MAIL_OPEN). /// 0241 <mail id>.L -void clif_parse_Mail_read(int fd, struct map_session_data *sd) +static void clif_parse_Mail_read(int fd, struct map_session_data *sd) { int mail_id = RFIFOL(fd,2); @@ -15466,10 +15636,10 @@ void clif_parse_Mail_read(int fd, struct map_session_data *sd) clif->mail_read(sd, RFIFOL(fd,2)); } -void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to receive mail's attachment (CZ_MAIL_GET_ITEM). /// 0244 <mail id>.L -void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) +static void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) { int mail_id = RFIFOL(fd,2); int i; @@ -15534,10 +15704,10 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) intif->Mail_getattach(sd->status.char_id, mail_id); } -void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_delete(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to delete a mail (CZ_MAIL_DELETE). /// 0243 <mail id>.L -void clif_parse_Mail_delete(int fd, struct map_session_data *sd) +static void clif_parse_Mail_delete(int fd, struct map_session_data *sd) { int mail_id = RFIFOL(fd,2); int i; @@ -15565,10 +15735,10 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd) } } -void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_return(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to return a mail (CZ_REQ_MAIL_RETURN). /// 0273 <mail id>.L <receive name>.24B -void clif_parse_Mail_return(int fd, struct map_session_data *sd) +static void clif_parse_Mail_return(int fd, struct map_session_data *sd) { int mail_id = RFIFOL(fd,2); int i; @@ -15589,10 +15759,10 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd) } } -void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add an item or Zeny to mail (CZ_MAIL_ADD_ITEM). /// 0247 <index>.W <amount>.L -void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) +static void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) { int idx = RFIFOW(fd,2); int amount = RFIFOL(fd,4); @@ -15607,14 +15777,14 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) clif->mail_setattachment(fd,idx,flag); } -void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to reset mail item and/or Zeny (CZ_MAIL_RESET_ITEM). /// 0246 <type>.W /// type: /// 0 = reset all /// 1 = remove item /// 2 = remove zeny -void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) +static void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) { int flag = RFIFOW(fd,2); @@ -15624,11 +15794,11 @@ void clif_parse_Mail_winopen(int fd, struct map_session_data *sd) mail->removezeny(sd, 0); } -void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Mail_send(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to send mail (CZ_MAIL_SEND). /// 0248 <packet len>.W <recipient>.24B <title>.40B <body len>.B <body>.?B -void clif_parse_Mail_send(int fd, struct map_session_data *sd) +static void clif_parse_Mail_send(int fd, struct map_session_data *sd) { struct mail_message msg; int body_len; @@ -15700,7 +15870,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) /// type: /// 0 = open /// 1 = close -void clif_Auction_openwindow(struct map_session_data *sd) +static void clif_Auction_openwindow(struct map_session_data *sd) { int fd; @@ -15720,7 +15890,7 @@ void clif_Auction_openwindow(struct map_session_data *sd) /// Returns auction item search results (ZC_AUCTION_ITEM_REQ_SEARCH). /// 0252 <packet len>.W <pages>.L <count>.L { <auction id>.L <seller name>.24B <name id>.W <type>.L <amount>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <now price>.L <max price>.L <buyer name>.24B <delete time>.L }* -void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) +static void clif_Auction_results(struct map_session_data *sd, short count, short pages, const uint8 *buf) { int i, fd, len = sizeof(struct auction_data); struct auction_data auction; @@ -15768,7 +15938,8 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages, /// result: /// 0 = success /// 1 = failure -void clif_Auction_setitem(int fd, int index, bool fail) { +static void clif_Auction_setitem(int fd, int index, bool fail) +{ WFIFOHEAD(fd,packet_len(0x256)); WFIFOW(fd,0) = 0x256; WFIFOW(fd,2) = index; @@ -15776,14 +15947,14 @@ void clif_Auction_setitem(int fd, int index, bool fail) { WFIFOSET(fd,packet_len(0x256)); } -void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to initialize 'new auction' data (CZ_AUCTION_CREATE). /// 024b <type>.W /// type: /// 0 = create (any other action in auction window) /// 1 = cancel (cancel pressed on register tab) /// ? = junk, uninitialized value (ex. when switching between list filters) -void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) +static void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) { if( sd->auction.amount > 0 ) clif->additem(sd, sd->auction.index, sd->auction.amount, 0); @@ -15791,10 +15962,10 @@ void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd) sd->auction.amount = 0; } -void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add an item to the action (CZ_AUCTION_ADD_ITEM). /// 024c <index>.W <count>.L -void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) +static void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) { int idx = RFIFOW(fd,2) - 2; int amount = RFIFOL(fd,4); // Always 1 @@ -15848,7 +16019,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) /// 7 = You have failed to win the auction /// 8 = You do not have enough Zeny /// 9 = You cannot place more than 5 bids at a time -void clif_Auction_message(int fd, unsigned char flag) +static void clif_Auction_message(int fd, unsigned char flag) { WFIFOHEAD(fd,packet_len(0x250)); WFIFOW(fd,0) = 0x250; @@ -15862,7 +16033,7 @@ void clif_Auction_message(int fd, unsigned char flag) /// 0 = You have ended the auction /// 1 = You cannot end the auction /// 2 = Auction ID is incorrect -void clif_Auction_close(int fd, unsigned char flag) +static void clif_Auction_close(int fd, unsigned char flag) { WFIFOHEAD(fd, 4); WFIFOW(fd,0) = 0x25d; // BUG: The client identifies this packet as 0x25d (CZ_AUCTION_REQ_MY_SELL_STOP) @@ -15870,10 +16041,10 @@ void clif_Auction_close(int fd, unsigned char flag) WFIFOSET(fd, 4); } -void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to add an auction (CZ_AUCTION_ADD). /// 024d <now money>.L <max money>.L <delete hour>.W -void clif_parse_Auction_register(int fd, struct map_session_data *sd) +static void clif_parse_Auction_register(int fd, struct map_session_data *sd) { struct auction_data auction; struct item_data *item; @@ -15965,30 +16136,30 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) } } -void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Cancels an auction (CZ_AUCTION_ADD_CANCEL). /// 024e <auction id>.L -void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) +static void clif_parse_Auction_cancel(int fd, struct map_session_data *sd) { unsigned int auction_id = RFIFOL(fd,2); intif->Auction_cancel(sd->status.char_id, auction_id); } -void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_close(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Closes an auction (CZ_AUCTION_REQ_MY_SELL_STOP). /// 025d <auction id>.L -void clif_parse_Auction_close(int fd, struct map_session_data *sd) +static void clif_parse_Auction_close(int fd, struct map_session_data *sd) { unsigned int auction_id = RFIFOL(fd,2); intif->Auction_close(sd->status.char_id, auction_id); } -void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_bid(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Places a bid on an auction (CZ_AUCTION_BUY). /// 024f <auction id>.L <money>.L -void clif_parse_Auction_bid(int fd, struct map_session_data *sd) +static void clif_parse_Auction_bid(int fd, struct map_session_data *sd) { unsigned int auction_id = RFIFOL(fd,2); int bid = RFIFOL(fd,6); @@ -16010,7 +16181,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd) } } -void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_search(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Auction Search (CZ_AUCTION_ITEM_SEARCH). /// 0251 <search type>.W <auction id>.L <search text>.24B <page number>.W /// search type: @@ -16020,7 +16191,7 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd) __attribute_ /// 3 = misc /// 4 = name search /// 5 = auction id search -void clif_parse_Auction_search(int fd, struct map_session_data* sd) +static void clif_parse_Auction_search(int fd, struct map_session_data *sd) { char search_text[NAME_LENGTH]; short type = RFIFOW(fd,2), page = RFIFOW(fd,32); @@ -16035,13 +16206,13 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd) intif->Auction_requestlist(sd->status.char_id, type, price, search_text, page); } -void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_Auction_buysell(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Requests list of own currently active bids or auctions (CZ_AUCTION_REQ_MY_INFO). /// 025c <type>.W /// type: /// 0 = sell (own auctions) /// 1 = buy (own bids) -void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) +static void clif_parse_Auction_buysell(int fd, struct map_session_data *sd) { short type = RFIFOW(fd,2) + 6; @@ -16059,7 +16230,8 @@ void clif_parse_Auction_buysell(int fd, struct map_session_data* sd) /// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST). /// 0287 <packet len>.W <cash point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }* /// 0287 <packet len>.W <cash point>.L <kafra point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }* (PACKETVER >= 20070711) -void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { +static void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) +{ struct npc_item_list *shop = NULL; unsigned short shop_size = 0; int fd,i, c = 0; @@ -16117,7 +16289,8 @@ void clif_cashshop_show(struct map_session_data *sd, struct npc_data *nd) { /// 0289 <cash point>.L <error>.W /// 0289 <cash point>.L <kafra point>.L <error>.W (PACKETVER >= 20070711) /// For error return codes see enum cashshop_error@clif.h -void clif_cashshop_ack(struct map_session_data* sd, int error) { +static void clif_cashshop_ack(struct map_session_data *sd, int error) +{ struct npc_data *nd; int fd; int currency[2] = { 0,0 }; @@ -16145,12 +16318,12 @@ void clif_cashshop_ack(struct map_session_data* sd, int error) { WFIFOSET(fd, packet_len(0x289)); } -void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to buy item(s) from cash shop (CZ_PC_BUY_CASH_POINT_ITEM). /// 0288 <name id>.W <amount>.W /// 0288 <name id>.W <amount>.W <kafra points>.L (PACKETVER >= 20070711) /// 0288 <packet len>.W <kafra points>.L <count>.W { <amount>.W <name id>.W }.4B*count (PACKETVER >= 20100803) -void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) +static void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) { int fail = 0; @@ -16210,7 +16383,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) /// 0 = "You cannot adopt more than 1 child." /// 1 = "You must be at least character level 70 in order to adopt someone." /// 2 = "You cannot adopt a married person." -void clif_Adopt_reply(struct map_session_data *sd, int type) +static void clif_Adopt_reply(struct map_session_data *sd, int type) { int fd; @@ -16224,7 +16397,8 @@ void clif_Adopt_reply(struct map_session_data *sd, int type) /// Adoption confirmation (ZC_REQ_BABY). /// 01f6 <account id>.L <char id>.L <name>.B -void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) { +static void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *src, int p_id) +{ int fd; nullpo_retv(sd); @@ -16238,10 +16412,11 @@ void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *sr WFIFOSET(fd,34); } -void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Adopt_request(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to adopt a player (CZ_REQ_JOIN_BABY). /// 01f9 <account id>.L -void clif_parse_Adopt_request(int fd, struct map_session_data *sd) { +static void clif_parse_Adopt_request(int fd, struct map_session_data *sd) +{ struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)), *p_sd = map->charid2sd(sd->status.partner_id); if( pc->can_Adopt(sd, p_sd, tsd) ) { @@ -16250,13 +16425,14 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd) { } } -void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Answer to adopt confirmation (CZ_JOIN_BABY). /// 01f7 <account id>.L <char id>.L <answer>.L /// answer: /// 0 = rejected /// 1 = accepted -void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { +static void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) +{ int p1_id = RFIFOL(fd,2); int p2_id = RFIFOL(fd,6); int result = RFIFOL(fd,10); @@ -16285,7 +16461,7 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) { /// 1 = Boss is alive (position update) (BOSS_INFO_ALIVE). /// 2 = Boss is alive (initial announce) (BOSS_INFO_ALIVE_WITHMSG). /// 3 = Boss is dead (BOSS_INFO_DEAD). -void clif_bossmapinfo(int fd, struct mob_data *md, short flag) +static void clif_bossmapinfo(int fd, struct mob_data *md, short flag) { WFIFOHEAD(fd,70); memset(WFIFOP(fd,0),0,70); @@ -16319,10 +16495,11 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag) WFIFOSET(fd,70); } -void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ViewPlayerEquip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Requesting equip of a player (CZ_EQUIPWIN_MICROSCOPE). /// 02d6 <account id>.L -void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { +static void clif_parse_ViewPlayerEquip(int fd, struct map_session_data *sd) +{ int charid = RFIFOL(fd, 2); struct map_session_data* tsd = map->id2sd(charid); @@ -16338,7 +16515,7 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { } } -void clif_parse_cz_config(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_cz_config(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Receive configurations (CZ_CONFIG). /// 02d8 <type>.L <value>.L /// type: @@ -16348,7 +16525,7 @@ void clif_parse_cz_config(int fd, struct map_session_data *sd) __attribute__((no /// value: /// 0 = disabled /// 1 = enabled -void clif_parse_cz_config(int fd, struct map_session_data *sd) +static void clif_parse_cz_config(int fd, struct map_session_data *sd) { enum CZ_CONFIG type = RFIFOL(fd, 2); int flag = RFIFOL(fd, 6); @@ -16380,12 +16557,12 @@ void clif_parse_cz_config(int fd, struct map_session_data *sd) clif->zc_config(sd, type, flag); } -void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_PartyTick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change party invitation tick. /// value: /// 0 = disabled /// 1 = enabled -void clif_parse_PartyTick(int fd, struct map_session_data* sd) +static void clif_parse_PartyTick(int fd, struct map_session_data *sd) { bool flag = RFIFOB(fd,6)?true:false; sd->status.allow_party = flag; @@ -16399,7 +16576,7 @@ void clif_parse_PartyTick(int fd, struct map_session_data* sd) /// 02b1 <packet len>.W <num>.L { <quest id>.L <active>.B }*num /// 097a <packet len>.W <num>.L { <quest id>.L <active>.B <remaining time>.L <time>.L <count>.W { <mob_id>.L <killed>.W <total>.W <mob name>.24B }*count }*num /// 09f8 <packet len>.W <num>.L { <quest id>.L <active>.B <remaining time>.L <time>.L <count>.W { <hunt identification>.L <mob type>.L <mob_id>.L <min level>.L <max level>.L <killed>.W <total>.W <mob name>.24B }*count }*num -void clif_quest_send_list(struct map_session_data *sd) +static void clif_quest_send_list(struct map_session_data *sd) { int i, len, real_len; uint8 *buf = NULL; @@ -16460,7 +16637,7 @@ void clif_quest_send_list(struct map_session_data *sd) /// Sends list of all quest missions (ZC_ALL_QUEST_MISSION). /// 02b2 <packet len>.W <num>.L { <quest id>.L <start time>.L <expire time>.L <mobs>.W { <mob id>.L <mob count>.W <mob name>.24B }*3 }*num -void clif_quest_send_mission(struct map_session_data *sd) +static void clif_quest_send_mission(struct map_session_data *sd) { int fd = sd->fd; int i, j; @@ -16495,7 +16672,7 @@ void clif_quest_send_mission(struct map_session_data *sd) /// Notification about a new quest (ZC_ADD_QUEST). /// 02b3 <quest id>.L <active>.B <start time>.L <expire time>.L <mobs>.W { <mob id>.L <mob count>.W <mob name>.24B }*3 /// 09f9 <quest id>.L <active>.B <start time>.L <expire time>.L <mobs>.W { <hunt identification>.L <mob type>.L <mob id>.L <min level>.L <max level>.L <mob count>.W <mob name>.24B }*3 -void clif_quest_add(struct map_session_data *sd, struct quest *qd) +static void clif_quest_add(struct map_session_data *sd, struct quest *qd) { int i, len; uint8 *buf = NULL; @@ -16545,7 +16722,8 @@ void clif_quest_add(struct map_session_data *sd, struct quest *qd) /// Notification about a quest being removed (ZC_DEL_QUEST). /// 02b4 <quest id>.L -void clif_quest_delete(struct map_session_data *sd, int quest_id) { +static void clif_quest_delete(struct map_session_data *sd, int quest_id) +{ int fd; nullpo_retv(sd); @@ -16559,7 +16737,7 @@ void clif_quest_delete(struct map_session_data *sd, int quest_id) { /// Notification of an update to the hunting mission counter (ZC_UPDATE_MISSION_HUNT). /// 02b5 <packet len>.W <mobs>.W { <quest id>.L <mob id>.L <total count>.W <current count>.W }*3 /// 09fa <packet len>.W <mobs>.W { <quest id>.L <hunt identification>.L <total count>.W <current count>.W }*3 -void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) +static void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) { int i, len, real_len; uint8 *buf = NULL; @@ -16601,7 +16779,7 @@ void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) /// Notification of an hunting mission counter just after quest is added (ZC_HUNTING_QUEST_INFO). /// 08fe <packet len>.W { <quest id>.L <mob id>.L <total count>.W <current count>.W }*3 -void clif_quest_notify_objective(struct map_session_data *sd, struct quest *qd) +static void clif_quest_notify_objective(struct map_session_data *sd, struct quest *qd) { #if PACKETVER >= 20150513 int i, len, real_len; @@ -16638,16 +16816,18 @@ void clif_quest_notify_objective(struct map_session_data *sd, struct quest *qd) #endif } -void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change the state of a quest (CZ_ACTIVE_QUEST). /// 02b6 <quest id>.L <active>.B -void clif_parse_questStateAck(int fd, struct map_session_data *sd) { +static void clif_parse_questStateAck(int fd, struct map_session_data *sd) +{ quest->update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); } /// Notification about the change of a quest state (ZC_ACTIVE_QUEST). /// 02b7 <quest id>.L <active>.B -void clif_quest_update_status(struct map_session_data *sd, int quest_id, bool active) { +static void clif_quest_update_status(struct map_session_data *sd, int quest_id, bool active) +{ int fd; nullpo_retv(sd); @@ -16670,7 +16850,7 @@ void clif_quest_update_status(struct map_session_data *sd, int quest_id, bool ac /// 1 = orange /// 2 = green /// 3 = purple -void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) +static void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, short state, short color) { #if PACKETVER >= 20090218 int fd; @@ -16694,7 +16874,8 @@ void clif_quest_show_event(struct map_session_data *sd, struct block_list *bl, s /// Notification about a mercenary status parameter change (ZC_MER_PAR_CHANGE). /// 02a2 <var id>.W <value>.L -void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { +static void clif_mercenary_updatestatus(struct map_session_data *sd, int type) +{ struct mercenary_data *md; struct status_data *mstatus; int fd; @@ -16760,7 +16941,8 @@ void clif_mercenary_updatestatus(struct map_session_data *sd, int type) { /// 029b <id>.L <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W /// <name>.24B <level>.W <hp>.L <maxhp>.L <sp>.L <maxsp>.L <expire time>.L <faith>.W /// <calls>.L <kills>.L <atk range>.W -void clif_mercenary_info(struct map_session_data *sd) { +static void clif_mercenary_info(struct map_session_data *sd) +{ int fd; struct mercenary_data *md; struct status_data *mstatus; @@ -16816,7 +16998,7 @@ void clif_mercenary_info(struct map_session_data *sd) { /// Mercenary skill tree (ZC_MER_SKILLINFO_LIST). /// 029d <packet len>.W { <skill id>.W <type>.L <level>.W <sp cost>.W <attack range>.W <skill name>.24B <upgradeable>.B }* -void clif_mercenary_skillblock(struct map_session_data *sd) +static void clif_mercenary_skillblock(struct map_session_data *sd) { struct mercenary_data *md; int fd, i, len = 4, j; @@ -16851,12 +17033,12 @@ void clif_mercenary_skillblock(struct map_session_data *sd) WFIFOSET(fd,len); } -void clif_parse_mercenary_action(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_mercenary_action(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke a mercenary menu action (CZ_MER_COMMAND). /// 029f <command>.B /// 1 = mercenary information /// 2 = delete -void clif_parse_mercenary_action(int fd, struct map_session_data* sd) +static void clif_parse_mercenary_action(int fd, struct map_session_data *sd) { int option = RFIFOB(fd,2); if (sd->md == NULL) @@ -16872,7 +17054,7 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd) /// 1 = Your mercenary soldier has been killed. /// 2 = Your mercenary soldier has been fired. /// 3 = Your mercenary soldier has ran away. -void clif_mercenary_message(struct map_session_data* sd, int message) +static void clif_mercenary_message(struct map_session_data *sd, int message) { #if PACKETVER >= 20070227 clif->msgtable(sd, MSG_MER_FINISH + message); @@ -16881,7 +17063,7 @@ void clif_mercenary_message(struct map_session_data* sd, int message) /// Notification about the remaining time of a rental item (ZC_CASH_TIME_COUNTER). /// 0298 <name id>.W <seconds>.L -void clif_rental_time(int fd, int nameid, int seconds) +static void clif_rental_time(int fd, int nameid, int seconds) { // '<ItemName>' item will disappear in <seconds/60> minutes. WFIFOHEAD(fd,packet_len(0x298)); WFIFOW(fd,0) = 0x298; @@ -16892,7 +17074,7 @@ void clif_rental_time(int fd, int nameid, int seconds) /// Deletes a rental item from client's inventory (ZC_CASH_ITEM_DELETE). /// 0299 <index>.W <name id>.W -void clif_rental_expired(int fd, int index, int nameid) +static void clif_rental_expired(int fd, int index, int nameid) { // '<ItemName>' item has been deleted from the Inventory WFIFOHEAD(fd,packet_len(0x299)); WFIFOW(fd,0) = 0x299; @@ -16903,7 +17085,7 @@ void clif_rental_expired(int fd, int index, int nameid) /// Book Reading (ZC_READ_BOOK). /// 0294 <book id>.L <page>.L -void clif_readbook(int fd, int book_id, int page) +static void clif_readbook(int fd, int book_id, int page) { WFIFOHEAD(fd,packet_len(0x294)); WFIFOW(fd,0) = 0x294; @@ -16918,7 +17100,7 @@ void clif_readbook(int fd, int book_id, int page) /// Updates HP bar of a camp member. /// 02e0 <account id>.L <name>.24B <hp>.W <max hp>.W (ZC_BATTLEFIELD_NOTIFY_HP). /// 0a0e <account id>.L <hp>.L <max hp>.L (ZC_BATTLEFIELD_NOTIFY_HP2) -void clif_bg_hp(struct map_session_data *sd) +static void clif_bg_hp(struct map_session_data *sd) { unsigned char buf[34]; @@ -16961,7 +17143,7 @@ void clif_bg_hp(struct map_session_data *sd) /// Updates the position of a camp member on the minimap (ZC_BATTLEFIELD_NOTIFY_POSITION). /// 02df <account id>.L <name>.24B <class>.W <x>.W <y>.W -void clif_bg_xy(struct map_session_data *sd) +static void clif_bg_xy(struct map_session_data *sd) { unsigned char buf[36]; nullpo_retv(sd); @@ -16976,7 +17158,7 @@ void clif_bg_xy(struct map_session_data *sd) clif->send(buf, packet_len(0x2df), &sd->bl, BG_SAMEMAP_WOS); } -void clif_bg_xy_remove(struct map_session_data *sd) +static void clif_bg_xy_remove(struct map_session_data *sd) { unsigned char buf[36]; nullpo_retv(sd); @@ -16993,7 +17175,7 @@ void clif_bg_xy_remove(struct map_session_data *sd) /// Notifies clients of a battleground message (ZC_BATTLEFIELD_CHAT). /// 02dc <packet len>.W <account id>.L <name>.24B <message>.?B -void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes) +static void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes) { struct map_session_data *sd; unsigned char *buf; @@ -17030,8 +17212,8 @@ void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name * @param fd The incoming file descriptor. * @param sd The related character. */ -void clif_parse_BattleChat(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_BattleChat(int fd, struct map_session_data *sd) +static void clif_parse_BattleChat(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BattleChat(int fd, struct map_session_data *sd) { const struct packet_chat_message *packet = RP2PTR(fd); char message[CHAT_SIZE_MAX + NAME_LENGTH + 3 + 1]; @@ -17044,7 +17226,8 @@ void clif_parse_BattleChat(int fd, struct map_session_data *sd) /// Notifies client of a battleground score change (ZC_BATTLEFIELD_NOTIFY_POINT). /// 02de <camp A points>.W <camp B points>.W -void clif_bg_updatescore(int16 m) { +static void clif_bg_updatescore(int16 m) +{ struct block_list bl; unsigned char buf[6]; @@ -17058,7 +17241,8 @@ void clif_bg_updatescore(int16 m) { clif->send(buf,packet_len(0x2de),&bl,ALL_SAMEMAP); } -void clif_bg_updatescore_single(struct map_session_data *sd) { +static void clif_bg_updatescore_single(struct map_session_data *sd) +{ int fd; nullpo_retv(sd); fd = sd->fd; @@ -17072,7 +17256,7 @@ void clif_bg_updatescore_single(struct map_session_data *sd) { /// Battleground camp belong-information (ZC_BATTLEFIELD_NOTIFY_CAMPINFO). /// 02dd <account id>.L <name>.24B <camp>.W -void clif_sendbgemblem_area(struct map_session_data *sd) +static void clif_sendbgemblem_area(struct map_session_data *sd) { unsigned char buf[33]; nullpo_retv(sd); @@ -17084,7 +17268,7 @@ void clif_sendbgemblem_area(struct map_session_data *sd) clif->send(buf,packet_len(0x2dd), &sd->bl, AREA); } -void clif_sendbgemblem_single(int fd, struct map_session_data *sd) +static void clif_sendbgemblem_single(int fd, struct map_session_data *sd) { nullpo_retv(sd); WFIFOHEAD(fd,32); @@ -17097,7 +17281,7 @@ void clif_sendbgemblem_single(int fd, struct map_session_data *sd) /// Custom Fonts (ZC_NOTIFY_FONT). /// 02ef <account_id>.L <font id>.W -void clif_font(struct map_session_data *sd) +static void clif_font(struct map_session_data *sd) { #if PACKETVER >= 20080102 unsigned char buf[8]; @@ -17112,7 +17296,8 @@ void clif_font(struct map_session_data *sd) /*========================================== * Instancing Window *------------------------------------------*/ -int clif_instance(int instance_id, int type, int flag) { +static int clif_instance(int instance_id, int type, int flag) +{ struct map_session_data *sd = NULL; unsigned char buf[255]; enum send_target target = PARTY; @@ -17184,7 +17369,7 @@ int clif_instance(int instance_id, int type, int flag) { return 0; } -void clif_instance_join(int fd, int instance_id) +static void clif_instance_join(int fd, int instance_id) { if( instance->list[instance_id].idle_timer != INVALID_TIMER ) { WFIFOHEAD(fd,packet_len(0x02CD)); @@ -17209,7 +17394,7 @@ void clif_instance_join(int fd, int instance_id) } } -void clif_instance_leave(int fd) +static void clif_instance_leave(int fd) { WFIFOHEAD(fd,packet_len(0x02CE)); WFIFOW(fd,0) = 0x02ce; @@ -17219,7 +17404,7 @@ void clif_instance_leave(int fd) /// Notifies clients about item picked up by a party member (ZC_ITEM_PICKUP_PARTY). /// 02b8 <account id>.L <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.W <item type>.B -void clif_party_show_picker(struct map_session_data * sd, struct item * item_data) +static void clif_party_show_picker(struct map_session_data *sd, struct item *item_data) { #if PACKETVER >= 20071002 unsigned char buf[22]; @@ -17248,7 +17433,7 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat /// exp type: /// 0 = normal exp gain/loss /// 1 = quest exp gain/loss -void clif_displayexp(struct map_session_data *sd, uint64 exp, char type, bool is_quest) +static void clif_displayexp(struct map_session_data *sd, uint64 exp, char type, bool is_quest) { int fd; @@ -17286,7 +17471,7 @@ void clif_displayexp(struct map_session_data *sd, uint64 exp, char type, bool is /// 3 = Decremental counter (1 tick/second), 'value' specifies start value (stops when reaching 0, displays at most 2 digits). /// value: /// Except for type 3 it is interpreted as seconds for displaying as DD:HH:MM:SS, HH:MM:SS, MM:SS or SS (leftmost '00' is not displayed). -void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) +static void clif_showdigit(struct map_session_data *sd, unsigned char type, int value) { nullpo_retv(sd); WFIFOHEAD(sd->fd, packet_len(0x1b1)); @@ -17296,7 +17481,7 @@ void clif_showdigit(struct map_session_data* sd, unsigned char type, int value) WFIFOSET(sd->fd, packet_len(0x1b1)); } -void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_LessEffect(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Notification of the state of client command /effect (CZ_LESSEFFECT). /// 021d <state>.L /// state: @@ -17309,16 +17494,16 @@ void clif_parse_LessEffect(int fd, struct map_session_data* sd) __attribute__((n /// constructed, this state tracking was rendered useless, /// as the only skill unit, that is sent with 0x1c9 is /// Graffiti. -void clif_parse_LessEffect(int fd, struct map_session_data* sd) +static void clif_parse_LessEffect(int fd, struct map_session_data *sd) { int isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); sd->state.lesseffect = ( isLess != 0 ); } -void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// S 07e4 <length>.w <option>.l <val>.l {<index>.w <amount>.w).4b* -void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) +static void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) { int n = ((int)RFIFOW(fd, 2) - 12) / 4; int type = RFIFOL(fd,4); @@ -17369,7 +17554,8 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *sd) /*========================================== * Elemental System *==========================================*/ -void clif_elemental_updatestatus(struct map_session_data *sd, int type) { +static void clif_elemental_updatestatus(struct map_session_data *sd, int type) +{ struct elemental_data *ed; struct status_data *estatus; int fd; @@ -17399,7 +17585,8 @@ void clif_elemental_updatestatus(struct map_session_data *sd, int type) { WFIFOSET(fd,8); } -void clif_elemental_info(struct map_session_data *sd) { +static void clif_elemental_info(struct map_session_data *sd) +{ int fd; struct elemental_data *ed; struct status_data *estatus; @@ -17425,7 +17612,7 @@ void clif_elemental_info(struct map_session_data *sd) { /// Opens preparation window for buying store (ZC_OPEN_BUYING_STORE). /// 0810 <slots>.B -void clif_buyingstore_open(struct map_session_data* sd) +static void clif_buyingstore_open(struct map_session_data *sd) { #if PACKETVER >= 20100303 int fd; @@ -17439,13 +17626,14 @@ void clif_buyingstore_open(struct map_session_data* sd) #endif } -void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to create a buying store (CZ_REQ_OPEN_BUYING_STORE). /// 0811 <packet len>.W <limit zeny>.L <result>.B <store name>.80B { <name id>.W <amount>.W <price>.L }* /// result: /// 0 = cancel /// 1 = open -void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { +static void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data *sd) +{ const unsigned int blocksize = 8; const uint8 *itemlist; char storename[MESSAGE_SIZE]; @@ -17491,7 +17679,7 @@ void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) { /// 2 = "Total amount of then possessed items exceeds the weight limit by <weight/10-maxweight*90%>. Please re-enter." (0x6ce, MSI_BUYINGSTORE_OVERWEIGHT) /// 8 = "No sale (purchase) information available." (0x705) /// ? = nothing -void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short result, unsigned int weight) +static void clif_buyingstore_open_failed(struct map_session_data *sd, unsigned short result, unsigned int weight) { #if PACKETVER >= 20100420 int fd; @@ -17508,7 +17696,7 @@ void clif_buyingstore_open_failed(struct map_session_data* sd, unsigned short re /// Notification, that the requested buying store was created (ZC_MYITEMLIST_BUYING_STORE). /// 0813 <packet len>.W <account id>.L <limit zeny>.L { <price>.L <count>.W <type>.B <name id>.W }* -void clif_buyingstore_myitemlist(struct map_session_data* sd) +static void clif_buyingstore_myitemlist(struct map_session_data *sd) { int fd; unsigned int i; @@ -17534,7 +17722,7 @@ void clif_buyingstore_myitemlist(struct map_session_data* sd) /// Notifies clients in area of a buying store (ZC_BUYING_STORE_ENTRY). /// 0814 <account id>.L <store name>.80B -void clif_buyingstore_entry(struct map_session_data* sd) +static void clif_buyingstore_entry(struct map_session_data *sd) { #if PACKETVER >= 20100420 uint8 buf[86]; @@ -17547,7 +17735,7 @@ void clif_buyingstore_entry(struct map_session_data* sd) clif->send(buf, packet_len(0x814), &sd->bl, AREA_WOS); #endif } -void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +static void clif_buyingstore_entry_single(struct map_session_data *sd, struct map_session_data *pl_sd) { #if PACKETVER >= 20100420 int fd; @@ -17562,16 +17750,17 @@ void clif_buyingstore_entry_single(struct map_session_data* sd, struct map_sessi #endif } -void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to close own buying store (CZ_REQ_CLOSE_BUYING_STORE). /// 0815 -void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data* sd) { +static void clif_parse_ReqCloseBuyingStore(int fd, struct map_session_data *sd) +{ buyingstore->close(sd); } /// Notifies clients in area that a buying store was closed (ZC_DISAPPEAR_BUYING_STORE_ENTRY). /// 0816 <account id>.L -void clif_buyingstore_disappear_entry(struct map_session_data* sd) +static void clif_buyingstore_disappear_entry(struct map_session_data *sd) { #if PACKETVER >= 20100309 uint8 buf[6]; @@ -17584,7 +17773,7 @@ void clif_buyingstore_disappear_entry(struct map_session_data* sd) #endif } -void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd) +static void clif_buyingstore_disappear_entry_single(struct map_session_data *sd, struct map_session_data *pl_sd) { #if PACKETVER >= 20100309 int fd; @@ -17601,7 +17790,7 @@ void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct /// Request to open someone else's buying store (CZ_REQ_CLICK_TO_BUYING_STORE). /// 0817 <account id>.L -void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) +static void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data *sd) { int account_id; @@ -17612,7 +17801,7 @@ void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data* sd) /// Sends buying store item list (ZC_ACK_ITEMLIST_BUYING_STORE). /// 0818 <packet len>.W <account id>.L <store id>.L <limit zeny>.L { <price>.L <amount>.W <type>.B <name id>.W }* -void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd) +static void clif_buyingstore_itemlist(struct map_session_data *sd, struct map_session_data *pl_sd) { int fd; unsigned int i; @@ -17638,10 +17827,11 @@ void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_d WFIFOSET(fd,WFIFOW(fd,2)); } -void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to sell items to a buying store (CZ_REQ_TRADE_BUYING_STORE). /// 0819 <packet len>.W <account id>.L <store id>.L { <index>.W <name id>.W <amount>.W }* -void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { +static void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data *sd) +{ const unsigned int blocksize = 6; const uint8 *itemlist; int account_id; @@ -17682,7 +17872,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) { /// 3 = "All items within the buy limit were purchased." (0x6cf, MSI_BUYINGSTORE_TRADE_OVERLIMITZENY) /// 4 = "All items were purchased." (0x6d0, MSI_BUYINGSTORE_TRADE_BUYCOMPLETE) /// ? = nothing -void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result) +static void clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, short result) { #if PACKETVER >= 20100420 int fd; @@ -17698,7 +17888,7 @@ void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short resu /// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE). /// 081b <name id>.W <amount>.W <limit zeny>.L -void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) +static void clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) { int fd; #if PACKETVER < 20141016 // TODO : not sure for client date [Napster] @@ -17731,7 +17921,7 @@ void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short na /// "%s (%d) were sold at %dz." (0x6d2, MSI_BUYINGSTORE_TRADE_SELLCOMPLETE) /// /// NOTE: This function has to be called _instead_ of clif_delitem/clif_dropitem. -void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price) +static void clif_buyingstore_delete_item(struct map_session_data *sd, short index, unsigned short amount, int price) { #if PACKETVER >= 20100420 int fd; @@ -17754,7 +17944,7 @@ void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsi /// 6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT) /// 7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY) /// ? = nothing -void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid) +static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, unsigned short nameid) { #if PACKETVER >= 20100420 int fd; @@ -17769,7 +17959,7 @@ void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short res #endif } -void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_SearchStoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Search Store Info System /// @@ -17782,7 +17972,8 @@ void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) __attribute /// NOTE: The client determines the item ids by specifying a name and optionally, /// amount of card slots. If the client does not know about the item it /// cannot be searched. -void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { +static void clif_parse_SearchStoreInfo(int fd, struct map_session_data *sd) +{ const unsigned int blocksize = 2; const uint8* itemlist; const uint8* cardlist; @@ -17838,7 +18029,7 @@ void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) { /// is next page: /// 0 = no "next" label /// 1 = "next" label to retrieve more results -void clif_search_store_info_ack(struct map_session_data* sd) +static void clif_search_store_info_ack(struct map_session_data *sd) { #if PACKETVER >= 20150226 const unsigned int blocksize = MESSAGE_SIZE + 26 + 5 * MAX_ITEM_OPTIONS; @@ -17897,7 +18088,7 @@ void clif_search_store_info_ack(struct map_session_data* sd) /// 2 = "You cannot search anymore." (0x706) /// 3 = "You cannot search yet." (0x708) /// 4 = "No sale (purchase) information available." (0x705) -void clif_search_store_info_failed(struct map_session_data* sd, unsigned char reason) +static void clif_search_store_info_failed(struct map_session_data *sd, unsigned char reason) { #if PACKETVER >= 20100601 int fd; @@ -17911,10 +18102,10 @@ void clif_search_store_info_failed(struct map_session_data* sd, unsigned char re #endif } -void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to display next page of results (CZ_SEARCH_STORE_INFO_NEXT_PAGE). /// 0838 -void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) +static void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data *sd) { searchstore->next(sd); } @@ -17924,7 +18115,7 @@ void clif_parse_SearchStoreInfoNextPage(int fd, struct map_session_data* sd) /// type: /// 0 = Search Stores /// 1 = Search Stores (Cash), asks for confirmation, when clicking a store -void clif_open_search_store_info(struct map_session_data* sd) +static void clif_open_search_store_info(struct map_session_data *sd) { #if PACKETVER >= 20100608 int fd; @@ -17941,18 +18132,18 @@ void clif_open_search_store_info(struct map_session_data* sd) #endif } -void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to close the store search window (CZ_CLOSE_SEARCH_STORE_INFO). /// 083b -void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd) +static void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data *sd) { searchstore->close(sd); } -void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to invoke catalog effect on a store from search results (CZ_SSILIST_ITEM_CLICK). /// 083c <account id>.L <store id>.L <nameid>.W -void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd) +static void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data *sd) { unsigned short nameid; int account_id, store_id; @@ -17967,7 +18158,7 @@ void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd /// Notification of the store position on current map (ZC_SSILIST_ITEM_CLICK_ACK). /// 083d <xPos>.W <yPos>.W -void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y) +static void clif_search_store_info_click_ack(struct map_session_data *sd, short x, short y) { #if PACKETVER >= 20100608 int fd; @@ -17983,7 +18174,8 @@ void clif_search_store_info_click_ack(struct map_session_data* sd, short x, shor } /// Parse function for packet debugging. -void clif_parse_debug(int fd,struct map_session_data *sd) { +static void clif_parse_debug(int fd, struct map_session_data *sd) +{ int cmd, packet_len; // clif_parse ensures, that there is at least 2 bytes of data @@ -18007,7 +18199,8 @@ void clif_parse_debug(int fd,struct map_session_data *sd) { * Server tells client to display a window similar to Magnifier (item) one * Server populates the window with available elemental converter options according to player's inventory *------------------------------------------*/ -int clif_elementalconverter_list(struct map_session_data *sd) { +static int clif_elementalconverter_list(struct map_session_data *sd) +{ int i,c,view,fd; nullpo_ret(sd); @@ -18038,7 +18231,8 @@ int clif_elementalconverter_list(struct map_session_data *sd) { /** * Rune Knight **/ -void clif_millenniumshield(struct block_list *bl, short shields ) { +static void clif_millenniumshield(struct block_list *bl, short shields) +{ #if PACKETVER >= 20081217 unsigned char buf[10]; @@ -18056,7 +18250,7 @@ void clif_millenniumshield(struct block_list *bl, short shields ) { /*========================================== * Spellbook list [LimitLine/3CeAM] *------------------------------------------*/ -int clif_spellbook_list(struct map_session_data *sd) +static int clif_spellbook_list(struct map_session_data *sd) { int i, c; int fd; @@ -18096,7 +18290,8 @@ int clif_spellbook_list(struct map_session_data *sd) /*========================================== * Magic Decoy Material List *------------------------------------------*/ -int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) { +static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y) +{ int i, c; int fd; @@ -18132,7 +18327,8 @@ int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, /*========================================== * Guillotine Cross Poisons List *------------------------------------------*/ -int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { +static int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) +{ int i, c; int fd; @@ -18160,7 +18356,8 @@ int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) { return 1; } -int clif_autoshadowspell_list(struct map_session_data *sd) { +static int clif_autoshadowspell_list(struct map_session_data *sd) +{ int fd, i, c; nullpo_ret(sd); fd = sd->fd; @@ -18196,7 +18393,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { * Skill list for Four Elemental Analysis * and Change Material skills. *------------------------------------------*/ -int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ) +static int clif_skill_itemlistwindow(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { #if PACKETVER >= 20090922 int fd; @@ -18222,12 +18419,13 @@ int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uin } -void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /*========================================== * used by SC_AUTOSHADOWSPELL * RFIFOL(fd,2) - flag (currently not used) *------------------------------------------*/ -void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { +static void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) +{ if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) return; @@ -18246,7 +18444,7 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { /*========================================== * Kagerou/Oboro amulet spirit *------------------------------------------*/ -void clif_charm(struct map_session_data *sd) +static void clif_charm(struct map_session_data *sd) { #if PACKETVER >= 20110809 unsigned char buf[10]; @@ -18261,7 +18459,7 @@ void clif_charm(struct map_session_data *sd) #endif } -void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Move Item from or to Personal Tab (CZ_WHATSOEVER) [FE] /// 0907 <index>.W /// @@ -18269,7 +18467,8 @@ void clif_parse_MoveItem(int fd, struct map_session_data *sd) __attribute__((non /// type: /// 0 = move item to personal tab /// 1 = move item to normal tab -void clif_parse_MoveItem(int fd, struct map_session_data *sd) { +static void clif_parse_MoveItem(int fd, struct map_session_data *sd) +{ #if PACKETVER >= 20111122 int index; @@ -18295,7 +18494,8 @@ void clif_parse_MoveItem(int fd, struct map_session_data *sd) { } /* [Ind/Hercules] */ -void clif_cashshop_db(void) { +static void clif_cashshop_db(void) +{ struct config_t cashshop_conf; struct config_setting_t *cashshop = NULL, *cats = NULL; const char *config_filename = "db/cashshop_db.conf"; // FIXME hardcoded name @@ -18359,7 +18559,8 @@ void clif_cashshop_db(void) { } /// Items that are in favorite tab of inventory (ZC_ITEM_FAVORITE). /// 0900 <index>.W <favorite>.B -void clif_favorite_item(struct map_session_data* sd, unsigned short index) { +static void clif_favorite_item(struct map_session_data *sd, unsigned short index) +{ #if PACKETVER >= 20120410 int fd; @@ -18373,7 +18574,8 @@ void clif_favorite_item(struct map_session_data* sd, unsigned short index) { #endif } -void clif_snap( struct block_list *bl, short x, short y ) { +static void clif_snap(struct block_list *bl, short x, short y) +{ #if PACKETVER >= 20110809 unsigned char buf[10]; @@ -18387,7 +18589,7 @@ void clif_snap( struct block_list *bl, short x, short y ) { #endif } -void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd) +static void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd) { #if PACKETVER >= 20120228 struct packet_monster_hp p; @@ -18404,12 +18606,14 @@ void clif_monster_hp_bar(struct mob_data *md, struct map_session_data *sd) } /* [Ind/Hercules] placeholder for unsupported incoming packets (avoids server disconnecting client) */ -void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd) { +static void __attribute__ ((unused)) clif_parse_dull(int fd, struct map_session_data *sd) +{ return; } -void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { +static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) +{ if (map->list[sd->bl.m].flag.nocashshop) { clif->messagecolor_self(fd, COLOR_RED, msg_fd(fd,1489)); //Cash Shop is disabled in this map @@ -18423,13 +18627,14 @@ void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { WFIFOSET(fd, 10); } -void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CashShopClose(int fd, struct map_session_data *sd) { +static void clif_parse_CashShopClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CashShopClose(int fd, struct map_session_data *sd) +{ /* TODO apply some state tracking */ } -void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) +static void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) { #if PACKETVER >= 20110614 int i, j = 0; @@ -18455,8 +18660,9 @@ void clif_parse_CashShopSchedule(int fd, struct map_session_data *sd) } /// R 0848 <len>.W <limit>.W <kafra pay>.L (<item id>.L <amount>.L <tab>.W)* -void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { +static void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) +{ int len = RFIFOW(fd, 2); unsigned short limit, i, j; unsigned int kafra_pay; @@ -18563,9 +18769,9 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { } } -void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* [Ind/Hercules] */ -void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) +static void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { #if PACKETVER >= 20110222 short tab = RFIFOW(fd, 2); @@ -18590,7 +18796,7 @@ void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) } /* [Ind/Hercules] */ -void clif_maptypeproperty2(struct block_list *bl,enum send_target t) +static void clif_maptypeproperty2(struct block_list *bl, enum send_target t) { #if PACKETVER >= 20121010 struct packet_maptypeproperty2 p; @@ -18618,7 +18824,8 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) #endif } -void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { +static void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) +{ struct packet_status_change2 p; p.PacketType = status_change2Type; @@ -18633,7 +18840,8 @@ void clif_status_change2(struct block_list *bl, int tid, enum send_target target clif->send(&p,sizeof(p), bl, target); } -void clif_partytickack(struct map_session_data* sd, bool flag) { +static void clif_partytickack(struct map_session_data *sd, bool flag) +{ nullpo_retv(sd); WFIFOHEAD(sd->fd, packet_len(0x2c9)); @@ -18642,7 +18850,7 @@ void clif_partytickack(struct map_session_data* sd, bool flag) { WFIFOSET(sd->fd, packet_len(0x2c9)); } -void clif_ShowScript(struct block_list *bl, const char *message) +static void clif_ShowScript(struct block_list *bl, const char *message) { #if PACKETVER >= 20110111 char buf[256]; @@ -18667,7 +18875,8 @@ void clif_ShowScript(struct block_list *bl, const char *message) #endif } -void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { +static void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) +{ struct packet_status_change_end p; nullpo_retv(bl); @@ -18683,7 +18892,8 @@ void clif_status_change_end(struct block_list *bl, int tid, enum send_target tar clif->send(&p,sizeof(p), bl, target); } -void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) { +static void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) +{ switch (response) { case BGQA_FAIL_COOLDOWN: case BGQA_FAIL_DESERTER: @@ -18703,7 +18913,7 @@ void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK } } -void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) +static void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, const char *name) { struct packet_bgqueue_notice_delete p; @@ -18715,8 +18925,8 @@ void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_ clif->send(&p,sizeof(p), &sd->bl, SELF); } -void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) +static void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) { const struct packet_bgqueue_register *p = RP2PTR(fd); struct bg_arena *arena = NULL; @@ -18740,7 +18950,8 @@ void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) bg->queue_add(sd, arena, (enum bg_queue_types)p->type); } -void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) { +static void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) +{ struct packet_bgqueue_update_info p; nullpo_retv(sd); @@ -18754,8 +18965,8 @@ void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_i clif->send(&p,sizeof(p), &sd->bl, SELF); } -void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) +static void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) { const struct packet_bgqueue_checkstate *p = RP2PTR(fd); @@ -18766,8 +18977,8 @@ void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) } } -void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) +static void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) { const struct packet_bgqueue_revoke_req *p = RP2PTR(fd); @@ -18777,8 +18988,8 @@ void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,p->bg_name); } -void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) +static void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) { const struct packet_bgqueue_battlebegin_ack *p = RP2PTR(fd); struct bg_arena *arena; @@ -18792,7 +19003,8 @@ void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) } } -void clif_bgqueue_joined(struct map_session_data *sd, int pos) { +static void clif_bgqueue_joined(struct map_session_data *sd, int pos) +{ struct packet_bgqueue_notify_entry p; nullpo_retv(sd); @@ -18803,13 +19015,15 @@ void clif_bgqueue_joined(struct map_session_data *sd, int pos) { clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE); } -void clif_bgqueue_pcleft(struct map_session_data *sd) { +static void clif_bgqueue_pcleft(struct map_session_data *sd) +{ /* no idea */ return; } // Sends BG ready req to all with same bg arena/type as sd -void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) { +static void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) +{ struct packet_bgqueue_battlebegins p; nullpo_retv(sd); @@ -18821,7 +19035,7 @@ void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_ clif->send(&p,sizeof(p), &sd->bl, target); } -void clif_scriptclear(struct map_session_data *sd, int npcid) +static void clif_scriptclear(struct map_session_data *sd, int npcid) { #if PACKETVER >= 20110928 struct packet_script_clear p; @@ -18835,7 +19049,8 @@ void clif_scriptclear(struct map_session_data *sd, int npcid) } /* Made Possible Thanks to Yommy! */ -void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { +static void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) +{ struct packet_package_item_announce p; nullpo_retv(sd); @@ -18852,7 +19067,8 @@ void clif_package_item_announce(struct map_session_data *sd, unsigned short name } /* Made Possible Thanks to Yommy! */ -void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { +static void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) +{ struct packet_item_drop_announce p; nullpo_retv(sd); @@ -18869,7 +19085,8 @@ void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, } /* [Ind/Hercules] special thanks to Yommy~! */ -void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { +static void clif_skill_cooldown_list(int fd, struct skill_cd *cd) +{ #if PACKETVER >= 20120604 const int offset = 10; #else @@ -18909,7 +19126,8 @@ void clif_skill_cooldown_list(int fd, struct skill_cd* cd) { * - ADDITEM_TO_CART_FAIL_WEIGHT = 0x0 * - ADDITEM_TO_CART_FAIL_COUNT = 0x1 */ -void clif_cart_additem_ack(struct map_session_data *sd, int flag) { +static void clif_cart_additem_ack(struct map_session_data *sd, int flag) +{ struct packet_cart_additem_ack p; nullpo_retv(sd); @@ -18920,8 +19138,8 @@ void clif_cart_additem_ack(struct map_session_data *sd, int flag) { } /* Bank System [Yommy/Hercules] */ -void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_BankDeposit(int fd, struct map_session_data *sd) +static void clif_parse_BankDeposit(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BankDeposit(int fd, struct map_session_data *sd) { const struct packet_banking_deposit_req *p = RP2PTR(fd); int money; @@ -18936,8 +19154,8 @@ void clif_parse_BankDeposit(int fd, struct map_session_data *sd) pc->bank_deposit(sd,money); } -void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) +static void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) { const struct packet_banking_withdraw_req *p = RP2PTR(fd); int money; @@ -18952,8 +19170,8 @@ void clif_parse_BankWithdraw(int fd, struct map_session_data *sd) pc->bank_withdraw(sd,money); } -void clif_parse_BankCheck(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_BankCheck(int fd, struct map_session_data* sd) +static void clif_parse_BankCheck(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BankCheck(int fd, struct map_session_data *sd) { #if PACKETVER >= 20130320 struct packet_banking_check p; @@ -18971,17 +19189,19 @@ void clif_parse_BankCheck(int fd, struct map_session_data* sd) #endif } -void clif_parse_BankOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_BankOpen(int fd, struct map_session_data* sd) { +static void clif_parse_BankOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BankOpen(int fd, struct map_session_data *sd) +{ return; } -void clif_parse_BankClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_BankClose(int fd, struct map_session_data* sd) { +static void clif_parse_BankClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_BankClose(int fd, struct map_session_data *sd) +{ return; } -void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) +static void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK reason) { #if PACKETVER >= 20130313 struct packet_banking_deposit_ack p; @@ -18996,7 +19216,7 @@ void clif_bank_deposit(struct map_session_data *sd, enum e_BANKING_DEPOSIT_ACK r #endif } -void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK reason) +static void clif_bank_withdraw(struct map_session_data *sd, enum e_BANKING_WITHDRAW_ACK reason) { #if PACKETVER >= 20130313 struct packet_banking_withdraw_ack p; @@ -19013,7 +19233,8 @@ void clif_bank_withdraw(struct map_session_data *sd,enum e_BANKING_WITHDRAW_ACK /* TODO: official response packet (tried 0x8cb/0x97b but the display was quite screwed up.) */ /* currently mimicing */ -void clif_show_modifiers (struct map_session_data *sd) { +static void clif_show_modifiers(struct map_session_data *sd) +{ nullpo_retv(sd); if( sd->status.mod_exp != 100 || sd->status.mod_drop != 100 || sd->status.mod_death != 100 ) { @@ -19026,7 +19247,8 @@ void clif_show_modifiers (struct map_session_data *sd) { } -void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { +static void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) +{ struct packet_notify_bounditem p; nullpo_retv(sd); @@ -19036,11 +19258,12 @@ void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { clif->send(&p,sizeof(p), &sd->bl, SELF); } -void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /** * Parses the (GM) right click option 'remove all equipment' **/ -void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { +static void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) +{ struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); int i; @@ -19057,7 +19280,8 @@ void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { /** * clif_delay_damage timer, sends the stored data and clears the memory afterwards **/ -int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { +static int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) +{ struct cdelayed_damage *dd = (struct cdelayed_damage *)data; clif->send(&dd->p,sizeof(struct packet_damage),&dd->bl,AREA_WOS); @@ -19081,7 +19305,8 @@ int clif_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { * * @return clif->calc_walkdelay used in further processing **/ -int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) { +static int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst, int sdelay, int ddelay, int64 in_damage, short div, unsigned char type) +{ struct cdelayed_damage *dd; struct status_change *sc; #if PACKETVER < 20071113 @@ -19140,15 +19365,17 @@ int clif_delay_damage(int64 tick, struct block_list *src, struct block_list *dst return clif->calc_walkdelay(dst,ddelay,type,damage,div); } -void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* Thanks to Yommy */ -void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) { +static void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) +{ /* TODO track the state <3~ */ sd->npc_shopid = 0; } /* NPC Market (by Ind after an extensive debugging of the packet, only possible thanks to Yommy <3) */ -void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { +static void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) +{ #if PACKETVER >= 20131223 struct npc_item_list *shop; unsigned short shop_size, i, c; @@ -19177,13 +19404,14 @@ void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { #endif } -void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) { +static void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) +{ /* TODO track the state <3~ */ sd->npc_shopid = 0; } -void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) +static void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct itemlist *item_list, unsigned char response) { #if PACKETVER >= 20131223 unsigned short c = 0; @@ -19220,8 +19448,8 @@ void clif_npc_market_purchase_ack(struct map_session_data *sd, const struct item #endif } -void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) +static void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) { #if PACKETVER >= 20131223 const struct packet_npc_market_purchase *p = RP2PTR(fd); @@ -19250,7 +19478,8 @@ void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) #endif } -void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) { +static void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) +{ struct packet_party_leader_changed p; nullpo_retv(sd); @@ -19262,9 +19491,10 @@ void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, i clif->send(&p,sizeof(p),&sd->bl,PARTY); } -void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_RouletteOpen(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /* Roulette System [Yommy/Hercules] */ -void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { +static void clif_parse_RouletteOpen(int fd, struct map_session_data *sd) +{ #if PACKETVER >= 20140612 struct packet_roulette_open_ack p; @@ -19287,8 +19517,8 @@ void clif_parse_RouletteOpen(int fd, struct map_session_data* sd) { #endif } -void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) +static void clif_parse_RouletteInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RouletteInfo(int fd, struct map_session_data *sd) { #if PACKETVER >= 20140612 struct packet_roulette_info_ack p; @@ -19319,8 +19549,9 @@ void clif_parse_RouletteInfo(int fd, struct map_session_data* sd) #endif } -void clif_parse_RouletteClose(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { +static void clif_parse_RouletteClose(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RouletteClose(int fd, struct map_session_data *sd) +{ if( !battle_config.feature_roulette ) { clif->message(fd, msg_fd(fd,82)); // Roulette is disabled return; @@ -19332,8 +19563,9 @@ void clif_parse_RouletteClose(int fd, struct map_session_data* sd) { return; } -void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { +static void clif_parse_RouletteGenerate(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_RouletteGenerate(int fd, struct map_session_data *sd) +{ unsigned char result = GENERATE_ROULETTE_SUCCESS; short stage = sd->roulette.stage; @@ -19386,11 +19618,11 @@ void clif_parse_RouletteGenerate(int fd, struct map_session_data* sd) { sd->roulette.stage++; } -void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); +static void clif_parse_RouletteRecvItem(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /** * Request to cash in! **/ -void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) +static void clif_parse_RouletteRecvItem(int fd, struct map_session_data *sd) { #if PACKETVER >= 20140612 struct packet_roulette_itemrecv_ack p; @@ -19438,7 +19670,8 @@ void clif_parse_RouletteRecvItem(int fd, struct map_session_data* sd) #endif } -bool clif_parse_roulette_db(void) { +static bool clif_parse_roulette_db(void) +{ struct config_t roulette_conf; struct config_setting_t *roulette = NULL, *levels = NULL; const char *config_filename = "db/roulette_db.conf"; // FIXME hardcoded name @@ -19530,7 +19763,7 @@ bool clif_parse_roulette_db(void) { /** * **/ -void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) +static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { #if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; @@ -19552,7 +19785,7 @@ void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char resul /** * Stackable items merger */ -void clif_openmergeitem(int fd, struct map_session_data *sd) +static void clif_openmergeitem(int fd, struct map_session_data *sd) { #if PACKETVER > 20120228 int i = 0, n = 0, j = 0; @@ -19600,7 +19833,7 @@ void clif_openmergeitem(int fd, struct map_session_data *sd) #endif } -int clif_comparemergeitem(const void *a, const void *b) +static int clif_comparemergeitem(const void *a, const void *b) { const struct merge_item *a_ = a; const struct merge_item *b_ = b; @@ -19612,7 +19845,7 @@ int clif_comparemergeitem(const void *a, const void *b) return a_->nameid > b_->nameid ? -1 : 1; } -void clif_ackmergeitems(int fd, struct map_session_data *sd) +static void clif_ackmergeitems(int fd, struct map_session_data *sd) { #if PACKETVER > 20120228 int i = 0, n = 0, length = 0, count = 0; @@ -19697,13 +19930,13 @@ void clif_ackmergeitems(int fd, struct map_session_data *sd) #endif } -void clif_cancelmergeitem (int fd, struct map_session_data *sd) +static void clif_cancelmergeitem(int fd, struct map_session_data *sd) { //Track The merge item cancelation ? return; } -void clif_dressroom_open(struct map_session_data *sd, int view) +static void clif_dressroom_open(struct map_session_data *sd, int view) { #if PACKETVER >= 20150513 int fd; @@ -19720,7 +19953,7 @@ void clif_dressroom_open(struct map_session_data *sd, int view) /// Request to select cart's visual look for new cart design (ZC_SELECTCART). /// 097f <Length>.W <identity>.L <type>.B -void clif_selectcart(struct map_session_data *sd) +static void clif_selectcart(struct map_session_data *sd) { #if PACKETVER >= 20150805 int i = 0, fd; @@ -19741,7 +19974,7 @@ void clif_selectcart(struct map_session_data *sd) } /// Starts navigation to the given target on client side -void clif_navigate_to(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id) +static void clif_navigate_to(struct map_session_data *sd, const char *mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id) { // probably this packet with other fields present in older packet versions #if PACKETVER >= 20120307 @@ -19788,7 +20021,7 @@ void clif_navigate_to(struct map_session_data *sd, const char* mapname, uint16 x * @param bl The requested bl. * @return The bl's name (guaranteed to be non-NULL). */ -const char *clif_get_bl_name(const struct block_list *bl) +static const char *clif_get_bl_name(const struct block_list *bl) { const char *name = status->get_name(bl); @@ -19803,7 +20036,7 @@ const char *clif_get_bl_name(const struct block_list *bl) * 098a <length>.W <clan id>.L <clan name>.24B <clan master>.24B <clan map>.16B <alliance count>.B * <antagonist count>.B { <alliance>.24B } * alliance count { <antagonist>.24B } * antagonist count (ZC_CLANINFO) */ -void clif_clan_basicinfo(struct map_session_data *sd) +static void clif_clan_basicinfo(struct map_session_data *sd) { #if PACKETVER >= 20120716 int len, i, fd; @@ -19860,7 +20093,7 @@ void clif_clan_basicinfo(struct map_session_data *sd) * Clan System: Updates the online and maximum player count of a clan. * 0988 <online count>.W <maximum member amount>.W (ZC_NOTIFY_CLAN_CONNECTINFO) */ -void clif_clan_onlinecount(struct clan *c) +static void clif_clan_onlinecount(struct clan *c) { #if PACKETVER >= 20120716 struct map_session_data *sd; @@ -19879,10 +20112,10 @@ void clif_clan_onlinecount(struct clan *c) } /** -* Clan System: Notifies the client that the player has left his clan. -* 0989 (ZC_ACK_CLAN_LEAVE) -**/ -void clif_clan_leave(struct map_session_data* sd) + * Clan System: Notifies the client that the player has left his clan. + * 0989 (ZC_ACK_CLAN_LEAVE) + */ +static void clif_clan_leave(struct map_session_data *sd) { #if PACKETVER >= 20131223 struct PACKET_ZC_ACK_CLAN_LEAVE p; @@ -19899,7 +20132,7 @@ void clif_clan_leave(struct map_session_data* sd) * Clan System: Sends a clan message to a player * 098e <length>.W <name>.24B <message>.?B (ZC_NOTIFY_CLAN_CHAT) */ -void clif_clan_message(struct clan *c, const char *mes, int len) +static void clif_clan_message(struct clan *c, const char *mes, int len) { #if PACKETVER >= 20120716 struct map_session_data *sd; @@ -19930,12 +20163,12 @@ void clif_clan_message(struct clan *c, const char *mes, int len) #endif } -void clif_parse_ClanMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_ClanMessage(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /** * Clan System: Parses a clan message from a player. * 098d <length>.W <text>.?B (<name> : <message>) (CZ_CLAN_CHAT) */ -void clif_parse_ClanMessage(int fd, struct map_session_data *sd) +static void clif_parse_ClanMessage(int fd, struct map_session_data *sd) { #if PACKETVER >= 20120716 const struct packet_chat_message *packet = RP2PTR(fd); @@ -19949,20 +20182,23 @@ void clif_parse_ClanMessage(int fd, struct map_session_data *sd) } /* */ -unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { +static unsigned short clif_decrypt_cmd(int cmd, struct map_session_data *sd) +{ if( sd ) { return (cmd ^ ((sd->cryptKey >> 16) & 0x7FFF)); } return (cmd ^ (((( clif->cryptKey[0] * clif->cryptKey[1] ) + clif->cryptKey[2]) >> 16) & 0x7FFF)); } -unsigned short clif_parse_cmd_normal( int fd, struct map_session_data *sd ) { +static unsigned short clif_parse_cmd_normal(int fd, struct map_session_data *sd) +{ unsigned short cmd = RFIFOW(fd,0); return cmd; } -unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { +static unsigned short clif_parse_cmd_decrypt(int fd, struct map_session_data *sd) +{ unsigned short cmd = RFIFOW(fd,0); cmd = clif->decrypt_cmd(cmd, sd); @@ -19970,7 +20206,8 @@ unsigned short clif_parse_cmd_decrypt( int fd, struct map_session_data *sd ) { return cmd; } -unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { +static unsigned short clif_parse_cmd_optional(int fd, struct map_session_data *sd) +{ unsigned short cmd = RFIFOW(fd,0); // filter out invalid / unsupported packets @@ -19989,8 +20226,8 @@ unsigned short clif_parse_cmd_optional( int fd, struct map_session_data *sd ) { * RoDEX *------------------------------------------*/ -void clif_parse_rodex_open_write_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_open_write_mail(int fd, struct map_session_data *sd) +static void clif_parse_rodex_open_write_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_open_write_mail(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_OPEN_WRITE_MAIL *rPacket = RFIFOP(fd, 0); int8 result = (rodex->isenabled() == true && sd->npc_id == 0) ? 1 : 0; @@ -19998,7 +20235,7 @@ void clif_parse_rodex_open_write_mail(int fd, struct map_session_data *sd) clif->rodex_open_write_mail(fd, rPacket->receiveName, result); } -void clif_rodex_open_write_mail(int fd, const char *receiver_name, int8 result) +static void clif_rodex_open_write_mail(int fd, const char *receiver_name, int8 result) { #if PACKETVER >= 20140416 struct PACKET_ZC_ACK_OPEN_WRITE_MAIL *sPacket = NULL; @@ -20014,8 +20251,8 @@ void clif_rodex_open_write_mail(int fd, const char *receiver_name, int8 result) #endif } -void clif_parse_rodex_add_item(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_add_item(int fd, struct map_session_data *sd) +static void clif_parse_rodex_add_item(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_add_item(int fd, struct map_session_data *sd) { const struct PACKET_CZ_ADD_ITEM_TO_MAIL *rPacket = RFIFOP(fd, 0); int16 idx = rPacket->index - 2; @@ -20023,7 +20260,7 @@ void clif_parse_rodex_add_item(int fd, struct map_session_data *sd) rodex->add_item(sd, idx, (int16)rPacket->count); } -void clif_rodex_add_item_result(struct map_session_data *sd, int16 idx, int16 amount, int8 result) +static void clif_rodex_add_item_result(struct map_session_data *sd, int16 idx, int16 amount, int8 result) { #if PACKETVER >= 20141119 struct PACKET_ZC_ADD_ITEM_TO_MAIL *packet; @@ -20065,8 +20302,8 @@ void clif_rodex_add_item_result(struct map_session_data *sd, int16 idx, int16 am #endif } -void clif_parse_rodex_remove_item(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_remove_item(int fd, struct map_session_data *sd) +static void clif_parse_rodex_remove_item(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_remove_item(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_REMOVE_ITEM_MAIL *rPacket = RFIFOP(fd, 0); int16 idx = rPacket->index - 2; @@ -20074,7 +20311,7 @@ void clif_parse_rodex_remove_item(int fd, struct map_session_data *sd) rodex->remove_item(sd, idx, (int16)rPacket->cnt); } -void clif_rodex_remove_item_result(struct map_session_data *sd, int16 idx, int16 amount) +static void clif_rodex_remove_item_result(struct map_session_data *sd, int16 idx, int16 amount) { #if PACKETVER >= 20140521 struct PACKET_ZC_ACK_REMOVE_ITEM_MAIL *packet; @@ -20096,8 +20333,8 @@ void clif_rodex_remove_item_result(struct map_session_data *sd, int16 idx, int16 #endif } -void clif_parse_rodex_checkname(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_checkname(int fd, struct map_session_data *sd) +static void clif_parse_rodex_checkname(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_checkname(int fd, struct map_session_data *sd) { const struct PACKET_CZ_CHECKNAME *rPacket = RFIFOP(fd, 0); int char_id = 0, base_level = 0; @@ -20109,7 +20346,7 @@ void clif_parse_rodex_checkname(int fd, struct map_session_data *sd) rodex->check_player(sd, name, &base_level, &char_id, &class); } -void clif_rodex_checkname_result(struct map_session_data *sd, int char_id, short class_, int base_level, const char *name) +static void clif_rodex_checkname_result(struct map_session_data *sd, int char_id, short class_, int base_level, const char *name) { #if PACKETVER >= 20140521 struct PACKET_ZC_CHECKNAME *sPacket; @@ -20137,8 +20374,8 @@ void clif_rodex_checkname_result(struct map_session_data *sd, int char_id, short #endif } -void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) +static void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) { const struct PACKET_CZ_SEND_MAIL *rPacket = RFIFOP(fd, 0); int8 result; @@ -20164,7 +20401,7 @@ void clif_parse_rodex_send_mail(int fd, struct map_session_data *sd) rodex->clean(sd, 1); } -void clif_rodex_send_mail_result(int fd, struct map_session_data *sd, int8 result) +static void clif_rodex_send_mail_result(int fd, struct map_session_data *sd, int8 result) { #if PACKETVER >= 20131230 struct PACKET_ZC_WRITE_MAIL_RESULT *sPacket; @@ -20177,7 +20414,7 @@ void clif_rodex_send_mail_result(int fd, struct map_session_data *sd, int8 resul #endif } -void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_type, int64 page_start) +static void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_type, int64 page_start) { #if PACKETVER >= 20131218 struct PACKET_ZC_MAIL_LIST *packet; @@ -20235,7 +20472,7 @@ void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_typ #endif } -void clif_rodex_send_mails_all(int fd, struct map_session_data *sd, int64 mail_id) +static void clif_rodex_send_mails_all(int fd, struct map_session_data *sd, int64 mail_id) { #if PACKETVER >= 20170419 struct PACKET_ZC_MAIL_LIST *packet; @@ -20307,7 +20544,7 @@ void clif_rodex_send_mails_all(int fd, struct map_session_data *sd, int64 mail_i #endif } -void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type, int count) +static void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type, int count) { #if PACKETVER >= 20131218 struct PACKET_ZC_MAIL_LIST *packet; @@ -20367,23 +20604,23 @@ void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type #endif } -void clif_parse_rodex_next_maillist(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_next_maillist(int fd, struct map_session_data *sd) +static void clif_parse_rodex_next_maillist(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_next_maillist(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_NEXT_MAIL_LIST *packet = RFIFOP(fd, 0); rodex->next_page(sd, packet->opentype, packet->Lower_MailID); } -void clif_parse_rodex_read_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_read_mail(int fd, struct map_session_data *sd) +static void clif_parse_rodex_read_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_read_mail(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_READ_MAIL *rPacket = RFIFOP(fd, 0); rodex->read_mail(sd, rPacket->MailID); } -void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, struct rodex_message *msg) +static void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, struct rodex_message *msg) { #if PACKETVER >= 20140115 struct PACKET_ZC_READ_MAIL *sPacket; @@ -20438,15 +20675,15 @@ void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, struct rod #endif } -void clif_parse_rodex_delete_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_delete_mail(int fd, struct map_session_data *sd) +static void clif_parse_rodex_delete_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_delete_mail(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_DELETE_MAIL *rPacket = RFIFOP(fd, 0); rodex->delete_mail(sd, rPacket->MailID); } -void clif_rodex_delete_mail(struct map_session_data *sd, int8 opentype, int64 mail_id) +static void clif_rodex_delete_mail(struct map_session_data *sd, int8 opentype, int64 mail_id) { #if PACKETVER >= 20131218 struct PACKET_ZC_ACK_DELETE_MAIL *sPacket; @@ -20465,15 +20702,15 @@ void clif_rodex_delete_mail(struct map_session_data *sd, int8 opentype, int64 ma #endif } -void clif_parse_rodex_request_zeny(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_request_zeny(int fd, struct map_session_data *sd) +static void clif_parse_rodex_request_zeny(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_request_zeny(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_ZENY_FROM_MAIL *rPacket = RFIFOP(fd, 0); rodex->get_zeny(sd, rPacket->opentype, rPacket->MailID); } -void clif_rodex_request_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result) +static void clif_rodex_request_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result) { #if PACKETVER >= 20140409 struct PACKET_ZC_ACK_ZENY_FROM_MAIL *sPacket; @@ -20493,15 +20730,15 @@ void clif_rodex_request_zeny(struct map_session_data *sd, int8 opentype, int64 m #endif } -void clif_parse_rodex_request_items(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_request_items(int fd, struct map_session_data *sd) +static void clif_parse_rodex_request_items(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_request_items(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_ITEM_FROM_MAIL *rPacket = RFIFOP(fd, 0); rodex->get_items(sd, rPacket->opentype, rPacket->MailID); } -void clif_rodex_request_items(struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result) +static void clif_rodex_request_items(struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result) { #if PACKETVER >= 20140409 struct PACKET_ZC_ACK_ITEM_FROM_MAIL *sPacket; @@ -20521,7 +20758,7 @@ void clif_rodex_request_items(struct map_session_data *sd, int8 opentype, int64 #endif } -void clif_rodex_icon(int fd, bool show) +static void clif_rodex_icon(int fd, bool show) { // packet add date is 20140716, but from players reports it wrong. Using closer known correct version. #if PACKETVER >= 20141112 @@ -20532,8 +20769,8 @@ void clif_rodex_icon(int fd, bool show) #endif } -void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) +static void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_REFRESH_MAIL_LIST *packet = RFIFOP(fd, 0); #if PACKETVER >= 20170419 @@ -20543,8 +20780,8 @@ void clif_parse_rodex_refresh_maillist(int fd, struct map_session_data *sd) #endif } -void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) +static void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_OPEN_MAIL *packet = RFIFOP(fd, 0); #if PACKETVER >= 20170419 @@ -20555,20 +20792,20 @@ void clif_parse_rodex_open_mailbox(int fd, struct map_session_data *sd) rodex->clean(sd, 1); } -void clif_parse_rodex_close_mailbox(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_close_mailbox(int fd, struct map_session_data *sd) +static void clif_parse_rodex_close_mailbox(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_close_mailbox(int fd, struct map_session_data *sd) { rodex->clean(sd, 0); intif->rodex_checkhasnew(sd); } -void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) +static void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) { rodex->clean(sd, 1); } -void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime) +static void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime) { #if PACKETVER >= 20151223 struct PACKET_ZC_SKILL_SCALE p; @@ -20596,7 +20833,7 @@ void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 sk /// Send hat effects to the client (ZC_HAT_EFFECT). /// 0A3B <Length>.W <AID>.L <Status>.B { <HatEffectId>.W } -void clif_hat_effect(struct block_list *bl, struct block_list *tbl, enum send_target target) +static void clif_hat_effect(struct block_list *bl, struct block_list *tbl, enum send_target target) { #if PACKETVER >= 20150422 unsigned char *buf; @@ -20632,7 +20869,7 @@ void clif_hat_effect(struct block_list *bl, struct block_list *tbl, enum send_ta #endif } -void clif_hat_effect_single(struct block_list *bl, uint16 effectId, bool enable){ +static void clif_hat_effect_single(struct block_list *bl, uint16 effectId, bool enable){ #if PACKETVER >= 20150422 unsigned char buf[13]; @@ -20648,7 +20885,7 @@ void clif_hat_effect_single(struct block_list *bl, uint16 effectId, bool enable) #endif } -bool clif_parse_attendance_db(void) +static bool clif_parse_attendance_db(void) { struct config_t attendance_conf; struct config_setting_t *attendance = NULL, *it = NULL; @@ -20670,7 +20907,7 @@ bool clif_parse_attendance_db(void) return true; } -bool clif_attendancedb_libconfig_sub(struct config_setting_t *it, int n, const char *source) +static bool clif_attendancedb_libconfig_sub(struct config_setting_t *it, int n, const char *source) { struct attendance_entry entry = { 0 }; int i32 = 0; @@ -20695,7 +20932,7 @@ bool clif_attendancedb_libconfig_sub(struct config_setting_t *it, int n, const c return true; } -bool clif_attendance_timediff(struct map_session_data *sd) +static bool clif_attendance_timediff(struct map_session_data *sd) { int64 timediff; @@ -20707,7 +20944,7 @@ bool clif_attendance_timediff(struct map_session_data *sd) return false; return true; } -time_t clif_attendance_getendtime(void) +static time_t clif_attendance_getendtime(void) { time_t timestamp; struct tm tmtime = { 0 }; @@ -20726,8 +20963,8 @@ time_t clif_attendance_getendtime(void) return timestamp; } -void clif_parse_open_ui_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_open_ui_request(int fd, struct map_session_data *sd) +static void clif_parse_open_ui_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_open_ui_request(int fd, struct map_session_data *sd) { const struct PACKET_CZ_OPEN_UI *p = RP2PTR(fd); @@ -20745,7 +20982,7 @@ void clif_parse_open_ui_request(int fd, struct map_session_data *sd) clif->open_ui(sd, p->UIType); } -void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) +static void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) { #if PACKETVER >= 20150128 struct PACKET_ZC_OPEN_UI p; @@ -20785,8 +21022,8 @@ void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) #endif } -void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) +static void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) { #if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411 @@ -20836,12 +21073,12 @@ void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) #endif } -void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) +static void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) { } -void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) +static void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) { struct PACKET_ZC_UI_ACTION p; @@ -20855,8 +21092,8 @@ void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) clif->send(&p, sizeof(p), &sd->bl, SELF); } -void clif_parse_private_airship_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_private_airship_request(int fd, struct map_session_data *sd) +static void clif_parse_private_airship_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_private_airship_request(int fd, struct map_session_data *sd) { #if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 char evname[EVENT_NAME_LENGTH]; @@ -20876,7 +21113,7 @@ void clif_parse_private_airship_request(int fd, struct map_session_data *sd) #endif } -void clif_private_airship_response(struct map_session_data *sd, uint32 flag) +static void clif_private_airship_response(struct map_session_data *sd, uint32 flag) { #if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE p; @@ -20897,7 +21134,7 @@ void clif_private_airship_response(struct map_session_data *sd, uint32 flag) #endif } -void clif_stylist_vector_init(void) +static void clif_stylist_vector_init(void) { int i; for (i = 0; i < MAX_STYLIST_TYPE; i++) { @@ -20905,7 +21142,7 @@ void clif_stylist_vector_init(void) } } -void clif_stylist_vector_clear(void) +static void clif_stylist_vector_clear(void) { int i; for (i = 0; i < MAX_STYLIST_TYPE; i++) { @@ -20913,7 +21150,7 @@ void clif_stylist_vector_clear(void) } } -bool clif_stylist_read_db_libconfig(void) +static bool clif_stylist_read_db_libconfig(void) { struct config_t stylist_conf; struct config_setting_t *stylist = NULL, *it = NULL; @@ -20939,7 +21176,7 @@ bool clif_stylist_read_db_libconfig(void) return true; } -bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) +static bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { struct stylist_data_entry entry = { 0 }; int i32 = 0, type = 0; @@ -20978,7 +21215,7 @@ bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, co return true; } -bool clif_style_change_validate_requirements(struct map_session_data *sd, int type, int16 idx) +static bool clif_style_change_validate_requirements(struct map_session_data *sd, int type, int16 idx) { struct item it; struct stylist_data_entry *entry; @@ -21009,7 +21246,7 @@ bool clif_style_change_validate_requirements(struct map_session_data *sd, int ty } return false; } -void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) +static void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) { struct rodex_message msg = { 0 }; @@ -21030,8 +21267,8 @@ void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) intif->rodex_sendmail(&msg); } -void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); -void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) +static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) { const struct PACKET_CZ_REQ_STYLE_CHANGE *p = RP2PTR(fd); @@ -21052,7 +21289,7 @@ void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) return; } -void clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 idx, bool isitem) +static void clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 idx, bool isitem) { struct stylist_data_entry *entry; @@ -21071,7 +21308,7 @@ void clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 i } } -void clif_style_change_response(struct map_session_data *sd, enum stylist_shop flag) +static void clif_style_change_response(struct map_session_data *sd, enum stylist_shop flag) { #if PACKETVER >= 20151104 struct PACKET_ZC_STYLE_CHANGE_RES p; @@ -21090,7 +21327,8 @@ void clif_style_change_response(struct map_session_data *sd, enum stylist_shop f /*========================================== * Main client packet processing function *------------------------------------------*/ -int clif_parse(int fd) { +static int clif_parse(int fd) +{ int cmd, packet_len; struct map_session_data *sd; int pnum; @@ -21243,14 +21481,15 @@ int clif_parse(int fd) { * @param packet_id The packet ID. * @return The corresponding packet_db entry, if any. */ -const struct s_packet_db *clif_packet(int packet_id) +static const struct s_packet_db *clif_packet(int packet_id) { if (packet_id < MIN_PACKET_DB || packet_id > MAX_PACKET_DB || packet_db[packet_id].len == 0) return NULL; return &packet_db[packet_id]; } -static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) { +static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) +{ va_list va; int i; int pos; @@ -21294,7 +21533,9 @@ static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...) } va_end(va); } -void packetdb_loaddb(void) { + +static void packetdb_loaddb(void) +{ memset(packet_db,0,sizeof(packet_db)); #define packet(id, size, ...) packetdb_addpacket((id), (size), ##__VA_ARGS__, 0xFFFF) @@ -21317,7 +21558,9 @@ void packetdb_loaddb(void) { #endif // defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3) #undef packetKeys } -void clif_bc_ready(void) { + +static void clif_bc_ready(void) +{ if( battle_config.display_status_timers ) clif->status_change = clif_status_change; else @@ -21339,7 +21582,7 @@ void clif_bc_ready(void) { /*========================================== * *------------------------------------------*/ -int do_init_clif(bool minimal) +static int do_init_clif(bool minimal) { if (minimal) return 0; @@ -21361,7 +21604,7 @@ int do_init_clif(bool minimal) return 0; } -void do_final_clif(void) +static void do_final_clif(void) { unsigned char i; @@ -21384,7 +21627,9 @@ void do_final_clif(void) } } -void clif_defaults(void) { + +void clif_defaults(void) +{ clif = &clif_s; /* vars */ clif->bind_ip = INADDR_ANY; diff --git a/src/map/duel.c b/src/map/duel.c index d22c34495..39e5b5253 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -33,13 +33,14 @@ #include <string.h> #include <time.h> -struct duel_interface duel_s; +static struct duel_interface duel_s; struct duel_interface *duel; /*========================================== * Duel organizing functions [LuzZza] *------------------------------------------*/ -void duel_savetime(struct map_session_data* sd) { +static void duel_savetime(struct map_session_data *sd) +{ time_t clock; struct tm *t; @@ -49,7 +50,8 @@ void duel_savetime(struct map_session_data* sd) { pc_setglobalreg(sd, script->add_str("PC_LAST_DUEL_TIME"), t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min); } -int duel_checktime(struct map_session_data* sd) { +static int duel_checktime(struct map_session_data *sd) +{ int diff; time_t clock; struct tm *t; @@ -62,7 +64,7 @@ int duel_checktime(struct map_session_data* sd) { return !(diff >= 0 && diff < battle_config.duel_time_interval); } -static int duel_showinfo_sub(struct map_session_data* sd, va_list va) +static int duel_showinfo_sub(struct map_session_data *sd, va_list va) { struct map_session_data *ssd = va_arg(va, struct map_session_data*); int *p = va_arg(va, int*); @@ -77,7 +79,8 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va) return 1; } -void duel_showinfo(const unsigned int did, struct map_session_data* sd) { +static void duel_showinfo(const unsigned int did, struct map_session_data *sd) +{ int p=0; char output[256]; @@ -97,7 +100,8 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) { map->foreachpc(duel_showinfo_sub, sd, &p); } -int duel_create(struct map_session_data* sd, const unsigned int maxpl) { +static int duel_create(struct map_session_data *sd, const unsigned int maxpl) +{ int i=1; char output[256]; @@ -120,7 +124,8 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl) { return i; } -void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd) { +static void duel_invite(const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd) +{ char output[256]; nullpo_retv(sd); @@ -137,7 +142,7 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map clif->broadcast(&target_sd->bl, output, (int)strlen(output)+1, BC_BLUE, SELF); } -static int duel_leave_sub(struct map_session_data* sd, va_list va) +static int duel_leave_sub(struct map_session_data *sd, va_list va) { int did = va_arg(va, int); nullpo_ret(sd); @@ -146,7 +151,8 @@ static int duel_leave_sub(struct map_session_data* sd, va_list va) return 0; } -void duel_leave(const unsigned int did, struct map_session_data* sd) { +static void duel_leave(const unsigned int did, struct map_session_data *sd) +{ char output[256]; nullpo_retv(sd); @@ -166,7 +172,8 @@ void duel_leave(const unsigned int did, struct map_session_data* sd) { clif->maptypeproperty2(&sd->bl,SELF); } -void duel_accept(const unsigned int did, struct map_session_data* sd) { +static void duel_accept(const unsigned int did, struct map_session_data *sd) +{ char output[256]; nullpo_retv(sd); @@ -183,7 +190,8 @@ void duel_accept(const unsigned int did, struct map_session_data* sd) { clif->maptypeproperty2(&sd->bl,SELF); } -void duel_reject(const unsigned int did, struct map_session_data* sd) { +static void duel_reject(const unsigned int did, struct map_session_data *sd) +{ char output[256]; nullpo_retv(sd); @@ -195,10 +203,12 @@ void duel_reject(const unsigned int did, struct map_session_data* sd) { sd->duel_invite = 0; } -void do_final_duel(void) { +static void do_final_duel(void) +{ } -void do_init_duel(bool minimal) { +static void do_init_duel(bool minimal) +{ if (minimal) return; @@ -206,11 +216,12 @@ void do_init_duel(bool minimal) { } /*===================================== -* Default Functions : duel.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void duel_defaults(void) { + * Default Functions : duel.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void duel_defaults(void) +{ duel = &duel_s; /* vars */ duel->count = 0; diff --git a/src/map/elemental.c b/src/map/elemental.c index 6b6d6bc54..b7bd5c090 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -57,20 +57,23 @@ #include <stdlib.h> #include <string.h> -struct elemental_interface elemental_s; +static struct elemental_interface elemental_s; struct elemental_interface *elemental; -int elemental_search_index(int class_) { +static int elemental_search_index(int class_) +{ int i; ARR_FIND(0, MAX_ELEMENTAL_CLASS, i, elemental->db[i].class_ == class_); return (i == MAX_ELEMENTAL_CLASS)?-1:i; } -bool elemental_class(int class_) { +static bool elemental_class(int class_) +{ return (bool)(elemental->search_index(class_) > -1); } -struct view_data * elemental_get_viewdata(int class_) { +static struct view_data *elemental_get_viewdata(int class_) +{ int i = elemental->search_index(class_); if( i < 0 ) return 0; @@ -78,7 +81,8 @@ struct view_data * elemental_get_viewdata(int class_) { return &elemental->db[i].vd; } -int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime) { +static int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime) +{ struct s_elemental ele; struct s_elemental_db *db; int i, summon_level, skill_level; @@ -169,7 +173,8 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet return 1; } -int elemental_get_lifetime(struct elemental_data *ed) { +static int elemental_get_lifetime(struct elemental_data *ed) +{ const struct TimerData * td; if( ed == NULL || ed->summon_timer == INVALID_TIMER ) return 0; @@ -178,7 +183,8 @@ int elemental_get_lifetime(struct elemental_data *ed) { return (td != NULL) ? DIFF_TICK32(td->tick, timer->gettick()) : 0; } -int elemental_save(struct elemental_data *ed) { +static int elemental_save(struct elemental_data *ed) +{ nullpo_retr(1, ed); ed->elemental.mode = ed->battle_status.mode; ed->elemental.hp = ed->battle_status.hp; @@ -197,7 +203,8 @@ int elemental_save(struct elemental_data *ed) { return 1; } -int elemental_summon_end_timer(int tid, int64 tick, int id, intptr_t data) { +static int elemental_summon_end_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct elemental_data *ed; @@ -217,14 +224,16 @@ int elemental_summon_end_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void elemental_summon_stop(struct elemental_data *ed) { +static void elemental_summon_stop(struct elemental_data *ed) +{ nullpo_retv(ed); if( ed->summon_timer != INVALID_TIMER ) timer->delete(ed->summon_timer, elemental->summon_end_timer); ed->summon_timer = INVALID_TIMER; } -int elemental_delete(struct elemental_data *ed, int reply) { +static int elemental_delete(struct elemental_data *ed, int reply) +{ struct map_session_data *sd; nullpo_ret(ed); @@ -246,7 +255,8 @@ int elemental_delete(struct elemental_data *ed, int reply) { return unit->remove_map(&ed->bl, 0, ALC_MARK); } -void elemental_summon_init(struct elemental_data *ed) { +static void elemental_summon_init(struct elemental_data *ed) +{ nullpo_retv(ed); if (ed->summon_timer == INVALID_TIMER) ed->summon_timer = timer->add(timer->gettick() + ed->elemental.life_time, elemental->summon_end_timer, ed->master->bl.id, 0); @@ -254,7 +264,7 @@ void elemental_summon_init(struct elemental_data *ed) { ed->regen.state.block = 0; } -int elemental_data_received(const struct s_elemental *ele, bool flag) +static int elemental_data_received(const struct s_elemental *ele, bool flag) { struct map_session_data *sd; struct elemental_data *ed; @@ -318,7 +328,8 @@ int elemental_data_received(const struct s_elemental *ele, bool flag) return 1; } -int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) { +static int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) +{ struct block_list *bl; sc_type type = status->skill2sc(skill_id); @@ -365,7 +376,8 @@ int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id) { return 1; } -int elemental_clean_effect(struct elemental_data *ed) { +static int elemental_clean_effect(struct elemental_data *ed) +{ struct map_session_data *sd; nullpo_ret(ed); @@ -425,7 +437,8 @@ int elemental_clean_effect(struct elemental_data *ed) { return 1; } -int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tick) { +static int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tick) +{ struct skill_condition req; uint16 skill_id, skill_lv; int i; @@ -506,7 +519,8 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, int64 tic * Action that elemental perform after changing mode. * Activates one of the skills of the new mode. *-------------------------------------------------------------*/ -int elemental_change_mode_ack(struct elemental_data *ed, int mode) { +static int elemental_change_mode_ack(struct elemental_data *ed, int mode) +{ struct block_list *bl = &ed->master->bl; uint16 skill_id, skill_lv; int i; @@ -552,7 +566,7 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) { * @param mode The new mode. * @retval 1 in case of success. */ -int elemental_change_mode(struct elemental_data *ed, uint32 mode) +static int elemental_change_mode(struct elemental_data *ed, uint32 mode) { int skillmode = EL_SKILLMODE_PASIVE; nullpo_ret(ed); @@ -580,7 +594,8 @@ int elemental_change_mode(struct elemental_data *ed, uint32 mode) return 1; } -void elemental_heal(struct elemental_data *ed, int hp, int sp) { +static void elemental_heal(struct elemental_data *ed, int hp, int sp) +{ nullpo_retv(ed); if( hp ) clif->elemental_updatestatus(ed->master, SP_HP); @@ -588,12 +603,14 @@ void elemental_heal(struct elemental_data *ed, int hp, int sp) { clif->elemental_updatestatus(ed->master, SP_SP); } -int elemental_dead(struct elemental_data *ed) { +static int elemental_dead(struct elemental_data *ed) +{ elemental->delete(ed, 1); return 0; } -int elemental_unlocktarget(struct elemental_data *ed) { +static int elemental_unlocktarget(struct elemental_data *ed) +{ nullpo_ret(ed); ed->target_id = 0; @@ -602,7 +619,8 @@ int elemental_unlocktarget(struct elemental_data *ed) { return 0; } -int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed) { +static int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed) +{ int idx = skill->get_index(skill_id); nullpo_retr(1,ed); @@ -612,7 +630,8 @@ int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed) { return skill->not_ok(skill_id, ed->master); } -struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv){ +static struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 skill_lv) +{ struct skill_condition req; int idx = skill->get_index(skill_id); @@ -630,7 +649,8 @@ struct skill_condition elemental_skill_get_requirements(uint16 skill_id, uint16 return req; } -int elemental_set_target( struct map_session_data *sd, struct block_list *bl ) { +static int elemental_set_target(struct map_session_data *sd, struct block_list *bl) +{ struct elemental_data *ed; nullpo_ret(sd); @@ -650,7 +670,8 @@ int elemental_set_target( struct map_session_data *sd, struct block_list *bl ) { return 1; } -int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap) { +static int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap) +{ struct elemental_data *ed; struct block_list **target; int dist; @@ -689,7 +710,8 @@ int elemental_ai_sub_timer_activesearch(struct block_list *bl, va_list ap) { return 0; } -int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, int64 tick) { +static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, int64 tick) +{ struct block_list *target = NULL; int master_dist, view_range; uint32 mode; @@ -805,7 +827,8 @@ int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *s return 0; } -int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) { +static int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) +{ int64 tick = va_arg(ap,int64); nullpo_ret(sd); if(sd->status.ele_id && sd->ed) @@ -814,12 +837,14 @@ int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) { return 0; } -int elemental_ai_timer(int tid, int64 tick, int id, intptr_t data) { +static int elemental_ai_timer(int tid, int64 tick, int id, intptr_t data) +{ map->foreachpc(elemental->ai_sub_foreachclient,tick); return 0; } -int read_elementaldb(void) { +static int read_elementaldb(void) +{ FILE *fp; char line[1024], *p; char *str[26]; @@ -911,7 +936,8 @@ int read_elementaldb(void) { return 0; } -int read_elemental_skilldb(void) { +static int read_elemental_skilldb(void) +{ FILE *fp; char line[1024], *p; char *str[4]; @@ -983,16 +1009,19 @@ int read_elemental_skilldb(void) { return 0; } -void reload_elementaldb(void) { +static void reload_elementaldb(void) +{ elemental->read_db(); elemental->reload_skilldb(); } -void reload_elemental_skilldb(void) { +static void reload_elemental_skilldb(void) +{ elemental->read_skilldb(); } -int do_init_elemental(bool minimal) { +static int do_init_elemental(bool minimal) +{ if (minimal) return 0; @@ -1005,16 +1034,18 @@ int do_init_elemental(bool minimal) { return 0; } -void do_final_elemental(void) { +static void do_final_elemental(void) +{ return; } /*===================================== -* Default Functions : elemental.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void elemental_defaults(void) { + * Default Functions : elemental.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void elemental_defaults(void) +{ elemental = &elemental_s; /* */ diff --git a/src/map/guild.c b/src/map/guild.c index 8b9c0fd43..302a534a2 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -51,13 +51,13 @@ #include <stdlib.h> #include <string.h> -struct guild_interface guild_s; +static struct guild_interface guild_s; struct guild_interface *guild; /*========================================== * Retrieves and validates the sd pointer for this guild member [Skotlex] *------------------------------------------*/ -struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_id) +static struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_id) { struct map_session_data *sd = map->id2sd(account_id); @@ -74,14 +74,16 @@ struct map_session_data *guild_sd_check(int guild_id, int account_id, int char_i } // Modified [Komurka] -int guild_skill_get_max (int id) { +static int guild_skill_get_max(int id) +{ if (id < GD_SKILLBASE || id >= GD_SKILLBASE+MAX_GUILDSKILL) return 0; return guild->skill_tree[id-GD_SKILLBASE].max; } // Retrieve skill_lv learned by guild -int guild_checkskill(struct guild *g, int id) { +static int guild_checkskill(struct guild *g, int id) +{ int idx = id - GD_SKILLBASE; nullpo_ret(g); if (idx < 0 || idx >= MAX_GUILDSKILL) @@ -92,7 +94,7 @@ int guild_checkskill(struct guild *g, int id) { /*========================================== * guild_skill_tree.txt reading - from jA [Komurka] *------------------------------------------*/ -bool guild_read_guildskill_tree_db(char* split[], int columns, int current) +static bool guild_read_guildskill_tree_db(char *split[], int columns, int current) {// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5> int k, id, skill_id; @@ -125,7 +127,7 @@ bool guild_read_guildskill_tree_db(char* split[], int columns, int current) /*========================================== * Guild skill check - from jA [Komurka] *------------------------------------------*/ -int guild_check_skill_require(struct guild *g,int id) +static int guild_check_skill_require(struct guild *g, int id) { int i; int idx = id-GD_SKILLBASE; @@ -145,7 +147,7 @@ int guild_check_skill_require(struct guild *g,int id) return 1; } -bool guild_read_castledb(char* str[], int columns, int current) +static bool guild_read_castledb(char *str[], int columns, int current) {// <castle id>,<map name>,<castle name>,<castle event>[,<reserved/unused switch flag>] struct guild_castle *gc; int index; @@ -169,13 +171,13 @@ bool guild_read_castledb(char* str[], int columns, int current) } /// lookup: guild id -> guild* -struct guild* guild_search(int guild_id) +static struct guild *guild_search(int guild_id) { return (struct guild*)idb_get(guild->db,guild_id); } /// lookup: guild name -> guild* -struct guild* guild_searchname(char* str) +static struct guild *guild_searchname(char *str) { struct guild* g; struct DBIterator *iter = db_iterator(guild->db); @@ -192,13 +194,13 @@ struct guild* guild_searchname(char* str) } /// lookup: castle id -> castle* -struct guild_castle* guild_castle_search(int gcid) +static struct guild_castle *guild_castle_search(int gcid) { return (struct guild_castle*)idb_get(guild->castle_db,gcid); } /// lookup: map index -> castle* -struct guild_castle* guild_mapindex2gc(short map_index) +static struct guild_castle *guild_mapindex2gc(short map_index) { struct guild_castle* gc; struct DBIterator *iter = db_iterator(guild->castle_db); @@ -214,12 +216,12 @@ struct guild_castle* guild_mapindex2gc(short map_index) } /// lookup: map name -> castle* -struct guild_castle* guild_mapname2gc(const char* mapname) +static struct guild_castle *guild_mapname2gc(const char *mapname) { return guild->mapindex2gc(mapindex->name2id(mapname)); } -struct map_session_data* guild_getavailablesd(struct guild* g) +static struct map_session_data *guild_getavailablesd(struct guild *g) { int i; @@ -230,7 +232,7 @@ struct map_session_data* guild_getavailablesd(struct guild* g) } /// lookup: player AID/CID -> member index -int guild_getindex(const struct guild *g, int account_id, int char_id) +static int guild_getindex(const struct guild *g, int account_id, int char_id) { int i; @@ -245,7 +247,7 @@ int guild_getindex(const struct guild *g, int account_id, int char_id) } /// lookup: player sd -> member position -int guild_getposition(struct guild* g, struct map_session_data* sd) +static int guild_getposition(struct guild *g, struct map_session_data *sd) { int i; @@ -257,7 +259,7 @@ int guild_getposition(struct guild* g, struct map_session_data* sd) } //Creation of member information -void guild_makemember(struct guild_member *m,struct map_session_data *sd) +static void guild_makemember(struct guild_member *m, struct map_session_data *sd) { nullpo_retv(sd); nullpo_retv(m); @@ -283,7 +285,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd) * Server cache to be flushed to inter the Guild EXP * @see DBApply */ -int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap) +static int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap) { int i; struct guild_expcache *c; @@ -311,7 +313,8 @@ int guild_payexp_timer_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) { +static int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) +{ guild->expcache_db->clear(guild->expcache_db,guild->payexp_timer_sub); return 0; } @@ -320,7 +323,7 @@ int guild_payexp_timer(int tid, int64 tick, int id, intptr_t data) { * Taken from party_send_xy_timer_sub. [Skotlex] * @see DBApply */ -int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) +static int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) { struct guild *g = DB->data2ptr(data); int i; @@ -345,12 +348,13 @@ int guild_send_xy_timer_sub(union DBKey key, struct DBData *data, va_list ap) } //Code from party_send_xy_timer [Skotlex] -int guild_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { +static int guild_send_xy_timer(int tid, int64 tick, int id, intptr_t data) +{ guild->db->foreach(guild->db,guild->send_xy_timer_sub,tick); return 0; } -int guild_send_dot_remove(struct map_session_data *sd) +static int guild_send_dot_remove(struct map_session_data *sd) { nullpo_ret(sd); if (sd->status.guild_id) @@ -359,7 +363,7 @@ int guild_send_dot_remove(struct map_session_data *sd) } //------------------------------------------------------------------------ -int guild_create(struct map_session_data *sd, const char *name) +static int guild_create(struct map_session_data *sd, const char *name) { char tname[NAME_LENGTH]; struct guild_member m; @@ -393,7 +397,8 @@ int guild_create(struct map_session_data *sd, const char *name) } //Whether or not to create guild -int guild_created(int account_id,int guild_id) { +static int guild_created(int account_id, int guild_id) +{ struct map_session_data *sd=map->id2sd(account_id); if(sd==NULL) @@ -414,13 +419,13 @@ int guild_created(int account_id,int guild_id) { } //Information request -int guild_request_info(int guild_id) +static int guild_request_info(int guild_id) { return intif->guild_request_info(guild_id); } //Information request with event -int guild_npc_request_info(int guild_id,const char *event) +static int guild_npc_request_info(int guild_id, const char *event) { if (guild->search(guild_id) != NULL) { if (event != NULL && *event != '\0') @@ -443,7 +448,7 @@ int guild_npc_request_info(int guild_id,const char *event) } //Confirmation of the character belongs to guild -int guild_check_member(const struct guild *g) +static int guild_check_member(const struct guild *g) { int i; struct map_session_data *sd; @@ -469,7 +474,7 @@ int guild_check_member(const struct guild *g) } //Delete association with guild_id for all characters -int guild_recv_noinfo(int guild_id) +static int guild_recv_noinfo(int guild_id) { struct map_session_data *sd; struct s_mapiterator* iter; @@ -485,7 +490,7 @@ int guild_recv_noinfo(int guild_id) } //Get and display information for all member -int guild_recv_info(const struct guild *sg) +static int guild_recv_info(const struct guild *sg) { struct guild *g,before; int i,bm,m; @@ -634,7 +639,8 @@ int guild_recv_info(const struct guild *sg) /*============================================= * Player sd send a guild invatation to player tsd to join his guild *--------------------------------------------*/ -int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { +static int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) +{ struct guild *g; int i; @@ -688,7 +694,8 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) { /// Guild invitation reply. /// flag: 0:rejected, 1:accepted -int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) { +static int guild_reply_invite(struct map_session_data *sd, int guild_id, int flag) +{ struct map_session_data* tsd; nullpo_ret(sd); @@ -746,7 +753,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag) { //- If guild is not in memory, it is requested //- Otherwise sd pointer is set up. //- Player must be authed and must belong to a guild before invoking this method -void guild_member_joined(struct map_session_data *sd) +static void guild_member_joined(struct map_session_data *sd) { struct guild* g; int i; @@ -780,7 +787,8 @@ void guild_member_joined(struct map_session_data *sd) /*========================================== * Add a player to a given guild_id *----------------------------------------*/ -int guild_member_added(int guild_id,int account_id,int char_id,int flag) { +static int guild_member_added(int guild_id, int account_id, int char_id, int flag) +{ struct map_session_data *sd = map->id2sd(account_id),*sd2; struct guild *g; @@ -828,7 +836,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag) { * Player request leaving a given guild_id * mes - non null terminated string *----------------------------------------*/ -int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) +static int guild_leave(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes) { struct guild *g; @@ -857,7 +865,8 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c * Request remove a player to a given guild_id * mes - non null terminated string *----------------------------------------*/ -int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) { +static int guild_expulsion(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes) +{ struct map_session_data *tsd; struct guild *g; int i,ps; @@ -892,7 +901,7 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i return 0; } -int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char* name, const char* mes) +static int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes) { int i; struct guild* g = guild->search(guild_id); @@ -948,7 +957,8 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c return 0; } -void guild_retrieveitembound(int char_id,int aid,int guild_id) { +static void guild_retrieveitembound(int char_id, int aid, int guild_id) +{ #ifdef GP_BOUND_ITEMS struct map_session_data *sd = map->charid2sd(char_id); if (sd != NULL) { //Character is online @@ -970,8 +980,9 @@ void guild_retrieveitembound(int char_id,int aid,int guild_id) { #endif } -int guild_send_memberinfoshort(struct map_session_data *sd,int online) -{ // cleaned up [LuzZza] +// cleaned up [LuzZza] +static int guild_send_memberinfoshort(struct map_session_data *sd, int online) +{ struct guild *g; nullpo_ret(sd); @@ -1002,8 +1013,9 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) return 0; } -int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login) -{ // cleaned up [LuzZza] +// cleaned up [LuzZza] +static int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class, uint32 last_login) +{ int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1; struct guild *g = guild->search(guild_id); @@ -1068,7 +1080,7 @@ int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int on /*==================================================== * Send a message to whole guild *---------------------------------------------------*/ -int guild_send_message(struct map_session_data *sd, const char *mes) +static int guild_send_message(struct map_session_data *sd, const char *mes) { int len = (int)strlen(mes); nullpo_ret(sd); @@ -1087,7 +1099,7 @@ int guild_send_message(struct map_session_data *sd, const char *mes) /*==================================================== * Guild receive a message, will be displayed to whole member *---------------------------------------------------*/ -int guild_recv_message(int guild_id,int account_id,const char *mes,int len) +static int guild_recv_message(int guild_id, int account_id, const char *mes, int len) { struct guild *g; if( (g=guild->search(guild_id))==NULL) @@ -1099,7 +1111,7 @@ int guild_recv_message(int guild_id,int account_id,const char *mes,int len) /*==================================================== * Member changing position in guild *---------------------------------------------------*/ -int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx) +static int guild_change_memberposition(int guild_id, int account_id, int char_id, short idx) { return intif->guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx)); } @@ -1107,7 +1119,7 @@ int guild_change_memberposition(int guild_id,int account_id,int char_id,short id /*==================================================== * Notification of new position for member *---------------------------------------------------*/ -int guild_memberposition_changed(struct guild *g,int idx,int pos) +static int guild_memberposition_changed(struct guild *g, int idx, int pos) { nullpo_ret(g); Assert_ret(idx >= 0 && idx < MAX_GUILD); @@ -1124,7 +1136,7 @@ int guild_memberposition_changed(struct guild *g,int idx,int pos) /*==================================================== * Change guild title or member *---------------------------------------------------*/ -int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name) +static int guild_change_position(int guild_id, int idx, int mode, int exp_mode, const char *name) { struct guild_position p; nullpo_ret(name); @@ -1139,7 +1151,7 @@ int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char /*==================================================== * Notification of member has changed his guild title *---------------------------------------------------*/ -int guild_position_changed(int guild_id, int idx, const struct guild_position *p) +static int guild_position_changed(int guild_id, int idx, const struct guild_position *p) { struct guild *g=guild->search(guild_id); int i; @@ -1160,7 +1172,7 @@ int guild_position_changed(int guild_id, int idx, const struct guild_position *p /*==================================================== * Change guild notice *---------------------------------------------------*/ -int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2) +static int guild_change_notice(struct map_session_data *sd, int guild_id, const char *mes1, const char *mes2) { nullpo_ret(sd); @@ -1172,7 +1184,7 @@ int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes /*==================================================== * Notification of guild has changed his notice *---------------------------------------------------*/ -int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) +static int guild_notice_changed(int guild_id, const char *mes1, const char *mes2) { int i; struct guild *g=guild->search(guild_id); @@ -1195,7 +1207,7 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) /*==================================================== * Change guild emblem *---------------------------------------------------*/ -int guild_change_emblem(struct map_session_data *sd,int len,const char *data) +static int guild_change_emblem(struct map_session_data *sd, int len, const char *data) { struct guild *g; nullpo_ret(sd); @@ -1212,7 +1224,7 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data) /*==================================================== * Notification of guild emblem changed *---------------------------------------------------*/ -int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) +static int guild_emblem_changed(int len, int guild_id, int emblem_id, const char *data) { int i; struct map_session_data *sd; @@ -1272,7 +1284,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) /** * @see DBCreateData */ -struct DBData create_expcache(union DBKey key, va_list args) +static struct DBData create_expcache(union DBKey key, va_list args) { struct guild_expcache *c; struct map_session_data *sd = va_arg(args, struct map_session_data*); @@ -1289,7 +1301,7 @@ struct DBData create_expcache(union DBKey key, va_list args) /*==================================================== * Return taxed experience from player sd to guild *---------------------------------------------------*/ -uint64 guild_payexp(struct map_session_data *sd, uint64 exp) +static uint64 guild_payexp(struct map_session_data *sd, uint64 exp) { struct guild *g; struct guild_expcache *c; @@ -1323,7 +1335,7 @@ uint64 guild_payexp(struct map_session_data *sd, uint64 exp) * Add this experience to guild exp * [Celest] *---------------------------------------------------*/ -int guild_getexp(struct map_session_data *sd,int exp) +static int guild_getexp(struct map_session_data *sd, int exp) { struct guild_expcache *c; nullpo_ret(sd); @@ -1342,7 +1354,7 @@ int guild_getexp(struct map_session_data *sd,int exp) /*==================================================== * Ask to increase guildskill skill_id *---------------------------------------------------*/ -int guild_skillup(struct map_session_data *sd, uint16 skill_id) +static int guild_skillup(struct map_session_data *sd, uint16 skill_id) { struct guild* g; int idx = skill_id - GD_SKILLBASE; @@ -1366,7 +1378,8 @@ int guild_skillup(struct map_session_data *sd, uint16 skill_id) /*==================================================== * Notification of guildskill skill_id increase request *---------------------------------------------------*/ -int guild_skillupack(int guild_id,uint16 skill_id,int account_id) { +static int guild_skillupack(int guild_id, uint16 skill_id, int account_id) +{ struct map_session_data *sd=map->id2sd(account_id); struct guild *g=guild->search(guild_id); int i; @@ -1395,7 +1408,8 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id) { return 0; } -void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { +static void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) +{ struct skill_unit_group* group = NULL; int type = status->skill2sc(skill_id); nullpo_retv(sd); @@ -1421,7 +1435,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1 * 0 = allied * 1 = enemy *---------------------------------------------------*/ -int guild_get_alliance_count(struct guild *g,int flag) +static int guild_get_alliance_count(struct guild *g, int flag) { int i,c; @@ -1435,7 +1449,7 @@ int guild_get_alliance_count(struct guild *g,int flag) } // Blocks all guild skills which have a common delay time. -void guild_block_skill(struct map_session_data *sd, int time) +static void guild_block_skill(struct map_session_data *sd, int time) { uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL }; int i; @@ -1450,7 +1464,7 @@ void guild_block_skill(struct map_session_data *sd, int time) * 1 = enemy * Returns true if yes. *---------------------------------------------------*/ -int guild_check_alliance(int guild_id1, int guild_id2, int flag) +static int guild_check_alliance(int guild_id1, int guild_id2, int flag) { struct guild *g; int i; @@ -1466,7 +1480,8 @@ int guild_check_alliance(int guild_id1, int guild_id2, int flag) /*==================================================== * Player sd, asking player tsd an alliance between their 2 guilds *---------------------------------------------------*/ -int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) { +static int guild_reqalliance(struct map_session_data *sd, struct map_session_data *tsd) +{ struct guild *g[2]; int i; @@ -1522,7 +1537,8 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd) /*==================================================== * Player sd, answer to player tsd (account_id) for an alliance request *---------------------------------------------------*/ -int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) { +static int guild_reply_reqalliance(struct map_session_data *sd, int account_id, int flag) +{ struct map_session_data *tsd; nullpo_ret(sd); @@ -1582,7 +1598,8 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag) /*==================================================== * Player sd asking to break alliance with guild guild_id *---------------------------------------------------*/ -int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) { +static int guild_delalliance(struct map_session_data *sd, int guild_id, int flag) +{ nullpo_ret(sd); if(map->agit_flag || map->agit2_flag) { @@ -1598,7 +1615,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag) { /*==================================================== * Player sd, asking player tsd a formal enemy relation between their 2 guilds *---------------------------------------------------*/ -int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) +static int guild_opposition(struct map_session_data *sd, struct map_session_data *tsd) { struct guild *g; int i; @@ -1641,7 +1658,8 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd) /*==================================================== * Notification of a relationship between 2 guilds *---------------------------------------------------*/ -int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2) { +static int guild_allianceack(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag, const char *name1, const char *name2) +{ struct guild *g[2] = { NULL }; int guild_id[2] = { 0 }; const char *guild_name[2] = { NULL }; @@ -1731,7 +1749,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id * Notification for the guild disbanded * @see DBApply */ -int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) +static int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) { struct guild *g = DB->data2ptr(data); int guild_id=va_arg(ap,int); @@ -1757,7 +1775,7 @@ int guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) * Invoked on Castles when a guild is broken. [Skotlex] * @see DBApply */ -int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) +static int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) { struct guild_castle *gc = DB->data2ptr(data); int guild_id = va_arg(ap, int); @@ -1778,7 +1796,7 @@ int castle_guild_broken_sub(union DBKey key, struct DBData *data, va_list ap) } //Invoked on /breakguild "Guild name" -int guild_broken(int guild_id,int flag) +static int guild_broken(int guild_id, int flag) { struct guild *g = guild->search(guild_id); struct map_session_data *sd = NULL; @@ -1822,7 +1840,7 @@ int guild_broken(int guild_id,int flag) } //Changes the Guild Master to the specified player. [Skotlex] -int guild_gm_change(int guild_id, int char_id) +static int guild_gm_change(int guild_id, int char_id) { struct guild *g = guild->search(guild_id); char *name; @@ -1848,7 +1866,7 @@ int guild_gm_change(int guild_id, int char_id) } //Notification from Char server that a guild's master has changed. [Skotlex] -int guild_gm_changed(int guild_id, int account_id, int char_id) +static int guild_gm_changed(int guild_id, int account_id, int char_id) { struct guild *g; struct guild_member gm; @@ -1905,7 +1923,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id) /*==================================================== * Guild disbanded *---------------------------------------------------*/ -int guild_break(struct map_session_data *sd, const char *name) +static int guild_break(struct map_session_data *sd, const char *name) { struct guild *g; struct unit_data *ud; @@ -1967,7 +1985,7 @@ int guild_break(struct map_session_data *sd, const char *name) * Creates a list of guild castle IDs to be requested * from char-server. */ -void guild_castle_map_init(void) +static void guild_castle_map_init(void) { int num = db_size(guild->castle_db); @@ -1997,7 +2015,7 @@ void guild_castle_map_init(void) * @param index Type of data to change * @param value New value */ -int guild_castledatasave(int castle_id, int index, int value) +static int guild_castledatasave(int castle_id, int index, int value) { struct guild_castle *gc = guild->castle_search(castle_id); @@ -2058,7 +2076,7 @@ int guild_castledatasave(int castle_id, int index, int value) return 0; } -void guild_castle_reconnect_sub(void *key, void *data, va_list ap) +static void guild_castle_reconnect_sub(void *key, void *data, va_list ap) { int castle_id = GetWord((int)h64BPTRSIZE(key), 0); int index = GetWord((int)h64BPTRSIZE(key), 1); @@ -2071,7 +2089,7 @@ void guild_castle_reconnect_sub(void *key, void *data, va_list ap) * disconnected. * On reconnect pushes all changes to char-server for saving. */ -void guild_castle_reconnect(int castle_id, int index, int value) +static void guild_castle_reconnect(int castle_id, int index, int value) { static struct linkdb_node *gc_save_pending = NULL; @@ -2087,7 +2105,7 @@ void guild_castle_reconnect(int castle_id, int index, int value) } // Load castle data then invoke OnAgitInit* on last -int guild_castledataloadack(int len, const struct guild_castle *gc) +static int guild_castledataloadack(int len, const struct guild_castle *gc) { int i; int n = (len-4) / sizeof(struct guild_castle); @@ -2130,7 +2148,7 @@ int guild_castledataloadack(int len, const struct guild_castle *gc) /*==================================================== * Start normal woe and triggers all npc OnAgitStart *---------------------------------------------------*/ -void guild_agit_start(void) +static void guild_agit_start(void) { // Run All NPC_Event[OnAgitStart] int c = npc->event_doall("OnAgitStart"); @@ -2140,7 +2158,7 @@ void guild_agit_start(void) /*==================================================== * End normal woe and triggers all npc OnAgitEnd *---------------------------------------------------*/ -void guild_agit_end(void) +static void guild_agit_end(void) { // Run All NPC_Event[OnAgitEnd] int c = npc->event_doall("OnAgitEnd"); @@ -2150,7 +2168,7 @@ void guild_agit_end(void) /*==================================================== * Start woe2 and triggers all npc OnAgitStart2 *---------------------------------------------------*/ -void guild_agit2_start(void) +static void guild_agit2_start(void) { // Run All NPC_Event[OnAgitStart2] int c = npc->event_doall("OnAgitStart2"); @@ -2160,7 +2178,7 @@ void guild_agit2_start(void) /*==================================================== * End woe2 and triggers all npc OnAgitEnd2 *---------------------------------------------------*/ -void guild_agit2_end(void) +static void guild_agit2_end(void) { // Run All NPC_Event[OnAgitEnd2] int c = npc->event_doall("OnAgitEnd2"); @@ -2168,7 +2186,7 @@ void guild_agit2_end(void) } // How many castles does this guild have? -int guild_checkcastles(struct guild *g) +static int guild_checkcastles(struct guild *g) { int nb_cas = 0; struct guild_castle* gc = NULL; @@ -2184,7 +2202,7 @@ int guild_checkcastles(struct guild *g) } // Are these two guilds allied? -bool guild_isallied(int guild_id, int guild_id2) +static bool guild_isallied(int guild_id, int guild_id2) { int i; struct guild* g = guild->search(guild_id); @@ -2194,7 +2212,8 @@ bool guild_isallied(int guild_id, int guild_id2) return( i < MAX_GUILDALLIANCE && g->alliance[i].opposition == 0 ); } -void guild_flag_add(struct npc_data *nd) { +static void guild_flag_add(struct npc_data *nd) +{ int i; nullpo_retv(nd); @@ -2212,7 +2231,8 @@ void guild_flag_add(struct npc_data *nd) { guild->flags[i] = nd; } -void guild_flag_remove(struct npc_data *nd) { +static void guild_flag_remove(struct npc_data *nd) +{ int i, cursor; nullpo_retv(nd); if( guild->flags_count == 0 ) @@ -2241,7 +2261,7 @@ void guild_flag_remove(struct npc_data *nd) { /** * @see DBApply */ -int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap) +static int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap) { struct eventlist *next = NULL; struct eventlist *current = DB->data2ptr(data); @@ -2256,7 +2276,7 @@ int eventlist_db_final(union DBKey key, struct DBData *data, va_list ap) /** * @see DBApply */ -int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap) +static int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap) { ers_free(guild->expcache_ers, DB->data2ptr(data)); return 0; @@ -2265,7 +2285,7 @@ int guild_expcache_db_final(union DBKey key, struct DBData *data, va_list ap) /** * @see DBApply */ -int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap) +static int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap) { struct guild_castle* gc = DB->data2ptr(data); if( gc->temp_guardians ) @@ -2275,7 +2295,8 @@ int guild_castle_db_final(union DBKey key, struct DBData *data, va_list ap) } /* called when scripts are reloaded/unloaded */ -void guild_flags_clear(void) { +static void guild_flags_clear(void) +{ int i; for( i = 0; i < guild->flags_count; i++ ) { if( guild->flags[i] ) @@ -2285,7 +2306,8 @@ void guild_flags_clear(void) { guild->flags_count = 0; } -void do_init_guild(bool minimal) { +static void do_init_guild(bool minimal) +{ if (minimal) return; @@ -2305,7 +2327,7 @@ void do_init_guild(bool minimal) { timer->add_interval(timer->gettick()+GUILD_SEND_XY_INVERVAL,guild->send_xy_timer,0,0,GUILD_SEND_XY_INVERVAL); } -void do_final_guild(void) +static void do_final_guild(void) { struct DBIterator *iter = db_iterator(guild->db); struct guild *g; @@ -2331,7 +2353,9 @@ void do_final_guild(void) if( guild->flags ) aFree(guild->flags); } -void guild_defaults(void) { + +void guild_defaults(void) +{ guild = &guild_s; guild->init = do_init_guild; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index a708c0a28..a6e7bb71c 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -58,19 +58,21 @@ #include <stdlib.h> #include <string.h> -struct homunculus_interface homunculus_s; -struct homun_dbs homundbs; +static struct homunculus_interface homunculus_s; +static struct homun_dbs homundbs; struct homunculus_interface *homun; //Returns the viewdata for homunculus -struct view_data* homunculus_get_viewdata(int class_) { +static struct view_data *homunculus_get_viewdata(int class_) +{ Assert_retr(NULL, homdb_checkid(class_)); return &homun->dbs->viewdb[class_-HM_CLASS_BASE]; } -enum homun_type homunculus_class2type(int class_) { +static enum homun_type homunculus_class2type(int class_) +{ switch(class_) { // Normal Homunculus case HOMID_LIF: @@ -104,7 +106,8 @@ enum homun_type homunculus_class2type(int class_) { } } -void homunculus_addspiritball(struct homun_data *hd, int max) { +static void homunculus_addspiritball(struct homun_data *hd, int max) +{ nullpo_retv(hd); if (max > MAX_SKILL_LEVEL) @@ -121,7 +124,8 @@ void homunculus_addspiritball(struct homun_data *hd, int max) { clif->spiritball(&hd->bl); } -void homunculus_delspiritball(struct homun_data *hd, int count, int type) { +static void homunculus_delspiritball(struct homun_data *hd, int count, int type) +{ nullpo_retv(hd); if (hd->homunculus.spiritball <= 0) { @@ -140,11 +144,13 @@ void homunculus_delspiritball(struct homun_data *hd, int count, int type) { clif->spiritball(&hd->bl); } -void homunculus_damaged(struct homun_data *hd) { +static void homunculus_damaged(struct homun_data *hd) +{ clif->hominfo(hd->master,hd,0); } -int homunculus_dead(struct homun_data *hd) { +static int homunculus_dead(struct homun_data *hd) +{ //There's no intimacy penalties on death (from Tharis) struct map_session_data *sd; @@ -165,7 +171,8 @@ int homunculus_dead(struct homun_data *hd) { } //Vaporize a character's homun. If flag, HP needs to be 80% or above. -int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) { +static int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) +{ struct homun_data *hd; nullpo_ret(sd); @@ -193,7 +200,8 @@ int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) { //delete a homunculus, completely "killing it". //Emote is the emotion the master should use, send negative to disable. -int homunculus_delete(struct homun_data *hd, int emote) { +static int homunculus_delete(struct homun_data *hd, int emote) +{ struct map_session_data *sd; nullpo_ret(hd); sd = hd->master; @@ -212,7 +220,8 @@ int homunculus_delete(struct homun_data *hd, int emote) { return unit->remove_map(&hd->bl,CLR_OUTSIGHT, ALC_MARK); } -int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) { +static int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) +{ int i, id = 0; int j, f = 1; int c = 0; @@ -269,7 +278,8 @@ int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) { return 0; } -int homunculus_checkskill(struct homun_data *hd,uint16 skill_id) { +static int homunculus_checkskill(struct homun_data *hd, uint16 skill_id) +{ int i = skill_id - HM_SKILLBASE; if(!hd) return 0; @@ -281,7 +291,8 @@ int homunculus_checkskill(struct homun_data *hd,uint16 skill_id) { return 0; } -int homunculus_skill_tree_get_max(int id, int b_class) { +static int homunculus_skill_tree_get_max(int id, int b_class) +{ int i, skill_id; b_class -= HM_CLASS_BASE; Assert_ret(b_class >= 0 && b_class < MAX_HOMUNCULUS_CLASS); @@ -291,7 +302,8 @@ int homunculus_skill_tree_get_max(int id, int b_class) { return skill->get_max(id); } -void homunculus_skillup(struct homun_data *hd,uint16 skill_id) { +static void homunculus_skillup(struct homun_data *hd, uint16 skill_id) +{ int i = 0 ; nullpo_retv(hd); @@ -317,7 +329,8 @@ void homunculus_skillup(struct homun_data *hd,uint16 skill_id) { } } -bool homunculus_levelup(struct homun_data *hd) { +static bool homunculus_levelup(struct homun_data *hd) +{ struct s_homunculus *hom; struct h_stats *min, *max; int growth_str, growth_agi, growth_vit, growth_int, growth_dex, growth_luk ; @@ -396,7 +409,8 @@ bool homunculus_levelup(struct homun_data *hd) { return true; } -int homunculus_change_class(struct homun_data *hd, short class_) { +static int homunculus_change_class(struct homun_data *hd, short class_) +{ int i = homun->db_search(class_,HOMUNCULUS_CLASS); nullpo_retr(0, hd); if (i == INDEX_NOT_FOUND) @@ -408,7 +422,8 @@ int homunculus_change_class(struct homun_data *hd, short class_) { return 1; } -bool homunculus_evolve(struct homun_data *hd) { +static bool homunculus_evolve(struct homun_data *hd) +{ struct s_homunculus *hom; struct h_stats *max, *min; struct map_session_data *sd; @@ -460,7 +475,8 @@ bool homunculus_evolve(struct homun_data *hd) { return true; } -bool homunculus_mutate(struct homun_data *hd, int homun_id) { +static bool homunculus_mutate(struct homun_data *hd, int homun_id) +{ struct s_homunculus *hom; struct map_session_data *sd; int prev_class = 0; @@ -506,7 +522,8 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) { return true; } -int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { +static int homunculus_gainexp(struct homun_data *hd, unsigned int exp) +{ enum homun_type htype; nullpo_ret(hd); @@ -550,7 +567,8 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { } // Return the new value -unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) { +static unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) +{ nullpo_ret(hd); if (battle_config.homunculus_friendly_rate != 100) value = (value * battle_config.homunculus_friendly_rate) / 100; @@ -563,7 +581,8 @@ unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) } // Return 0 if decrease fails or intimacy became 0 else the new value -unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int value) { +static unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int value) +{ nullpo_ret(hd); if (hd->homunculus.intimacy >= value) hd->homunculus.intimacy -= value; @@ -573,12 +592,14 @@ unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int val return hd->homunculus.intimacy; } -void homunculus_healed (struct homun_data *hd) { +static void homunculus_healed(struct homun_data *hd) +{ nullpo_retv(hd); clif->hominfo(hd->master,hd,0); } -void homunculus_save(struct homun_data *hd) { +static void homunculus_save(struct homun_data *hd) +{ // copy data that must be saved in homunculus struct ( hp / sp ) struct map_session_data *sd = NULL; //Do not check for max_hp/max_sp caps as current could be higher to max due @@ -592,7 +613,8 @@ void homunculus_save(struct homun_data *hd) { intif->homunculus_requestsave(sd->status.account_id, &hd->homunculus); } -unsigned char homunculus_menu(struct map_session_data *sd,unsigned char menu_num) { +static unsigned char homunculus_menu(struct map_session_data *sd, unsigned char menu_num) +{ nullpo_ret(sd); if (sd->hd == NULL) return 1; @@ -613,7 +635,8 @@ unsigned char homunculus_menu(struct map_session_data *sd,unsigned char menu_num return 0; } -bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) { +static bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) +{ int i, foodID, emotion; nullpo_retr(false, hd); @@ -661,7 +684,8 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) { return true; } -int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) { +static int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct homun_data *hd; @@ -702,7 +726,8 @@ int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void homunculus_hunger_timer_delete(struct homun_data *hd) { +static void homunculus_hunger_timer_delete(struct homun_data *hd) +{ nullpo_retv(hd); if(hd->hungry_timer != INVALID_TIMER) { timer->delete(hd->hungry_timer,homun->hunger_timer); @@ -710,7 +735,7 @@ void homunculus_hunger_timer_delete(struct homun_data *hd) { } } -int homunculus_change_name(struct map_session_data *sd, const char *name) +static int homunculus_change_name(struct map_session_data *sd, const char *name) { int i; struct homun_data *hd; @@ -731,7 +756,7 @@ int homunculus_change_name(struct map_session_data *sd, const char *name) return intif_rename_hom(sd, name); } -bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, int flag) +static bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, int flag) { struct homun_data *hd; char *newname = NULL; @@ -757,7 +782,8 @@ bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, i return true; } -int homunculus_db_search(int key,int type) { +static int homunculus_db_search(int key, int type) +{ int i; for(i=0;i<MAX_HOMUNCULUS_CLASS;i++) { @@ -791,7 +817,7 @@ int homunculus_db_search(int key,int type) { * @param hom The homunculus source data. * @retval false in case of errors. */ -bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom) +static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom) { struct homun_data *hd; int i = 0; @@ -841,14 +867,16 @@ bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *h return true; } -void homunculus_init_timers(struct homun_data * hd) { +static void homunculus_init_timers(struct homun_data *hd) +{ nullpo_retv(hd); if (hd->hungry_timer == INVALID_TIMER) hd->hungry_timer = timer->add(timer->gettick()+hd->homunculusDB->hungryDelay,homun->hunger_timer,hd->master->bl.id,0); hd->regen.state.block = 0; //Restore HP/SP block. } -bool homunculus_call(struct map_session_data *sd) { +static bool homunculus_call(struct map_session_data *sd) +{ struct homun_data *hd; nullpo_retr(false, sd); @@ -886,7 +914,7 @@ bool homunculus_call(struct map_session_data *sd) { } // Receive homunculus data from char server -bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int flag) +static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int flag) { struct map_session_data *sd; struct homun_data *hd; @@ -945,7 +973,8 @@ bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int fla } // Ask homunculus creation to char server -bool homunculus_creation_request(struct map_session_data *sd, int class_) { +static bool homunculus_creation_request(struct map_session_data *sd, int class_) +{ struct s_homunculus hom; struct h_stats *base; int i; @@ -981,7 +1010,8 @@ bool homunculus_creation_request(struct map_session_data *sd, int class_) { return true; } -bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short x, short y) { +static bool homunculus_ressurect(struct map_session_data *sd, unsigned char per, short x, short y) +{ struct homun_data* hd; nullpo_retr(false,sd); @@ -1014,7 +1044,8 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short return true; } -void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) { +static void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) +{ struct map_session_data *sd; nullpo_retv(hd); @@ -1028,7 +1059,8 @@ void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) clif->homskillinfoblock(sd); } //Resets a homunc stats back to zero (but doesn't touches hunger or intimacy) -void homunculus_stat_reset(struct homun_data *hd) { +static void homunculus_stat_reset(struct homun_data *hd) +{ struct s_homunculus_db *db; struct s_homunculus *hom; struct h_stats *base; @@ -1052,7 +1084,8 @@ void homunculus_stat_reset(struct homun_data *hd) { hd->homunculus.skillpts = 0; } -bool homunculus_shuffle(struct homun_data *hd) { +static bool homunculus_shuffle(struct homun_data *hd) +{ struct map_session_data *sd; int lv, skillpts; unsigned int exp; @@ -1101,7 +1134,8 @@ bool homunculus_shuffle(struct homun_data *hd) { return true; } -bool homunculus_read_db_sub(char* str[], int columns, int current) { +static bool homunculus_read_db_sub(char *str[], int columns, int current) +{ int classid; struct s_homunculus_db *db; @@ -1212,7 +1246,8 @@ bool homunculus_read_db_sub(char* str[], int columns, int current) { return true; } -void homunculus_read_db(void) { +static void homunculus_read_db(void) +{ int i; const char *filename[]={DBPATH"homunculus_db.txt","homunculus_db2.txt"}; memset(homun->dbs->db, 0, sizeof(homun->dbs->db)); @@ -1232,7 +1267,8 @@ void homunculus_read_db(void) { } // <hom class>,<skill id>,<max level>[,<job level>],<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>,<intimacy lv req> -bool homunculus_read_skill_db_sub(char* split[], int columns, int current) { +static bool homunculus_read_skill_db_sub(char *split[], int columns, int current) +{ int k, classid; int j; int minJobLevelPresent = 0; @@ -1272,7 +1308,8 @@ bool homunculus_read_skill_db_sub(char* split[], int columns, int current) { return true; } -int8 homunculus_get_intimacy_grade(struct homun_data *hd) { +static int8 homunculus_get_intimacy_grade(struct homun_data *hd) +{ unsigned int val; nullpo_ret(hd); val = hd->homunculus.intimacy / 100; @@ -1292,12 +1329,14 @@ int8 homunculus_get_intimacy_grade(struct homun_data *hd) { return 0; } -void homunculus_skill_db_read(void) { +static void homunculus_skill_db_read(void) +{ memset(homun->dbs->skill_tree, 0, sizeof(homun->dbs->skill_tree)); sv->readdb(map->db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub); } -void homunculus_exp_db_read(void) { +static void homunculus_exp_db_read(void) +{ char line[1024]; int i, j=0; char *filename[]={ @@ -1331,16 +1370,19 @@ void homunculus_exp_db_read(void) { } } -void homunculus_reload(void) { +static void homunculus_reload(void) +{ homun->read_db(); homun->exp_db_read(); } -void homunculus_skill_reload(void) { +static void homunculus_skill_reload(void) +{ homun->skill_db_read(); } -void do_init_homunculus(bool minimal) { +static void do_init_homunculus(bool minimal) +{ int class_; if (minimal) @@ -1358,11 +1400,13 @@ void do_init_homunculus(bool minimal) { homun->dbs->viewdb[class_].class = HM_CLASS_BASE + class_; } -void do_final_homunculus(void) { +static void do_final_homunculus(void) +{ } -void homunculus_defaults(void) { +void homunculus_defaults(void) +{ homun = &homunculus_s; homun->dbs = &homundbs; diff --git a/src/map/instance.c b/src/map/instance.c index 250c73542..2c40449ad 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -47,11 +47,12 @@ #include <string.h> #include <time.h> -struct instance_interface instance_s; +static struct instance_interface instance_s; struct instance_interface *instance; /// Checks whether given instance id is valid or not. -bool instance_is_valid(int instance_id) { +static bool instance_is_valid(int instance_id) +{ if( instance_id < 0 || instance_id >= instance->instances ) {// out of range return false; } @@ -69,7 +70,8 @@ bool instance_is_valid(int instance_id) { * -4 = already exists | -3 = no free instances | -2 = owner not found | -1 = invalid type * On success return instance_id *--------------------------------------*/ -int instance_create(int owner_id, const char *name, enum instance_owner_type type) { +static int instance_create(int owner_id, const char *name, enum instance_owner_type type) +{ struct map_session_data *sd = NULL; unsigned short *icptr = NULL; struct party_data *p = NULL; @@ -180,7 +182,8 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ * @retval -3 No more map indices available. * @retval -4 Source map is already an instance. **/ -int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) { +static int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) +{ int16 m = map->mapname2mapid(name); int i, im = -1; size_t num_cell, size, j; @@ -317,7 +320,8 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const * party_id : source party of this instance * type : result (0 = map id | 1 = instance id) *--------------------------------------*/ -int instance_map2imap(int16 m, int instance_id) { +static int instance_map2imap(int16 m, int instance_id) +{ int i; if( !instance->valid(instance_id) ) { @@ -331,7 +335,8 @@ int instance_map2imap(int16 m, int instance_id) { return -1; } -int instance_mapname2imap(const char *map_name, int instance_id) { +static int instance_mapname2imap(const char *map_name, int instance_id) +{ int i; nullpo_retr(-1, map_name); @@ -351,7 +356,8 @@ int instance_mapname2imap(const char *map_name, int instance_id) { * instance_id : where to search * result : mapid of map "m" in this instance *--------------------------------------*/ -int instance_mapid2imapid(int16 m, int instance_id) { +static int instance_mapid2imapid(int16 m, int instance_id) +{ Assert_retr(-1, m >= 0 && m < map->count); if( map->list[m].flag.src4instance == 0 ) return m; // not instances found for this map @@ -369,7 +375,7 @@ int instance_mapid2imapid(int16 m, int instance_id) { /*-------------------------------------- * Used on Init instance. Duplicates each script on source map *--------------------------------------*/ -int instance_map_npcsub(struct block_list* bl, va_list args) +static int instance_map_npcsub(struct block_list *bl, va_list args) { struct npc_data *nd = NULL; int16 m = va_arg(args, int); // Destination Map @@ -384,7 +390,7 @@ int instance_map_npcsub(struct block_list* bl, va_list args) return 1; } -int instance_init_npc(struct block_list* bl, va_list args) +static int instance_init_npc(struct block_list *bl, va_list args) { struct npc_data *nd = NULL; struct event_data *ev; @@ -405,7 +411,8 @@ int instance_init_npc(struct block_list* bl, va_list args) /*-------------------------------------- * Init all map on the instance. Npcs are created here *--------------------------------------*/ -void instance_init(int instance_id) { +static void instance_init(int instance_id) +{ int i; if( !instance->valid(instance_id) ) @@ -424,7 +431,8 @@ void instance_init(int instance_id) { * Used on instance deleting process. * Warps all players on each instance map to its save points. *--------------------------------------*/ -int instance_del_load(struct map_session_data* sd, va_list args) { +static int instance_del_load(struct map_session_data *sd, va_list args) +{ int16 m = va_arg(args,int); if( !sd || sd->bl.m != m ) @@ -435,7 +443,8 @@ int instance_del_load(struct map_session_data* sd, va_list args) { } /* for npcs behave differently when being unloaded within a instance */ -int instance_cleanup_sub(struct block_list *bl, va_list ap) { +static int instance_cleanup_sub(struct block_list *bl, va_list ap) +{ nullpo_ret(bl); switch(bl->type) { @@ -465,7 +474,8 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) { /*-------------------------------------- * Removes a simple instance map *--------------------------------------*/ -void instance_del_map(int16 m) { +static void instance_del_map(int16 m) +{ int i; if( m <= 0 || map->list[m].instance_id == -1 ) { @@ -537,7 +547,8 @@ void instance_del_map(int16 m) { /*-------------------------------------- * Timer to destroy instance by process or idle *--------------------------------------*/ -int instance_destroy_timer(int tid, int64 tick, int id, intptr_t data) { +static int instance_destroy_timer(int tid, int64 tick, int id, intptr_t data) +{ instance->destroy(id); return 0; } @@ -545,7 +556,8 @@ int instance_destroy_timer(int tid, int64 tick, int id, intptr_t data) { /*-------------------------------------- * Removes a instance, all its maps and npcs. *--------------------------------------*/ -void instance_destroy(int instance_id) { +static void instance_destroy(int instance_id) +{ struct map_session_data *sd = NULL; unsigned short *icptr = NULL; struct party_data *p = NULL; @@ -636,7 +648,8 @@ void instance_destroy(int instance_id) { /*-------------------------------------- * Checks if there are users in the instance or not to start idle timer *--------------------------------------*/ -void instance_check_idle(int instance_id) { +static void instance_check_idle(int instance_id) +{ bool idle = true; unsigned int now = (unsigned int)time(NULL); @@ -661,7 +674,7 @@ void instance_check_idle(int instance_id) { /*-------------------------------------- * Set instance Timers *--------------------------------------*/ -void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout) +static void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout) { unsigned int now = (unsigned int)time(0); @@ -700,7 +713,8 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign /*-------------------------------------- * Checks if sd in on a instance and should be kicked from it *--------------------------------------*/ -void instance_check_kick(struct map_session_data *sd) { +static void instance_check_kick(struct map_session_data *sd) +{ int16 m = sd->bl.m; nullpo_retv(sd); @@ -713,7 +727,8 @@ void instance_check_kick(struct map_session_data *sd) { } } -void do_reload_instance(void) { +static void do_reload_instance(void) +{ struct s_mapiterator *iter; struct map_session_data *sd; int i, k; @@ -743,7 +758,8 @@ void do_reload_instance(void) { mapit->free(iter); } -void do_final_instance(void) { +static void do_final_instance(void) +{ int i; for(i = 0; i < instance->instances; i++) { @@ -757,14 +773,16 @@ void do_final_instance(void) { instance->instances = 0; } -void do_init_instance(bool minimal) { +static void do_init_instance(bool minimal) +{ if (minimal) return; timer->add_func_list(instance->destroy_timer, "instance_destroy_timer"); } -void instance_defaults(void) { +void instance_defaults(void) +{ instance = &instance_s; instance->init = do_init_instance; diff --git a/src/map/intif.c b/src/map/intif.c index 8a88f9244..6dc4b3a0a 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -55,7 +55,7 @@ #include <string.h> #include <sys/types.h> -struct intif_interface intif_s; +static struct intif_interface intif_s; struct intif_interface *intif; #define inter_fd (chrif->fd) // alias @@ -63,14 +63,14 @@ struct intif_interface *intif; //----------------------------------------------------------------- // Send to inter server -int CheckForCharServer(void) +static int CheckForCharServer(void) { return ((chrif->fd <= 0) || sockt->session[chrif->fd] == NULL || sockt->session[chrif->fd]->wdata == NULL); } // pet -int intif_create_pet(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,char *pet_name) +static int intif_create_pet(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, char *pet_name) { if (intif->CheckForCharServer()) return 0; @@ -93,7 +93,7 @@ int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,sho return 0; } -int intif_request_petdata(int account_id,int char_id,int pet_id) +static int intif_request_petdata(int account_id, int char_id, int pet_id) { if (intif->CheckForCharServer()) return 0; @@ -107,7 +107,7 @@ int intif_request_petdata(int account_id,int char_id,int pet_id) return 0; } -int intif_save_petdata(int account_id,struct s_pet *p) +static int intif_save_petdata(int account_id, struct s_pet *p) { if (intif->CheckForCharServer()) return 0; @@ -122,7 +122,7 @@ int intif_save_petdata(int account_id,struct s_pet *p) return 0; } -int intif_delete_petdata(int pet_id) +static int intif_delete_petdata(int pet_id) { if (intif->CheckForCharServer()) return 0; @@ -134,7 +134,7 @@ int intif_delete_petdata(int pet_id) return 1; } -int intif_rename(struct map_session_data *sd, int type, const char *name) +static int intif_rename(struct map_session_data *sd, int type, const char *name) { if (intif->CheckForCharServer()) return 1; @@ -152,7 +152,7 @@ int intif_rename(struct map_session_data *sd, int type, const char *name) } // GM Send a message -int intif_broadcast(const char *mes, int len, int type) +static int intif_broadcast(const char *mes, int len, int type) { int lp = (type&BC_COLOR_MASK) ? 4 : 0; @@ -184,7 +184,7 @@ int intif_broadcast(const char *mes, int len, int type) return 0; } -int intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY) +static int intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY) { nullpo_ret(mes); Assert_ret(len < 32000); @@ -213,7 +213,7 @@ int intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fon /// send a message using the main chat system /// <sd> the source of message /// <message> the message that was sent -int intif_main_message(struct map_session_data* sd, const char* message) +static int intif_main_message(struct map_session_data *sd, const char *message) { char output[256]; @@ -233,7 +233,7 @@ int intif_main_message(struct map_session_data* sd, const char* message) } // The transmission of Wisp/Page to inter-server (player not found on this server) -int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, int mes_len) +static int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, int mes_len) { if (intif->CheckForCharServer()) return 0; @@ -262,7 +262,7 @@ int intif_wis_message(struct map_session_data *sd, const char *nick, const char } // The reply of Wisp/page -int intif_wis_replay(int id, int flag) +static int intif_wis_replay(int id, int flag) { if (intif->CheckForCharServer()) return 0; @@ -279,7 +279,7 @@ int intif_wis_replay(int id, int flag) } // The transmission of GM only Wisp/Page from server to inter-server -int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes) +static int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes) { int mes_len; if (intif->CheckForCharServer()) @@ -304,7 +304,7 @@ int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes) } //Request for saving registry values. -int intif_saveregistry(struct map_session_data *sd) +static int intif_saveregistry(struct map_session_data *sd) { struct DBIterator *iter; union DBKey key; @@ -421,7 +421,7 @@ int intif_saveregistry(struct map_session_data *sd) } //Request the registries for this player. -int intif_request_registry(struct map_session_data *sd, int flag) +static int intif_request_registry(struct map_session_data *sd, int flag) { nullpo_ret(sd); @@ -450,7 +450,7 @@ int intif_request_registry(struct map_session_data *sd, int flag) * @packet 0x3010 [out] <account_id>.L * @param sd [in] pointer to session data. */ -void intif_request_account_storage(const struct map_session_data *sd) +static void intif_request_account_storage(const struct map_session_data *sd) { nullpo_retv(sd); @@ -469,7 +469,7 @@ void intif_request_account_storage(const struct map_session_data *sd) * @packet 0x3805 [in] <packet_len>.W <account_id>.L <struct item[]>.P * @param fd [in] file/socket descriptor. */ -void intif_parse_account_storage(int fd) +static void intif_parse_account_storage(int fd) { int account_id = 0, payload_size = 0, storage_count = 0; int i = 0; @@ -511,7 +511,7 @@ void intif_parse_account_storage(int fd) * @packet 0x3011 [out] <packet_len>.W <account_id>.L <struct item[]>.P * @param sd [in] pointer to session data. */ -void intif_send_account_storage(const struct map_session_data *sd) +static void intif_send_account_storage(const struct map_session_data *sd) { int len = 0, i = 0, c = 0; @@ -546,7 +546,7 @@ void intif_send_account_storage(const struct map_session_data *sd) * @packet 0x3808 [in] <account_id>.L <saved_flag>.B * @param fd [in] file/socket descriptor. */ -void intif_parse_account_storage_save_ack(int fd) +static void intif_parse_account_storage_save_ack(int fd) { int account_id = RFIFOL(fd, 2); uint8 saved = RFIFOB(fd, 6); @@ -570,7 +570,7 @@ void intif_parse_account_storage_save_ack(int fd) // Guild Storage //----------------------------------------------------------------- -int intif_request_guild_storage(int account_id,int guild_id) +static int intif_request_guild_storage(int account_id, int guild_id) { if (intif->CheckForCharServer()) return 0; @@ -581,7 +581,7 @@ int intif_request_guild_storage(int account_id,int guild_id) WFIFOSET(inter_fd,10); return 0; } -int intif_send_guild_storage(int account_id,struct guild_storage *gstor) +static int intif_send_guild_storage(int account_id, struct guild_storage *gstor) { if (intif->CheckForCharServer()) return 0; @@ -597,7 +597,7 @@ int intif_send_guild_storage(int account_id,struct guild_storage *gstor) } // Party creation request -int intif_create_party(struct party_member *member, const char *name, int item, int item2) +static int intif_create_party(struct party_member *member, const char *name, int item, int item2) { if (intif->CheckForCharServer()) return 0; @@ -616,7 +616,7 @@ int intif_create_party(struct party_member *member, const char *name, int item, } // Party information request -int intif_request_partyinfo(int party_id, int char_id) +static int intif_request_partyinfo(int party_id, int char_id) { if (intif->CheckForCharServer()) return 0; @@ -629,7 +629,7 @@ int intif_request_partyinfo(int party_id, int char_id) } // Request to add a member to party -int intif_party_addmember(int party_id,struct party_member *member) +static int intif_party_addmember(int party_id, struct party_member *member) { if (intif->CheckForCharServer()) return 0; @@ -644,7 +644,7 @@ int intif_party_addmember(int party_id,struct party_member *member) } // Request to change party configuration (exp,item share) -int intif_party_changeoption(int party_id,int account_id,int exp,int item) +static int intif_party_changeoption(int party_id, int account_id, int exp, int item) { if (intif->CheckForCharServer()) return 0; @@ -659,7 +659,7 @@ int intif_party_changeoption(int party_id,int account_id,int exp,int item) } // Request to leave party -int intif_party_leave(int party_id,int account_id, int char_id) +static int intif_party_leave(int party_id, int account_id, int char_id) { if (intif->CheckForCharServer()) return 0; @@ -673,7 +673,8 @@ int intif_party_leave(int party_id,int account_id, int char_id) } // Request keeping party for new map ?? -int intif_party_changemap(struct map_session_data *sd,int online) { +static int intif_party_changemap(struct map_session_data *sd, int online) +{ int16 m, map_index; if (intif->CheckForCharServer()) @@ -699,7 +700,7 @@ int intif_party_changemap(struct map_session_data *sd,int online) { } // Request breaking party -int intif_break_party(int party_id) +static int intif_break_party(int party_id) { if (intif->CheckForCharServer()) return 0; @@ -711,7 +712,7 @@ int intif_break_party(int party_id) } // Sending party chat -int intif_party_message(int party_id,int account_id,const char *mes,int len) +static int intif_party_message(int party_id, int account_id, const char *mes, int len) { if (intif->CheckForCharServer()) return 0; @@ -732,7 +733,7 @@ int intif_party_message(int party_id,int account_id,const char *mes,int len) } // Request a new leader for party -int intif_party_leaderchange(int party_id,int account_id,int char_id) +static int intif_party_leaderchange(int party_id, int account_id, int char_id) { if (intif->CheckForCharServer()) return 0; @@ -755,7 +756,7 @@ int intif_party_leaderchange(int party_id,int account_id,int char_id) * @param clan_id Id of the clan to have members counted * @param kick_interval Interval of the inactivity kick */ -int intif_clan_membercount(int clan_id, int kick_interval) +static int intif_clan_membercount(int clan_id, int kick_interval) { if (intif->CheckForCharServer() || clan_id == 0 || kick_interval <= 0) return 0; @@ -768,7 +769,7 @@ int intif_clan_membercount(int clan_id, int kick_interval) return 1; } -int intif_clan_kickoffline(int clan_id, int kick_interval) +static int intif_clan_kickoffline(int clan_id, int kick_interval) { if (intif->CheckForCharServer() || clan_id == 0 || kick_interval <= 0) return 0; @@ -781,7 +782,7 @@ int intif_clan_kickoffline(int clan_id, int kick_interval) return 1; } -void intif_parse_RecvClanMemberAction(int fd) +static void intif_parse_RecvClanMemberAction(int fd) { struct clan *c; int clan_id = RFIFOL(fd, 2); @@ -821,7 +822,7 @@ void intif_parse_RecvClanMemberAction(int fd) } // Request a Guild creation -int intif_guild_create(const char *name,const struct guild_member *master) +static int intif_guild_create(const char *name, const struct guild_member *master) { if (intif->CheckForCharServer()) return 0; @@ -839,7 +840,7 @@ int intif_guild_create(const char *name,const struct guild_member *master) } // Request Guild information -int intif_guild_request_info(int guild_id) +static int intif_guild_request_info(int guild_id) { if (intif->CheckForCharServer()) return 0; @@ -851,7 +852,7 @@ int intif_guild_request_info(int guild_id) } // Request to add member to the guild -int intif_guild_addmember(int guild_id,struct guild_member *m) +static int intif_guild_addmember(int guild_id, struct guild_member *m) { if (intif->CheckForCharServer()) return 0; @@ -866,7 +867,7 @@ int intif_guild_addmember(int guild_id,struct guild_member *m) } // Request a new leader for guild -int intif_guild_change_gm(int guild_id, const char *name, int len) +static int intif_guild_change_gm(int guild_id, const char *name, int len) { if (intif->CheckForCharServer()) return 0; @@ -882,7 +883,7 @@ int intif_guild_change_gm(int guild_id, const char *name, int len) } // Request to leave guild -int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const char *mes) +static int intif_guild_leave(int guild_id, int account_id, int char_id, int flag, const char *mes) { if (intif->CheckForCharServer()) return 0; @@ -899,7 +900,7 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha } //Update request / Lv online status of the guild members -int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) +static int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class) { if (intif->CheckForCharServer()) return 0; @@ -916,7 +917,7 @@ int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int o } //Guild disbanded notification -int intif_guild_break(int guild_id) +static int intif_guild_break(int guild_id) { if (intif->CheckForCharServer()) return 0; @@ -928,7 +929,7 @@ int intif_guild_break(int guild_id) } // Send a guild message -int intif_guild_message(int guild_id,int account_id,const char *mes,int len) +static int intif_guild_message(int guild_id, int account_id, const char *mes, int len) { if (intif->CheckForCharServer()) return 0; @@ -953,7 +954,7 @@ int intif_guild_message(int guild_id,int account_id,const char *mes,int len) * Requests to change a basic guild information, it is parsed via mapif_parse_GuildBasicInfoChange * To see the information types that can be changed see mmo.h::guild_basic_info **/ -int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len) +static int intif_guild_change_basicinfo(int guild_id, int type, const void *data, int len) { if (intif->CheckForCharServer()) return 0; @@ -970,8 +971,7 @@ int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len) } // Request a change of Guild member information -int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id, - int type,const void *data,int len) +static int intif_guild_change_memberinfo(int guild_id, int account_id, int char_id, int type, const void *data, int len) { if (intif->CheckForCharServer()) return 0; @@ -990,7 +990,7 @@ int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id, } // Request a change of Guild title -int intif_guild_position(int guild_id,int idx,struct guild_position *p) +static int intif_guild_position(int guild_id, int idx, struct guild_position *p) { if (intif->CheckForCharServer()) return 0; @@ -1006,7 +1006,7 @@ int intif_guild_position(int guild_id,int idx,struct guild_position *p) } // Request an update of Guildskill skill_id -int intif_guild_skillup(int guild_id, uint16 skill_id, int account_id, int max) +static int intif_guild_skillup(int guild_id, uint16 skill_id, int account_id, int max) { if( intif->CheckForCharServer() ) return 0; @@ -1021,7 +1021,7 @@ int intif_guild_skillup(int guild_id, uint16 skill_id, int account_id, int max) } // Request a new guild relationship -int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag) +static int intif_guild_alliance(int guild_id1, int guild_id2, int account_id1, int account_id2, int flag) { if (intif->CheckForCharServer()) return 0; @@ -1037,7 +1037,7 @@ int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account } // Request to change guild notice -int intif_guild_notice(int guild_id,const char *mes1,const char *mes2) +static int intif_guild_notice(int guild_id, const char *mes1, const char *mes2) { if (intif->CheckForCharServer()) return 0; @@ -1053,7 +1053,7 @@ int intif_guild_notice(int guild_id,const char *mes1,const char *mes2) } // Request to change guild emblem -int intif_guild_emblem(int guild_id,int len,const char *data) +static int intif_guild_emblem(int guild_id, int len, const char *data) { if (intif->CheckForCharServer()) return 0; @@ -1076,7 +1076,7 @@ int intif_guild_emblem(int guild_id,int len,const char *data) * @param num Number of castles, size of castle_ids array. * @param castle_ids Pointer to array of castle IDs. */ -int intif_guild_castle_dataload(int num, int *castle_ids) +static int intif_guild_castle_dataload(int num, int *castle_ids) { if (intif->CheckForCharServer()) return 0; @@ -1090,7 +1090,7 @@ int intif_guild_castle_dataload(int num, int *castle_ids) } // Request change castle guild owner and save data -int intif_guild_castle_datasave(int castle_id,int index, int value) +static int intif_guild_castle_datasave(int castle_id, int index, int value) { if (intif->CheckForCharServer()) return 0; @@ -1107,7 +1107,7 @@ int intif_guild_castle_datasave(int castle_id,int index, int value) // Homunculus Packets send to Inter server [albator] //----------------------------------------------------------------- -int intif_homunculus_create(int account_id, struct s_homunculus *sh) +static int intif_homunculus_create(int account_id, struct s_homunculus *sh) { if (intif->CheckForCharServer()) return 0; @@ -1121,7 +1121,8 @@ int intif_homunculus_create(int account_id, struct s_homunculus *sh) return 0; } -bool intif_homunculus_requestload(int account_id, int homun_id) { +static bool intif_homunculus_requestload(int account_id, int homun_id) +{ if (intif->CheckForCharServer()) return false; WFIFOHEAD(inter_fd, 10); @@ -1132,7 +1133,7 @@ bool intif_homunculus_requestload(int account_id, int homun_id) { return true; } -int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh) +static int intif_homunculus_requestsave(int account_id, struct s_homunculus *sh) { if (intif->CheckForCharServer()) return 0; @@ -1147,7 +1148,7 @@ int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh) } -int intif_homunculus_requestdelete(int homun_id) +static int intif_homunculus_requestdelete(int homun_id) { if (intif->CheckForCharServer()) return 0; @@ -1163,7 +1164,8 @@ int intif_homunculus_requestdelete(int homun_id) // Packets receive from inter server // Wisp/Page reception // rewritten by [Yor] -void intif_parse_WisMessage(int fd) { +static void intif_parse_WisMessage(int fd) +{ struct map_session_data* sd; const char *wisp_source; char name[NAME_LENGTH]; @@ -1199,7 +1201,7 @@ void intif_parse_WisMessage(int fd) { } // Wisp/page transmission result reception -void intif_parse_WisEnd(int fd) +static void intif_parse_WisEnd(int fd) { struct map_session_data* sd; const char *playername = RFIFOP(fd, 2); @@ -1213,7 +1215,7 @@ void intif_parse_WisEnd(int fd) return; } -int intif_parse_WisToGM_sub(struct map_session_data *sd, va_list va) +static int intif_parse_WisToGM_sub(struct map_session_data *sd, va_list va) { int permission = va_arg(va, int); char *wisp_name; @@ -1232,7 +1234,7 @@ int intif_parse_WisToGM_sub(struct map_session_data *sd, va_list va) // Received wisp message from map-server via char-server for ALL gm // 0x3003/0x3803 <packet_len>.w <wispname>.24B <permission>.l <message>.?B -void intif_parse_WisToGM(int fd) +static void intif_parse_WisToGM(int fd) { int permission, mes_len; char Wisp_name[NAME_LENGTH]; @@ -1254,7 +1256,7 @@ void intif_parse_WisToGM(int fd) } // Request player registre -void intif_parse_Registers(int fd) +static void intif_parse_Registers(int fd) { int flag; struct map_session_data *sd; @@ -1355,7 +1357,7 @@ void intif_parse_Registers(int fd) pc->reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex] } -void intif_parse_LoadGuildStorage(int fd) +static void intif_parse_LoadGuildStorage(int fd) { struct guild_storage *gstor; struct map_session_data *sd; @@ -1397,13 +1399,13 @@ void intif_parse_LoadGuildStorage(int fd) } // ACK guild_storage saved -void intif_parse_SaveGuildStorage(int fd) +static void intif_parse_SaveGuildStorage(int fd) { gstorage->saved(/*RFIFOL(fd,2), */RFIFOL(fd,6)); } // ACK party creation -void intif_parse_PartyCreated(int fd) +static void intif_parse_PartyCreated(int fd) { if(battle_config.etc_log) ShowInfo("intif: party created by account %u\n\n", RFIFOL(fd,2)); @@ -1411,7 +1413,8 @@ void intif_parse_PartyCreated(int fd) } // Receive party info -void intif_parse_PartyInfo(int fd) { +static void intif_parse_PartyInfo(int fd) +{ if (RFIFOW(fd,2) == 12) { ShowWarning("intif: party noinfo (char_id=%u party_id=%u)\n", RFIFOL(fd,4), RFIFOL(fd,8)); party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4)); @@ -1425,7 +1428,7 @@ void intif_parse_PartyInfo(int fd) { } // ACK adding party member -void intif_parse_PartyMemberAdded(int fd) +static void intif_parse_PartyMemberAdded(int fd) { if(battle_config.etc_log) ShowInfo("intif: party member added Party (%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); @@ -1433,13 +1436,13 @@ void intif_parse_PartyMemberAdded(int fd) } // ACK changing party option -void intif_parse_PartyOptionChanged(int fd) +static void intif_parse_PartyOptionChanged(int fd) { party->optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14)); } // ACK member leaving party -void intif_parse_PartyMemberWithdraw(int fd) +static void intif_parse_PartyMemberWithdraw(int fd) { if(battle_config.etc_log) ShowInfo("intif: party member withdraw: Party(%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); @@ -1447,28 +1450,32 @@ void intif_parse_PartyMemberWithdraw(int fd) } // ACK party break -void intif_parse_PartyBroken(int fd) { +static void intif_parse_PartyBroken(int fd) +{ party->broken(RFIFOL(fd,2)); } // ACK party on new map -void intif_parse_PartyMove(int fd) +static void intif_parse_PartyMove(int fd) { party->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17)); } // ACK party messages -void intif_parse_PartyMessage(int fd) { +static void intif_parse_PartyMessage(int fd) +{ party->recv_message(RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); } // ACK guild creation -void intif_parse_GuildCreated(int fd) { +static void intif_parse_GuildCreated(int fd) +{ guild->created(RFIFOL(fd,2),RFIFOL(fd,6)); } // ACK guild infos -void intif_parse_GuildInfo(int fd) { +static void intif_parse_GuildInfo(int fd) +{ if (RFIFOW(fd,2) == 8) { ShowWarning("intif: guild noinfo %u\n", RFIFOL(fd,4)); guild->recv_noinfo(RFIFOL(fd,4)); @@ -1481,30 +1488,35 @@ void intif_parse_GuildInfo(int fd) { } // ACK adding guild member -void intif_parse_GuildMemberAdded(int fd) { +static void intif_parse_GuildMemberAdded(int fd) +{ if(battle_config.etc_log) ShowInfo("intif: guild member added %u %u %u %d\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14)); guild->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14)); } // ACK member leaving guild -void intif_parse_GuildMemberWithdraw(int fd) { +static void intif_parse_GuildMemberWithdraw(int fd) +{ guild->member_withdraw(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOP(fd,55), RFIFOP(fd,15)); } // ACK guild member basic info -void intif_parse_GuildMemberInfoShort(int fd) { +static void intif_parse_GuildMemberInfoShort(int fd) +{ guild->recv_memberinfoshort(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17),RFIFOL(fd,19)); } // ACK guild break -void intif_parse_GuildBroken(int fd) { +static void intif_parse_GuildBroken(int fd) +{ guild->broken(RFIFOL(fd,2),RFIFOB(fd,6)); } // basic guild info change notice // 0x3839 <packet len>.w <guild id>.l <type>.w <data>.?b -void intif_parse_GuildBasicInfoChanged(int fd) { +static void intif_parse_GuildBasicInfoChanged(int fd) +{ //int len = RFIFOW(fd,2) - 10; int guild_id = RFIFOL(fd,4); int type = RFIFOW(fd,8); @@ -1540,7 +1552,8 @@ void intif_parse_GuildBasicInfoChanged(int fd) { // guild member info change notice // 0x383a <packet len>.w <guild id>.l <account id>.l <char id>.l <type>.w <data>.?b -void intif_parse_GuildMemberInfoChanged(int fd) { +static void intif_parse_GuildMemberInfoChanged(int fd) +{ //int len = RFIFOW(fd,2) - 18; int guild_id = RFIFOL(fd,4); int account_id = RFIFOL(fd,8); @@ -1571,7 +1584,8 @@ void intif_parse_GuildMemberInfoChanged(int fd) { } // ACK change of guild title -void intif_parse_GuildPosition(int fd) { +static void intif_parse_GuildPosition(int fd) +{ if (RFIFOW(fd,2)!=sizeof(struct guild_position)+12) ShowError("intif: guild info: data size mismatch (%u) %d != %"PRIuS"\n", RFIFOL(fd,4), RFIFOW(fd,2), sizeof(struct guild_position) + 12); @@ -1579,47 +1593,56 @@ void intif_parse_GuildPosition(int fd) { } // ACK change of guild skill update -void intif_parse_GuildSkillUp(int fd) { +static void intif_parse_GuildSkillUp(int fd) +{ guild->skillupack(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); } // ACK change of guild relationship -void intif_parse_GuildAlliance(int fd) { +static void intif_parse_GuildAlliance(int fd) +{ guild->allianceack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOB(fd,18), RFIFOP(fd,19), RFIFOP(fd,43)); } // ACK change of guild notice -void intif_parse_GuildNotice(int fd) { +static void intif_parse_GuildNotice(int fd) +{ guild->notice_changed(RFIFOL(fd,2), RFIFOP(fd,6), RFIFOP(fd,66)); } // ACK change of guild emblem -void intif_parse_GuildEmblem(int fd) { +static void intif_parse_GuildEmblem(int fd) +{ guild->emblem_changed(RFIFOW(fd,2)-12, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12)); } // ACK guild message -void intif_parse_GuildMessage(int fd) { +static void intif_parse_GuildMessage(int fd) +{ guild->recv_message(RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); } // Reply guild castle data request -void intif_parse_GuildCastleDataLoad(int fd) { +static void intif_parse_GuildCastleDataLoad(int fd) +{ guild->castledataloadack(RFIFOW(fd,2), RFIFOP(fd,4)); } // ACK change of guildmaster -void intif_parse_GuildMasterChanged(int fd) { +static void intif_parse_GuildMasterChanged(int fd) +{ guild->gm_changed(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); } // Request pet creation -void intif_parse_CreatePet(int fd) { +static void intif_parse_CreatePet(int fd) +{ pet->get_egg(RFIFOL(fd,2), RFIFOW(fd,6), RFIFOL(fd,8)); } // ACK pet data -void intif_parse_RecvPetData(int fd) { +static void intif_parse_RecvPetData(int fd) +{ struct s_pet p; int len; len=RFIFOW(fd,2); @@ -1633,19 +1656,21 @@ void intif_parse_RecvPetData(int fd) { } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ // ACK pet save data -void intif_parse_SavePetOk(int fd) { +static void intif_parse_SavePetOk(int fd) +{ if(RFIFOB(fd,6) == 1) ShowError("pet data save failure\n"); } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ // ACK deleting pet -void intif_parse_DeletePetOk(int fd) { +static void intif_parse_DeletePetOk(int fd) +{ if(RFIFOB(fd,2) == 1) ShowError("pet data delete failure\n"); } // ACK changing name request, players,pets,homun -void intif_parse_ChangeNameOk(int fd) +static void intif_parse_ChangeNameOk(int fd) { struct map_session_data *sd = NULL; if((sd=map->id2sd(RFIFOL(fd,2)))==NULL || @@ -1668,7 +1693,8 @@ void intif_parse_ChangeNameOk(int fd) //---------------------------------------------------------------- // Homunculus recv packets [albator] -void intif_parse_CreateHomunculus(int fd) { +static void intif_parse_CreateHomunculus(int fd) +{ int len = RFIFOW(fd,2)-9; if (sizeof(struct s_homunculus) != len) { if (battle_config.etc_log) @@ -1678,7 +1704,8 @@ void intif_parse_CreateHomunculus(int fd) { homun->recv_data(RFIFOL(fd,4), RFIFOP(fd,9), RFIFOB(fd,8)) ; } -void intif_parse_RecvHomunculusData(int fd) { +static void intif_parse_RecvHomunculusData(int fd) +{ int len = RFIFOW(fd,2)-9; if (sizeof(struct s_homunculus) != len) { @@ -1690,29 +1717,29 @@ void intif_parse_RecvHomunculusData(int fd) { } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_SaveHomunculusOk(int fd) { +static void intif_parse_SaveHomunculusOk(int fd) +{ if(RFIFOB(fd,6) != 1) ShowError("homunculus data save failure for account %u\n", RFIFOL(fd,2)); } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_DeleteHomunculusOk(int fd) { +static void intif_parse_DeleteHomunculusOk(int fd) +{ if(RFIFOB(fd,2) != 1) ShowError("Homunculus data delete failure\n"); } /************************************** - -QUESTLOG SYSTEM FUNCTIONS - -***************************************/ + * QUESTLOG SYSTEM FUNCTIONS * + **************************************/ /** * Requests a character's quest log entries to the inter server. * * @param sd Character's data */ -void intif_request_questlog(struct map_session_data *sd) +static void intif_request_questlog(struct map_session_data *sd) { nullpo_retv(sd); WFIFOHEAD(inter_fd,6); @@ -1728,7 +1755,8 @@ void intif_request_questlog(struct map_session_data *sd) * * @see intif_parse */ -void intif_parse_QuestLog(int fd) { +static void intif_parse_QuestLog(int fd) +{ int char_id = RFIFOL(fd, 4), num_received = (RFIFOW(fd, 2)-8)/sizeof(struct quest); struct map_session_data *sd = map->charid2sd(char_id); @@ -1783,7 +1811,8 @@ void intif_parse_QuestLog(int fd) { * * @see intif_parse */ -void intif_parse_QuestSave(int fd) { +static void intif_parse_QuestSave(int fd) +{ int cid = RFIFOL(fd, 2); struct map_session_data *sd = map->id2sd(cid); @@ -1799,7 +1828,7 @@ void intif_parse_QuestSave(int fd) { * @param sd Character's data * @return 0 in case of success, nonzero otherwise */ -int intif_quest_save(struct map_session_data *sd) +static int intif_quest_save(struct map_session_data *sd) { int len = sizeof(struct quest)*sd->num_quests + 8; @@ -1826,7 +1855,7 @@ int intif_quest_save(struct map_session_data *sd) * Inbox Request * flag: 0 Update Inbox | 1 OpenMail *------------------------------------------*/ -int intif_Mail_requestinbox(int char_id, unsigned char flag) +static int intif_Mail_requestinbox(int char_id, unsigned char flag) { if (intif->CheckForCharServer()) return 0; @@ -1840,7 +1869,8 @@ int intif_Mail_requestinbox(int char_id, unsigned char flag) return 0; } -void intif_parse_MailInboxReceived(int fd) { +static void intif_parse_MailInboxReceived(int fd) +{ struct map_session_data *sd; unsigned char flag = RFIFOB(fd,8); @@ -1869,7 +1899,7 @@ void intif_parse_MailInboxReceived(int fd) { /*------------------------------------------ * Mail Read *------------------------------------------*/ -int intif_Mail_read(int mail_id) +static int intif_Mail_read(int mail_id) { if (intif->CheckForCharServer()) return 0; @@ -1884,7 +1914,7 @@ int intif_Mail_read(int mail_id) /*------------------------------------------ * Get Attachment *------------------------------------------*/ -int intif_Mail_getattach(int char_id, int mail_id) +static int intif_Mail_getattach(int char_id, int mail_id) { if (intif->CheckForCharServer()) return 0; @@ -1898,7 +1928,8 @@ int intif_Mail_getattach(int char_id, int mail_id) return 0; } -void intif_parse_MailGetAttach(int fd) { +static void intif_parse_MailGetAttach(int fd) +{ struct map_session_data *sd; struct item item; int zeny = RFIFOL(fd,8); @@ -1923,7 +1954,7 @@ void intif_parse_MailGetAttach(int fd) { /*------------------------------------------ * Delete Message *------------------------------------------*/ -int intif_Mail_delete(int char_id, int mail_id) +static int intif_Mail_delete(int char_id, int mail_id) { if (intif->CheckForCharServer()) return 0; @@ -1937,7 +1968,8 @@ int intif_Mail_delete(int char_id, int mail_id) return 0; } -void intif_parse_MailDelete(int fd) { +static void intif_parse_MailDelete(int fd) +{ struct map_session_data *sd; int char_id = RFIFOL(fd,2); int mail_id = RFIFOL(fd,6); @@ -1965,7 +1997,7 @@ void intif_parse_MailDelete(int fd) { /*------------------------------------------ * Return Message *------------------------------------------*/ -int intif_Mail_return(int char_id, int mail_id) +static int intif_Mail_return(int char_id, int mail_id) { if (intif->CheckForCharServer()) return 0; @@ -1979,7 +2011,8 @@ int intif_Mail_return(int char_id, int mail_id) return 0; } -void intif_parse_MailReturn(int fd) { +static void intif_parse_MailReturn(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int mail_id = RFIFOL(fd,6); short fail = RFIFOB(fd,10); @@ -2006,7 +2039,7 @@ void intif_parse_MailReturn(int fd) { /*------------------------------------------ * Send Mail *------------------------------------------*/ -int intif_Mail_send(int account_id, struct mail_message *msg) +static int intif_Mail_send(int account_id, struct mail_message *msg) { int len = sizeof(struct mail_message) + 8; @@ -2024,7 +2057,8 @@ int intif_Mail_send(int account_id, struct mail_message *msg) return 1; } -void intif_parse_MailSend(int fd) { +static void intif_parse_MailSend(int fd) +{ struct mail_message msg; struct map_session_data *sd; bool fail; @@ -2050,7 +2084,8 @@ void intif_parse_MailSend(int fd) { } } -void intif_parse_MailNew(int fd) { +static void intif_parse_MailNew(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int mail_id = RFIFOL(fd,6); const char *sender_name = RFIFOP(fd,10); @@ -2067,7 +2102,7 @@ void intif_parse_MailNew(int fd) { * AUCTION SYSTEM * By Zephyrus *==========================================*/ -int intif_Auction_requestlist(int char_id, short type, int price, const char* searchtext, short page) +static int intif_Auction_requestlist(int char_id, short type, int price, const char *searchtext, short page) { int len = NAME_LENGTH + 16; @@ -2088,7 +2123,8 @@ int intif_Auction_requestlist(int char_id, short type, int price, const char* se return 0; } -void intif_parse_AuctionResults(int fd) { +static void intif_parse_AuctionResults(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,4)); short count = RFIFOW(fd,8); short pages = RFIFOW(fd,10); @@ -2100,7 +2136,7 @@ void intif_parse_AuctionResults(int fd) { clif->auction_results(sd, count, pages, data); } -int intif_Auction_register(struct auction_data *auction) +static int intif_Auction_register(struct auction_data *auction) { int len = sizeof(struct auction_data) + 4; @@ -2117,7 +2153,8 @@ int intif_Auction_register(struct auction_data *auction) return 1; } -void intif_parse_AuctionRegister(int fd) { +static void intif_parse_AuctionRegister(int fd) +{ struct map_session_data *sd; struct auction_data auction; @@ -2144,7 +2181,7 @@ void intif_parse_AuctionRegister(int fd) { } } -int intif_Auction_cancel(int char_id, unsigned int auction_id) +static int intif_Auction_cancel(int char_id, unsigned int auction_id) { if( intif->CheckForCharServer() ) return 0; @@ -2158,7 +2195,8 @@ int intif_Auction_cancel(int char_id, unsigned int auction_id) return 0; } -void intif_parse_AuctionCancel(int fd) { +static void intif_parse_AuctionCancel(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int result = RFIFOB(fd,6); @@ -2173,7 +2211,7 @@ void intif_parse_AuctionCancel(int fd) { } } -int intif_Auction_close(int char_id, unsigned int auction_id) +static int intif_Auction_close(int char_id, unsigned int auction_id) { if( intif->CheckForCharServer() ) return 0; @@ -2187,7 +2225,8 @@ int intif_Auction_close(int char_id, unsigned int auction_id) return 0; } -void intif_parse_AuctionClose(int fd) { +static void intif_parse_AuctionClose(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); @@ -2202,7 +2241,7 @@ void intif_parse_AuctionClose(int fd) { } } -int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, int bid) +static int intif_Auction_bid(int char_id, const char *name, unsigned int auction_id, int bid) { int len = 16 + NAME_LENGTH; @@ -2222,7 +2261,8 @@ int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, in return 0; } -void intif_parse_AuctionBid(int fd) { +static void intif_parse_AuctionBid(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); int bid = RFIFOL(fd,6); unsigned char result = RFIFOB(fd,10); @@ -2241,7 +2281,8 @@ void intif_parse_AuctionBid(int fd) { } // Used to send 'You have won the auction' and 'You failed to won the auction' messages -void intif_parse_AuctionMessage(int fd) { +static void intif_parse_AuctionMessage(int fd) +{ struct map_session_data *sd = map->charid2sd(RFIFOL(fd,2)); unsigned char result = RFIFOB(fd,6); @@ -2254,7 +2295,7 @@ void intif_parse_AuctionMessage(int fd) { /*========================================== * Mercenary's System *------------------------------------------*/ -int intif_mercenary_create(struct s_mercenary *merc) +static int intif_mercenary_create(struct s_mercenary *merc) { int size = sizeof(struct s_mercenary) + 4; @@ -2270,7 +2311,8 @@ int intif_mercenary_create(struct s_mercenary *merc) return 0; } -void intif_parse_MercenaryReceived(int fd) { +static void intif_parse_MercenaryReceived(int fd) +{ int len = RFIFOW(fd,2) - 5; if (sizeof(struct s_mercenary) != len) { @@ -2282,7 +2324,7 @@ void intif_parse_MercenaryReceived(int fd) { mercenary->data_received(RFIFOP(fd,5), RFIFOB(fd,4)); } -int intif_mercenary_request(int merc_id, int char_id) +static int intif_mercenary_request(int merc_id, int char_id) { if (intif->CheckForCharServer()) return 0; @@ -2295,7 +2337,7 @@ int intif_mercenary_request(int merc_id, int char_id) return 0; } -int intif_mercenary_delete(int merc_id) +static int intif_mercenary_delete(int merc_id) { if (intif->CheckForCharServer()) return 0; @@ -2307,12 +2349,13 @@ int intif_mercenary_delete(int merc_id) return 0; } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_MercenaryDeleted(int fd) { +static void intif_parse_MercenaryDeleted(int fd) +{ if( RFIFOB(fd,2) != 1 ) ShowError("Mercenary data delete failure\n"); } -int intif_mercenary_save(struct s_mercenary *merc) +static int intif_mercenary_save(struct s_mercenary *merc) { int size = sizeof(struct s_mercenary) + 4; @@ -2328,7 +2371,8 @@ int intif_mercenary_save(struct s_mercenary *merc) return 0; } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_MercenarySaved(int fd) { +static void intif_parse_MercenarySaved(int fd) +{ if( RFIFOB(fd,2) != 1 ) ShowError("Mercenary data save failure\n"); } @@ -2336,7 +2380,7 @@ void intif_parse_MercenarySaved(int fd) { /*========================================== * Elemental's System *------------------------------------------*/ -int intif_elemental_create(struct s_elemental *ele) +static int intif_elemental_create(struct s_elemental *ele) { int size = sizeof(struct s_elemental) + 4; @@ -2352,7 +2396,8 @@ int intif_elemental_create(struct s_elemental *ele) return 0; } -void intif_parse_ElementalReceived(int fd) { +static void intif_parse_ElementalReceived(int fd) +{ int len = RFIFOW(fd,2) - 5; if (sizeof(struct s_elemental) != len) { @@ -2364,7 +2409,7 @@ void intif_parse_ElementalReceived(int fd) { elemental->data_received(RFIFOP(fd,5), RFIFOB(fd,4)); } -int intif_elemental_request(int ele_id, int char_id) +static int intif_elemental_request(int ele_id, int char_id) { if (intif->CheckForCharServer()) return 0; @@ -2377,7 +2422,7 @@ int intif_elemental_request(int ele_id, int char_id) return 0; } -int intif_elemental_delete(int ele_id) +static int intif_elemental_delete(int ele_id) { if (intif->CheckForCharServer()) return 0; @@ -2389,12 +2434,13 @@ int intif_elemental_delete(int ele_id) return 0; } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_ElementalDeleted(int fd) { +static void intif_parse_ElementalDeleted(int fd) +{ if( RFIFOB(fd,2) != 1 ) ShowError("Elemental data delete failure\n"); } -int intif_elemental_save(struct s_elemental *ele) +static int intif_elemental_save(struct s_elemental *ele) { int size = sizeof(struct s_elemental) + 4; @@ -2410,12 +2456,14 @@ int intif_elemental_save(struct s_elemental *ele) return 0; } /* Really? Whats the point, shouldn't be sent when successful then [Ind] */ -void intif_parse_ElementalSaved(int fd) { +static void intif_parse_ElementalSaved(int fd) +{ if( RFIFOB(fd,2) != 1 ) ShowError("Elemental data save failure\n"); } -void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) { +static void intif_request_accinfo(int u_fd, int aid, int group_lv, char *query) +{ nullpo_retv(query); WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH); @@ -2430,7 +2478,8 @@ void intif_request_accinfo( int u_fd, int aid, int group_lv, char* query ) { return; } -void intif_parse_MessageToFD(int fd) { +static void intif_parse_MessageToFD(int fd) +{ int u_fd = RFIFOL(fd,4); Assert_retv(sockt->session_is_valid(u_fd)); @@ -2451,7 +2500,8 @@ void intif_parse_MessageToFD(int fd) { /*========================================== * Item Bound System [Xantara][Mhalicot] *------------------------------------------*/ -void intif_itembound_req(int char_id,int aid,int guild_id) { +static void intif_itembound_req(int char_id, int aid, int guild_id) +{ #ifdef GP_BOUND_ITEMS struct guild_storage *gstor = idb_get(gstorage->db,guild_id); WFIFOHEAD(inter_fd,12); @@ -2466,7 +2516,8 @@ void intif_itembound_req(int char_id,int aid,int guild_id) { } //3856 -void intif_parse_Itembound_ack(int fd) { +static void intif_parse_Itembound_ack(int fd) +{ #ifdef GP_BOUND_ITEMS struct guild_storage *gstor; int guild_id = RFIFOW(fd,6); @@ -2478,8 +2529,8 @@ void intif_parse_Itembound_ack(int fd) { } /*========================================== -* RoDEX System -*==========================================*/ + * RoDEX System + *==========================================*/ /*------------------------------------------ * Mail List @@ -2489,7 +2540,7 @@ void intif_parse_Itembound_ack(int fd) { // char_id: char_id // account_id: account_id (used by account mail) // flag: 0 - Open/Refresh ; 1 = Next Page -int intif_rodex_requestinbox(int char_id, int account_id, int8 flag, int8 opentype, int64 mail_id) +static int intif_rodex_requestinbox(int char_id, int account_id, int8 flag, int8 opentype, int64 mail_id) { if (intif->CheckForCharServer()) return 0; @@ -2506,7 +2557,7 @@ int intif_rodex_requestinbox(int char_id, int account_id, int8 flag, int8 openty return 0; } -void intif_parse_RequestRodexOpenInbox(int fd) +static void intif_parse_RequestRodexOpenInbox(int fd) { struct map_session_data *sd; #if PACKETVER < 20170419 @@ -2566,7 +2617,7 @@ void intif_parse_RequestRodexOpenInbox(int fd) /*------------------------------------------ * Notifications *------------------------------------------*/ -int intif_rodex_hasnew(struct map_session_data *sd) +static int intif_rodex_hasnew(struct map_session_data *sd) { nullpo_retr(0, sd); @@ -2582,7 +2633,7 @@ int intif_rodex_hasnew(struct map_session_data *sd) return 0; } -void intif_parse_RodexNotifications(int fd) +static void intif_parse_RodexNotifications(int fd) { struct map_session_data *sd; bool has_messages; @@ -2607,7 +2658,7 @@ void intif_parse_RodexNotifications(int fd) /// 2 - user got Items /// 3 - delete /// 4 - sender Read (returned mail) -int intif_rodex_updatemail(int64 mail_id, int8 flag) +static int intif_rodex_updatemail(int64 mail_id, int8 flag) { if (intif->CheckForCharServer()) return 0; @@ -2624,7 +2675,7 @@ int intif_rodex_updatemail(int64 mail_id, int8 flag) /*------------------------------------------ * Send Mail *------------------------------------------*/ -int intif_rodex_sendmail(struct rodex_message *msg) +static int intif_rodex_sendmail(struct rodex_message *msg) { if (intif->CheckForCharServer()) return 0; @@ -2640,7 +2691,7 @@ int intif_rodex_sendmail(struct rodex_message *msg) return 0; } -void intif_parse_RodexSendMail(int fd) +static void intif_parse_RodexSendMail(int fd) { struct map_session_data *ssd = NULL, *rsd = NULL; int sender_id = RFIFOL(fd, 2); @@ -2661,7 +2712,7 @@ void intif_parse_RodexSendMail(int fd) /*------------------------------------------ * Check Player *------------------------------------------*/ -int intif_rodex_checkname(struct map_session_data *sd, const char *name) +static int intif_rodex_checkname(struct map_session_data *sd, const char *name) { if (intif->CheckForCharServer()) return 0; @@ -2678,7 +2729,7 @@ int intif_rodex_checkname(struct map_session_data *sd, const char *name) return 0; } -void intif_parse_RodexCheckName(int fd) +static void intif_parse_RodexCheckName(int fd) { struct map_session_data *sd = NULL; int reqchar_id = RFIFOL(fd, 2); @@ -2712,7 +2763,7 @@ void intif_parse_RodexCheckName(int fd) // Communication from the inter server // Return a 0 (false) if there were any errors. // 1, 2 if there are not enough to return the length of the packet if the packet processing -int intif_parse(int fd) +static int intif_parse(int fd) { int packet_len, cmd; cmd = RFIFOW(fd,0); @@ -2837,11 +2888,12 @@ int intif_parse(int fd) } /*===================================== -* Default Functions : intif.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void intif_defaults(void) { + * Default Functions : intif.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void intif_defaults(void) +{ const int packet_len_table [INTIF_PACKET_LEN_TABLE_SIZE] = { -1,-1,27,-1, -1,-1,37,-1, 7, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f 0, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index d087588af..6f37fa4a6 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -43,13 +43,14 @@ //#define IRCBOT_DEBUG -struct irc_bot_interface irc_bot_s; +static struct irc_bot_interface irc_bot_s; struct irc_bot_interface *ircbot; -char send_string[IRC_MESSAGE_LENGTH]; +static char send_string[IRC_MESSAGE_LENGTH]; /// @copydoc irc_bot_interface::connect_timer() -int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) { +static int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) +{ struct hSockOpt opt; if( ircbot->isOn || ++ircbot->fails >= 3 ) return 0; @@ -69,7 +70,8 @@ int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) { } /// @copydoc irc_bot_interface::identify_timer() -int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) { +static int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) +{ if( !ircbot->isOn ) return 0; @@ -84,7 +86,8 @@ int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) { } /// @copydoc irc_bot_interface::join_timer() -int irc_join_timer(int tid, int64 tick, int id, intptr_t data) { +static int irc_join_timer(int tid, int64 tick, int id, intptr_t data) +{ if( !ircbot->isOn ) return 0; @@ -105,7 +108,8 @@ int irc_join_timer(int tid, int64 tick, int id, intptr_t data) { } /// @copydoc irc_bot_interface::func_search() -struct irc_func* irc_func_search(char* function_name) { +static struct irc_func *irc_func_search(char *function_name) +{ int i; nullpo_retr(NULL, function_name); for(i = 0; i < ircbot->funcs.size; i++) { @@ -117,7 +121,8 @@ struct irc_func* irc_func_search(char* function_name) { } /// @copydoc irc_bot_interface::parse() -int irc_parse(int fd) { +static int irc_parse(int fd) +{ char *parse_string = NULL, *p = NULL, *str_safe = NULL; if (sockt->session[fd]->flag.eof) { @@ -151,7 +156,8 @@ int irc_parse(int fd) { } /// @copydoc irc_bot_interface::parse_source() -void irc_parse_source(char *source, char *nick, char *ident, char *host) { +static void irc_parse_source(char *source, char *nick, char *ident, char *host) +{ int i, pos = 0; size_t len; unsigned char stage = 0; @@ -175,7 +181,8 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) { } /// @copydoc irc_bot_interface::parse_sub() -void irc_parse_sub(int fd, char *str) { +static void irc_parse_sub(int fd, char *str) +{ char source[180], command[60], buf1[IRC_MESSAGE_LENGTH], buf2[IRC_MESSAGE_LENGTH]; char *target = buf1, *message = buf2; struct irc_func *func; @@ -205,7 +212,7 @@ void irc_parse_sub(int fd, char *str) { } /// @copydoc irc_bot_interface::queue() -void irc_queue(char *str) +static void irc_queue(char *str) { struct message_flood *queue_entry = NULL; @@ -242,7 +249,7 @@ void irc_queue(char *str) } /// @copydoc irc_bot_interface::queue_timer() -int irc_queue_timer(int tid, int64 tick, int id, intptr_t data) +static int irc_queue_timer(int tid, int64 tick, int id, intptr_t data) { struct message_flood *queue_entry = ircbot->message_current; nullpo_ret(queue_entry); @@ -263,7 +270,7 @@ int irc_queue_timer(int tid, int64 tick, int id, intptr_t data) } /// @copydoc irc_bot_interface::send() -void irc_send(char *str, bool force) +static void irc_send(char *str, bool force) { size_t len; nullpo_retv(str); @@ -283,14 +290,16 @@ void irc_send(char *str, bool force) } /// @copydoc irc_interface_bot::pong() -void irc_pong(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_pong(int fd, char *cmd, char *source, char *target, char *msg) +{ nullpo_retv(cmd); snprintf(send_string, IRC_MESSAGE_LENGTH, "PONG %s", cmd); ircbot->send(send_string, false); } /// @copydoc irc_interface_bot::privmsg_ctcp() -void irc_privmsg_ctcp(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_privmsg_ctcp(int fd, char *cmd, char *source, char *target, char *msg) +{ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; source_nick[0] = source_ident[0] = source_host[0] = '\0'; @@ -336,7 +345,8 @@ void irc_privmsg_ctcp(int fd, char *cmd, char *source, char *target, char *msg) } /// @copydoc irc_bot_interface::privmsg() -void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) +{ size_t len = msg ? strlen(msg) : 0; nullpo_retv(source); nullpo_retv(target); @@ -374,7 +384,8 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { } /// @copydoc irc_bot_interface::userjoin() -void irc_userjoin(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_userjoin(int fd, char *cmd, char *source, char *target, char *msg) +{ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; nullpo_retv(source); @@ -390,7 +401,8 @@ void irc_userjoin(int fd, char *cmd, char *source, char *target, char *msg) { } /// @copydoc irc_bot_interface::userleave() -void irc_userleave(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_userleave(int fd, char *cmd, char *source, char *target, char *msg) +{ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; nullpo_retv(source); @@ -409,7 +421,8 @@ void irc_userleave(int fd, char *cmd, char *source, char *target, char *msg) { } /// @copydoc irc_bot_interface::usernick() -void irc_usernick(int fd, char *cmd, char *source, char *target, char *msg) { +static void irc_usernick(int fd, char *cmd, char *source, char *target, char *msg) +{ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; nullpo_retv(source); @@ -425,7 +438,7 @@ void irc_usernick(int fd, char *cmd, char *source, char *target, char *msg) { } /// @copydoc irc_bot_interface::relay() -void irc_relay(const char *name, const char *msg) +static void irc_relay(const char *name, const char *msg) { if (!ircbot->isIn) return; @@ -440,7 +453,8 @@ void irc_relay(const char *name, const char *msg) } /// @copydoc irc_bot_interface::init() -void irc_bot_init(bool minimal) { +static void irc_bot_init(bool minimal) +{ /// Command handlers const struct irc_func irc_func_base[] = { { "PING" , ircbot->pong }, @@ -491,7 +505,8 @@ void irc_bot_init(bool minimal) { } /// @copydoc irc_bot_interface::final() -void irc_bot_final(void) { +static void irc_bot_final(void) +{ int i; if (!channel->config->irc) @@ -519,7 +534,8 @@ void irc_bot_final(void) { /** * IRC bot interface defaults initializer */ -void ircbot_defaults(void) { +void ircbot_defaults(void) +{ ircbot = &irc_bot_s; ircbot->channel = NULL; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index f2fd2ac80..cee38b973 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -41,7 +41,7 @@ #include <stdlib.h> #include <string.h> -struct itemdb_interface itemdb_s; +static struct itemdb_interface itemdb_s; struct itemdb_interface *itemdb; /** @@ -49,7 +49,7 @@ struct itemdb_interface *itemdb; * name = item alias, so we should find items aliases first. if not found then look for "jname" (full name) * @see DBApply */ -int itemdb_searchname_sub(union DBKey key, struct DBData *data, va_list ap) +static int itemdb_searchname_sub(union DBKey key, struct DBData *data, va_list ap) { struct item_data *item = DB->data2ptr(data), **dst, **dst2; char *str; @@ -78,7 +78,8 @@ int itemdb_searchname_sub(union DBKey key, struct DBData *data, va_list ap) /*========================================== * Return item data from item name. (lookup) *------------------------------------------*/ -struct item_data* itemdb_searchname(const char *str) { +static struct item_data *itemdb_searchname(const char *str) +{ struct item_data* item; struct item_data* item2=NULL; int i; @@ -105,14 +106,15 @@ struct item_data* itemdb_searchname(const char *str) { return item?item:item2; } /* name to item data */ -struct item_data* itemdb_name2id(const char *str) { +static struct item_data *itemdb_name2id(const char *str) +{ return strdb_get(itemdb->names,str); } /** * @see DBMatcher */ -int itemdb_searchname_array_sub(union DBKey key, struct DBData data, va_list ap) +static int itemdb_searchname_array_sub(union DBKey key, struct DBData data, va_list ap) { struct item_data *item = DB->data2ptr(&data); char *str; @@ -135,7 +137,8 @@ int itemdb_searchname_array_sub(union DBKey key, struct DBData data, va_list ap) * 0 - approximate match * 1 - exact match *------------------------------------------*/ -int itemdb_searchname_array(struct item_data** data, int size, const char *str, int flag) { +static int itemdb_searchname_array(struct item_data **data, int size, const char *str, int flag) +{ struct item_data* item; int i; int count=0; @@ -181,7 +184,8 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str, return count; } /* [Ind/Hercules] */ -int itemdb_chain_item(unsigned short chain_id, int *rate) { +static int itemdb_chain_item(unsigned short chain_id, int *rate) +{ struct item_chain_entry *entry; if( chain_id >= itemdb->chain_count ) { @@ -199,7 +203,8 @@ int itemdb_chain_item(unsigned short chain_id, int *rate) { return entry->id; } /* [Ind/Hercules] */ -void itemdb_package_item(struct map_session_data *sd, struct item_package *package) { +static void itemdb_package_item(struct map_session_data *sd, struct item_package *package) +{ int i = 0, get_count, j, flag; nullpo_retv(sd); @@ -287,7 +292,8 @@ void itemdb_package_item(struct map_session_data *sd, struct item_package *packa /*========================================== * Return a random item id from group. (takes into account % chance giving/tot group) *------------------------------------------*/ -int itemdb_searchrandomid(struct item_group *group) { +static int itemdb_searchrandomid(struct item_group *group) +{ nullpo_retr(UNKNOWN_ITEM_ID, group); if (group->qty) @@ -296,7 +302,8 @@ int itemdb_searchrandomid(struct item_group *group) { ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group->id); return UNKNOWN_ITEM_ID; } -bool itemdb_in_group(struct item_group *group, int nameid) { +static bool itemdb_in_group(struct item_group *group, int nameid) +{ int i; nullpo_retr(false, group); @@ -309,7 +316,7 @@ bool itemdb_in_group(struct item_group *group, int nameid) { /// Searches for the item_data. /// Returns the item_data or NULL if it does not exist. -struct item_data* itemdb_exists(int nameid) +static struct item_data *itemdb_exists(int nameid) { struct item_data* item; @@ -326,14 +333,14 @@ struct item_data* itemdb_exists(int nameid) * @param option_index as the index of the item option (client side). * @return pointer to struct itemdb_option data or NULL. */ -struct itemdb_option *itemdb_option_exists(int idx) +static struct itemdb_option *itemdb_option_exists(int idx) { return (struct itemdb_option *)idb_get(itemdb->options, idx); } /// Returns human readable name for given item type. /// @param type Type id to retrieve name for ( IT_* ). -const char* itemdb_typename(int type) +static const char *itemdb_typename(int type) { switch(type) { @@ -362,7 +369,7 @@ const char* itemdb_typename(int type) * * @author Dastgir */ -void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable) +static void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable) { uint64 mask[3] = { 0 }; int i; @@ -489,7 +496,7 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable) * @param bclass Pointer to the variable containing the new format. * @param jobmask Variable containing JobMask. */ -void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) +static void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) { nullpo_retv(bclass); bclass[0] = bclass[1] = bclass[2] = 0; @@ -572,7 +579,7 @@ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask) bclass[0] |= 1ULL<<MAPID_SUMMONER; } -void create_dummy_data(void) +static void create_dummy_data(void) { memset(&itemdb->dummy, 0, sizeof(struct item_data)); itemdb->dummy.nameid=500; @@ -584,7 +591,7 @@ void create_dummy_data(void) itemdb->dummy.view_id=UNKNOWN_ITEM_ID; } -struct item_data* create_item_data(int nameid) +static struct item_data *create_item_data(int nameid) { struct item_data *id; CREATE(id, struct item_data, 1); @@ -597,7 +604,8 @@ struct item_data* create_item_data(int nameid) /*========================================== * Loads (and creates if not found) an item from the db. *------------------------------------------*/ -struct item_data* itemdb_load(int nameid) { +static struct item_data *itemdb_load(int nameid) +{ struct item_data *id; if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb->array) ) @@ -620,7 +628,7 @@ struct item_data* itemdb_load(int nameid) { /*========================================== * Loads an item from the db. If not found, it will return the dummy item. *------------------------------------------*/ -struct item_data* itemdb_search(int nameid) +static struct item_data *itemdb_search(int nameid) { struct item_data* id; if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb->array) ) @@ -640,7 +648,7 @@ struct item_data* itemdb_search(int nameid) /*========================================== * Returns if given item is a player-equippable piece. *------------------------------------------*/ -int itemdb_isequip(int nameid) +static int itemdb_isequip(int nameid) { int type=itemdb_type(nameid); switch (type) { @@ -656,7 +664,8 @@ int itemdb_isequip(int nameid) /*========================================== * Alternate version of itemdb_isequip *------------------------------------------*/ -int itemdb_isequip2(struct item_data *data) { +static int itemdb_isequip2(struct item_data *data) +{ nullpo_ret(data); switch(data->type) { case IT_WEAPON: @@ -671,7 +680,7 @@ int itemdb_isequip2(struct item_data *data) { /*========================================== * Returns if given item's type is stackable. *------------------------------------------*/ -int itemdb_isstackable(int nameid) +static int itemdb_isstackable(int nameid) { int type=itemdb_type(nameid); switch(type) { @@ -688,7 +697,7 @@ int itemdb_isstackable(int nameid) /*========================================== * Alternate version of itemdb_isstackable *------------------------------------------*/ -int itemdb_isstackable2(struct item_data *data) +static int itemdb_isstackable2(struct item_data *data) { nullpo_ret(data); switch(data->type) { @@ -705,43 +714,52 @@ int itemdb_isstackable2(struct item_data *data) /*========================================== * Trade Restriction functions [Skotlex] *------------------------------------------*/ -int itemdb_isdropable_sub(struct item_data *item, int gmlv, int unused) { +static int itemdb_isdropable_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NODROP) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_cantrade_sub(struct item_data* item, int gmlv, int gmlv2) { +static int itemdb_cantrade_sub(struct item_data *item, int gmlv, int gmlv2) +{ return (item && (!(item->flag.trade_restriction&ITR_NOTRADE) || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override)); } -int itemdb_canpartnertrade_sub(struct item_data* item, int gmlv, int gmlv2) { +static int itemdb_canpartnertrade_sub(struct item_data *item, int gmlv, int gmlv2) +{ return (item && (item->flag.trade_restriction&ITR_PARTNEROVERRIDE || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override)); } -int itemdb_cansell_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_cansell_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOSELLTONPC) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_cancartstore_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_cancartstore_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOCART) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_canstore_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_canstore_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOSTORAGE) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_canguildstore_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_canguildstore_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOGSTORAGE) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_canmail_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_canmail_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOMAIL) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_canauction_sub(struct item_data* item, int gmlv, int unused) { +static int itemdb_canauction_sub(struct item_data *item, int gmlv, int unused) +{ return (item && (!(item->flag.trade_restriction&ITR_NOAUCTION) || gmlv >= item->gm_lv_trade_override)); } -int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int)) +static int itemdb_isrestricted(struct item *item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int)) { struct item_data* item_data; int i; @@ -765,7 +783,8 @@ int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(stru /*========================================== * Specifies if item-type should drop unidentified. *------------------------------------------*/ -int itemdb_isidentified(int nameid) { +static int itemdb_isidentified(int nameid) +{ int type=itemdb_type(nameid); switch (type) { case IT_WEAPON: @@ -777,7 +796,8 @@ int itemdb_isidentified(int nameid) { } } /* same as itemdb_isidentified but without a lookup */ -int itemdb_isidentified2(struct item_data *data) { +static int itemdb_isidentified2(struct item_data *data) +{ nullpo_ret(data); switch (data->type) { case IT_WEAPON: @@ -789,7 +809,8 @@ int itemdb_isidentified2(struct item_data *data) { } } -void itemdb_read_groups(void) { +static void itemdb_read_groups(void) +{ struct config_t item_group_conf; struct config_setting_t *itg = NULL, *it = NULL; #ifdef RENEWAL @@ -877,7 +898,8 @@ void itemdb_read_groups(void) { } /* [Ind/Hercules] - HCache for Packages */ -void itemdb_write_cached_packages(const char *config_filename) { +static void itemdb_write_cached_packages(const char *config_filename) +{ FILE *file; unsigned short pcount = itemdb->package_count; unsigned short i; @@ -948,7 +970,8 @@ void itemdb_write_cached_packages(const char *config_filename) { return; } -bool itemdb_read_cached_packages(const char *config_filename) { +static bool itemdb_read_cached_packages(const char *config_filename) +{ FILE *file; unsigned short pcount = 0; unsigned short i; @@ -1079,7 +1102,8 @@ bool itemdb_read_cached_packages(const char *config_filename) { return true; } -void itemdb_read_packages(void) { +static void itemdb_read_packages(void) +{ struct config_t item_packages_conf; struct config_setting_t *itg = NULL, *it = NULL, *t = NULL; #ifdef RENEWAL @@ -1318,7 +1342,7 @@ void itemdb_read_packages(void) { * @param[in] source Source of the entry (file name), to be displayed in * case of validation errors. */ -void itemdb_readdb_options_additional_fields(struct itemdb_option *ito, struct config_setting_t *t, const char *source) +static void itemdb_readdb_options_additional_fields(struct itemdb_option *ito, struct config_setting_t *t, const char *source) { // do nothing. plugins can do their own work } @@ -1326,7 +1350,7 @@ void itemdb_readdb_options_additional_fields(struct itemdb_option *ito, struct c /** * Reads the Item Options configuration file. */ -void itemdb_read_options(void) +static void itemdb_read_options(void) { struct config_t item_options_db; struct config_setting_t *ito = NULL, *conf = NULL; @@ -1428,7 +1452,8 @@ void itemdb_read_options(void) ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filepath); } -void itemdb_read_chains(void) { +static void itemdb_read_chains(void) +{ struct config_t item_chain_conf; struct config_setting_t *itc = NULL; #ifdef RENEWAL @@ -1498,7 +1523,8 @@ void itemdb_read_chains(void) { /** * @return: amount of retrieved entries. **/ -int itemdb_combo_split_atoi (char *str, int *val) { +static int itemdb_combo_split_atoi(char *str, int *val) +{ int i; nullpo_ret(val); @@ -1520,7 +1546,7 @@ int itemdb_combo_split_atoi (char *str, int *val) { /** * <combo{:combo{:combo:{..}}}>,<{ script }> **/ -void itemdb_read_combos(void) +static void itemdb_read_combos(void) { uint32 lines = 0, count = 0; char line[1024]; @@ -1631,7 +1657,7 @@ void itemdb_read_combos(void) /*====================================== * Applies gender restrictions according to settings. [Skotlex] *======================================*/ -int itemdb_gendercheck(struct item_data *id) +static int itemdb_gendercheck(struct item_data *id) { nullpo_ret(id); if (id->nameid == WEDDING_RING_M) //Grom Ring @@ -1663,7 +1689,8 @@ int itemdb_gendercheck(struct item_data *id) * (i.e. item_db2 inheritance), as it will make sure not to free any scripts * still in use by the new entry. */ -int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { +static int itemdb_validate_entry(struct item_data *entry, int n, const char *source) +{ struct item_data *item; nullpo_ret(entry); @@ -1838,7 +1865,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { return item->nameid; } -void itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, int n, const char *source) +static void itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, int n, const char *source) { // do nothing. plugins can do own work } @@ -1850,7 +1877,7 @@ void itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, in * @param t Libconfig setting entry. It is expected to be valid and it won't * be freed (it is care of the caller to do so if necessary). */ -void itemdb_readdb_job_sub(struct item_data *id, struct config_setting_t *t) +static void itemdb_readdb_job_sub(struct item_data *id, struct config_setting_t *t) { int idx = 0; struct config_setting_t *it = NULL; @@ -1889,7 +1916,8 @@ void itemdb_readdb_job_sub(struct item_data *id, struct config_setting_t *t) * validation errors. * @return Nameid of the validated entry, or 0 in case of failure. */ -int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char *source) { +static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char *source) +{ struct item_data id = { 0 }; struct config_setting_t *t = NULL; const char *str = NULL; @@ -2228,7 +2256,7 @@ int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const char * return itemdb->validate_entry(&id, n, source); } -bool itemdb_lookup_const(const struct config_setting_t *it, const char *name, int *value) +static bool itemdb_lookup_const(const struct config_setting_t *it, const char *name, int *value) { const char *str = NULL; @@ -2247,7 +2275,7 @@ bool itemdb_lookup_const(const struct config_setting_t *it, const char *name, in return false; } -bool itemdb_lookup_const_mask(const struct config_setting_t *it, const char *name, int *value) +static bool itemdb_lookup_const_mask(const struct config_setting_t *it, const char *name, int *value) { const struct config_setting_t *t = NULL; @@ -2310,7 +2338,8 @@ bool itemdb_lookup_const_mask(const struct config_setting_t *it, const char *nam * @param filename File name, relative to the database path. * @return The number of found entries. */ -int itemdb_readdb_libconfig(const char *filename) { +static int itemdb_readdb_libconfig(const char *filename) +{ bool duplicate[MAX_ITEMDB]; struct config_t item_db_conf; struct config_setting_t *itdb, *it; @@ -2352,10 +2381,11 @@ int itemdb_readdb_libconfig(const char *filename) { } /*========================================== -* Unique item ID function -* Only one operation by once -*------------------------------------------*/ -uint64 itemdb_unique_id(struct map_session_data *sd) { + * Unique item ID function + * Only one operation by once + *------------------------------------------*/ +static uint64 itemdb_unique_id(struct map_session_data *sd) +{ nullpo_ret(sd); return ((uint64)sd->status.char_id << 32) | sd->status.uniqueitem_counter++; @@ -2364,7 +2394,8 @@ uint64 itemdb_unique_id(struct map_session_data *sd) { /** * Reads all item-related databases. */ -void itemdb_read(bool minimal) { +static void itemdb_read(bool minimal) +{ int i; struct DBData prev; @@ -2400,7 +2431,8 @@ void itemdb_read(bool minimal) { /** * retrieves item_combo data by combo id **/ -struct item_combo * itemdb_id2combo( unsigned short id ) { +static struct item_combo *itemdb_id2combo(unsigned short id) +{ if( id > itemdb->combo_count ) return NULL; return itemdb->combos[id]; @@ -2409,7 +2441,7 @@ struct item_combo * itemdb_id2combo( unsigned short id ) { /** * check is item have usable type **/ -bool itemdb_is_item_usable(struct item_data *item) +static bool itemdb_is_item_usable(struct item_data *item) { nullpo_retr(false, item); return item->type == IT_HEALING || item->type == IT_USABLE || item->type == IT_CASH; @@ -2420,7 +2452,7 @@ bool itemdb_is_item_usable(struct item_data *item) *------------------------------------------*/ /// Destroys the item_data. -void destroy_item_data(struct item_data* self, int free_self) +static void destroy_item_data(struct item_data *self, int free_self) { if( self == NULL ) return; @@ -2446,7 +2478,7 @@ void destroy_item_data(struct item_data* self, int free_self) /** * @see DBApply */ -int itemdb_final_sub(union DBKey key, struct DBData *data, va_list ap) +static int itemdb_final_sub(union DBKey key, struct DBData *data, va_list ap) { struct item_data *id = DB->data2ptr(data); @@ -2456,7 +2488,7 @@ int itemdb_final_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -int itemdb_options_final_sub(union DBKey key, struct DBData *data, va_list ap) +static int itemdb_options_final_sub(union DBKey key, struct DBData *data, va_list ap) { struct itemdb_option *ito = DB->data2ptr(data); @@ -2466,7 +2498,8 @@ int itemdb_options_final_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -void itemdb_clear(bool total) { +static void itemdb_clear(bool total) +{ int i; // clear the previous itemdb data for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) { @@ -2536,7 +2569,8 @@ void itemdb_clear(bool total) { db_clear(itemdb->names); } -void itemdb_reload(void) { +static void itemdb_reload(void) +{ struct s_mapiterator* iter; struct map_session_data* sd; @@ -2598,7 +2632,7 @@ void itemdb_reload(void) { } mapit->free(iter); } -void itemdb_name_constants(void) +static void itemdb_name_constants(void) { struct DBIterator *iter = db_iterator(itemdb->names); struct item_data *data; @@ -2614,7 +2648,8 @@ void itemdb_name_constants(void) dbi_destroy(iter); } -void do_final_itemdb(void) { +static void do_final_itemdb(void) +{ itemdb->clear(true); itemdb->other->destroy(itemdb->other, itemdb->final_sub); @@ -2625,7 +2660,8 @@ void do_final_itemdb(void) { clif->stylist_vector_clear(); } -void do_init_itemdb(bool minimal) { +static void do_init_itemdb(bool minimal) +{ memset(itemdb->array, 0, sizeof(itemdb->array)); itemdb->other = idb_alloc(DB_OPT_BASE); itemdb->options = idb_alloc(DB_OPT_RELEASE_DATA); @@ -2645,7 +2681,8 @@ void do_init_itemdb(bool minimal) { VECTOR_INIT(clif->attendance_data); clif->pAttendanceDB(); } -void itemdb_defaults(void) { +void itemdb_defaults(void) +{ itemdb = &itemdb_s; itemdb->init = do_init_itemdb; diff --git a/src/map/log.c b/src/map/log.c index b42837382..efb7fefbc 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -39,11 +39,12 @@ #include <stdlib.h> #include <string.h> -struct log_interface log_s; +static struct log_interface log_s; struct log_interface *logs; /// obtain log type character for item/zeny logs -char log_picktype2char(e_log_pick_type type) { +static char log_picktype2char(e_log_pick_type type) +{ switch( type ) { case LOG_TYPE_TRADE: return 'T'; // (T)rade case LOG_TYPE_VENDING: return 'V'; // (V)ending @@ -82,7 +83,7 @@ char log_picktype2char(e_log_pick_type type) { } /// obtain log type character for chat logs -char log_chattype2char(e_log_chat_type type) +static char log_chattype2char(e_log_chat_type type) { switch (type) { case LOG_CHAT_GLOBAL: @@ -105,7 +106,8 @@ char log_chattype2char(e_log_chat_type type) } /// check if this item should be logged according the settings -bool should_log_item(int nameid, int amount, int refine, struct item_data *id) { +static bool should_log_item(int nameid, int amount, int refine, struct item_data *id) +{ int filter = logs->config.filter; if( id == NULL ) @@ -128,7 +130,7 @@ bool should_log_item(int nameid, int amount, int refine, struct item_data *id) { return false; } -void log_branch_sub_sql(struct map_session_data* sd) +static void log_branch_sub_sql(struct map_session_data *sd) { struct SqlStmt *stmt; @@ -144,7 +146,8 @@ void log_branch_sub_sql(struct map_session_data* sd) } SQL->StmtFree(stmt); } -void log_branch_sub_txt(struct map_session_data* sd) { +static void log_branch_sub_txt(struct map_session_data *sd) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -159,7 +162,8 @@ void log_branch_sub_txt(struct map_session_data* sd) { } /// logs items, that summon monsters -void log_branch(struct map_session_data* sd) { +static void log_branch(struct map_session_data *sd) +{ nullpo_retv(sd); if( !logs->config.branch ) @@ -167,7 +171,8 @@ void log_branch(struct map_session_data* sd) { logs->branch_sub(sd); } -void log_pick_sub_sql(int id, int16 m, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) { +static void log_pick_sub_sql(int id, int16 m, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) +{ nullpo_retv(itm); if (SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, " @@ -182,7 +187,8 @@ void log_pick_sub_sql(int id, int16 m, e_log_pick_type type, int amount, struct return; } } -void log_pick_sub_txt(int id, int16 m, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) { +static void log_pick_sub_txt(int id, int16 m, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -198,7 +204,8 @@ void log_pick_sub_txt(int id, int16 m, e_log_pick_type type, int amount, struct fclose(logfp); } /// logs item transactions (generic) -void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) { +static void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) +{ nullpo_retv(itm); if( ( logs->config.enable_logs&type ) == 0 ) {// disabled return; @@ -211,19 +218,22 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it } /// logs item transactions (players) -void log_pick_pc(struct map_session_data* sd, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) { +static void log_pick_pc(struct map_session_data *sd, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) +{ nullpo_retv(sd); nullpo_retv(itm); log_pick(sd->status.char_id, sd->bl.m, type, amount, itm, data ? data : itemdb->exists(itm->nameid)); } /// logs item transactions (monsters) -void log_pick_mob(struct mob_data* md, e_log_pick_type type, int amount, struct item* itm, struct item_data *data) { +static void log_pick_mob(struct mob_data *md, e_log_pick_type type, int amount, struct item *itm, struct item_data *data) +{ nullpo_retv(md); nullpo_retv(itm); log_pick(md->class_, md->bl.m, type, amount, itm, data ? data : itemdb->exists(itm->nameid)); } -void log_zeny_sub_sql(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount) { +static void log_zeny_sub_sql(struct map_session_data *sd, e_log_pick_type type, struct map_session_data *src_sd, int amount) +{ nullpo_retv(sd); nullpo_retv(src_sd); if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `src_id`, `type`, `amount`, `map`) VALUES (NOW(), '%d', '%d', '%c', '%d', '%s')", @@ -233,7 +243,8 @@ void log_zeny_sub_sql(struct map_session_data* sd, e_log_pick_type type, struct return; } } -void log_zeny_sub_txt(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount) { +static void log_zeny_sub_txt(struct map_session_data *sd, e_log_pick_type type, struct map_session_data *src_sd, int amount) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -248,7 +259,7 @@ void log_zeny_sub_txt(struct map_session_data* sd, e_log_pick_type type, struct fclose(logfp); } /// logs zeny transactions -void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_session_data* src_sd, int amount) +static void log_zeny(struct map_session_data *sd, e_log_pick_type type, struct map_session_data *src_sd, int amount) { nullpo_retv(sd); @@ -257,7 +268,8 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess logs->zeny_sub(sd,type,src_sd,amount); } -void log_mvpdrop_sub_sql(struct map_session_data* sd, int monster_id, int* log_mvp) { +static void log_mvpdrop_sub_sql(struct map_session_data *sd, int monster_id, int *log_mvp) +{ nullpo_retv(sd); nullpo_retv(log_mvp); if( SQL_ERROR == SQL->Query(logs->mysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ", @@ -267,7 +279,8 @@ void log_mvpdrop_sub_sql(struct map_session_data* sd, int monster_id, int* log_m return; } } -void log_mvpdrop_sub_txt(struct map_session_data* sd, int monster_id, int* log_mvp) { +static void log_mvpdrop_sub_txt(struct map_session_data *sd, int monster_id, int *log_mvp) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -282,7 +295,7 @@ void log_mvpdrop_sub_txt(struct map_session_data* sd, int monster_id, int* log_m fclose(logfp); } /// logs MVP monster rewards -void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp) +static void log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp) { nullpo_retv(sd); @@ -292,7 +305,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp) logs->mvpdrop_sub(sd,monster_id,log_mvp); } -void log_atcommand_sub_sql(struct map_session_data* sd, const char* message) +static void log_atcommand_sub_sql(struct map_session_data *sd, const char *message) { struct SqlStmt *stmt; @@ -310,7 +323,8 @@ void log_atcommand_sub_sql(struct map_session_data* sd, const char* message) } SQL->StmtFree(stmt); } -void log_atcommand_sub_txt(struct map_session_data* sd, const char* message) { +static void log_atcommand_sub_txt(struct map_session_data *sd, const char *message) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -325,7 +339,7 @@ void log_atcommand_sub_txt(struct map_session_data* sd, const char* message) { fclose(logfp); } /// logs used atcommands -void log_atcommand(struct map_session_data* sd, const char* message) +static void log_atcommand(struct map_session_data *sd, const char *message) { nullpo_retv(sd); @@ -336,7 +350,7 @@ void log_atcommand(struct map_session_data* sd, const char* message) logs->atcommand_sub(sd,message); } -void log_npc_sub_sql(struct map_session_data *sd, const char *message) +static void log_npc_sub_sql(struct map_session_data *sd, const char *message) { struct SqlStmt *stmt; @@ -354,7 +368,8 @@ void log_npc_sub_sql(struct map_session_data *sd, const char *message) } SQL->StmtFree(stmt); } -void log_npc_sub_txt(struct map_session_data *sd, const char *message) { +static void log_npc_sub_txt(struct map_session_data *sd, const char *message) +{ char timestring[255]; time_t curtime; FILE* logfp; @@ -369,7 +384,7 @@ void log_npc_sub_txt(struct map_session_data *sd, const char *message) { fclose(logfp); } /// logs messages passed to script command 'logmes' -void log_npc(struct map_session_data* sd, const char* message) +static void log_npc(struct map_session_data *sd, const char *message) { nullpo_retv(sd); @@ -392,7 +407,7 @@ void log_npc(struct map_session_data* sd, const char* message) * @param dst_charname Destination character name. Must not be NULL. * @param message Message to log. */ -void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) +static void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) { struct SqlStmt* stmt; @@ -424,7 +439,7 @@ void log_chat_sub_sql(e_log_chat_type type, int type_id, int src_charid, int src * @param dst_charname Destination character name. Must not be NULL. * @param message Message to log. */ -void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) +static void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) { char timestring[255]; time_t curtime; @@ -454,7 +469,7 @@ void log_chat_sub_txt(e_log_chat_type type, int type_id, int src_charid, int src * @param dst_charname Destination character name. May be NULL when unused. * @param message Message to log. */ -void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) +static void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char *mapname, int x, int y, const char *dst_charname, const char *message) { if ((logs->config.chat&type) == 0) { // disabled @@ -472,7 +487,8 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, logs->chat_sub(type,type_id,src_charid,src_accid,mapname,x,y,dst_charname,message); } -void log_sql_init(void) { +static void log_sql_init(void) +{ // log db connection logs->mysql_handle = SQL->Malloc(); @@ -485,7 +501,8 @@ void log_sql_init(void) { if ( SQL_ERROR == SQL->SetEncoding(logs->mysql_handle, map->default_codepage) ) Sql_ShowDebug(logs->mysql_handle); } -void log_sql_final(void) { +static void log_sql_final(void) +{ ShowStatus("Close Log DB Connection....\n"); SQL->Free(logs->mysql_handle); logs->mysql_handle = NULL; @@ -738,7 +755,8 @@ bool log_config_read(const char *filename, bool imported) return retval; } -void log_config_complete(void) { +void log_config_complete(void) +{ if( logs->config.sql_logs ) { logs->pick_sub = log_pick_sub_sql; logs->zeny_sub = log_zeny_sub_sql; @@ -753,7 +771,8 @@ void log_config_complete(void) { /** * Initializes the log interface to the default values. */ -void log_defaults(void) { +void log_defaults(void) +{ logs = &log_s; sprintf(logs->db_ip,"127.0.0.1"); diff --git a/src/map/mail.c b/src/map/mail.c index 1eb69bc90..d67e658fd 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -34,10 +34,10 @@ #include <time.h> #include <string.h> -struct mail_interface mail_s; +static struct mail_interface mail_s; struct mail_interface *mail; -void mail_clear(struct map_session_data *sd) +static void mail_clear(struct map_session_data *sd) { nullpo_retv(sd); sd->mail.nameid = 0; @@ -48,7 +48,7 @@ void mail_clear(struct map_session_data *sd) return; } -int mail_removeitem(struct map_session_data *sd, short flag) +static int mail_removeitem(struct map_session_data *sd, short flag) { nullpo_ret(sd); @@ -66,7 +66,7 @@ int mail_removeitem(struct map_session_data *sd, short flag) return 1; } -int mail_removezeny(struct map_session_data *sd, short flag) +static int mail_removezeny(struct map_session_data *sd, short flag) { nullpo_ret(sd); @@ -79,7 +79,8 @@ int mail_removezeny(struct map_session_data *sd, short flag) return 1; } -unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) { +static unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) +{ nullpo_retr(1, sd); if( pc_istrading(sd) ) @@ -116,7 +117,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) { } } -bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg) +static bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg) { int n; @@ -156,7 +157,7 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg) return true; } -void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item) +static void mail_getattachment(struct map_session_data *sd, int zeny, struct item *item) { nullpo_retv(sd); nullpo_retv(item); @@ -172,7 +173,7 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item } } -int mail_openmail(struct map_session_data *sd) +static int mail_openmail(struct map_session_data *sd) { nullpo_ret(sd); @@ -184,7 +185,7 @@ int mail_openmail(struct map_session_data *sd) return 1; } -void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg) +static void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg) { nullpo_retv(sd); nullpo_retv(msg); @@ -204,7 +205,8 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg) } // This function only check if the mail operations are valid -bool mail_invalid_operation(struct map_session_data *sd) { +static bool mail_invalid_operation(struct map_session_data *sd) +{ nullpo_retr(false, sd); if( !map->list[sd->bl.m].flag.town && !pc->can_use_command(sd, "@mail") ) { ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name); diff --git a/src/map/map.c b/src/map/map.c index 09f8116fd..40261ebbc 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -87,8 +87,8 @@ #include <unistd.h> #endif -struct map_interface map_s; -struct mapit_interface mapit_s; +static struct map_interface map_s; +static struct mapit_interface mapit_s; struct map_interface *map; struct mapit_interface *mapit; @@ -96,18 +96,21 @@ struct mapit_interface *mapit; /*========================================== * server player count (of all mapservers) *------------------------------------------*/ -void map_setusers(int users) { +static void map_setusers(int users) +{ map->users = users; } -int map_getusers(void) { +static int map_getusers(void) +{ return map->users; } /** * Expands map->bl_list on demand **/ -static inline void map_bl_list_expand(void) { +static inline void map_bl_list_expand(void) +{ map->bl_list_size += 250; RECREATE(map->bl_list, struct block_list *, map->bl_list_size); } @@ -115,7 +118,8 @@ static inline void map_bl_list_expand(void) { /** * Expands map->block_free on demand **/ -static inline void map_block_free_expand(void) { +static inline void map_block_free_expand(void) +{ map->block_free_list_size += 100; RECREATE(map->block_free, struct block_list *, map->block_free_list_size); } @@ -123,14 +127,16 @@ static inline void map_block_free_expand(void) { /*========================================== * server player count (this mapserver only) *------------------------------------------*/ -int map_usercount(void) { +static int map_usercount(void) +{ return db_size(map->pc_db); } /*========================================== * Attempt to free a map blocklist *------------------------------------------*/ -int map_freeblock (struct block_list *bl) { +static int map_freeblock(struct block_list *bl) +{ nullpo_retr(map->block_free_lock, bl); if (map->block_free_lock == 0) { @@ -151,14 +157,16 @@ int map_freeblock (struct block_list *bl) { /*========================================== * Lock blocklist, (prevent map->freeblock usage) *------------------------------------------*/ -int map_freeblock_lock (void) { +static int map_freeblock_lock(void) +{ return ++map->block_free_lock; } /*========================================== * Remove the lock on map_bl *------------------------------------------*/ -int map_freeblock_unlock (void) { +static int map_freeblock_unlock(void) +{ if ((--map->block_free_lock) == 0) { int i; for (i = 0; i < map->block_free_count; i++) { @@ -179,7 +187,8 @@ int map_freeblock_unlock (void) { // Timer function to check if there some remaining lock and remove them if so. // Called each 1s -int map_freeblock_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_freeblock_timer(int tid, int64 tick, int id, intptr_t data) +{ if (map->block_free_lock > 0) { ShowError("map_freeblock_timer: block_free_lock(%d) is invalid.\n", map->block_free_lock); map->block_free_lock = 1; @@ -193,7 +202,8 @@ int map_freeblock_timer(int tid, int64 tick, int id, intptr_t data) { * Updates the counter (cell.cell_bl) of how many objects are on a tile. * @param add Whether the counter should be increased or decreased **/ -void map_update_cell_bl( struct block_list *bl, bool increase ) { +static void map_update_cell_bl(struct block_list *bl, bool increase) +{ #ifdef CELL_NOSTACK int pos; @@ -222,7 +232,7 @@ void map_update_cell_bl( struct block_list *bl, bool increase ) { * Adds a block to the map. * Returns 0 on success, 1 on failure (illegal coordinates). *------------------------------------------*/ -int map_addblock(struct block_list* bl) +static int map_addblock(struct block_list *bl) { int16 m, x, y; int pos; @@ -270,7 +280,7 @@ int map_addblock(struct block_list* bl) /*========================================== * Removes a block from the map. *------------------------------------------*/ -int map_delblock(struct block_list* bl) +static int map_delblock(struct block_list *bl) { int pos; nullpo_ret(bl); @@ -313,7 +323,8 @@ int map_delblock(struct block_list* bl) * Pass flag as 1 to prevent doing skill->unit_move checks * (which are executed by default on BL_CHAR types) *------------------------------------------*/ -int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { +static int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) +{ struct status_change *sc = NULL; int x0, y0; int moveblock; @@ -431,7 +442,8 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) { * 0x2 - don't count invinsible units * TODO: merge with bl_getall_area *------------------------------------------*/ -int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) { +static int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) +{ int bx,by; struct block_list *bl; int count = 0; @@ -489,7 +501,8 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) { * Looks for a skill unit on a given cell * flag&1: runs battle_check_target check based on unit->group->target_flag */ -struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag) { +static struct skill_unit *map_find_skill_unit_oncell(struct block_list *target, int16 x, int16 y, uint16 skill_id, struct skill_unit *out_unit, int flag) +{ int16 m,bx,by; struct block_list *bl; struct skill_unit *su; @@ -530,7 +543,8 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x, * @param args Extra arguments for func * @return Sum of the values returned by func */ -static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount, int max, va_list args) { +static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount, int max, va_list args) +{ int i; int returnCount = 0; @@ -559,7 +573,8 @@ static int bl_vforeach(int (*func)(struct block_list*, va_list), int blockcount, * @param args Extra arguments for func * @return Sum of the values returned by func */ -static int map_vforeachinmap(int (*func)(struct block_list*, va_list), int16 m, int type, va_list args) { +static int map_vforeachinmap(int (*func)(struct block_list*, va_list), int16 m, int type, va_list args) +{ int i; int returnCount = 0; int bsize; @@ -607,7 +622,8 @@ static int map_vforeachinmap(int (*func)(struct block_list*, va_list), int16 m, * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinmap(int (*func)(struct block_list*, va_list), int16 m, int type, ...) { +static int map_foreachinmap(int (*func)(struct block_list*, va_list), int16 m, int type, ...) +{ int returnCount; va_list ap; @@ -629,7 +645,8 @@ int map_foreachinmap(int (*func)(struct block_list*, va_list), int16 m, int type * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachininstance(int (*func)(struct block_list*, va_list), int16 instance_id, int type, va_list ap) { +static int map_vforeachininstance(int (*func)(struct block_list*, va_list), int16 instance_id, int type, va_list ap) +{ int i; int returnCount = 0; @@ -655,7 +672,8 @@ int map_vforeachininstance(int (*func)(struct block_list*, va_list), int16 insta * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachininstance(int (*func)(struct block_list*, va_list), int16 instance_id, int type, ...) { +static int map_foreachininstance(int (*func)(struct block_list*, va_list), int16 instance_id, int type, ...) +{ int returnCount; va_list ap; @@ -675,7 +693,8 @@ int map_foreachininstance(int (*func)(struct block_list*, va_list), int16 instan * @param ... Extra arguments for func * @return Number of found objects */ -static int bl_getall_area(int type, int m, int x0, int y0, int x1, int y1, int (*func)(struct block_list*, va_list), ...) { +static int bl_getall_area(int type, int m, int x0, int y0, int x1, int y1, int (*func)(struct block_list*, va_list), ...) +{ va_list args; int bx, by; struct block_list *bl; @@ -813,7 +832,8 @@ static int bl_vgetall_inrange(struct block_list *bl, va_list args) * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachinrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int type, va_list ap) { +static int map_vforeachinrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -841,7 +861,8 @@ int map_vforeachinrange(int (*func)(struct block_list*, va_list), struct block_l * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int type, ...) { +static int map_foreachinrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int type, ...) +{ int returnCount; va_list ap; @@ -865,7 +886,8 @@ int map_foreachinrange(int (*func)(struct block_list*, va_list), struct block_li * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforcountinrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int count, int type, va_list ap) { +static int map_vforcountinrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int count, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -895,7 +917,8 @@ int map_vforcountinrange(int (*func)(struct block_list*, va_list), struct block_ * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_forcountinrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int count, int type, ...) { +static int map_forcountinrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int count, int type, ...) +{ int returnCount; va_list ap; @@ -941,7 +964,8 @@ static int bl_vgetall_inshootrange(struct block_list *bl, va_list args) * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachinshootrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int type, va_list ap) { +static int map_vforeachinshootrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -969,7 +993,8 @@ int map_vforeachinshootrange(int (*func)(struct block_list*, va_list), struct bl * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinshootrange(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int type, ...) { +static int map_foreachinshootrange(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int type, ...) +{ int returnCount; va_list ap; @@ -994,7 +1019,8 @@ int map_foreachinshootrange(int (*func)(struct block_list*, va_list), struct blo * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, va_list ap) { +static int map_vforeachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -1023,7 +1049,8 @@ int map_vforeachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...) { +static int map_foreachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...) +{ int returnCount; va_list ap; @@ -1050,7 +1077,8 @@ int map_foreachinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, va_list ap) { +static int map_vforcountinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -1081,7 +1109,8 @@ int map_vforcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...) { +static int map_forcountinarea(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...) +{ int returnCount; va_list ap; @@ -1138,7 +1167,8 @@ static int bl_vgetall_inmovearea(struct block_list *bl, va_list args) * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachinmovearea(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, va_list ap) { +static int map_vforeachinmovearea(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int16 dx, int16 dy, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; int m, x0, x1, y0, y1; @@ -1196,7 +1226,8 @@ int map_vforeachinmovearea(int (*func)(struct block_list*, va_list), struct bloc * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinmovearea(int (*func)(struct block_list*, va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...) { +static int map_foreachinmovearea(int (*func)(struct block_list*, va_list), struct block_list *center, int16 range, int16 dx, int16 dy, int type, ...) +{ int returnCount; va_list ap; @@ -1219,7 +1250,8 @@ int map_foreachinmovearea(int (*func)(struct block_list*, va_list), struct block * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachincell(int (*func)(struct block_list*, va_list), int16 m, int16 x, int16 y, int type, va_list ap) { +static int map_vforeachincell(int (*func)(struct block_list*, va_list), int16 m, int16 x, int16 y, int type, va_list ap) +{ int returnCount = 0; int blockcount = map->bl_list_count; va_list apcopy; @@ -1245,7 +1277,8 @@ int map_vforeachincell(int (*func)(struct block_list*, va_list), int16 m, int16 * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachincell(int (*func)(struct block_list*, va_list), int16 m, int16 x, int16 y, int type, ...) { +static int map_foreachincell(int (*func)(struct block_list*, va_list), int16 m, int16 x, int16 y, int type, ...) +{ int returnCount; va_list ap; @@ -1324,7 +1357,8 @@ static int bl_vgetall_inpath(struct block_list *bl, va_list args) * @param ap Extra arguments for func * @return Sum of the values returned by func */ -int map_vforeachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, va_list ap) { +static int map_vforeachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, va_list ap) +{ // [Skotlex] // check for all targets in the square that // contains the initial and final positions (area range increased to match the @@ -1401,7 +1435,8 @@ int map_vforeachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 * @param ... Extra arguments for func * @return Sum of the values returned by func */ -int map_foreachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...) { +static int map_foreachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...) +{ int returnCount; va_list ap; @@ -1417,7 +1452,7 @@ int map_foreachinpath(int (*func)(struct block_list*, va_list), int16 m, int16 x /// Generates a new flooritem object id from the interval [MIN_FLOORITEM, MAX_FLOORITEM). /// Used for floor items, skill units and chatroom objects. /// @return The new object id -int map_get_new_object_id(void) +static int map_get_new_object_id(void) { static int last_object_id = MIN_FLOORITEM - 1; int i; @@ -1449,7 +1484,7 @@ int map_get_new_object_id(void) * Timered function to clear the floor (remove remaining item) * Called each flooritem_lifetime ms *------------------------------------------*/ -int map_clearflooritem_timer(int tid, int64 tick, int id, intptr_t data) +static int map_clearflooritem_timer(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = idb_get(map->id_db, id); struct flooritem_data *fitem = BL_CAST(BL_ITEM, bl); @@ -1472,7 +1507,7 @@ int map_clearflooritem_timer(int tid, int64 tick, int id, intptr_t data) /* * clears a single bl item out of the bazooonga. */ -void map_clearflooritem(struct block_list *bl) +static void map_clearflooritem(struct block_list *bl) { struct flooritem_data *fitem = BL_CAST(BL_ITEM, bl); @@ -1492,7 +1527,8 @@ void map_clearflooritem(struct block_list *bl) * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success. * x and y are modified with the target cell when successful. *------------------------------------------*/ -int map_searchrandfreecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int stack) { +static int map_searchrandfreecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int stack) +{ int free_cell,i,j; int free_cells[9][2]; @@ -1522,7 +1558,8 @@ int map_searchrandfreecell(int16 m, const struct block_list *bl, int16 *x, int16 return 1; } -int map_count_sub(struct block_list *bl,va_list ap) { +static int map_count_sub(struct block_list *bl, va_list ap) +{ return 1; } @@ -1538,7 +1575,7 @@ int map_count_sub(struct block_list *bl,va_list ap) { * &2 = the target should be able to walk to the target tile. * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting) *------------------------------------------*/ -int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int16 rx, int16 ry, int flag) +static int map_search_freecell(struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag) { int tries, spawn=0; int bx, by; @@ -1612,7 +1649,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1 * flag: * 0x1 - only count standing units *------------------------------------------*/ -bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int type, int flag) +static bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int type, int flag) { uint8 dir = 6; int16 tx; @@ -1698,7 +1735,7 @@ bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 * @flag: &1 MVP item. &2 do stacking check. * @showdropeffect: show effect when the item is dropped. *------------------------------------------*/ -int map_addflooritem(const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, bool showdropeffect) +static int map_addflooritem(const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags, bool showdropeffect) { int r; struct flooritem_data *fitem=NULL; @@ -1746,7 +1783,7 @@ int map_addflooritem(const struct block_list *bl, struct item *item_data, int am /** * @see DBCreateData */ -struct DBData create_charid2nick(union DBKey key, va_list args) +static struct DBData create_charid2nick(union DBKey key, va_list args) { struct charid2nick *p; CREATE(p, struct charid2nick, 1); @@ -1755,7 +1792,7 @@ struct DBData create_charid2nick(union DBKey key, va_list args) /// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests. /// Does nothing if the character is online. -void map_addnickdb(int charid, const char* nick) +static void map_addnickdb(int charid, const char *nick) { struct charid2nick* p; struct charid_request* req; @@ -1779,7 +1816,7 @@ void map_addnickdb(int charid, const char* nick) /// Removes the nick of charid from nick_db. /// Sends name to all pending requests on charid. -void map_delnickdb(int charid, const char* name) +static void map_delnickdb(int charid, const char *name) { struct charid2nick* p; struct charid_request* req; @@ -1803,7 +1840,7 @@ void map_delnickdb(int charid, const char* name) /// Notifies sd of the nick of charid. /// Uses the name in the character if online. /// Uses the name in nick_db if offline. -void map_reqnickdb(struct map_session_data * sd, int charid) +static void map_reqnickdb(struct map_session_data *sd, int charid) { struct charid2nick* p; struct charid_request* req; @@ -1832,7 +1869,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid) /*========================================== * add bl to id_db *------------------------------------------*/ -void map_addiddb(struct block_list *bl) +static void map_addiddb(struct block_list *bl) { nullpo_retv(bl); @@ -1857,7 +1894,7 @@ void map_addiddb(struct block_list *bl) /*========================================== * remove bl from id_db *------------------------------------------*/ -void map_deliddb(struct block_list *bl) +static void map_deliddb(struct block_list *bl) { nullpo_retv(bl); @@ -1879,7 +1916,8 @@ void map_deliddb(struct block_list *bl) /*========================================== * Standard call when a player connection is closed. *------------------------------------------*/ -int map_quit(struct map_session_data *sd) { +static int map_quit(struct map_session_data *sd) +{ int i; nullpo_ret(sd); @@ -2009,7 +2047,7 @@ int map_quit(struct map_session_data *sd) { * @return The searched map_session_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a player unit. */ -struct map_session_data *map_id2sd(int id) +static struct map_session_data *map_id2sd(int id) { struct block_list *bl = NULL; if (id <= 0) @@ -2029,7 +2067,7 @@ struct map_session_data *map_id2sd(int id) * @return The searched npc_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a NPC. */ -struct npc_data *map_id2nd(int id) +static struct npc_data *map_id2nd(int id) { // just a id2bl lookup because there's no npc_db struct block_list* bl = map->id2bl(id); @@ -2046,7 +2084,7 @@ struct npc_data *map_id2nd(int id) * @return The searched mob_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a mob unit. */ -struct mob_data *map_id2md(int id) +static struct mob_data *map_id2md(int id) { struct block_list *bl = NULL; if (id <= 0) @@ -2066,7 +2104,7 @@ struct mob_data *map_id2md(int id) * @return The searched flooritem_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a floor item. */ -struct flooritem_data *map_id2fi(int id) +static struct flooritem_data *map_id2fi(int id) { struct block_list* bl = map->id2bl(id); @@ -2080,7 +2118,7 @@ struct flooritem_data *map_id2fi(int id) * @return The searched chat_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a chat. */ -struct chat_data *map_id2cd(int id) +static struct chat_data *map_id2cd(int id) { struct block_list* bl = map->id2bl(id); @@ -2094,7 +2132,7 @@ struct chat_data *map_id2cd(int id) * @return The searched skill_unit data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a skill unit. */ -struct skill_unit *map_id2su(int id) +static struct skill_unit *map_id2su(int id) { struct block_list* bl = map->id2bl(id); @@ -2108,7 +2146,7 @@ struct skill_unit *map_id2su(int id) * @return The searched pet_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a pet. */ -struct pet_data *map_id2pd(int id) +static struct pet_data *map_id2pd(int id) { struct block_list* bl = map->id2bl(id); @@ -2122,7 +2160,7 @@ struct pet_data *map_id2pd(int id) * @return The searched homun_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a homunculus. */ -struct homun_data *map_id2hd(int id) +static struct homun_data *map_id2hd(int id) { struct block_list* bl = map->id2bl(id); @@ -2136,7 +2174,7 @@ struct homun_data *map_id2hd(int id) * @return The searched mercenary_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to a mercenary. */ -struct mercenary_data *map_id2mc(int id) +static struct mercenary_data *map_id2mc(int id) { struct block_list* bl = map->id2bl(id); @@ -2150,7 +2188,7 @@ struct mercenary_data *map_id2mc(int id) * @return The searched elemental_data, if it exists. * @retval NULL if the ID is invalid or doesn't belong to an elemental. */ -struct elemental_data *map_id2ed(int id) +static struct elemental_data *map_id2ed(int id) { struct block_list* bl = map->id2bl(id); @@ -2166,7 +2204,7 @@ struct elemental_data *map_id2ed(int id) * @return The searched block_list, if it exists. * @retval NULL if the ID is invalid. */ -struct block_list *map_id2bl(int id) +static struct block_list *map_id2bl(int id) { return idb_get(map->id_db, id); } @@ -2178,13 +2216,14 @@ struct block_list *map_id2bl(int id) * @retval true if the ID exists and is valid. * @retval false otherwise. */ -bool map_blid_exists(int id) +static bool map_blid_exists(int id) { return (idb_exists(map->id_db,id)); } /// Returns the nick of the target charid or NULL if unknown (requests the nick to the char server). -const char *map_charid2nick(int charid) { +static const char *map_charid2nick(int charid) +{ struct charid2nick *p; struct map_session_data* sd; @@ -2201,7 +2240,7 @@ const char *map_charid2nick(int charid) { } /// Returns the struct map_session_data of the charid or NULL if the char is not online. -struct map_session_data* map_charid2sd(int charid) +static struct map_session_data *map_charid2sd(int charid) { struct block_list *bl = idb_get(map->charid_db, charid); if (bl) @@ -2214,7 +2253,7 @@ struct map_session_data* map_charid2sd(int charid) * (without sensitive case if necessary) * return map_session_data pointer or NULL *------------------------------------------*/ -struct map_session_data * map_nick2sd(const char *nick) +static struct map_session_data *map_nick2sd(const char *nick) { struct map_session_data* sd; struct map_session_data* found_sd; @@ -2262,7 +2301,7 @@ struct map_session_data * map_nick2sd(const char *nick) /*========================================== * Convext Mirror *------------------------------------------*/ -struct mob_data *map_getmob_boss(int16 m) +static struct mob_data *map_getmob_boss(int16 m) { struct DBIterator *iter; struct mob_data *md = NULL; @@ -2280,7 +2319,7 @@ struct mob_data *map_getmob_boss(int16 m) return (found)? md : NULL; } -struct mob_data *map_id2boss(int id) +static struct mob_data *map_id2boss(int id) { struct block_list *bl = NULL; if (id <= 0) @@ -2298,7 +2337,7 @@ struct mob_data *map_id2boss(int id) * * @return The equivalent race bitmask. */ -uint32 map_race_id2mask(int race) +static uint32 map_race_id2mask(int race) { if (race >= RC_FORMLESS && race < RC_MAX) return 1 << race; @@ -2326,7 +2365,7 @@ uint32 map_race_id2mask(int race) /// Applies func to all the players in the db. /// Stops iterating if func returns -1. -void map_vforeachpc(int (*func)(struct map_session_data* sd, va_list args), va_list args) +static void map_vforeachpc(int (*func)(struct map_session_data *sd, va_list args), va_list args) { struct DBIterator *iter = db_iterator(map->pc_db); struct map_session_data *sd = NULL; @@ -2348,7 +2387,8 @@ void map_vforeachpc(int (*func)(struct map_session_data* sd, va_list args), va_l /// Applies func to all the players in the db. /// Stops iterating if func returns -1. /// @see map_vforeachpc -void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...) { +static void map_foreachpc(int (*func)(struct map_session_data *sd, va_list args), ...) +{ va_list args; va_start(args, func); @@ -2358,7 +2398,7 @@ void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...) /// Applies func to all the mobs in the db. /// Stops iterating if func returns -1. -void map_vforeachmob(int (*func)(struct mob_data* md, va_list args), va_list args) +static void map_vforeachmob(int (*func)(struct mob_data *md, va_list args), va_list args) { struct DBIterator *iter = db_iterator(map->mobid_db); struct mob_data *md = NULL; @@ -2379,7 +2419,8 @@ void map_vforeachmob(int (*func)(struct mob_data* md, va_list args), va_list arg /// Applies func to all the mobs in the db. /// Stops iterating if func returns -1. /// @see map_vforeachmob -void map_foreachmob(int (*func)(struct mob_data* md, va_list args), ...) { +static void map_foreachmob(int (*func)(struct mob_data *md, va_list args), ...) +{ va_list args; va_start(args, func); @@ -2389,7 +2430,7 @@ void map_foreachmob(int (*func)(struct mob_data* md, va_list args), ...) { /// Applies func to all the npcs in the db. /// Stops iterating if func returns -1. -void map_vforeachnpc(int (*func)(struct npc_data* nd, va_list args), va_list args) +static void map_vforeachnpc(int (*func)(struct npc_data *nd, va_list args), va_list args) { struct DBIterator *iter = db_iterator(map->id_db); struct block_list *bl = NULL; @@ -2413,7 +2454,8 @@ void map_vforeachnpc(int (*func)(struct npc_data* nd, va_list args), va_list arg /// Applies func to all the npcs in the db. /// Stops iterating if func returns -1. /// @see map_vforeachnpc -void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...) { +static void map_foreachnpc(int (*func)(struct npc_data *nd, va_list args), ...) +{ va_list args; va_start(args, func); @@ -2423,7 +2465,7 @@ void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...) { /// Applies func to everything in the db. /// Stops iterating gif func returns -1. -void map_vforeachregen(int (*func)(struct block_list* bl, va_list args), va_list args) +static void map_vforeachregen(int (*func)(struct block_list *bl, va_list args), va_list args) { struct DBIterator *iter = db_iterator(map->regen_db); struct block_list *bl = NULL; @@ -2444,7 +2486,8 @@ void map_vforeachregen(int (*func)(struct block_list* bl, va_list args), va_list /// Applies func to everything in the db. /// Stops iterating gif func returns -1. /// @see map_vforeachregen -void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...) { +static void map_foreachregen(int (*func)(struct block_list *bl, va_list args), ...) +{ va_list args; va_start(args, func); @@ -2454,7 +2497,7 @@ void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...) { /// Applies func to everything in the db. /// Stops iterating if func returns -1. -void map_vforeachiddb(int (*func)(struct block_list* bl, va_list args), va_list args) +static void map_vforeachiddb(int (*func)(struct block_list *bl, va_list args), va_list args) { struct DBIterator *iter = db_iterator(map->id_db); struct block_list *bl = NULL; @@ -2475,7 +2518,8 @@ void map_vforeachiddb(int (*func)(struct block_list* bl, va_list args), va_list /// Applies func to everything in the db. /// Stops iterating if func returns -1. /// @see map_vforeachiddb -void map_foreachiddb(int (*func)(struct block_list* bl, va_list args), ...) { +static void map_foreachiddb(int (*func)(struct block_list *bl, va_list args), ...) +{ va_list args; va_start(args, func); @@ -2507,7 +2551,8 @@ struct s_mapiterator { /// @param flags Flags of the iterator /// @param type Target types /// @return Iterator -struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types) { +static struct s_mapiterator *mapit_alloc(enum e_mapitflags flags, enum bl_type types) +{ struct s_mapiterator* iter; iter = ers_alloc(map->iterator_ers, struct s_mapiterator); @@ -2522,7 +2567,8 @@ struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types) { /// Frees the iterator. /// /// @param iter Iterator -void mapit_free(struct s_mapiterator* iter) { +static void mapit_free(struct s_mapiterator *iter) +{ nullpo_retv(iter); dbi_destroy(iter->dbi); @@ -2534,7 +2580,8 @@ void mapit_free(struct s_mapiterator* iter) { /// /// @param iter Iterator /// @return first block_list or NULL -struct block_list* mapit_first(struct s_mapiterator* iter) { +static struct block_list *mapit_first(struct s_mapiterator *iter) +{ struct block_list* bl; nullpo_retr(NULL,iter); @@ -2551,7 +2598,8 @@ struct block_list* mapit_first(struct s_mapiterator* iter) { /// /// @param iter Iterator /// @return last block_list or NULL -struct block_list* mapit_last(struct s_mapiterator* iter) { +static struct block_list *mapit_last(struct s_mapiterator *iter) +{ struct block_list* bl; nullpo_retr(NULL,iter); @@ -2568,7 +2616,8 @@ struct block_list* mapit_last(struct s_mapiterator* iter) { /// /// @param iter Iterator /// @return next block_list or NULL -struct block_list* mapit_next(struct s_mapiterator* iter) { +static struct block_list *mapit_next(struct s_mapiterator *iter) +{ struct block_list* bl; nullpo_retr(NULL,iter); @@ -2589,7 +2638,8 @@ struct block_list* mapit_next(struct s_mapiterator* iter) { /// /// @param iter Iterator /// @return previous block_list or NULL -struct block_list* mapit_prev(struct s_mapiterator* iter) { +static struct block_list *mapit_prev(struct s_mapiterator *iter) +{ struct block_list* bl; nullpo_retr(NULL,iter); @@ -2609,7 +2659,8 @@ struct block_list* mapit_prev(struct s_mapiterator* iter) { /// /// @param iter Iterator /// @return true if it exists -bool mapit_exists(struct s_mapiterator* iter) { +static bool mapit_exists(struct s_mapiterator *iter) +{ nullpo_retr(false,iter); return dbi_exists(iter->dbi); @@ -2618,7 +2669,8 @@ bool mapit_exists(struct s_mapiterator* iter) { /*========================================== * Add npc-bl to id_db, basically register npc to map *------------------------------------------*/ -bool map_addnpc(int16 m,struct npc_data *nd) { +static bool map_addnpc(int16 m, struct npc_data *nd) +{ nullpo_ret(nd); if( m < 0 || m >= map->count ) @@ -2640,7 +2692,8 @@ bool map_addnpc(int16 m,struct npc_data *nd) { *-----------------------------------------*/ // Stores the spawn data entry in the mob list. // Returns the index of successful, or -1 if the list was full. -int map_addmobtolist(unsigned short m, struct spawn_data *spawn) { +static int map_addmobtolist(unsigned short m, struct spawn_data *spawn) +{ int i; nullpo_retr(-1, spawn); ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, map->list[m].moblist[i] == NULL ); @@ -2651,7 +2704,8 @@ int map_addmobtolist(unsigned short m, struct spawn_data *spawn) { return -1; } -void map_spawnmobs(int16 m) { +static void map_spawnmobs(int16 m) +{ int i, k=0; if (map->list[m].mob_delete_timer != INVALID_TIMER) { //Mobs have not been removed yet [Skotlex] @@ -2670,7 +2724,7 @@ void map_spawnmobs(int16 m) { } } -int map_removemobs_sub(struct block_list *bl, va_list ap) +static int map_removemobs_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; nullpo_ret(bl); @@ -2699,7 +2753,8 @@ int map_removemobs_sub(struct block_list *bl, va_list ap) return 1; } -int map_removemobs_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_removemobs_timer(int tid, int64 tick, int id, intptr_t data) +{ int count; const int16 m = id; @@ -2723,7 +2778,8 @@ int map_removemobs_timer(int tid, int64 tick, int id, intptr_t data) { return 1; } -void map_removemobs(int16 m) { +static void map_removemobs(int16 m) +{ Assert_retv(m >= 0 && m < map->count); if (map->list[m].mob_delete_timer != INVALID_TIMER) // should never happen return; //Mobs are already scheduled for removal @@ -2734,7 +2790,8 @@ void map_removemobs(int16 m) { /*========================================== * Hookup, get map_id from map_name *------------------------------------------*/ -int16 map_mapname2mapid(const char* name) { +static int16 map_mapname2mapid(const char *name) +{ unsigned short map_index; map_index = mapindex->name2id(name); if (!map_index) @@ -2745,7 +2802,8 @@ int16 map_mapname2mapid(const char* name) { /*========================================== * Returns the map of the given mapindex. [Skotlex] *------------------------------------------*/ -int16 map_mapindex2mapid(unsigned short map_index) { +static int16 map_mapindex2mapid(unsigned short map_index) +{ if (!map_index || map_index >= MAX_MAPINDEX) return -1; @@ -2756,7 +2814,8 @@ int16 map_mapindex2mapid(unsigned short map_index) { /*========================================== * Switching Ip, port ? (like changing map_server) get ip/port from map_name *------------------------------------------*/ -int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) { +static int map_mapname2ipport(unsigned short name, uint32 *ip, uint16 *port) +{ struct map_data_other_server *mdos; nullpo_retr(-1, ip); @@ -2770,9 +2829,9 @@ int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) { } /*========================================== -* Checks if both dirs point in the same direction. -*------------------------------------------*/ -int map_check_dir(int s_dir,int t_dir) + * Checks if both dirs point in the same direction. + *------------------------------------------*/ +static int map_check_dir(int s_dir, int t_dir) { if(s_dir == t_dir) return 0; @@ -2792,7 +2851,7 @@ int map_check_dir(int s_dir,int t_dir) /*========================================== * Returns the direction of the given cell, relative to 'src' *------------------------------------------*/ -uint8 map_calc_dir(struct block_list* src, int16 x, int16 y) +static uint8 map_calc_dir(struct block_list *src, int16 x, int16 y) { uint8 dir = 0; int dx, dy; @@ -2834,7 +2893,7 @@ uint8 map_calc_dir(struct block_list* src, int16 x, int16 y) * Randomizes target cell x,y to a random walkable cell that * has the same distance from object as given coordinates do. [Skotlex] *------------------------------------------*/ -int map_random_dir(struct block_list *bl, int16 *x, int16 *y) +static int map_random_dir(struct block_list *bl, int16 *x, int16 *y) { short xi; short yi; @@ -2870,7 +2929,8 @@ int map_random_dir(struct block_list *bl, int16 *x, int16 *y) } // gat system -struct mapcell map_gat2cell(int gat) { +static struct mapcell map_gat2cell(int gat) +{ struct mapcell cell; memset(&cell,0,sizeof(struct mapcell)); @@ -2891,7 +2951,8 @@ struct mapcell map_gat2cell(int gat) { return cell; } -int map_cell2gat(struct mapcell cell) { +static int map_cell2gat(struct mapcell cell) +{ if( cell.walkable == 1 && cell.shootable == 1 && cell.water == 0 ) return 0; if( cell.walkable == 0 && cell.shootable == 0 && cell.water == 0 ) return 1; if( cell.walkable == 1 && cell.shootable == 1 && cell.water == 1 ) return 3; @@ -2906,7 +2967,7 @@ int map_cell2gat(struct mapcell cell) { * * @param[in, out] m The target map. */ -void map_cellfromcache(struct map_data *m) +static void map_cellfromcache(struct map_data *m) { nullpo_retv(m); @@ -2939,11 +3000,13 @@ void map_cellfromcache(struct map_data *m) /*========================================== * Confirm if celltype in (m,x,y) match the one given in cellchk *------------------------------------------*/ -int map_getcell(int16 m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) { +static int map_getcell(int16 m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) +{ return (m < 0 || m >= map->count) ? 0 : map->list[m].getcellp(&map->list[m], bl, x, y, cellchk); } -int map_getcellp(struct map_data* m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) { +static int map_getcellp(struct map_data *m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) +{ struct mapcell cell; nullpo_ret(m); @@ -3011,7 +3074,8 @@ int map_getcellp(struct map_data* m, const struct block_list *bl, int16 x, int16 } /* [Ind/Hercules] */ -int map_sub_getcellp(struct map_data* m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) { +static int map_sub_getcellp(struct map_data *m, const struct block_list *bl, int16 x, int16 y, cell_chk cellchk) +{ nullpo_ret(m); map->cellfromcache(m); m->getcellp = map->getcellp; @@ -3024,7 +3088,8 @@ int map_sub_getcellp(struct map_data* m, const struct block_list *bl, int16 x, i * 'cell' - which flag to modify * 'flag' - true = on, false = off *------------------------------------------*/ -void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) { +static void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) +{ int j; if( m < 0 || m >= map->count || x < 0 || x >= map->list[m].xs || y < 0 || y >= map->list[m].ys ) @@ -3050,7 +3115,8 @@ void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) { break; } } -void map_sub_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) { +static void map_sub_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) +{ if( m < 0 || m >= map->count || x < 0 || x >= map->list[m].xs || y < 0 || y >= map->list[m].ys ) return; @@ -3059,7 +3125,8 @@ void map_sub_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) { map->list[m].getcellp = map->getcellp; map->list[m].setcell(m,x,y,cell,flag); } -void map_setgatcell(int16 m, int16 x, int16 y, int gat) { +static void map_setgatcell(int16 m, int16 x, int16 y, int gat) +{ int j; struct mapcell cell; @@ -3075,9 +3142,9 @@ void map_setgatcell(int16 m, int16 x, int16 y, int gat) { } /*========================================== -* Invisible Walls -*------------------------------------------*/ -void map_iwall_nextxy(int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1) + * Invisible Walls + *------------------------------------------*/ +static void map_iwall_nextxy(int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1) { nullpo_retv(x1); nullpo_retv(y1); @@ -3097,7 +3164,7 @@ void map_iwall_nextxy(int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1) *y1 = y + pos; } -bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name) +static bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char *wall_name) { struct iwall_data *iwall; int i; @@ -3141,7 +3208,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable return true; } -void map_iwall_get(struct map_session_data *sd) +static void map_iwall_get(struct map_session_data *sd) { struct iwall_data *iwall; struct DBIterator *iter; @@ -3166,7 +3233,7 @@ void map_iwall_get(struct map_session_data *sd) dbi_destroy(iter); } -bool map_iwall_remove(const char *wall_name) +static bool map_iwall_remove(const char *wall_name) { struct iwall_data *iwall; int16 i, x1, y1; @@ -3191,7 +3258,7 @@ bool map_iwall_remove(const char *wall_name) /** * @see DBCreateData */ -struct DBData create_map_data_other_server(union DBKey key, va_list args) +static struct DBData create_map_data_other_server(union DBKey key, va_list args) { struct map_data_other_server *mdos; unsigned short map_index = (unsigned short)key.ui; @@ -3204,7 +3271,7 @@ struct DBData create_map_data_other_server(union DBKey key, va_list args) /*========================================== * Add mapindex to db of another map server *------------------------------------------*/ -int map_setipport(unsigned short map_index, uint32 ip, uint16 port) +static int map_setipport(unsigned short map_index, uint32 ip, uint16 port) { struct map_data_other_server *mdos; @@ -3226,7 +3293,7 @@ int map_setipport(unsigned short map_index, uint32 ip, uint16 port) * Delete all the other maps server management * @see DBApply */ -int map_eraseallipport_sub(union DBKey key, struct DBData *data, va_list va) +static int map_eraseallipport_sub(union DBKey key, struct DBData *data, va_list va) { struct map_data_other_server *mdos = DB->data2ptr(data); nullpo_ret(mdos); @@ -3237,7 +3304,8 @@ int map_eraseallipport_sub(union DBKey key, struct DBData *data, va_list va) return 0; } -int map_eraseallipport(void) { +static int map_eraseallipport(void) +{ map->map_db->foreach(map->map_db,map->eraseallipport_sub); return 1; } @@ -3245,7 +3313,8 @@ int map_eraseallipport(void) { /*========================================== * Delete mapindex from db of another map server *------------------------------------------*/ -int map_eraseipport(unsigned short map_index, uint32 ip, uint16 port) { +static int map_eraseipport(unsigned short map_index, uint32 ip, uint16 port) +{ struct map_data_other_server *mdos; mdos = (struct map_data_other_server*)uidb_get(map->map_db,(unsigned int)map_index); @@ -3267,7 +3336,7 @@ int map_eraseipport(unsigned short map_index, uint32 ip, uint16 port) { * @return The loading success state. * @retval false in case of errors. */ -bool map_readfromcache(struct map_data *m) +static bool map_readfromcache(struct map_data *m) { unsigned int file_size; char file_path[256]; @@ -3319,7 +3388,7 @@ bool map_readfromcache(struct map_data *m) * @return The loading success state. * @retval false in case of errors. */ -bool map_readfromcache_v1(FILE *fp, struct map_data *m, unsigned int file_size) +static bool map_readfromcache_v1(FILE *fp, struct map_data *m, unsigned int file_size) { struct map_cache_header mheader = { 0 }; uint8 md5buf[16] = { 0 }; @@ -3389,7 +3458,7 @@ bool map_readfromcache_v1(FILE *fp, struct map_data *m, unsigned int file_size) * @param mapname The new map's name. * @return success state. */ -int map_addmap(const char *mapname) +static int map_addmap(const char *mapname) { map->list[map->count].instance_id = -1; mapindex->getmapname(mapname, map->list[map->count++].name); @@ -3401,7 +3470,7 @@ int map_addmap(const char *mapname) * * @param id The map ID. */ -void map_delmapid(int id) +static void map_delmapid(int id) { Assert_retv(id >= 0 && id < map->count); ShowNotice("Removing map [ %s ] from maplist"CL_CLL"\n",map->list[id].name); @@ -3415,7 +3484,7 @@ void map_delmapid(int id) * @param mapname The name of the map to remove. * @return the number of removed maps. */ -int map_delmap(const char *mapname) +static int map_delmap(const char *mapname) { int i; char map_name[MAP_NAME_LENGTH]; @@ -3439,7 +3508,8 @@ int map_delmap(const char *mapname) /** * **/ -void map_zone_clear_single(struct map_zone_data *zone) { +static void map_zone_clear_single(struct map_zone_data *zone) +{ int i; nullpo_retv(zone); @@ -3481,7 +3551,7 @@ void map_zone_clear_single(struct map_zone_data *zone) { /** * **/ -void map_zone_db_clear(void) +static void map_zone_db_clear(void) { struct DBIterator *iter = db_iterator(map->zone_db); struct map_zone_data *zone = NULL; @@ -3499,7 +3569,8 @@ void map_zone_db_clear(void) /* clear the main zone stuff */ map->zone_clear_single(&map->zone_all); } -void map_clean(int i) { +static void map_clean(int i) +{ int v; Assert_retv(i >= 0 && i < map->count); if(map->list[i].cell && map->list[i].cell != (struct mapcell *)0xdeadbeaf) aFree(map->list[i].cell); @@ -3550,7 +3621,8 @@ void map_clean(int i) { if( map->list[i].channel ) channel->delete(map->list[i].channel); } -void do_final_maps(void) { +static void do_final_maps(void) +{ int i, v = 0; for( i = 0; i < map->count; i++ ) { @@ -3619,7 +3691,8 @@ void do_final_maps(void) { } /// Initializes map flags and adjusts them depending on configuration. -void map_flags_init(void) { +static void map_flags_init(void) +{ int i, v = 0; for( i = 0; i < map->count; i++ ) { @@ -3695,7 +3768,7 @@ void map_flags_init(void) { * Assumed path for file is data/mapname.rsw * Credits to LittleWolf */ -int map_waterheight(char* mapname) +static int map_waterheight(char *mapname) { char fn[256]; char *rsw = NULL; @@ -3723,7 +3796,7 @@ int map_waterheight(char* mapname) /*================================== * .GAT format *----------------------------------*/ -int map_readgat (struct map_data* m) +static int map_readgat(struct map_data *m) { char filename[256]; uint8* gat; @@ -3767,12 +3840,14 @@ int map_readgat (struct map_data* m) /*====================================== * Add/Remove map to the map_db *--------------------------------------*/ -void map_addmap2db(struct map_data *m) { +static void map_addmap2db(struct map_data *m) +{ nullpo_retv(m); map->index2mapid[m->index] = m->m; } -void map_removemapdb(struct map_data *m) { +static void map_removemapdb(struct map_data *m) +{ nullpo_retv(m); map->index2mapid[m->index] = -1; } @@ -3780,7 +3855,8 @@ void map_removemapdb(struct map_data *m) { /*====================================== * Initiate maps loading stage *--------------------------------------*/ -int map_readallmaps (void) { +static int map_readallmaps(void) +{ int i; int maps_removed = 0; @@ -3862,7 +3938,7 @@ int map_readallmaps (void) { * * @retval false in case of error. */ -bool map_config_read_console(const char *filename, struct config_t *config, bool imported) +static bool map_config_read_console(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -3896,7 +3972,7 @@ bool map_config_read_console(const char *filename, struct config_t *config, bool * * @retval false in case of error. */ -bool map_config_read_connection(const char *filename, struct config_t *config, bool imported) +static bool map_config_read_connection(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -3929,7 +4005,7 @@ bool map_config_read_connection(const char *filename, struct config_t *config, b * * @retval false in case of error. */ -bool map_config_read_inter(const char *filename, struct config_t *config, bool imported) +static bool map_config_read_inter(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; const char *str = NULL; @@ -3979,7 +4055,7 @@ bool map_config_read_inter(const char *filename, struct config_t *config, bool i * * @retval false in case of error. */ -bool map_config_read_database(const char *filename, struct config_t *config, bool imported) +static bool map_config_read_database(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; @@ -4019,7 +4095,7 @@ bool map_config_read_database(const char *filename, struct config_t *config, boo * * @retval false in case of error. */ -bool map_config_read_map_list(const char *filename, struct config_t *config, bool imported) +static bool map_config_read_map_list(const char *filename, struct config_t *config, bool imported) { struct config_setting_t *setting = NULL; int i, count = 0; @@ -4094,7 +4170,7 @@ bool map_config_read_map_list(const char *filename, struct config_t *config, boo * * @retval false in case of error. */ -bool map_config_read(const char *filename, bool imported) +static bool map_config_read(const char *filename, bool imported) { struct config_t config; struct config_setting_t *setting = NULL; @@ -4154,7 +4230,7 @@ bool map_config_read(const char *filename, bool imported) * * @retval false in case of error. */ -bool map_read_npclist(const char *filename, bool imported) +static bool map_read_npclist(const char *filename, bool imported) { struct config_t config; struct config_setting_t *setting = NULL; @@ -4241,7 +4317,8 @@ bool map_read_npclist(const char *filename, bool imported) * * @param clear whether to clear the script list before reloading. */ -void map_reloadnpc(bool clear) { +static void map_reloadnpc(bool clear) +{ int i; if (clear) npc->clearsrcfile(); @@ -4266,7 +4343,7 @@ void map_reloadnpc(bool clear) { * * @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; @@ -4317,7 +4394,7 @@ bool inter_config_read(const char *filename, bool imported) * * @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; @@ -4349,7 +4426,7 @@ bool inter_config_read_connection(const char *filename, const struct config_t *c * * @retval false in case of error. */ -bool inter_config_read_database_names(const char *filename, const struct config_t *config, bool imported) +static bool inter_config_read_database_names(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; bool retval = true; @@ -4383,7 +4460,7 @@ bool inter_config_read_database_names(const char *filename, const struct config_ /*======================================= * MySQL Init *---------------------------------------*/ -int map_sql_init(void) +static int map_sql_init(void) { // main db connection map->mysql_handle = SQL->Malloc(); @@ -4400,7 +4477,7 @@ int map_sql_init(void) return 0; } -int map_sql_close(void) +static int map_sql_close(void) { ShowStatus("Close Map DB Connection....\n"); SQL->Free(map->mysql_handle); @@ -4418,7 +4495,8 @@ int map_sql_close(void) * * @return the newly created zone from merging main and other **/ -struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone_data *other) { +static struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone_data *other) +{ char newzone[MAP_ZONE_NAME_LENGTH]; struct map_zone_data *zone = NULL; int cursor, i, j; @@ -4515,7 +4593,7 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone return zone; } -void map_zone_change2(int m, struct map_zone_data *zone) +static void map_zone_change2(int m, struct map_zone_data *zone) { const char *empty = ""; @@ -4538,7 +4616,8 @@ void map_zone_change2(int m, struct map_zone_data *zone) map->zone_apply(m,zone,empty,empty,empty); } /* when changing from a mapflag to another during runtime */ -void map_zone_change(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath) { +static void map_zone_change(int m, struct map_zone_data *zone, const char *start, const char *buffer, const char *filepath) +{ Assert_retv(m >= 0 && m < map->count); map->list[m].prev_zone = map->list[m].zone; @@ -4547,7 +4626,7 @@ void map_zone_change(int m, struct map_zone_data *zone, const char* start, const map->zone_apply(m,zone,start,buffer,filepath); } /* removes previous mapflags from this map */ -void map_zone_remove(int m) +static void map_zone_remove(int m) { char flag[MAP_ZONE_MAPFLAG_LENGTH], params[MAP_ZONE_MAPFLAG_LENGTH]; unsigned short k; @@ -4574,7 +4653,8 @@ void map_zone_remove(int m) map->list[m].zone_mf = NULL; map->list[m].zone_mf_count = 0; } -static inline void map_zone_mf_cache_add(int m, char *rflag) { +static inline void map_zone_mf_cache_add(int m, char *rflag) +{ Assert_retv(m >= 0 && m < map->count); RECREATE(map->list[m].zone_mf, char *, ++map->list[m].zone_mf_count); CREATE(map->list[m].zone_mf[map->list[m].zone_mf_count - 1], char, MAP_ZONE_MAPFLAG_LENGTH); @@ -4582,7 +4662,8 @@ static inline void map_zone_mf_cache_add(int m, char *rflag) { } /* TODO: introduce enumerations to each mapflag so instead of reading the string a number of times we read it only once and use its value wherever we need */ /* cache previous values to revert */ -bool map_zone_mf_cache(int m, char *flag, char *params) { +static bool map_zone_mf_cache(int m, char *flag, char *params) +{ char rflag[MAP_ZONE_MAPFLAG_LENGTH]; int state = 1; @@ -5292,7 +5373,7 @@ bool map_zone_mf_cache(int m, char *flag, char *params) { return false; } -void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath) +static void map_zone_apply(int m, struct map_zone_data *zone, const char *start, const char *buffer, const char *filepath) { int i; const char *empty = ""; @@ -5320,7 +5401,7 @@ void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const } } /* used on npc load and reload to apply all "Normal" and "PK Mode" zones */ -void map_zone_init(void) +static void map_zone_init(void) { char flag[MAP_ZONE_MAPFLAG_LENGTH], params[MAP_ZONE_MAPFLAG_LENGTH]; struct map_zone_data *zone; @@ -5374,7 +5455,8 @@ void map_zone_init(void) } } -unsigned short map_zone_str2itemid(const char *name) { +static unsigned short map_zone_str2itemid(const char *name) +{ struct item_data *data; if( !name ) @@ -5390,7 +5472,8 @@ unsigned short map_zone_str2itemid(const char *name) { } return data->nameid; } -unsigned short map_zone_str2skillid(const char *name) { +static unsigned short map_zone_str2skillid(const char *name) +{ unsigned short nameid = 0; if( !name ) @@ -5406,7 +5489,8 @@ unsigned short map_zone_str2skillid(const char *name) { } return nameid; } -enum bl_type map_zone_bl_type(const char *entry, enum map_zone_skill_subtype *subtype) { +static enum bl_type map_zone_bl_type(const char *entry, enum map_zone_skill_subtype *subtype) +{ char temp[200], *parse; enum bl_type bl = BL_NUL; @@ -5452,7 +5536,8 @@ enum bl_type map_zone_bl_type(const char *entry, enum map_zone_skill_subtype *su return bl; } /* [Ind/Hercules] */ -void read_map_zone_db(void) { +static void read_map_zone_db(void) +{ struct config_t map_zone_db; struct config_setting_t *zones = NULL; /* TODO: #ifndef required for re/pre-re */ @@ -5880,11 +5965,13 @@ void read_map_zone_db(void) { libconfig->destroy(&map_zone_db); } -int map_get_new_bonus_id (void) { +static int map_get_new_bonus_id(void) +{ return map->bonus_id++; } -void map_add_questinfo(int m, struct questinfo *qi) { +static void map_add_questinfo(int m, struct questinfo *qi) +{ unsigned short i; nullpo_retv(qi); @@ -5901,7 +5988,8 @@ void map_add_questinfo(int m, struct questinfo *qi) { memcpy(&map->list[m].qi_data[i], qi, sizeof(struct questinfo)); } -bool map_remove_questinfo(int m, struct npc_data *nd) { +static bool map_remove_questinfo(int m, struct npc_data *nd) +{ unsigned short i; Assert_retr(false, m >= 0 && m < map->count); @@ -5921,7 +6009,7 @@ bool map_remove_questinfo(int m, struct npc_data *nd) { /** * @see DBApply */ -int map_db_final(union DBKey key, struct DBData *data, va_list ap) +static int map_db_final(union DBKey key, struct DBData *data, va_list ap) { struct map_data_other_server *mdos = DB->data2ptr(data); @@ -5934,7 +6022,7 @@ int map_db_final(union DBKey key, struct DBData *data, va_list ap) /** * @see DBApply */ -int nick_db_final(union DBKey key, struct DBData *data, va_list args) +static int nick_db_final(union DBKey key, struct DBData *data, va_list args) { struct charid2nick* p = DB->data2ptr(data); struct charid_request* req; @@ -5951,7 +6039,8 @@ int nick_db_final(union DBKey key, struct DBData *data, va_list args) return 0; } -int cleanup_sub(struct block_list *bl, va_list ap) { +static int cleanup_sub(struct block_list *bl, va_list ap) +{ nullpo_ret(bl); switch(bl->type) { @@ -5981,7 +6070,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) { /** * @see DBApply */ -int cleanup_db_sub(union DBKey key, struct DBData *data, va_list va) +static int cleanup_db_sub(union DBKey key, struct DBData *data, va_list va) { return map->cleanup_sub(DB->data2ptr(data), va); } @@ -5989,7 +6078,8 @@ int cleanup_db_sub(union DBKey key, struct DBData *data, va_list va) /*========================================== * map destructor *------------------------------------------*/ -int do_final(void) { +int do_final(void) +{ int i; struct map_session_data* sd; struct s_mapiterator* iter; @@ -6108,7 +6198,8 @@ int do_final(void) { return map->retval; } -int map_abort_sub(struct map_session_data* sd, va_list ap) { +static int map_abort_sub(struct map_session_data *sd, va_list ap) +{ chrif->save(sd,1); return 1; } @@ -6137,12 +6228,13 @@ void do_abort(void) chrif->flush(); } -void set_server_type(void) { +void set_server_type(void) +{ SERVER_TYPE = SERVER_TYPE_MAP; } /// Called when a terminate signal is received. -void do_shutdown(void) +static void do_shutdown(void) { if( core->runflag != MAPSERVER_ST_SHUTDOWN ) { @@ -6160,7 +6252,8 @@ void do_shutdown(void) } } -CPCMD(gm_position) { +static CPCMD(gm_position) +{ int x = 0, y = 0, m = 0; char map_name[25]; @@ -6184,7 +6277,8 @@ CPCMD(gm_position) { map->cpsd->bl.y = y; map->cpsd->bl.m = m; } -CPCMD(gm_use) { +static CPCMD(gm_use) +{ if( line == NULL ) { ShowError("gm:use invalid syntax. use '"CL_WHITE"gm:use @command <optional params>"CL_RESET"'\n"); @@ -6201,7 +6295,8 @@ CPCMD(gm_use) { map->cpsd_active = false; } /* Hercules Console Parser */ -void map_cp_defaults(void) { +static void map_cp_defaults(void) +{ #ifdef CONSOLE_INPUT /* default HCP data */ map->cpsd = pc->get_dummy_sd(); @@ -6215,7 +6310,8 @@ void map_cp_defaults(void) { #endif } -void map_load_defaults(void) { +static void map_load_defaults(void) +{ mapindex_defaults(); map_defaults(); /* */ @@ -6624,11 +6720,12 @@ int do_init(int argc, char *argv[]) } /*===================================== -* Default Functions : map.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void map_defaults(void) { + * Default Functions : map.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void map_defaults(void) +{ map = &map_s; /* */ diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index a69f66354..6e8b8f9b0 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -38,7 +38,7 @@ #include <stdlib.h> #include <string.h> -struct mapreg_interface mapreg_s; +static struct mapreg_interface mapreg_s; struct mapreg_interface *mapreg; #define MAPREG_AUTOSAVE_INTERVAL (300*1000) @@ -49,7 +49,8 @@ struct mapreg_interface *mapreg; * @param uid variable's unique identifier. * @return variable's integer value */ -int mapreg_readreg(int64 uid) { +static int mapreg_readreg(int64 uid) +{ struct mapreg_save *m = i64db_get(mapreg->regs.vars, uid); return m?m->u.i:0; } @@ -60,7 +61,8 @@ int mapreg_readreg(int64 uid) { * @param uid variable's unique identifier * @return variable's string value */ -char* mapreg_readregstr(int64 uid) { +static char *mapreg_readregstr(int64 uid) +{ struct mapreg_save *m = i64db_get(mapreg->regs.vars, uid); return m?m->u.str:NULL; } @@ -72,7 +74,8 @@ char* mapreg_readregstr(int64 uid) { * @param val new value * @retval true value was successfully set */ -bool mapreg_setreg(int64 uid, int val) { +static bool mapreg_setreg(int64 uid, int val) +{ struct mapreg_save *m; int num = script_getvarid(uid); unsigned int i = script_getvaridx(uid); @@ -129,7 +132,8 @@ bool mapreg_setreg(int64 uid, int val) { * @param str new value * @retval true value was successfully set */ -bool mapreg_setregstr(int64 uid, const char* str) { +static bool mapreg_setregstr(int64 uid, const char *str) +{ struct mapreg_save *m; int num = script_getvarid(uid); unsigned int i = script_getvaridx(uid); @@ -188,7 +192,8 @@ bool mapreg_setregstr(int64 uid, const char* str) { /** * Loads permanent variables from database. */ -void script_load_mapreg(void) { +static void script_load_mapreg(void) +{ /* 0 1 2 +-------------------------+ @@ -241,7 +246,7 @@ void script_load_mapreg(void) { /** * Saves permanent variables to database. */ -void script_save_mapreg(void) +static void script_save_mapreg(void) { if (mapreg->dirty) { struct DBIterator *iter = db_iterator(mapreg->regs.vars); @@ -274,7 +279,8 @@ void script_save_mapreg(void) * * @see timer->do_timer */ -int script_autosave_mapreg(int tid, int64 tick, int id, intptr_t data) { +static int script_autosave_mapreg(int tid, int64 tick, int id, intptr_t data) +{ mapreg->save(); return 0; } @@ -284,7 +290,7 @@ int script_autosave_mapreg(int tid, int64 tick, int id, intptr_t data) { * * @see DBApply */ -int mapreg_destroyreg(union DBKey key, struct DBData *data, va_list ap) +static int mapreg_destroyreg(union DBKey key, struct DBData *data, va_list ap) { struct mapreg_save *m = NULL; @@ -308,7 +314,8 @@ int mapreg_destroyreg(union DBKey key, struct DBData *data, va_list ap) * This has the effect of clearing the temporary variables, and * reloading the permanent ones. */ -void mapreg_reload(void) { +static void mapreg_reload(void) +{ mapreg->save(); mapreg->regs.vars->clear(mapreg->regs.vars, mapreg->destroyreg); @@ -324,7 +331,8 @@ void mapreg_reload(void) { /** * Finalizer. */ -void mapreg_final(void) { +static void mapreg_final(void) +{ mapreg->save(); mapreg->regs.vars->destroy(mapreg->regs.vars, mapreg->destroyreg); @@ -338,7 +346,8 @@ void mapreg_final(void) { /** * Initializer. */ -void mapreg_init(void) { +static void mapreg_init(void) +{ mapreg->regs.vars = i64db_alloc(DB_OPT_BASE); mapreg->ers = ers_new(sizeof(struct mapreg_save), "mapreg_sql.c::mapreg_ers", ERS_OPT_CLEAN); @@ -357,7 +366,7 @@ void mapreg_init(void) { * * @retval false in case of error. */ -bool mapreg_config_read(const char *filename, const struct config_setting_t *config, bool imported) +static bool mapreg_config_read(const char *filename, const struct config_setting_t *config, bool imported) { nullpo_retr(false, filename); nullpo_retr(false, config); @@ -371,7 +380,8 @@ bool mapreg_config_read(const char *filename, const struct config_setting_t *con /** * Interface defaults initializer. */ -void mapreg_defaults(void) { +void mapreg_defaults(void) +{ mapreg = &mapreg_s; /* */ diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 3e52da17a..918701c9d 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -57,12 +57,12 @@ #include <stdlib.h> #include <string.h> -struct mercenary_interface mercenary_s; -struct s_mercenary_db mercdb[MAX_MERCENARY_CLASS]; +static struct mercenary_interface mercenary_s; +static struct s_mercenary_db mercdb[MAX_MERCENARY_CLASS]; struct mercenary_interface *mercenary; -int merc_search_index(int class_) +static int merc_search_index(int class_) { int i; ARR_FIND(0, MAX_MERCENARY_CLASS, i, mercenary->db[i].class_ == class_); @@ -71,14 +71,14 @@ int merc_search_index(int class_) return i; } -bool merc_class(int class_) +static bool merc_class(int class_) { if (mercenary->search_index(class_) != INDEX_NOT_FOUND) return true; return false; } -struct view_data * merc_get_viewdata(int class_) +static struct view_data *merc_get_viewdata(int class_) { int i = mercenary->search_index(class_); if (i == INDEX_NOT_FOUND) @@ -87,7 +87,7 @@ struct view_data * merc_get_viewdata(int class_) return &mercenary->db[i].vd; } -int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime) +static int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime) { struct s_mercenary merc; struct s_mercenary_db *db; @@ -112,7 +112,7 @@ int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime) return 1; } -int mercenary_get_lifetime(struct mercenary_data *md) +static int mercenary_get_lifetime(struct mercenary_data *md) { const struct TimerData * td; if( md == NULL || md->contract_timer == INVALID_TIMER ) @@ -122,7 +122,7 @@ int mercenary_get_lifetime(struct mercenary_data *md) return (td != NULL) ? DIFF_TICK32(td->tick, timer->gettick()) : 0; } -int mercenary_get_guild(struct mercenary_data *md) +static int mercenary_get_guild(struct mercenary_data *md) { int class_; @@ -141,7 +141,7 @@ int mercenary_get_guild(struct mercenary_data *md) return -1; } -int mercenary_get_faith(struct mercenary_data *md) +static int mercenary_get_faith(struct mercenary_data *md) { struct map_session_data *sd; int class_; @@ -161,7 +161,7 @@ int mercenary_get_faith(struct mercenary_data *md) return 0; } -int mercenary_set_faith(struct mercenary_data *md, int value) +static int mercenary_set_faith(struct mercenary_data *md, int value) { struct map_session_data *sd; int class_, *faith; @@ -187,7 +187,7 @@ int mercenary_set_faith(struct mercenary_data *md, int value) return 0; } -int mercenary_get_calls(struct mercenary_data *md) +static int mercenary_get_calls(struct mercenary_data *md) { struct map_session_data *sd; int class_; @@ -207,7 +207,7 @@ int mercenary_get_calls(struct mercenary_data *md) return 0; } -int mercenary_set_calls(struct mercenary_data *md, int value) +static int mercenary_set_calls(struct mercenary_data *md, int value) { struct map_session_data *sd; int class_, *calls; @@ -232,7 +232,7 @@ int mercenary_set_calls(struct mercenary_data *md, int value) return 0; } -int mercenary_save(struct mercenary_data *md) +static int mercenary_save(struct mercenary_data *md) { nullpo_retr(1, md); md->mercenary.hp = md->battle_status.hp; @@ -243,7 +243,8 @@ int mercenary_save(struct mercenary_data *md) return 1; } -int merc_contract_end_timer(int tid, int64 tick, int id, intptr_t data) { +static int merc_contract_end_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct mercenary_data *md; @@ -264,7 +265,7 @@ int merc_contract_end_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -int merc_delete(struct mercenary_data *md, int reply) +static int merc_delete(struct mercenary_data *md, int reply) { struct map_session_data *sd; @@ -293,7 +294,7 @@ int merc_delete(struct mercenary_data *md, int reply) return unit->remove_map(&md->bl, CLR_OUTSIGHT, ALC_MARK); } -void merc_contract_stop(struct mercenary_data *md) +static void merc_contract_stop(struct mercenary_data *md) { nullpo_retv(md); if( md->contract_timer != INVALID_TIMER ) @@ -301,7 +302,7 @@ void merc_contract_stop(struct mercenary_data *md) md->contract_timer = INVALID_TIMER; } -void merc_contract_init(struct mercenary_data *md) +static void merc_contract_init(struct mercenary_data *md) { nullpo_retv(md); if( md->contract_timer == INVALID_TIMER ) @@ -310,7 +311,7 @@ void merc_contract_init(struct mercenary_data *md) md->regen.state.block = 0; } -int merc_data_received(const struct s_mercenary *merc, bool flag) +static int merc_data_received(const struct s_mercenary *merc, bool flag) { struct map_session_data *sd; struct mercenary_data *md; @@ -375,7 +376,7 @@ int merc_data_received(const struct s_mercenary *merc, bool flag) return 1; } -void mercenary_heal(struct mercenary_data *md, int hp, int sp) +static void mercenary_heal(struct mercenary_data *md, int hp, int sp) { nullpo_retv(md); if( hp ) @@ -384,13 +385,13 @@ void mercenary_heal(struct mercenary_data *md, int hp, int sp) clif->mercenary_updatestatus(md->master, SP_SP); } -int mercenary_dead(struct mercenary_data *md) +static int mercenary_dead(struct mercenary_data *md) { mercenary->delete(md, 1); return 0; } -int mercenary_killbonus(struct mercenary_data *md) +static int mercenary_killbonus(struct mercenary_data *md) { const enum sc_type scs[] = { SC_MER_FLEE, SC_MER_ATK, SC_MER_HP, SC_MER_SP, SC_MER_HIT }; int index = rnd() % ARRAYLENGTH(scs); @@ -400,7 +401,7 @@ int mercenary_killbonus(struct mercenary_data *md) return 0; } -int mercenary_kills(struct mercenary_data *md) +static int mercenary_kills(struct mercenary_data *md) { nullpo_ret(md); md->mercenary.kill_count++; @@ -418,7 +419,7 @@ int mercenary_kills(struct mercenary_data *md) return 0; } -int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id) +static int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id) { int i = skill_id - MC_SKILLBASE; @@ -430,7 +431,8 @@ int mercenary_checkskill(struct mercenary_data *md, uint16 skill_id) return 0; } -bool read_mercenarydb_sub(char* str[], int columns, int current) { +static bool read_mercenarydb_sub(char *str[], int columns, int current) +{ int ele; struct s_mercenary_db *db; struct status_data *mstatus; @@ -485,15 +487,17 @@ bool read_mercenarydb_sub(char* str[], int columns, int current) { return true; } -int read_mercenarydb(void) { +static int read_mercenarydb(void) +{ memset(mercenary->db, 0, sizeof(struct s_mercenary_db) * MAX_MERCENARY_CLASS); sv->readdb(map->db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, mercenary->read_db_sub); return 0; } -bool read_mercenary_skilldb_sub(char* str[], int columns, int current) -{// <merc id>,<skill id>,<skill level> +static bool read_mercenary_skilldb_sub(char *str[], int columns, int current) +{ + // <merc id>,<skill id>,<skill level> struct s_mercenary_db *db; int i, class_; uint16 skill_id, skill_lv; @@ -524,13 +528,15 @@ bool read_mercenary_skilldb_sub(char* str[], int columns, int current) return true; } -int read_mercenary_skilldb(void) { +static int read_mercenary_skilldb(void) +{ sv->readdb(map->db_path, "mercenary_skill_db.txt", ',', 3, 3, -1, mercenary->read_skill_db_sub); return 0; } -void do_init_mercenary(bool minimal) { +static void do_init_mercenary(bool minimal) +{ if (minimal) return; @@ -541,11 +547,12 @@ void do_init_mercenary(bool minimal) { } /*===================================== -* Default Functions : mercenary.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void mercenary_defaults(void) { + * Default Functions : mercenary.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void mercenary_defaults(void) +{ mercenary = &mercenary_s; /* vars */ diff --git a/src/map/mob.c b/src/map/mob.c index 6bd7829ba..403e3a2f2 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -64,7 +64,7 @@ #include <stdlib.h> #include <string.h> -struct mob_interface mob_s; +static struct mob_interface mob_s; struct mob_interface *mob; #define ACTIVE_AI_RANGE 2 //Distance added on top of 'AREA_SIZE' at which mobs enter active AI mode. @@ -97,12 +97,14 @@ static struct { int class_[350]; } summon[MAX_RANDOMMONSTER]; -struct mob_db *mob_db(int index) { +static struct mob_db *mob_db(int index) +{ if (index < 0 || index > MAX_MOB_DB || mob->db_data[index] == NULL) return mob->dummy; return mob->db_data[index]; } -struct mob_chat *mob_chat(short id) { +static struct mob_chat *mob_chat(short id) +{ if(id <= 0 || id > MAX_MOB_CHAT || mob->chat_db[id] == NULL) return NULL; return mob->chat_db[id]; @@ -111,7 +113,7 @@ struct mob_chat *mob_chat(short id) { /*========================================== * Mob is searched with a name. *------------------------------------------*/ -int mobdb_searchname(const char *str) +static int mobdb_searchname(const char *str) { int i; @@ -130,7 +132,8 @@ int mobdb_searchname(const char *str) return 0; } -int mobdb_searchname_array_sub(struct mob_db* monster, const char *str, int flag) { +static int mobdb_searchname_array_sub(struct mob_db *monster, const char *str, int flag) +{ nullpo_ret(monster); if (monster == mob->dummy) @@ -159,7 +162,7 @@ int mobdb_searchname_array_sub(struct mob_db* monster, const char *str, int flag *------------------------------------------*/ /// Creates a timer to spawn a tomb /// @param nd : The tomb -void mvptomb_spawn_delayed(struct npc_data *nd) +static void mvptomb_spawn_delayed(struct npc_data *nd) { nullpo_retv(nd); @@ -174,7 +177,7 @@ void mvptomb_spawn_delayed(struct npc_data *nd) /// @param tick : current tick /// @param id : NPC Id /// @param data : 0 -int mvptomb_delayspawn(int tid, int64 tick, int id, intptr_t data) +static int mvptomb_delayspawn(int tid, int64 tick, int id, intptr_t data) { struct npc_data *nd = map->id2nd(id); @@ -195,7 +198,7 @@ int mvptomb_delayspawn(int tid, int64 tick, int id, intptr_t data) return 0; } -void mvptomb_create(struct mob_data *md, char *killer, time_t time) +static void mvptomb_create(struct mob_data *md, char *killer, time_t time) { struct npc_data *nd; @@ -224,7 +227,8 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) mob->mvptomb_spawn_delayed(nd); } -void mvptomb_destroy(struct mob_data *md) { +static void mvptomb_destroy(struct mob_data *md) +{ struct npc_data *nd; nullpo_retv(md); @@ -258,7 +262,7 @@ void mvptomb_destroy(struct mob_data *md) { /*========================================== * Founds up to N matches. Returns number of matches [Skotlex] *------------------------------------------*/ -int mobdb_searchname_array(struct mob_db** data, int size, const char *str, int flag) +static int mobdb_searchname_array(struct mob_db **data, int size, const char *str, int flag) { int count = 0, i; struct mob_db* monster; @@ -279,7 +283,7 @@ int mobdb_searchname_array(struct mob_db** data, int size, const char *str, int /*========================================== * Id Mob is checked. *------------------------------------------*/ -int mobdb_checkid(const int id) +static int mobdb_checkid(const int id) { if (mob->db(id) == mob->dummy) return 0; @@ -291,7 +295,7 @@ int mobdb_checkid(const int id) /*========================================== * Returns the view data associated to this mob class. *------------------------------------------*/ -struct view_data * mob_get_viewdata(int class_) +static struct view_data *mob_get_viewdata(int class_) { if (mob->db(class_) == mob->dummy) return 0; @@ -300,7 +304,7 @@ struct view_data * mob_get_viewdata(int class_) /*========================================== * Cleans up mob-spawn data to make it "valid" *------------------------------------------*/ -int mob_parse_dataset(struct spawn_data *data) +static int mob_parse_dataset(struct spawn_data *data) { size_t len; @@ -326,7 +330,8 @@ int mob_parse_dataset(struct spawn_data *data) /*========================================== * Generates the basic mob data using the spawn_data provided. *------------------------------------------*/ -struct mob_data* mob_spawn_dataset(struct spawn_data *data) { +static struct mob_data *mob_spawn_dataset(struct spawn_data *data) +{ struct mob_data *md = NULL; nullpo_retr(NULL, data); CREATE(md, struct mob_data, 1); @@ -373,7 +378,7 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) { * &8: Selected monster must have normal spawn. * lv: Mob level to check against *------------------------------------------*/ -int mob_get_random_id(int type, int flag, int lv) +static int mob_get_random_id(int type, int flag, int lv) { struct mob_db *monster; int i=0, class_; @@ -404,7 +409,8 @@ int mob_get_random_id(int type, int flag, int lv) /*========================================== * Kill Steal Protection [Zephyrus] *------------------------------------------*/ -bool mob_ksprotected(struct block_list *src, struct block_list *target) { +static bool mob_ksprotected(struct block_list *src, struct block_list *target) +{ struct block_list *s_bl, *t_bl; struct map_session_data *sd, // Source @@ -487,7 +493,7 @@ bool mob_ksprotected(struct block_list *src, struct block_list *target) { return false; } -struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai) +static struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int16 y, const char *mobname, int class_, const char *event, unsigned int size, unsigned int ai) { struct spawn_data data; @@ -528,7 +534,8 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int /*========================================== * Spawn a single mob on the specified coordinates. *------------------------------------------*/ -int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) { +static int mob_once_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai) +{ struct mob_data* md = NULL; int count, lv; bool no_guardian_data = false; @@ -579,7 +586,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const /*========================================== * Spawn mobs in the specified area. *------------------------------------------*/ -int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char* mobname, int class_, int amount, const char* event, unsigned int size, unsigned int ai) +static int mob_once_spawn_area(struct map_session_data *sd, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, const char *mobname, int class_, int amount, const char *event, unsigned int size, unsigned int ai) { int i, max, id = 0; int lx = -1, ly = -1; @@ -637,7 +644,8 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0 * @retval Always 0 * @author Skotlex **/ -int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) { +static int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) +{ //Needed because the guild data may not be available at guardian spawn time. struct block_list* bl = map->id2bl(id); struct mob_data* md; @@ -680,7 +688,7 @@ int mob_spawn_guardian_sub(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Summoning Guardians [Valaris] *------------------------------------------*/ -int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian, bool has_index) +static int mob_spawn_guardian(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, int guardian, bool has_index) { struct mob_data *md=NULL; struct spawn_data data; @@ -780,7 +788,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam /*========================================== * Summoning BattleGround [Zephyrus] *------------------------------------------*/ -int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, unsigned int bg_id) +static int mob_spawn_bg(const char *mapname, short x, short y, const char *mobname, int class_, const char *event, unsigned int bg_id) { struct mob_data *md = NULL; struct spawn_data data; @@ -831,7 +839,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int * - MSS_RUSH: Chasing attacking player, path is complex * - MSS_FOLLOW: Initiative/support seek, path is complex *------------------------------------------*/ -int mob_can_reach(struct mob_data *md,struct block_list *bl,int range, int state) +static int mob_can_reach(struct mob_data *md, struct block_list *bl, int range, int state) { int easy = 0; @@ -853,7 +861,7 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range, int state /*========================================== * Links nearby mobs (supportive mobs) *------------------------------------------*/ -int mob_linksearch(struct block_list *bl,va_list ap) +static int mob_linksearch(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int class_ = va_arg(ap, int); @@ -882,7 +890,8 @@ int mob_linksearch(struct block_list *bl,va_list ap) /*========================================== * mob spawn with delay (timer function) *------------------------------------------*/ -int mob_delayspawn(int tid, int64 tick, int id, intptr_t data) { +static int mob_delayspawn(int tid, int64 tick, int id, intptr_t data) +{ struct block_list* bl = map->id2bl(id); // TODO: Why does this not use map->bl2md? struct mob_data* md = BL_CAST(BL_MOB, bl); @@ -902,7 +911,7 @@ int mob_delayspawn(int tid, int64 tick, int id, intptr_t data) { /*========================================== * spawn timing calculation *------------------------------------------*/ -int mob_setdelayspawn(struct mob_data *md) +static int mob_setdelayspawn(struct mob_data *md) { unsigned int spawntime; uint32 mode; @@ -946,7 +955,8 @@ int mob_setdelayspawn(struct mob_data *md) return 0; } -int mob_count_sub(struct block_list *bl, va_list ap) { +static int mob_count_sub(struct block_list *bl, va_list ap) +{ int mobid[10] = { 0 }, i; ARR_FIND(0, 10, i, (mobid[i] = va_arg(ap, int)) == 0); //fetch till 0 if (mobid[0]) { //if there one let's check it otherwise go backward @@ -961,7 +971,7 @@ int mob_count_sub(struct block_list *bl, va_list ap) { /*========================================== * Mob spawning. Initialization is also variously here. *------------------------------------------*/ -int mob_spawn (struct mob_data *md) +static int mob_spawn(struct mob_data *md) { int i=0; int64 tick = timer->gettick(); @@ -1055,7 +1065,7 @@ int mob_spawn (struct mob_data *md) /*========================================== * Determines if the mob can change target. [Skotlex] *------------------------------------------*/ -int mob_can_changetarget(const struct mob_data *md, const struct block_list *target, uint32 mode) +static int mob_can_changetarget(const struct mob_data *md, const struct block_list *target, uint32 mode) { nullpo_ret(md); nullpo_ret(target); @@ -1089,7 +1099,7 @@ int mob_can_changetarget(const struct mob_data *md, const struct block_list *tar /*========================================== * Determination for an attack of a monster *------------------------------------------*/ -int mob_target(struct mob_data *md,struct block_list *bl,int dist) +static int mob_target(struct mob_data *md, struct block_list *bl, int dist) { nullpo_ret(md); nullpo_ret(bl); @@ -1113,7 +1123,7 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) /*========================================== * The ?? routine of an active monster *------------------------------------------*/ -int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) +static int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) { struct mob_data *md; struct block_list **target; @@ -1176,7 +1186,8 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) /*========================================== * chase target-change routine. *------------------------------------------*/ -int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) { +static int mob_ai_sub_hard_changechase(struct block_list *bl, va_list ap) +{ struct mob_data *md; struct block_list **target; @@ -1204,7 +1215,8 @@ int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) { /*========================================== * finds nearby bg ally for guardians looking for users to follow. *------------------------------------------*/ -int mob_ai_sub_hard_bg_ally(struct block_list *bl,va_list ap) { +static int mob_ai_sub_hard_bg_ally(struct block_list *bl, va_list ap) +{ struct mob_data *md; struct block_list **target; @@ -1223,7 +1235,7 @@ int mob_ai_sub_hard_bg_ally(struct block_list *bl,va_list ap) { /*========================================== * loot monster item search *------------------------------------------*/ -int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) +static int mob_ai_sub_hard_lootsearch(struct block_list *bl, va_list ap) { struct mob_data* md; struct block_list **target; @@ -1245,7 +1257,8 @@ int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) return 0; } -int mob_warpchase_sub(struct block_list *bl,va_list ap) { +static int mob_warpchase_sub(struct block_list *bl, va_list ap) +{ int cur_distance; struct block_list *target = va_arg(ap, struct block_list *); struct npc_data **target_nd = va_arg(ap, struct npc_data **); @@ -1277,7 +1290,8 @@ int mob_warpchase_sub(struct block_list *bl,va_list ap) { /*========================================== * Processing of slave monsters *------------------------------------------*/ -int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) { +static int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) +{ struct block_list *bl; nullpo_ret(md); @@ -1360,7 +1374,8 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) { * when trying to pick new targets when the current chosen target is * unreachable. *------------------------------------------*/ -int mob_unlocktarget(struct mob_data *md, int64 tick) { +static int mob_unlocktarget(struct mob_data *md, int64 tick) +{ nullpo_ret(md); switch (md->state.skillstate) { @@ -1405,7 +1420,8 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) { /*========================================== * Random walk *------------------------------------------*/ -int mob_randomwalk(struct mob_data *md, int64 tick) { +static int mob_randomwalk(struct mob_data *md, int64 tick) +{ const int retrycount=20; int i,c,d; int speed; @@ -1455,7 +1471,7 @@ int mob_randomwalk(struct mob_data *md, int64 tick) { return 1; } -int mob_warpchase(struct mob_data *md, struct block_list *target) +static int mob_warpchase(struct mob_data *md, struct block_list *target) { struct npc_data *warp = NULL; int distance = AREA_SIZE; @@ -1482,7 +1498,8 @@ int mob_warpchase(struct mob_data *md, struct block_list *target) /*========================================== * AI of MOB whose is near a Player *------------------------------------------*/ -bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { +static bool mob_ai_sub_hard(struct mob_data *md, int64 tick) +{ struct block_list *tbl = NULL, *abl = NULL; uint32 mode; int view_range, can_move; @@ -1762,7 +1779,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { return true; } -int mob_ai_sub_hard_timer(struct block_list *bl, va_list ap) +static int mob_ai_sub_hard_timer(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int64 tick = va_arg(ap, int64); @@ -1783,7 +1800,8 @@ int mob_ai_sub_hard_timer(struct block_list *bl, va_list ap) /*========================================== * Serious processing for mob in PC field of view (foreachclient) *------------------------------------------*/ -int mob_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) { +static int mob_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) +{ int64 tick; nullpo_ret(sd); tick=va_arg(ap, int64); @@ -1795,7 +1813,8 @@ int mob_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) { /*========================================== * Negligent mode MOB AI (PC is not in near) *------------------------------------------*/ -int mob_ai_sub_lazy(struct mob_data *md, va_list args) { +static int mob_ai_sub_lazy(struct mob_data *md, va_list args) +{ int64 tick; nullpo_ret(md); @@ -1859,7 +1878,8 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args) { /*========================================== * Negligent processing for mob outside PC field of view (interval timer function) *------------------------------------------*/ -int mob_ai_lazy(int tid, int64 tick, int id, intptr_t data) { +static int mob_ai_lazy(int tid, int64 tick, int id, intptr_t data) +{ map->foreachmob(mob->ai_sub_lazy,tick); return 0; } @@ -1867,7 +1887,8 @@ int mob_ai_lazy(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Serious processing for mob in PC field of view (interval timer function) *------------------------------------------*/ -int mob_ai_hard(int tid, int64 tick, int id, intptr_t data) { +static int mob_ai_hard(int tid, int64 tick, int id, intptr_t data) +{ if (battle_config.mob_ai&0x20) map->foreachmob(mob->ai_sub_lazy,tick); @@ -1880,7 +1901,7 @@ int mob_ai_hard(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Initializes the delay drop structure for mob-dropped items. *------------------------------------------*/ -struct item_drop* mob_setdropitem(int nameid, int qty, struct item_data *data) +static struct item_drop *mob_setdropitem(int nameid, int qty, struct item_data *data) { struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop); drop->item_data.nameid = nameid; @@ -1894,7 +1915,7 @@ struct item_drop* mob_setdropitem(int nameid, int qty, struct item_data *data) /*========================================== * Initializes the delay drop structure for mob-looted items. *------------------------------------------*/ -struct item_drop* mob_setlootitem(struct item* item) +static struct item_drop *mob_setlootitem(struct item *item) { struct item_drop *drop ; @@ -1909,7 +1930,7 @@ struct item_drop* mob_setlootitem(struct item* item) /*========================================== * item drop with delay (timer function) *------------------------------------------*/ -int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) +static int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { struct item_drop_list *list; struct item_drop *ditem; @@ -1935,7 +1956,7 @@ int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) * rate is the drop-rate of the item, required for autoloot. * flag : Killed only by homunculus? *------------------------------------------*/ -void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct item_drop *ditem, int loot, int drop_rate, unsigned short flag) +static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct item_drop *ditem, int loot, int drop_rate, unsigned short flag) { struct map_session_data *sd = NULL; @@ -1971,7 +1992,8 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite dlist->item = ditem; } -int mob_timer_delete(int tid, int64 tick, int id, intptr_t data) { +static int mob_timer_delete(int tid, int64 tick, int id, intptr_t data) +{ struct block_list* bl = map->id2bl(id); // TODO: Why does this not use map->id2md? struct mob_data* md = BL_CAST(BL_MOB, bl); @@ -1992,7 +2014,7 @@ int mob_timer_delete(int tid, int64 tick, int id, intptr_t data) { /*========================================== * *------------------------------------------*/ -int mob_deleteslave_sub(struct block_list *bl,va_list ap) +static int mob_deleteslave_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int id = va_arg(ap, int); @@ -2009,14 +2031,16 @@ int mob_deleteslave_sub(struct block_list *bl,va_list ap) /*========================================== * *------------------------------------------*/ -int mob_deleteslave(struct mob_data *md) { +static int mob_deleteslave(struct mob_data *md) +{ nullpo_ret(md); map->foreachinmap(mob->deleteslave_sub, md->bl.m, BL_MOB,md->bl.id); return 0; } // Mob respawning through KAIZEL or NPC_REBIRTH [Skotlex] -int mob_respawn(int tid, int64 tick, int id, intptr_t data) { +static int mob_respawn(int tid, int64 tick, int id, intptr_t data) +{ struct block_list *bl = map->id2bl(id); if(!bl) return 0; @@ -2024,7 +2048,7 @@ int mob_respawn(int tid, int64 tick, int id, intptr_t data) { return 1; } -void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) +static void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) { int char_id = 0, flag = MDLF_NORMAL; @@ -2140,7 +2164,8 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) return; } //Call when a mob has received damage. -void mob_damage(struct mob_data *md, struct block_list *src, int damage) { +static void mob_damage(struct mob_data *md, struct block_list *src, int damage) +{ nullpo_retv(md); if (damage > 0) { //Store total damage... if (UINT_MAX - (unsigned int)damage > md->tdmg) @@ -2194,7 +2219,8 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) { * Signals death of mob. * type&1 -> no drops, type&2 -> no exp *------------------------------------------*/ -int mob_dead(struct mob_data *md, struct block_list *src, int type) { +static int mob_dead(struct mob_data *md, struct block_list *src, int type) +{ struct status_data *mstatus; struct map_session_data *sd = BL_CAST(BL_PC, src); struct map_session_data *tmpsd[DAMAGELOG_SIZE] = { NULL }; @@ -2743,7 +2769,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { return 3; //Remove from map. } -void mob_revive(struct mob_data *md, unsigned int hp) +static void mob_revive(struct mob_data *md, unsigned int hp) { int64 tick = timer->gettick(); @@ -2764,7 +2790,7 @@ void mob_revive(struct mob_data *md, unsigned int hp) clif->charnameack (0, &md->bl); } -int mob_guardian_guildchange(struct mob_data *md) +static int mob_guardian_guildchange(struct mob_data *md) { struct guild *g; nullpo_ret(md); @@ -2803,7 +2829,7 @@ int mob_guardian_guildchange(struct mob_data *md) /*========================================== * Pick a random class for the mob *------------------------------------------*/ -int mob_random_class (int *value, size_t count) +static int mob_random_class(int *value, size_t count) { nullpo_ret(value); @@ -2825,7 +2851,8 @@ int mob_random_class (int *value, size_t count) /*========================================== * Change mob base class *------------------------------------------*/ -int mob_class_change (struct mob_data *md, int class_) { +static int mob_class_change(struct mob_data *md, int class_) +{ int64 tick = timer->gettick(), c = 0; int i, hp_rate; @@ -2893,7 +2920,7 @@ int mob_class_change (struct mob_data *md, int class_) { /*========================================== * mob heal, update display hp info of mob for players *------------------------------------------*/ -void mob_heal(struct mob_data *md, unsigned int heal) +static void mob_heal(struct mob_data *md, unsigned int heal) { nullpo_retv(md); if (battle_config.show_mob_info&3) @@ -2921,7 +2948,7 @@ void mob_heal(struct mob_data *md, unsigned int heal) /*========================================== * Added by RoVeRT *------------------------------------------*/ -int mob_warpslave_sub(struct block_list *bl, va_list ap) +static int mob_warpslave_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; struct block_list *master; @@ -2947,7 +2974,8 @@ int mob_warpslave_sub(struct block_list *bl, va_list ap) * Warps slaves. Range is the area around the master that they can * appear in randomly. *------------------------------------------*/ -int mob_warpslave(struct block_list *bl, int range) { +static int mob_warpslave(struct block_list *bl, int range) +{ nullpo_ret(bl); if (range < 1) range = 1; //Min range needed to avoid crashes and stuff. [Skotlex] @@ -2958,7 +2986,7 @@ int mob_warpslave(struct block_list *bl, int range) { /*========================================== * Counts slave sub, currently checking if mob master is the given ID. *------------------------------------------*/ -int mob_countslave_sub(struct block_list *bl, va_list ap) +static int mob_countslave_sub(struct block_list *bl, va_list ap) { int id = va_arg(ap, int); struct mob_data *md = NULL; @@ -2975,7 +3003,8 @@ int mob_countslave_sub(struct block_list *bl, va_list ap) /*========================================== * Counts the number of slaves a mob has on the map. *------------------------------------------*/ -int mob_countslave(struct block_list *bl) { +static int mob_countslave(struct block_list *bl) +{ nullpo_ret(bl); return map->foreachinmap(mob->countslave_sub, bl->m, BL_MOB,bl->id); } @@ -2983,7 +3012,7 @@ int mob_countslave(struct block_list *bl) { /*========================================== * Summons amount slaves contained in the value[5] array using round-robin. [adapted by Skotlex] *------------------------------------------*/ -int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id) +static int mob_summonslave(struct mob_data *md2, int *value, int amount, uint16 skill_id) { struct mob_data *md; struct spawn_data data; @@ -3081,7 +3110,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id) * MOBskill lookup (get skillindex through skill_id) * Returns INDEX_NOT_FOUND if not found. *------------------------------------------*/ -int mob_skill_id2skill_idx(int class_,uint16 skill_id) +static int mob_skill_id2skill_idx(int class_, uint16 skill_id) { int i, max = mob->db(class_)->maxskill; struct mob_skill *ms=mob->db(class_)->skill; @@ -3098,7 +3127,7 @@ int mob_skill_id2skill_idx(int class_,uint16 skill_id) /*========================================== * Friendly Mob whose HP is decreasing by a nearby MOB is looked for. *------------------------------------------*/ -int mob_getfriendhprate_sub(struct block_list *bl,va_list ap) +static int mob_getfriendhprate_sub(struct block_list *bl, va_list ap) { int min_rate, max_rate,rate; struct block_list **fr; @@ -3126,7 +3155,8 @@ int mob_getfriendhprate_sub(struct block_list *bl,va_list ap) (*fr) = bl; return 1; } -struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,int max_rate) { +static struct block_list *mob_getfriendhprate(struct mob_data *md, int min_rate, int max_rate) +{ struct block_list *fr=NULL; int type = BL_MOB; @@ -3141,7 +3171,8 @@ struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,int max_ /*========================================== * Check hp rate of its master *------------------------------------------*/ -struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate) { +static struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md, int rate) +{ if( md && md->master_id > 0 ) { struct block_list *bl = map->id2bl(md->master_id); if( bl && get_percentage(status_get_hp(bl), status_get_max_hp(bl)) < rate ) @@ -3153,7 +3184,7 @@ struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate) { /*========================================== * What a status state suits by nearby MOB is looked for. *------------------------------------------*/ -int mob_getfriendstatus_sub(struct block_list *bl,va_list ap) +static int mob_getfriendstatus_sub(struct block_list *bl, va_list ap) { int cond1,cond2; struct mob_data **fr = NULL, *md = NULL, *mmd = NULL; @@ -3186,7 +3217,8 @@ int mob_getfriendstatus_sub(struct block_list *bl,va_list ap) return 0; } -struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2) { +static struct mob_data *mob_getfriendstatus(struct mob_data *md, int cond1, int cond2) +{ struct mob_data* fr = NULL; nullpo_ret(md); @@ -3197,7 +3229,8 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2) { /*========================================== * Skill use judging *------------------------------------------*/ -int mobskill_use(struct mob_data *md, int64 tick, int event) { +static int mobskill_use(struct mob_data *md, int64 tick, int event) +{ struct mob_skill *ms; struct block_list *fbl = NULL; //Friend bl, which can either be a BL_PC or BL_MOB depending on the situation. [Skotlex] struct block_list *bl; @@ -3417,7 +3450,8 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { /*========================================== * Skill use event processing *------------------------------------------*/ -int mobskill_event(struct mob_data *md, struct block_list *src, int64 tick, int flag) { +static int mobskill_event(struct mob_data *md, struct block_list *src, int64 tick, int flag) +{ int target_id, res = 0; nullpo_ret(md); @@ -3454,7 +3488,7 @@ int mobskill_event(struct mob_data *md, struct block_list *src, int64 tick, int } // Player cloned mobs. [Valaris] -int mob_is_clone(int class_) +static int mob_is_clone(int class_) { if(class_ < MOB_CLONE_START || class_ > MOB_CLONE_END) return 0; @@ -3468,7 +3502,7 @@ int mob_is_clone(int class_) //If mode is not passed, a default aggressive mode is used. //If master_id is passed, clone is attached to him. //Returns: ID of newly crafted copy. -int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, uint32 mode, int flag, unsigned int duration) +static int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, const char *event, int master_id, uint32 mode, int flag, unsigned int duration) { int class_; int i,j,h,inf, fd; @@ -3671,7 +3705,7 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons return md->bl.id; } -int mob_clone_delete(struct mob_data *md) +static int mob_clone_delete(struct mob_data *md) { int class_; @@ -3694,7 +3728,7 @@ int mob_clone_delete(struct mob_data *md) /*========================================== * Since un-setting [ mob ] up was used, it is an initial provisional value setup. *------------------------------------------*/ -int mob_makedummymobdb(int class_) +static int mob_makedummymobdb(int class_) { if (mob->dummy != NULL) { @@ -3736,7 +3770,7 @@ int mob_makedummymobdb(int class_) } //Adjusts the drop rate of item according to the criteria given. [Skotlex] -unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned short rate_min, unsigned short rate_max) +static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned short rate_min, unsigned short rate_max) { int64 rate = baserate; @@ -3764,7 +3798,7 @@ unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned short rate_ * @param mob_id ID of the monster * @param rate_adjust pointer to store ratio if found */ -void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust) +static void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust) { nullpo_retv(rate_adjust); if( item_drop_ratio_db[nameid] ) { @@ -3780,7 +3814,8 @@ void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust) } /* (mob_parse_dbrow)_cap_value */ -static inline int mob_parse_dbrow_cap_value(int class_, int min, int max, int value) { +static inline int mob_parse_dbrow_cap_value(int class_, int min, int max, int value) +{ if( value > max ) { ShowError("mob_parse_dbrow_cap_value: for class '%d', field value '%d' is higher than the maximum '%d'! capping...\n", class_, value, max); return max; @@ -3798,7 +3833,7 @@ static inline int mob_parse_dbrow_cap_value(int class_, int min, int max, int va * (mob_id is expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t *t) +static void mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t *t) { int i32; nullpo_retv(entry); @@ -3830,7 +3865,7 @@ void mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t *t) * * @return The parsed mode. */ -uint32 mob_read_db_mode_sub(struct mob_db *entry, struct config_setting_t *t) +static uint32 mob_read_db_mode_sub(struct mob_db *entry, struct config_setting_t *t) { uint32 mode = 0; struct config_setting_t *t2; @@ -3878,7 +3913,7 @@ uint32 mob_read_db_mode_sub(struct mob_db *entry, struct config_setting_t *t) * (mob_id is expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_mvpdrops_sub(struct mob_db *entry, struct config_setting_t *t) +static void mob_read_db_mvpdrops_sub(struct mob_db *entry, struct config_setting_t *t) { struct config_setting_t *drop; int i = 0; @@ -3935,7 +3970,7 @@ void mob_read_db_mvpdrops_sub(struct mob_db *entry, struct config_setting_t *t) * (mob_id, status.mode are expected to be already set). * @param[in] t The libconfig entry. */ -void mob_read_db_drops_sub(struct mob_db *entry, struct config_setting_t *t) +static void mob_read_db_drops_sub(struct mob_db *entry, struct config_setting_t *t) { struct config_setting_t *drop; int i = 0; @@ -4061,7 +4096,7 @@ void mob_read_db_drops_sub(struct mob_db *entry, struct config_setting_t *t) * (i.e. mob_db2 inheritance), as it will make sure not to free any data still * in use by the new entry. */ -int mob_db_validate_entry(struct mob_db *entry, int n, const char *source) +static int mob_db_validate_entry(struct mob_db *entry, int n, const char *source) { struct mob_data data; @@ -4164,7 +4199,7 @@ int mob_db_validate_entry(struct mob_db *entry, int n, const char *source) * validation errors. * @return Mob ID of the validated entry, or 0 in case of failure. */ -int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source) +static int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source) { struct mob_db md = { 0 }; struct config_setting_t *t = NULL; @@ -4473,12 +4508,12 @@ int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *source) * @param[in] source Source of the entry (file name), to be displayed in * case of validation errors. */ -void mob_read_db_additional_fields(struct mob_db *entry, struct config_setting_t *t, int n, const char *source) +static void mob_read_db_additional_fields(struct mob_db *entry, struct config_setting_t *t, int n, const char *source) { // do nothing. plugins can do own work } -bool mob_lookup_const(const struct config_setting_t *it, const char *name, int *value) +static bool mob_lookup_const(const struct config_setting_t *it, const char *name, int *value) { if (libconfig->setting_lookup_int(it, name, value)) { @@ -4496,7 +4531,7 @@ bool mob_lookup_const(const struct config_setting_t *it, const char *name, int * return false; } -bool mob_get_const(const struct config_setting_t *it, int *value) +static bool mob_get_const(const struct config_setting_t *it, int *value) { const char *str = config_setting_get_string(it); @@ -4511,7 +4546,8 @@ bool mob_get_const(const struct config_setting_t *it, int *value) /*========================================== * mob_db.txt reading *------------------------------------------*/ -void mob_readdb(void) { +static void mob_readdb(void) +{ const char* filename[] = { DBPATH"mob_db.conf", "mob_db2.conf" }; @@ -4532,7 +4568,7 @@ void mob_readdb(void) { * @param ignore_missing Whether to ignore errors caused by a missing db file. * @return the number of found entries. */ -int mob_read_libconfig(const char *filename, bool ignore_missing) +static int mob_read_libconfig(const char *filename, bool ignore_missing) { bool duplicate[MAX_MOB_DB] = { 0 }; struct config_t mob_db_conf; @@ -4576,7 +4612,8 @@ int mob_read_libconfig(const char *filename, bool ignore_missing) return count; } -void mob_name_constants(void) { +static void mob_name_constants(void) +{ int i; #ifdef ENABLE_CASE_CHECK script->parser_current_file = "Mob Database (Likely an invalid or conflicting SpriteName)"; @@ -4593,7 +4630,7 @@ void mob_name_constants(void) { /*========================================== * MOB display graphic change data reading *------------------------------------------*/ -bool mob_readdb_mobavail(char* str[], int columns, int current) +static bool mob_readdb_mobavail(char *str[], int columns, int current) { int class_, view_class; @@ -4635,7 +4672,7 @@ bool mob_readdb_mobavail(char* str[], int columns, int current) /*========================================== * Reading of random monster data *------------------------------------------*/ -int mob_read_randommonster(void) +static int mob_read_randommonster(void) { char line[1024]; char *str[10],*p; @@ -4702,7 +4739,7 @@ int mob_read_randommonster(void) * processes one mob_chat_db entry [SnakeDrak] * @param last_msg_id ensures that only one error message per mob id is printed *------------------------------------------*/ -bool mob_parse_row_chatdb(char** str, const char* source, int line, int* last_msg_id) +static bool mob_parse_row_chatdb(char **str, const char *source, int line, int *last_msg_id) { char* msg; struct mob_chat *ms; @@ -4762,7 +4799,8 @@ bool mob_parse_row_chatdb(char** str, const char* source, int line, int* last_ms /*========================================== * mob_chat_db.txt reading [SnakeDrak] *-------------------------------------------------------------------------*/ -void mob_readchatdb(void) { +static void mob_readchatdb(void) +{ char arc[]="mob_chat_db.txt"; uint32 lines=0, count=0; char line[1024], filepath[256]; @@ -4815,7 +4853,7 @@ void mob_readchatdb(void) { /*========================================== * processes one mob_skill_db entry *------------------------------------------*/ -bool mob_skill_db_libconfig(const char *filename, bool ignore_missing) +static bool mob_skill_db_libconfig(const char *filename, bool ignore_missing) { struct config_t mob_skill_conf; struct config_setting_t *it = NULL, *its = NULL, *mob_skill = NULL; @@ -4849,7 +4887,7 @@ bool mob_skill_db_libconfig(const char *filename, bool ignore_missing) return true; } -bool mob_skill_db_libconfig_sub(struct config_setting_t *it, int n) +static bool mob_skill_db_libconfig_sub(struct config_setting_t *it, int n) { int i = 0; int mob_id; @@ -4877,7 +4915,7 @@ bool mob_skill_db_libconfig_sub(struct config_setting_t *it, int n) return true; } -bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mob_id) +static bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mob_id) { int i, j, idx = 0; int i32; @@ -5053,7 +5091,8 @@ bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mo /*========================================== * mob_skill_db.txt reading *------------------------------------------*/ -void mob_readskilldb(void) { +static void mob_readskilldb(void) +{ const char *filename[] = { DBPATH"mob_skill_db.conf", @@ -5074,7 +5113,7 @@ void mob_readskilldb(void) { /*========================================== * mob_race2_db.txt reading *------------------------------------------*/ -bool mob_readdb_race2(char* fields[], int columns, int current) +static bool mob_readdb_race2(char *fields[], int columns, int current) { int race, i; @@ -5100,7 +5139,7 @@ bool mob_readdb_race2(char* fields[], int columns, int current) /** * Read mob_item_ratio.txt */ -bool mob_readdb_itemratio(char* str[], int columns, int current) +static bool mob_readdb_itemratio(char *str[], int columns, int current) { int nameid, ratio, i; @@ -5128,7 +5167,8 @@ bool mob_readdb_itemratio(char* str[], int columns, int current) /** * read all mob-related databases */ -void mob_load(bool minimal) { +static void mob_load(bool minimal) +{ if (minimal) { // Only read the mob db in minimal mode mob->readdb(); @@ -5143,7 +5183,8 @@ void mob_load(bool minimal) { sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2); } -void mob_reload(void) { +static void mob_reload(void) +{ int i; //Mob skills need to be cleared before re-reading them. [Skotlex] @@ -5167,7 +5208,7 @@ void mob_reload(void) { /** * Clears spawn related information for a script reload. */ -void mob_clear_spawninfo(void) +static void mob_clear_spawninfo(void) { int i; for (i = 0; i < MAX_MOB_DB; i++) @@ -5178,7 +5219,8 @@ void mob_clear_spawninfo(void) /*========================================== * Circumference initialization of mob *------------------------------------------*/ -int do_init_mob(bool minimal) { +static int do_init_mob(bool minimal) +{ // Initialize the mob database memset(mob->db_data,0,sizeof(mob->db_data)); //Clear the array mob->db_data[0] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns @@ -5205,7 +5247,7 @@ int do_init_mob(bool minimal) { return 0; } -void mob_destroy_mob_db(int index) +static void mob_destroy_mob_db(int index) { struct mob_db *data; Assert_retv(index >= 0 && index <= MAX_MOB_DB); @@ -5218,7 +5260,7 @@ void mob_destroy_mob_db(int index) /*========================================== * Clean memory usage. *------------------------------------------*/ -int do_final_mob(void) +static int do_final_mob(void) { int i; if (mob->dummy) @@ -5254,7 +5296,8 @@ int do_final_mob(void) return 0; } -void mob_defaults(void) { +void mob_defaults(void) +{ // Defines the Manuk/Splendide/Mora mob groups for the status reductions [Epoque & Frost] const int mob_manuk[8] = { MOBID_TATACHO, diff --git a/src/map/npc.c b/src/map/npc.c index 8172c962d..383558eaf 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -60,7 +60,7 @@ #include <string.h> #include <time.h> -struct npc_interface npc_s; +static struct npc_interface npc_s; struct npc_interface *npc; @@ -69,7 +69,7 @@ static struct view_data npc_viewdb[MAX_NPC_CLASS]; static struct view_data npc_viewdb2[MAX_NPC_CLASS2_END-MAX_NPC_CLASS2_START]; /* for speedup */ -unsigned int npc_market_qty[MAX_INVENTORY]; +static unsigned int npc_market_qty[MAX_INVENTORY]; static struct script_event_s { //Holds pointers to the commonly executed scripts for speedup. [Skotlex] @@ -83,7 +83,7 @@ static struct script_event_s { * @param class_ The NPC class ID. * @return The viewdata, or NULL if the ID is invalid. */ -struct view_data *npc_get_viewdata(int class_) +static struct view_data *npc_get_viewdata(int class_) { if (class_ == INVISIBLE_CLASS) return &npc_viewdb[0]; @@ -105,7 +105,7 @@ struct view_data *npc_get_viewdata(int class_) * @param id The NPC ID to validate. * @return Whether the value is a valid ID. */ -bool npc_db_checkid(int id) +static bool npc_db_checkid(int id) { if (id >= WARP_CLASS && id <= 125) // First subrange return true; @@ -123,7 +123,8 @@ bool npc_db_checkid(int id) /// Returns a new npc id that isn't being used in id_db. /// Fatal error if nothing is available. -int npc_get_new_npc_id(void) { +static int npc_get_new_npc_id(void) +{ if (npc->npc_id >= START_NPC_NUM && !map->blid_exists(npc->npc_id)) return npc->npc_id++;// available else {// find next id @@ -140,7 +141,7 @@ int npc_get_new_npc_id(void) { } } -int npc_isnear_sub(struct block_list *bl, va_list args) +static int npc_isnear_sub(struct block_list *bl, va_list args) { const struct npc_data *nd = NULL; @@ -157,7 +158,8 @@ int npc_isnear_sub(struct block_list *bl, va_list args) return 1; } -bool npc_isnear(struct block_list * bl) { +static bool npc_isnear(struct block_list *bl) +{ if( battle_config.min_npc_vendchat_distance > 0 && map->foreachinrange(npc->isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) ) return true; @@ -165,7 +167,7 @@ bool npc_isnear(struct block_list * bl) { return false; } -int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd) +static int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; @@ -180,7 +182,7 @@ int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd) return npc->event(sd,name,1); } -int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd) +static int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; @@ -193,7 +195,7 @@ int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd) return npc->event(sd, name, 2); } -int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd) +static int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; @@ -209,7 +211,7 @@ int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd) /*========================================== * Sub-function of npc_enable, runs OnTouch event when enabled *------------------------------------------*/ -int npc_enable_sub(struct block_list *bl, va_list ap) +static int npc_enable_sub(struct block_list *bl, va_list ap) { struct npc_data *nd; @@ -237,7 +239,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap) /*========================================== * Disable / Enable NPC *------------------------------------------*/ -int npc_enable(const char* name, int flag) +static int npc_enable(const char *name, int flag) { struct npc_data* nd = npc->name2id(name); @@ -275,7 +277,7 @@ int npc_enable(const char* name, int flag) /*========================================== * NPC lookup (get npc_data through npcname) *------------------------------------------*/ -struct npc_data *npc_name2id(const char *name) +static struct npc_data *npc_name2id(const char *name) { return strdb_get(npc->name_db, name); } @@ -285,7 +287,8 @@ struct npc_data *npc_name2id(const char *name) /** * Timer to check for idle time and timeout the dialog if necessary **/ -int npc_rr_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { +static int npc_rr_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) +{ #ifdef SECURE_NPCTIMEOUT struct map_session_data* sd = NULL; unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT; @@ -332,7 +335,7 @@ int npc_rr_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Dequeue event and add timer for execution (100ms) *------------------------------------------*/ -int npc_event_dequeue(struct map_session_data* sd) +static int npc_event_dequeue(struct map_session_data *sd) { nullpo_ret(sd); @@ -364,7 +367,7 @@ int npc_event_dequeue(struct map_session_data* sd) /** * @see DBCreateData */ -struct DBData npc_event_export_create(union DBKey key, va_list args) +static struct DBData npc_event_export_create(union DBKey key, va_list args) { struct linkdb_node** head_ptr; CREATE(head_ptr, struct linkdb_node*, 1); @@ -376,7 +379,7 @@ struct DBData npc_event_export_create(union DBKey key, va_list args) * exports a npc event label * called from npc_parse_script *------------------------------------------*/ -int npc_event_export(struct npc_data *nd, int i) +static int npc_event_export(struct npc_data *nd, int i) { char* lname; int pos; @@ -402,13 +405,13 @@ int npc_event_export(struct npc_data *nd, int i) return 0; } -int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char* eventname); //[Lance] +static int npc_event_sub(struct map_session_data *sd, struct event_data *ev, const char *eventname); //[Lance] /** * Exec name (NPC events) on player or global * Do on all NPC when called with foreach */ -void npc_event_doall_sub(void *key, void *data, va_list ap) +static void npc_event_doall_sub(void *key, void *data, va_list ap) { struct event_data* ev = data; int* c; @@ -434,7 +437,7 @@ void npc_event_doall_sub(void *key, void *data, va_list ap) } // runs the specified event (supports both single-npc and global events) -int npc_event_do(const char* name) +static int npc_event_do(const char *name) { nullpo_ret(name); if( name[0] == ':' && name[1] == ':' ) { @@ -451,7 +454,7 @@ int npc_event_do(const char* name) } // runs the specified event, with a RID attached (global only) -int npc_event_doall_id(const char* name, int rid) +static int npc_event_doall_id(const char *name, int rid) { int c = 0; struct linkdb_node **label_linkdb = strdb_get(npc->ev_label_db, name); @@ -464,7 +467,7 @@ int npc_event_doall_id(const char* name, int rid) } // runs the specified event (global only) -int npc_event_doall(const char* name) +static int npc_event_doall(const char *name) { return npc->event_doall_id(name, 0); } @@ -473,7 +476,8 @@ int npc_event_doall(const char* name) * Clock event execution * OnMinute/OnClock/OnHour/OnDay/OnDDHHMM *------------------------------------------*/ -int npc_event_do_clock(int tid, int64 tick, int id, intptr_t data) { +static int npc_event_do_clock(int tid, int64 tick, int id, intptr_t data) +{ static struct tm ev_tm_b; // tracks previous execution time time_t clock; struct tm* t; @@ -525,7 +529,7 @@ int npc_event_do_clock(int tid, int64 tick, int id, intptr_t data) { * OnInit event execution (the start of the event and watch) * @param reload Is the server reloading? **/ -void npc_event_do_oninit( bool reload ) +static void npc_event_do_oninit(bool reload) { ShowStatus("Event '"CL_WHITE"OnInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs."CL_CLL"\n", npc->event_doall("OnInit")); @@ -538,7 +542,7 @@ void npc_event_do_oninit( bool reload ) * Incorporation of the label for the timer event * called from npc_parse_script *------------------------------------------*/ -int npc_timerevent_export(struct npc_data *nd, int i) +static int npc_timerevent_export(struct npc_data *nd, int i) { int t = 0, len = 0; char *lname; @@ -577,7 +581,7 @@ struct timer_event_data { /*========================================== * triger 'OnTimerXXXX' events *------------------------------------------*/ -int npc_timerevent(int tid, int64 tick, int id, intptr_t data) +static int npc_timerevent(int tid, int64 tick, int id, intptr_t data) { int old_rid, old_timer; int64 old_tick; @@ -648,7 +652,8 @@ int npc_timerevent(int tid, int64 tick, int id, intptr_t data) /*========================================== * Start/Resume NPC timer *------------------------------------------*/ -int npc_timerevent_start(struct npc_data* nd, int rid) { +static int npc_timerevent_start(struct npc_data *nd, int rid) +{ int j; int64 tick = timer->gettick(); struct map_session_data *sd = NULL; //Player to whom script is attached. @@ -700,7 +705,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid) { /*========================================== * Stop NPC timer *------------------------------------------*/ -int npc_timerevent_stop(struct npc_data* nd) +static int npc_timerevent_stop(struct npc_data *nd) { struct map_session_data *sd = NULL; int *tid; @@ -734,7 +739,7 @@ int npc_timerevent_stop(struct npc_data* nd) /*========================================== * Aborts a running NPC timer that is attached to a player. *------------------------------------------*/ -void npc_timerevent_quit(struct map_session_data* sd) +static void npc_timerevent_quit(struct map_session_data *sd) { const struct TimerData *td; struct npc_data* nd; @@ -799,7 +804,8 @@ void npc_timerevent_quit(struct map_session_data* sd) * Get the tick value of an NPC timer * If it's stopped, return stopped time *------------------------------------------*/ -int64 npc_gettimerevent_tick(struct npc_data* nd) { +static int64 npc_gettimerevent_tick(struct npc_data *nd) +{ int64 tick; nullpo_ret(nd); @@ -815,7 +821,7 @@ int64 npc_gettimerevent_tick(struct npc_data* nd) { /*========================================== * Set tick for running and stopped timer *------------------------------------------*/ -int npc_settimerevent_tick(struct npc_data* nd, int newtimer) +static int npc_settimerevent_tick(struct npc_data *nd, int newtimer) { bool flag; int old_rid; @@ -839,7 +845,7 @@ int npc_settimerevent_tick(struct npc_data* nd, int newtimer) return 0; } -int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char* eventname) +static int npc_event_sub(struct map_session_data *sd, struct event_data *ev, const char *eventname) { nullpo_retr(2, sd); nullpo_retr(2, eventname); @@ -870,7 +876,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char /*========================================== * NPC processing event type *------------------------------------------*/ -int npc_event(struct map_session_data* sd, const char* eventname, int ontouch) +static int npc_event(struct map_session_data *sd, const char *eventname, int ontouch) { struct event_data* ev = (struct event_data*)strdb_get(npc->ev_db, eventname); struct npc_data *nd; @@ -899,7 +905,8 @@ int npc_event(struct map_session_data* sd, const char* eventname, int ontouch) /*========================================== * Sub chk then execute area event type *------------------------------------------*/ -int npc_touch_areanpc_sub(struct block_list *bl, va_list ap) { +static int npc_touch_areanpc_sub(struct block_list *bl, va_list ap) +{ struct map_session_data *sd; int pc_id; char *name; @@ -926,7 +933,8 @@ int npc_touch_areanpc_sub(struct block_list *bl, va_list ap) { * Chk if sd is still touching his assigned npc. * If not, it unsets it and searches for another player in range. *------------------------------------------*/ -int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap) { +static int npc_touchnext_areanpc(struct map_session_data *sd, bool leavemap) +{ struct npc_data *nd; short xs, ys; @@ -955,7 +963,7 @@ int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap) { /*========================================== * Exec OnTouch for player if in range of area event *------------------------------------------*/ -int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) +static int npc_touch_areanpc(struct map_session_data *sd, int16 m, int16 x, int16 y) { int xs,ys; int f = 1; @@ -1044,7 +1052,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) /*========================================== * Exec OnUnTouch for player if out range of area event *------------------------------------------*/ -int npc_untouch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) +static int npc_untouch_areanpc(struct map_session_data *sd, int16 m, int16 x, int16 y) { struct npc_data *nd = NULL; nullpo_retr(1, sd); @@ -1066,7 +1074,7 @@ int npc_untouch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) // OnTouch NPC or Warp for Mobs // Return 1 if Warped -int npc_touch_areanpc2(struct mob_data *md) +static int npc_touch_areanpc2(struct mob_data *md) { int i, m, x, y, id; char eventname[EVENT_NAME_LENGTH]; @@ -1131,7 +1139,8 @@ int npc_touch_areanpc2(struct mob_data *md) //Flag determines the type of object to check for: //&1: NPC Warps //&2: NPCs with on-touch events. -int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) { +static int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) +{ int i; int x0,y0,x1,y1; int xs,ys; @@ -1190,7 +1199,7 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range) { * Chk if player not too far to access the npc. * Returns npc_data (success) or NULL (fail). *------------------------------------------*/ -struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* bl) +static struct npc_data *npc_checknear(struct map_session_data *sd, struct block_list *bl) { struct npc_data *nd = BL_CAST(BL_NPC, bl); int distance = AREA_SIZE + 1; @@ -1223,7 +1232,7 @@ struct npc_data* npc_checknear(struct map_session_data* sd, struct block_list* b /*========================================== * Make NPC talk in global chat (like npctalk) *------------------------------------------*/ -int npc_globalmessage(const char* name, const char* mes) +static int npc_globalmessage(const char *name, const char *mes) { struct npc_data* nd = npc->name2id(name); char temp[100]; @@ -1241,7 +1250,8 @@ int npc_globalmessage(const char* name, const char* mes) } // MvP tomb [GreenBox] -void run_tomb(struct map_session_data* sd, struct npc_data* nd) { +static void run_tomb(struct map_session_data *sd, struct npc_data *nd) +{ char buffer[200]; char time[10]; @@ -1269,7 +1279,7 @@ void run_tomb(struct map_session_data* sd, struct npc_data* nd) { * NPC 1st call when clicking on npc * Do specific action for NPC type (openshop, run scripts...) *------------------------------------------*/ -int npc_click(struct map_session_data* sd, struct npc_data* nd) +static int npc_click(struct map_session_data *sd, struct npc_data *nd) { nullpo_retr(1, sd); @@ -1323,7 +1333,8 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) /*========================================== * *------------------------------------------*/ -int npc_scriptcont(struct map_session_data* sd, int id, bool closing) { +static int npc_scriptcont(struct map_session_data *sd, int id, bool closing) +{ struct block_list *target = map->id2bl(id); nullpo_retr(1, sd); @@ -1372,7 +1383,8 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing) { /*========================================== * Chk if valid call then open buy or selling list *------------------------------------------*/ -int npc_buysellsel(struct map_session_data* sd, int id, int type) { +static int npc_buysellsel(struct map_session_data *sd, int id, int type) +{ struct npc_data *nd; nullpo_retr(1, sd); @@ -1411,9 +1423,9 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) { } /*========================================== -* Cash Shop Buy List -*------------------------------------------*/ -int npc_cashshop_buylist(struct map_session_data *sd, int points, struct itemlist *item_list) + * Cash Shop Buy List + *------------------------------------------*/ +static int npc_cashshop_buylist(struct map_session_data *sd, int points, struct itemlist *item_list) { int i, j, new_, w, vt; struct npc_data *nd = NULL; @@ -1514,7 +1526,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, struct itemlis } //npc_buylist for script-controlled shops. -int npc_buylist_sub(struct map_session_data *sd, struct itemlist *item_list, struct npc_data *nd) +static int npc_buylist_sub(struct map_session_data *sd, struct itemlist *item_list, struct npc_data *nd) { char npc_ev[EVENT_NAME_LENGTH]; int i; @@ -1546,7 +1558,7 @@ int npc_buylist_sub(struct map_session_data *sd, struct itemlist *item_list, str /** * Loads persistent NPC Market Data from SQL **/ -void npc_market_fromsql(void) +static void npc_market_fromsql(void) { struct SqlStmt *stmt = SQL->StmtMalloc(map->mysql_handle); char name[NAME_LENGTH+1]; @@ -1597,7 +1609,8 @@ void npc_market_fromsql(void) /** * Saves persistent NPC Market Data into SQL **/ -void npc_market_tosql(struct npc_data *nd, unsigned short index) { +static void npc_market_tosql(struct npc_data *nd, unsigned short index) +{ nullpo_retv(nd); Assert_retv(index < nd->u.scr.shop->items); if (SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%u')", @@ -1607,7 +1620,8 @@ void npc_market_tosql(struct npc_data *nd, unsigned short index) { /** * Removes persistent NPC Market Data from SQL */ -void npc_market_delfromsql_sub(const char *npcname, unsigned short index) { +static void npc_market_delfromsql_sub(const char *npcname, unsigned short index) +{ if( index == USHRT_MAX ) { if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `name`='%s'", map->npc_market_data_db, npcname) ) Sql_ShowDebug(map->mysql_handle); @@ -1620,7 +1634,8 @@ void npc_market_delfromsql_sub(const char *npcname, unsigned short index) { /** * Removes persistent NPC Market Data from SQL **/ -void npc_market_delfromsql(struct npc_data *nd, unsigned short index) { +static void npc_market_delfromsql(struct npc_data *nd, unsigned short index) +{ nullpo_retv(nd); Assert_retv(index == USHRT_MAX || index < nd->u.scr.shop->items); npc->market_delfromsql_sub(nd->exname, index == USHRT_MAX ? index : nd->u.scr.shop->item[index].nameid); @@ -1628,7 +1643,8 @@ void npc_market_delfromsql(struct npc_data *nd, unsigned short index) { /** * Judges whether to allow and spawn a trader's window. **/ -bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) { +static bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) +{ nullpo_retr(false, sd); nullpo_retr(false, nd); if( !nd->u.scr.shop || !nd->u.scr.shop->items ) @@ -1668,7 +1684,8 @@ bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) { * * @param master id of the original npc **/ -void npc_trader_update(int master) { +static void npc_trader_update(int master) +{ struct DBIterator *iter; struct block_list* bl; struct npc_data *master_nd = map->id2nd(master); @@ -1692,7 +1709,8 @@ void npc_trader_update(int master) { * @param nd shop * @param sd player **/ -void npc_trader_count_funds(struct npc_data *nd, struct map_session_data *sd) { +static void npc_trader_count_funds(struct npc_data *nd, struct map_session_data *sd) +{ char evname[EVENT_NAME_LENGTH]; struct event_data *ev = NULL; @@ -1732,7 +1750,8 @@ void npc_trader_count_funds(struct npc_data *nd, struct map_session_data *sd) { * * @return bool whether it was successful (if the script does not respond it will fail) **/ -bool npc_trader_pay(struct npc_data *nd, struct map_session_data *sd, int price, int points) { +static bool npc_trader_pay(struct npc_data *nd, struct map_session_data *sd, int price, int points) +{ char evname[EVENT_NAME_LENGTH]; struct event_data *ev = NULL; @@ -1753,7 +1772,8 @@ bool npc_trader_pay(struct npc_data *nd, struct map_session_data *sd, int price, /*========================================== * Cash Shop Buy *------------------------------------------*/ -int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points) { +static int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points) +{ struct npc_data *nd = NULL; struct item_data *item; struct npc_item_list *shop = NULL; @@ -1858,7 +1878,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po * @param item_list List of items. * @return result code for clif->parse_NpcBuyListSend. */ -int npc_buylist(struct map_session_data *sd, struct itemlist *item_list) +static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list) { struct npc_data* nd; struct npc_item_list *shop = NULL; @@ -1981,7 +2001,7 @@ int npc_buylist(struct map_session_data *sd, struct itemlist *item_list) /** * Processes incoming npc market purchase list **/ -int npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list) +static int npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list) { struct npc_data* nd; struct npc_item_list *shop = NULL; @@ -2088,7 +2108,7 @@ int npc_market_buylist(struct map_session_data *sd, struct itemlist *item_list) } /// npc_selllist for script-controlled shops -int npc_selllist_sub(struct map_session_data *sd, struct itemlist *item_list, struct npc_data *nd) +static int npc_selllist_sub(struct map_session_data *sd, struct itemlist *item_list, struct npc_data *nd) { char npc_ev[EVENT_NAME_LENGTH]; char card_slot[NAME_LENGTH]; @@ -2181,7 +2201,7 @@ int npc_selllist_sub(struct map_session_data *sd, struct itemlist *item_list, st /// /// @param item_list 'n' pairs <index,amount> /// @return result code for clif->parse_NpcSellListSend -int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) +static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) { int64 z; int i,skill_t, skill_idx = skill->get_index(MC_OVERCHARGE); @@ -2280,7 +2300,8 @@ int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) //Atempt to remove an npc from a map //This doesn't remove it from map_db -int npc_remove_map(struct npc_data* nd) { +static int npc_remove_map(struct npc_data *nd) +{ int16 m,i; nullpo_retr(1, nd); @@ -2303,7 +2324,7 @@ int npc_remove_map(struct npc_data* nd) { /** * @see DBApply */ -int npc_unload_ev(union DBKey key, struct DBData *data, va_list ap) +static int npc_unload_ev(union DBKey key, struct DBData *data, va_list ap) { struct event_data* ev = DB->data2ptr(data); char* npcname = va_arg(ap, char *); @@ -2318,7 +2339,7 @@ int npc_unload_ev(union DBKey key, struct DBData *data, va_list ap) /** * @see DBApply */ -int npc_unload_ev_label(union DBKey key, struct DBData *data, va_list ap) +static int npc_unload_ev_label(union DBKey key, struct DBData *data, va_list ap) { struct linkdb_node **label_linkdb = DB->data2ptr(data); struct npc_data* nd = va_arg(ap, struct npc_data *); @@ -2330,7 +2351,7 @@ int npc_unload_ev_label(union DBKey key, struct DBData *data, va_list ap) //Chk if npc matches src_id, then unload. //Sub-function used to find duplicates. -int npc_unload_dup_sub(struct npc_data* nd, va_list args) +static int npc_unload_dup_sub(struct npc_data *nd, va_list args) { int src_id; @@ -2342,14 +2363,15 @@ int npc_unload_dup_sub(struct npc_data* nd, va_list args) } //Removes all npcs that are duplicates of the passed one. [Skotlex] -void npc_unload_duplicates(struct npc_data* nd) { +static void npc_unload_duplicates(struct npc_data *nd) +{ nullpo_retv(nd); map->foreachnpc(npc->unload_dup_sub,nd->bl.id); } //Removes an npc from map and db. //Single is to free name (for duplicates). -int npc_unload(struct npc_data* nd, bool single) +static int npc_unload(struct npc_data *nd, bool single) { nullpo_ret(nd); @@ -2449,7 +2471,7 @@ int npc_unload(struct npc_data* nd, bool single) // /// Clears the npc source file list -void npc_clearsrcfile(void) +static void npc_clearsrcfile(void) { struct npc_src_list* file = npc->src_files; @@ -2466,7 +2488,7 @@ void npc_clearsrcfile(void) * * @param name The file name to add. */ -void npc_addsrcfile(const char *name) +static void npc_addsrcfile(const char *name) { struct npc_src_list* file; struct npc_src_list* file_prev = NULL; @@ -2496,7 +2518,7 @@ void npc_addsrcfile(const char *name) * * @param name The file name to remove. */ -void npc_delsrcfile(const char *name) +static void npc_delsrcfile(const char *name) { struct npc_src_list* file = npc->src_files; struct npc_src_list* file_prev = NULL; @@ -2523,7 +2545,7 @@ void npc_delsrcfile(const char *name) * @param filepath The file path to retain. * @return A retained reference to filepath. */ -const char *npc_retainpathreference(const char *filepath) +static const char *npc_retainpathreference(const char *filepath) { struct npc_path_data * npd = NULL; nullpo_ret(filepath); @@ -2558,7 +2580,7 @@ const char *npc_retainpathreference(const char *filepath) * * @param filepath The file path to release. */ -void npc_releasepathreference(const char *filepath) +static void npc_releasepathreference(const char *filepath) { struct npc_path_data* npd = NULL; @@ -2577,7 +2599,8 @@ void npc_releasepathreference(const char *filepath) /// Parses and sets the name and exname of a npc. /// Assumes that m, x and y are already set in nd. -void npc_parsename(struct npc_data* nd, const char* name, const char* start, const char* buffer, const char* filepath) { +static void npc_parsename(struct npc_data *nd, const char *name, const char *start, const char *buffer, const char *filepath) +{ const char* p; struct npc_data* dnd;// duplicate npc char newname[NAME_LENGTH]; @@ -2635,7 +2658,8 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con // Parse View // Support for using Constants in place of NPC View IDs. -int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) { +static int npc_parseview(const char *w4, const char *start, const char *buffer, const char *filepath) +{ int val = FAKE_NPC, i = 0; char viewid[1024]; // Max size of name from constants.conf, see script->read_constdb. @@ -2669,7 +2693,7 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c // View is ID // Checks if given view is an ID or constant. -bool npc_viewisid(const char * viewid) +static bool npc_viewisid(const char *viewid) { nullpo_retr(false, viewid); if (atoi(viewid) != FAKE_NPC) { @@ -2693,7 +2717,7 @@ bool npc_viewisid(const char * viewid) * @param class_ The NPC view class. * @return A pointer to the created NPC data (ownership passed to the caller). */ -struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, uint8 dir, int16 class_) +static struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, uint8 dir, int16 class_) { struct npc_data *nd; @@ -2715,7 +2739,8 @@ struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, u } //Add then display an npc warp on map -struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y) { +static struct npc_data *npc_add_warp(char *name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y) +{ int i, flag = 0; struct npc_data *nd; @@ -2762,7 +2787,7 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_warp(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_warp(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { int x, y, xs, ys, to_x, to_y, m; unsigned short i; @@ -2829,7 +2854,7 @@ const char *npc_parse_warp(const char *w1, const char *w2, const char *w3, const * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_shop(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_shop(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { //TODO: could be rewritten to NOT need this temp array [ultramage] // We could use nd->u.shop.shop_item to store directly the items, but this could lead @@ -2956,7 +2981,8 @@ const char *npc_parse_shop(const char *w1, const char *w2, const char *w3, const return strchr(start,'\n');// continue } -void npc_convertlabel_db(struct npc_label_list* label_list, const char *filepath) { +static void npc_convertlabel_db(struct npc_label_list *label_list, const char *filepath) +{ int i; nullpo_retv(label_list); @@ -2988,7 +3014,8 @@ void npc_convertlabel_db(struct npc_label_list* label_list, const char *filepath } // Skip the contents of a script. -const char* npc_skip_script(const char* start, const char* buffer, const char* filepath, int *retval) { +static const char *npc_skip_script(const char *start, const char *buffer, const char *filepath, int *retval) +{ const char* p; int curly_count; @@ -3074,7 +3101,7 @@ const char* npc_skip_script(const char* start, const char* buffer, const char* f * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_script(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval) +static const char *npc_parse_script(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval) { int x, y, dir = 0, m, xs = 0, ys = 0; // [Valaris] thanks to fov struct script_code *scriptroot; @@ -3194,7 +3221,7 @@ const char *npc_parse_script(const char *w1, const char *w2, const char *w3, con * * @param nd The NPC to register. */ -void npc_add_to_location(struct npc_data *nd) +static void npc_add_to_location(struct npc_data *nd) { nullpo_retv(nd); @@ -3218,7 +3245,7 @@ void npc_add_to_location(struct npc_data *nd) /** * Duplicates a script (@see npc_duplicate_sub) */ -bool npc_duplicate_script_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) +static bool npc_duplicate_script_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) { int i; bool retval = true; @@ -3268,7 +3295,7 @@ bool npc_duplicate_script_sub(struct npc_data *nd, const struct npc_data *snd, i /** * Duplicates a shop or cash shop (@see npc_duplicate_sub) */ -bool npc_duplicate_shop_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) +static bool npc_duplicate_shop_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) { nullpo_retr(false, nd); nullpo_retr(false, snd); @@ -3286,7 +3313,7 @@ bool npc_duplicate_shop_sub(struct npc_data *nd, const struct npc_data *snd, int /** * Duplicates a warp (@see npc_duplicate_sub) */ -bool npc_duplicate_warp_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) +static bool npc_duplicate_warp_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) { nullpo_retr(false, nd); nullpo_retr(false, snd); @@ -3318,7 +3345,7 @@ bool npc_duplicate_warp_sub(struct npc_data *nd, const struct npc_data *snd, int * @param options The NPC options. * @retval false if there were any issues while creating and validating the NPC. */ -bool npc_duplicate_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) +static bool npc_duplicate_sub(struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options) { nullpo_retr(false, nd); nullpo_retr(false, snd); @@ -3376,7 +3403,7 @@ bool npc_duplicate_sub(struct npc_data *nd, const struct npc_data *snd, int xs, * @remark * Only `NPO_ONINIT` is available trough the options argument. */ -const char *npc_parse_duplicate(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval) +static const char *npc_parse_duplicate(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval) { int x, y, dir, m, xs = -1, ys = -1; char srcname[128]; @@ -3468,7 +3495,7 @@ const char *npc_parse_duplicate(const char *w1, const char *w2, const char *w3, * @return success state. * @retval 0 in case of successful creation. */ -int npc_duplicate4instance(struct npc_data *snd, int16 m) +static int npc_duplicate4instance(struct npc_data *snd, int16 m) { char newname[NAME_LENGTH]; int dm = -1, im = -1, xs = -1, ys = -1; @@ -3524,7 +3551,7 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) } //Set mapcell CELL_NPC to trigger event later -void npc_setcells(struct npc_data* nd) +static void npc_setcells(struct npc_data *nd) { int16 m, x, y, xs, ys; int i,j; @@ -3558,7 +3585,7 @@ void npc_setcells(struct npc_data* nd) } } -int npc_unsetcells_sub(struct block_list *bl, va_list ap) +static int npc_unsetcells_sub(struct block_list *bl, va_list ap) { struct npc_data *nd = NULL; int id = va_arg(ap, int); @@ -3573,7 +3600,8 @@ int npc_unsetcells_sub(struct block_list *bl, va_list ap) return 1; } -void npc_unsetcells(struct npc_data* nd) { +static void npc_unsetcells(struct npc_data *nd) +{ int16 m, x, y, xs, ys; int i,j, x0, x1, y0, y1; @@ -3613,7 +3641,7 @@ void npc_unsetcells(struct npc_data* nd) { map->foreachinarea( npc->unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id ); } -void npc_movenpc(struct npc_data* nd, int16 x, int16 y) +static void npc_movenpc(struct npc_data *nd, int16 x, int16 y) { int16 m; nullpo_retv(nd); @@ -3632,7 +3660,7 @@ void npc_movenpc(struct npc_data* nd, int16 x, int16 y) /// /// @param nd Target npc /// @param newname New display name -void npc_setdisplayname(struct npc_data* nd, const char* newname) +static void npc_setdisplayname(struct npc_data *nd, const char *newname) { nullpo_retv(nd); nullpo_retv(newname); @@ -3646,7 +3674,8 @@ void npc_setdisplayname(struct npc_data* nd, const char* newname) /// /// @param nd Target npc /// @param class_ New display class -void npc_setclass(struct npc_data* nd, short class_) { +static void npc_setclass(struct npc_data *nd, short class_) +{ nullpo_retv(nd); if( nd->class_ == class_ ) @@ -3660,7 +3689,7 @@ void npc_setclass(struct npc_data* nd, short class_) { clif->spawn(&nd->bl);// fade in } -void npc_refresh(struct npc_data* nd) +static void npc_refresh(struct npc_data *nd) { nullpo_retv(nd); @@ -3673,7 +3702,7 @@ void npc_refresh(struct npc_data* nd) } // @commands (script based) -int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname) +static int npc_do_atcmd_event(struct map_session_data *sd, const char *command, const char *message, const char *eventname) { struct event_data* ev = (struct event_data*)strdb_get(npc->ev_db, eventname); struct npc_data *nd; @@ -3760,7 +3789,7 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_function(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_function(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { struct DBMap *func_db; struct DBData old_data; @@ -3814,7 +3843,7 @@ const char *npc_parse_function(const char *w1, const char *w2, const char *w3, c * Parse Mob 2 - Actually Spawns Mob * [Wizputer] *------------------------------------------*/ -void npc_parse_mob2(struct spawn_data* mobspawn) +static void npc_parse_mob2(struct spawn_data *mobspawn) { int i; @@ -3844,7 +3873,7 @@ void npc_parse_mob2(struct spawn_data* mobspawn) * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_mob(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_mob(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { int num, class_, m,x,y,xs,ys, i,j; int mob_lv = -1, ai = -1, size = -1; @@ -4030,7 +4059,7 @@ const char *npc_parse_mob(const char *w1, const char *w2, const char *w3, const * * @see npc_parse_mapflag */ -void npc_parse_unknown_mapflag(const char *name, const char *w3, const char *w4, const char* start, const char* buffer, const char* filepath, int *retval) +static void npc_parse_unknown_mapflag(const char *name, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer)); if (retval) @@ -4062,7 +4091,7 @@ void npc_parse_unknown_mapflag(const char *name, const char *w3, const char *w4, * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { int16 m; char mapname[32]; @@ -4545,7 +4574,7 @@ const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, co * (EXIT_FAILURE) status. May be NULL. * @return A pointer to the advanced buffer position. */ -const char *npc_parse_unknown_object(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +static const char *npc_parse_unknown_object(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { nullpo_retr(start, retval); ShowError("npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4); @@ -4563,7 +4592,8 @@ const char *npc_parse_unknown_object(const char *w1, const char *w2, const char * @retval EXIT_SUCCESS if filepath was loaded correctly. * @retval EXIT_FAILURE if there were errors/warnings when loading filepath. */ -int npc_parsesrcfile(const char* filepath, bool runOnInit) { +static int npc_parsesrcfile(const char *filepath, bool runOnInit) +{ int success = EXIT_SUCCESS; int16 m, x, y; int lines = 0; @@ -4751,7 +4781,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) { return success; } -int npc_script_event(struct map_session_data* sd, enum npce_event type) +static int npc_script_event(struct map_session_data *sd, enum npce_event type) { int i; if (type == NPCE_MAX) @@ -4765,7 +4795,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type) return i; } -void npc_read_event_script(void) +static void npc_read_event_script(void) { int i; struct { @@ -4828,7 +4858,7 @@ void npc_read_event_script(void) /** * @see DBApply */ -int npc_path_db_clear_sub(union DBKey key, struct DBData *data, va_list args) +static int npc_path_db_clear_sub(union DBKey key, struct DBData *data, va_list args) { struct npc_path_data *npd = DB->data2ptr(data); nullpo_ret(npd); @@ -4840,7 +4870,7 @@ int npc_path_db_clear_sub(union DBKey key, struct DBData *data, va_list args) /** * @see DBApply */ -int npc_ev_label_db_clear_sub(union DBKey key, struct DBData *data, va_list args) +static int npc_ev_label_db_clear_sub(union DBKey key, struct DBData *data, va_list args) { struct linkdb_node **label_linkdb = DB->data2ptr(data); linkdb_final(label_linkdb); // linked data (struct event_data*) is freed when clearing ev_db @@ -4851,7 +4881,8 @@ int npc_ev_label_db_clear_sub(union DBKey key, struct DBData *data, va_list args * Main npc file processing * @param npc_min Minimum npc id - used to know how many NPCs were loaded **/ -void npc_process_files( int npc_min ) { +static void npc_process_files(int npc_min) +{ struct npc_src_list *file; // Current file ShowStatus("Loading NPCs...\r"); @@ -4871,7 +4902,8 @@ void npc_process_files( int npc_min ) { } //Clear then reload npcs files -int npc_reload(void) { +static int npc_reload(void) +{ int npc_new_min = npc->npc_id; struct s_mapiterator* iter; struct block_list* bl; @@ -4970,7 +5002,7 @@ int npc_reload(void) { } //Unload all npc in the given file -bool npc_unloadfile(const char *filepath) +static bool npc_unloadfile(const char *filepath) { struct DBIterator *iter = db_iterator(npc->name_db); struct npc_data* nd = NULL; @@ -4994,7 +5026,8 @@ bool npc_unloadfile(const char *filepath) return found; } -void do_clear_npc(void) { +static void do_clear_npc(void) +{ db_clear(npc->name_db); db_clear(npc->ev_db); npc->ev_label_db->clear(npc->ev_label_db, npc->ev_label_db_clear_sub); @@ -5003,7 +5036,8 @@ void do_clear_npc(void) { /*========================================== * Destructor *------------------------------------------*/ -int do_final_npc(void) { +static int do_final_npc(void) +{ db_destroy(npc->ev_db); npc->ev_label_db->destroy(npc->ev_label_db, npc->ev_label_db_clear_sub); db_destroy(npc->name_db); @@ -5014,7 +5048,8 @@ int do_final_npc(void) { return 0; } -void npc_debug_warps_sub(struct npc_data* nd) { +static void npc_debug_warps_sub(struct npc_data *nd) +{ int16 m; nullpo_retv(nd); @@ -5042,7 +5077,8 @@ void npc_debug_warps_sub(struct npc_data* nd) { } } -static void npc_debug_warps(void) { +static void npc_debug_warps(void) +{ int16 m, i; for (m = 0; m < map->count; m++) for (i = 0; i < map->list[m].npc_num; i++) @@ -5052,7 +5088,8 @@ static void npc_debug_warps(void) { /*========================================== * npc initialization *------------------------------------------*/ -int do_init_npc(bool minimal) { +static int do_init_npc(bool minimal) +{ int i; unit->init_ud(&npc->base_ud); @@ -5123,7 +5160,8 @@ int do_init_npc(bool minimal) { return 0; } -void npc_defaults(void) { +void npc_defaults(void) +{ npc = &npc_s; npc->npc_id = START_NPC_NUM; diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 3052ddd83..92393122e 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -40,8 +40,8 @@ /** * interface sources **/ -struct npc_chat_interface npc_chat_s; -struct pcre_interface libpcre_s; +static struct npc_chat_interface npc_chat_s; +static struct pcre_interface libpcre_s; struct npc_chat_interface *npc_chat; struct pcre_interface *libpcre; @@ -98,7 +98,7 @@ struct pcre_interface *libpcre; * * This does NOT do the list management */ -void finalize_pcrematch_entry(struct pcrematch_entry* e) +static void finalize_pcrematch_entry(struct pcrematch_entry *e) { nullpo_retv(e); libpcre->free(e->pcre_); @@ -110,7 +110,8 @@ void finalize_pcrematch_entry(struct pcrematch_entry* e) /** * Lookup (and possibly create) a new set of patterns by the set id */ -struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid) { +static struct pcrematch_set *lookup_pcreset(struct npc_data *nd, int setid) +{ struct pcrematch_set *pcreset; struct npc_parse *npcParse; @@ -152,7 +153,7 @@ struct pcrematch_set* lookup_pcreset(struct npc_data* nd, int setid) { * * if the setid does not exist, this will silently return */ -void activate_pcreset(struct npc_data* nd, int setid) +static void activate_pcreset(struct npc_data *nd, int setid) { struct pcrematch_set *pcreset; struct npc_parse *npcParse; @@ -187,7 +188,7 @@ void activate_pcreset(struct npc_data* nd, int setid) * * if the setid does not exist, this will silently return */ -void deactivate_pcreset(struct npc_data* nd, int setid) +static void deactivate_pcreset(struct npc_data *nd, int setid) { struct pcrematch_set *pcreset; struct npc_parse *npcParse; @@ -225,7 +226,7 @@ void deactivate_pcreset(struct npc_data* nd, int setid) /** * delete a set of patterns. */ -void delete_pcreset(struct npc_data* nd, int setid) +static void delete_pcreset(struct npc_data *nd, int setid) { int active = 1; struct pcrematch_set *pcreset; @@ -277,7 +278,7 @@ void delete_pcreset(struct npc_data* nd, int setid) /** * create a new pattern entry */ -struct pcrematch_entry* create_pcrematch_entry(struct pcrematch_set* set) +static struct pcrematch_entry *create_pcrematch_entry(struct pcrematch_set *set) { struct pcrematch_entry *e; struct pcrematch_entry *last; @@ -310,7 +311,7 @@ struct pcrematch_entry* create_pcrematch_entry(struct pcrematch_set* set) /** * define/compile a new pattern */ -void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, const char* label) +static void npc_chat_def_pattern(struct npc_data *nd, int setid, const char *pattern, const char *label) { const char *err; int erroff; @@ -330,7 +331,7 @@ void npc_chat_def_pattern(struct npc_data* nd, int setid, const char* pattern, c * * this could be more efficient but.. how often do you do this? */ -void npc_chat_finalize(struct npc_data* nd) +static void npc_chat_finalize(struct npc_data *nd) { struct npc_parse *npcParse; @@ -352,7 +353,7 @@ void npc_chat_finalize(struct npc_data* nd) /** * Handler called whenever a global message is spoken in a NPC's area */ -int npc_chat_sub(struct block_list* bl, va_list ap) +static int npc_chat_sub(struct block_list *bl, va_list ap) { struct npc_data *nd = NULL; struct npc_parse *npcParse = NULL; @@ -463,7 +464,8 @@ BUILDIN(deletepset) return true; } -void npc_chat_defaults(void) { +void npc_chat_defaults(void) +{ npc_chat = &npc_chat_s; npc_chat->sub = npc_chat_sub; diff --git a/src/map/party.c b/src/map/party.c index b48a00590..9024b1c19 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -51,14 +51,15 @@ #include <stdlib.h> #include <string.h> -struct party_interface party_s; +static struct party_interface party_s; struct party_interface *party; /*========================================== * Fills the given party_member structure according to the sd provided. * Used when creating/adding people to a party. [Skotlex] *------------------------------------------*/ -void party_fill_member(struct party_member* member, struct map_session_data* sd, unsigned int leader) { +static void party_fill_member(struct party_member *member, struct map_session_data *sd, unsigned int leader) +{ nullpo_retv(member); nullpo_retv(sd); @@ -80,7 +81,7 @@ void party_fill_member(struct party_member* member, struct map_session_data* sd, * @return the member_id. * @retval INDEX_NOT_FOUND if not in party. */ -int party_getmemberid(struct party_data *p, struct map_session_data *sd) +static int party_getmemberid(struct party_data *p, struct map_session_data *sd) { int member_id; nullpo_retr(INDEX_NOT_FOUND, p); @@ -98,7 +99,7 @@ int party_getmemberid(struct party_data *p, struct map_session_data *sd) /*========================================== * Request an available sd of this party *------------------------------------------*/ -struct map_session_data* party_getavailablesd(struct party_data *p) +static struct map_session_data *party_getavailablesd(struct party_data *p) { int i; nullpo_retr(NULL, p); @@ -109,7 +110,7 @@ struct map_session_data* party_getavailablesd(struct party_data *p) /*========================================== * Retrieves and validates the sd pointer for this party member [Skotlex] *------------------------------------------*/ -struct map_session_data *party_sd_check(int party_id, int account_id, int char_id) +static struct map_session_data *party_sd_check(int party_id, int account_id, int char_id) { struct map_session_data *sd = map->id2sd(account_id); @@ -126,7 +127,7 @@ struct map_session_data *party_sd_check(int party_id, int account_id, int char_i return sd; } -int party_db_final(union DBKey key, struct DBData *data, va_list ap) +static int party_db_final(union DBKey key, struct DBData *data, va_list ap) { struct party_data *p; @@ -139,7 +140,7 @@ int party_db_final(union DBKey key, struct DBData *data, va_list ap) return 0; } /// Party data lookup using party id. -struct party_data* party_search(int party_id) +static struct party_data *party_search(int party_id) { if(!party_id) return NULL; @@ -147,7 +148,7 @@ struct party_data* party_search(int party_id) } /// Party data lookup using party name. -struct party_data* party_searchname(const char* str) +static struct party_data *party_searchname(const char *str) { struct party_data* p; @@ -161,7 +162,7 @@ struct party_data* party_searchname(const char* str) return p; } -int party_create(struct map_session_data *sd, const char *name,int item,int item2) +static int party_create(struct map_session_data *sd, const char *name, int item, int item2) { struct party_member leader; char tname[NAME_LENGTH]; @@ -191,7 +192,7 @@ int party_create(struct map_session_data *sd, const char *name,int item,int item return 0; } -void party_created(int account_id, int char_id, int fail, int party_id, const char *name) +static void party_created(int account_id, int char_id, int fail, int party_id, const char *name) { struct map_session_data *sd; sd=map->id2sd(account_id); @@ -215,13 +216,14 @@ void party_created(int account_id, int char_id, int fail, int party_id, const ch } -int party_request_info(int party_id, int char_id) +static int party_request_info(int party_id, int char_id) { return intif->request_partyinfo(party_id, char_id); } /// Invoked (from char-server) when the party info is not found. -int party_recv_noinfo(int party_id, int char_id) { +static int party_recv_noinfo(int party_id, int char_id) +{ party->broken(party_id); if( char_id != 0 ) { // requester @@ -233,7 +235,8 @@ int party_recv_noinfo(int party_id, int char_id) { return 0; } -void party_check_state(struct party_data *p) { +static void party_check_state(struct party_data *p) +{ int i; nullpo_retv(p); memset(&p->state, 0, sizeof(p->state)); @@ -264,7 +267,7 @@ void party_check_state(struct party_data *p) { } } -int party_recv_info(const struct party *sp, int char_id) +static int party_recv_info(const struct party *sp, int char_id) { struct party_data* p; const struct party_member *member; @@ -362,7 +365,7 @@ int party_recv_info(const struct party *sp, int char_id) return 0; } -int party_invite(struct map_session_data *sd,struct map_session_data *tsd) +static int party_invite(struct map_session_data *sd, struct map_session_data *tsd) { struct party_data *p; int i; @@ -424,7 +427,8 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd) return 1; } -void party_reply_invite(struct map_session_data *sd,int party_id,int flag) { +static void party_reply_invite(struct map_session_data *sd, int party_id, int flag) +{ struct map_session_data* tsd; struct party_member member; @@ -457,7 +461,7 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag) { //- Loads up party data if not in server //- Sets up the pointer to him //- Player must be authed/active and belong to a party before calling this method -void party_member_joined(struct map_session_data *sd) +static void party_member_joined(struct map_session_data *sd) { struct party_data* p; int i; @@ -486,7 +490,8 @@ void party_member_joined(struct map_session_data *sd) /// Invoked (from char-server) when a new member is added to the party. /// flag: 0-success, 1-failure -int party_member_added(int party_id,int account_id,int char_id, int flag) { +static int party_member_added(int party_id, int account_id, int char_id, int flag) +{ struct map_session_data *sd = map->id2sd(account_id),*sd2; struct party_data *p = party->search(party_id); int i, j; @@ -546,7 +551,7 @@ int party_member_added(int party_id,int account_id,int char_id, int flag) { } /// Party member 'sd' requesting kick of member with <account_id, name>. -int party_removemember(struct map_session_data* sd, int account_id, const char *name) +static int party_removemember(struct map_session_data *sd, int account_id, const char *name) { struct party_data *p; int i; @@ -572,7 +577,7 @@ int party_removemember(struct map_session_data* sd, int account_id, const char * } /// Party member 'sd' requesting exit from party. -int party_leave(struct map_session_data *sd) +static int party_leave(struct map_session_data *sd) { struct party_data *p; int i; @@ -591,7 +596,7 @@ int party_leave(struct map_session_data *sd) } /// Invoked (from char-server) when a party member leaves the party. -int party_member_withdraw(int party_id, int account_id, int char_id) +static int party_member_withdraw(int party_id, int account_id, int char_id) { struct map_session_data* sd = map->id2sd(account_id); struct party_data* p = party->search(party_id); @@ -660,7 +665,7 @@ int party_member_withdraw(int party_id, int account_id, int char_id) } /// Invoked (from char-server) when a party is disbanded. -int party_broken(int party_id) +static int party_broken(int party_id) { struct party_data* p; int i, j; @@ -692,7 +697,7 @@ int party_broken(int party_id) return 0; } -int party_changeoption(struct map_session_data *sd,int exp,int item) +static int party_changeoption(struct map_session_data *sd, int exp, int item) { nullpo_ret(sd); @@ -702,7 +707,8 @@ int party_changeoption(struct map_session_data *sd,int exp,int item) return 0; } -int party_optionchanged(int party_id,int account_id,int exp,int item,int flag) { +static int party_optionchanged(int party_id, int account_id, int exp, int item, int flag) +{ struct party_data *p; struct map_session_data *sd=map->id2sd(account_id); if( (p=party->search(party_id))==NULL) @@ -719,7 +725,7 @@ int party_optionchanged(int party_id,int account_id,int exp,int item,int flag) { return 0; } -bool party_changeleader(struct map_session_data *sd, struct map_session_data *tsd) +static bool party_changeleader(struct map_session_data *sd, struct map_session_data *tsd) { struct party_data *p; int mi, tmi; @@ -777,7 +783,7 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts /// - changes maps /// - logs in or out /// - gains a level (disabled) -int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short mapid,int online,int lv) +static int party_recv_movemap(int party_id, int account_id, int char_id, unsigned short mapid, int online, int lv) { struct party_member* m; struct party_data* p; @@ -805,7 +811,7 @@ int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short m return 0; } -void party_send_movemap(struct map_session_data *sd) +static void party_send_movemap(struct map_session_data *sd) { struct party_data *p; @@ -840,12 +846,12 @@ void party_send_movemap(struct map_session_data *sd) return; } -void party_send_levelup(struct map_session_data *sd) +static void party_send_levelup(struct map_session_data *sd) { intif->party_changemap(sd,1); } -int party_send_logout(struct map_session_data *sd) +static int party_send_logout(struct map_session_data *sd) { struct party_data *p; int i; @@ -868,7 +874,7 @@ int party_send_logout(struct map_session_data *sd) return 1; } -int party_send_message(struct map_session_data *sd, const char *mes) +static int party_send_message(struct map_session_data *sd, const char *mes) { int len; @@ -888,7 +894,7 @@ int party_send_message(struct map_session_data *sd, const char *mes) return 0; } -int party_recv_message(int party_id,int account_id,const char *mes,int len) +static int party_recv_message(int party_id, int account_id, const char *mes, int len) { struct party_data *p; if( (p=party->search(party_id))==NULL) @@ -897,7 +903,7 @@ int party_recv_message(int party_id,int account_id,const char *mes,int len) return 0; } -int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv) +static int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv) { struct party_data *p; struct map_session_data *p_sd; @@ -949,7 +955,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id return 0; } -int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) +static int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { struct DBIterator *iter = db_iterator(party->db); struct party_data* p; @@ -988,7 +994,7 @@ int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -int party_send_xy_clear(struct party_data *p) +static int party_send_xy_clear(struct party_data *p) { int i; @@ -1004,7 +1010,7 @@ int party_send_xy_clear(struct party_data *p) } // exp share and added zeny share [Valaris] -int party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny) +static int party_exp_share(struct party_data *p, struct block_list *src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data* sd[MAX_PARTY]; unsigned int i, c; @@ -1045,7 +1051,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b } //Does party loot. first_charid holds the charid of the player who has time priority to take the item. -int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid) +static int party_share_loot(struct party_data *p, struct map_session_data *sd, struct item *item_data, int first_charid) { struct map_session_data *target = NULL; int i; @@ -1114,7 +1120,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i return 0; } -int party_send_dot_remove(struct map_session_data *sd) +static int party_send_dot_remove(struct map_session_data *sd) { nullpo_ret(sd); if (sd->status.party_id) @@ -1125,7 +1131,7 @@ int party_send_dot_remove(struct map_session_data *sd) // To use for Taekwon's "Fighting Chant" // int c = 0; // party_foreachsamemap(party->sub_count, sd, 0, &c); -int party_sub_count(struct block_list *bl, va_list ap) +static int party_sub_count(struct block_list *bl, va_list ap) { const struct map_session_data *sd = NULL; @@ -1147,7 +1153,8 @@ int party_sub_count(struct block_list *bl, va_list ap) * Arglist-based version of party_foreachsamemap * @see party_foreachsamemap */ -int party_vforeachsamemap(int (*func)(struct block_list*,va_list), struct map_session_data *sd, int range, va_list ap) { +static int party_vforeachsamemap(int (*func)(struct block_list*, va_list), struct map_session_data *sd, int range, va_list ap) +{ struct party_data *p; int i; int x0,y0,x1,y1; @@ -1193,7 +1200,7 @@ int party_vforeachsamemap(int (*func)(struct block_list*,va_list), struct map_se } // Special check for Minstrel's and Wanderer's chorus skills. -int party_sub_count_chorus(struct block_list *bl, va_list ap) +static int party_sub_count_chorus(struct block_list *bl, va_list ap) { const struct map_session_data *sd = NULL; @@ -1221,7 +1228,8 @@ int party_sub_count_chorus(struct block_list *bl, va_list ap) * @param ... Additional parameters to pass to func() * @return Sum of the return values from func() */ -int party_foreachsamemap(int (*func)(struct block_list*,va_list), struct map_session_data *sd, int range, ...) { +static int party_foreachsamemap(int (*func)(struct block_list*, va_list), struct map_session_data *sd, int range, ...) +{ va_list ap; int ret; va_start(ap, range); @@ -1234,14 +1242,16 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list), struct map_ses * Party Booking in KRO [Spiria] *------------------------------------------*/ -struct party_booking_ad_info* create_party_booking_data(void) { +static struct party_booking_ad_info *create_party_booking_data(void) +{ struct party_booking_ad_info *pb_ad; CREATE(pb_ad, struct party_booking_ad_info, 1); pb_ad->index = party->booking_nextid++; return pb_ad; } -void party_recruit_register(struct map_session_data *sd, short level, const char *notice) { +static void party_recruit_register(struct map_session_data *sd, short level, const char *notice) +{ #ifdef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; @@ -1273,7 +1283,8 @@ void party_recruit_register(struct map_session_data *sd, short level, const char #endif } -void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job) { +static void party_booking_register(struct map_session_data *sd, short level, short mapid, short *job) +{ #ifndef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; int i; @@ -1310,7 +1321,8 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi #endif } -void party_recruit_update(struct map_session_data *sd, const char *notice) { +static void party_recruit_update(struct map_session_data *sd, const char *notice) +{ #ifdef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; @@ -1331,7 +1343,8 @@ void party_recruit_update(struct map_session_data *sd, const char *notice) { return; #endif } -void party_booking_update(struct map_session_data *sd, short* job) { +static void party_booking_update(struct map_session_data *sd, short *job) +{ #ifndef PARTY_RECRUIT int i; struct party_booking_ad_info *pb_ad; @@ -1357,7 +1370,8 @@ void party_booking_update(struct map_session_data *sd, short* job) { #endif } -void party_recruit_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount) { +static void party_recruit_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount) +{ #ifdef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; int count = 0; @@ -1388,7 +1402,8 @@ void party_recruit_search(struct map_session_data *sd, short level, short mapid, return; #endif } -void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount) { +static void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount) +{ #ifndef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; int i; @@ -1430,7 +1445,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, #endif } -bool party_booking_delete(struct map_session_data *sd) +static bool party_booking_delete(struct map_session_data *sd) { struct party_booking_ad_info* pb_ad; @@ -1447,12 +1462,14 @@ bool party_booking_delete(struct map_session_data *sd) } return true; } -void do_final_party(void) { +static void do_final_party(void) +{ party->db->destroy(party->db,party->db_final); db_destroy(party->booking_db); // Party Booking [Spiria] } // Constructor, init vars -void do_init_party(bool minimal) { +static void do_init_party(bool minimal) +{ if (minimal) return; @@ -1461,12 +1478,14 @@ void do_init_party(bool minimal) { timer->add_func_list(party->send_xy_timer, "party_send_xy_timer"); timer->add_interval(timer->gettick()+battle_config.party_update_interval, party->send_xy_timer, 0, 0, battle_config.party_update_interval); } + /*===================================== -* Default Functions : party.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void party_defaults(void) { + * Default Functions : party.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void party_defaults(void) +{ party = &party_s; /* */ diff --git a/src/map/path.c b/src/map/path.c index 72c188dad..16d9b0563 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -44,7 +44,7 @@ #define DIR_SOUTH 4 #define DIR_EAST 8 -struct path_interface path_s; +static struct path_interface path_s; struct path_interface *path; /// @name Structures and defines for A* pathfinding @@ -85,7 +85,7 @@ static const unsigned char walk_choices [3][3] = * Find the closest reachable cell, 'count' cells away from (x0,y0) in direction (dx,dy). * Income after the coordinates of the blow *------------------------------------------*/ -int path_blownpos(struct block_list *bl, int16 m,int16 x0,int16 y0,int16 dx,int16 dy,int count) +static int path_blownpos(struct block_list *bl, int16 m, int16 x0, int16 y0, int16 dx, int16 dy, int count) { struct map_data *md; @@ -119,7 +119,7 @@ int path_blownpos(struct block_list *bl, int16 m,int16 x0,int16 y0,int16 dx,int1 /*========================================== * is ranged attack from (x0,y0) to (x1,y1) possible? *------------------------------------------*/ -bool path_search_long(struct shootpath_data *spd,struct block_list *bl,int16 m,int16 x0,int16 y0,int16 x1,int16 y1,cell_chk cell) +static bool path_search_long(struct shootpath_data *spd, struct block_list *bl, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, cell_chk cell) { int dx, dy; int wx = 0, wy = 0; @@ -253,7 +253,7 @@ static int add_path(struct node_heap *heap, struct path_node *tp, int16 x, int16 * flag: &1 = easy path search only * cell: type of obstruction to check for *------------------------------------------*/ -bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int flag, cell_chk cell) +static bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int flag, cell_chk cell) { register int i, x, y, dx, dy; struct map_data *md; @@ -429,7 +429,7 @@ bool path_search(struct walkpath_data *wpd, struct block_list *bl, int16 m, int1 } //Distance functions, taken from http://www.flipcode.com/articles/article_fastdistance.shtml -bool check_distance(int dx, int dy, int distance) +static bool check_distance(int dx, int dy, int distance) { #ifdef CIRCULAR_AREA //In this case, we just do a square comparison. Add 1 tile grace for diagonal range checks. @@ -441,7 +441,7 @@ bool check_distance(int dx, int dy, int distance) #endif } -unsigned int distance(int dx, int dy) +static unsigned int distance(int dx, int dy) { #ifdef CIRCULAR_AREA unsigned int min, max; @@ -478,7 +478,7 @@ unsigned int distance(int dx, int dy) * @param distance: Distance to check against * @return Within distance(1); Not within distance(0); */ -bool check_distance_client(int dx, int dy, int distance) +static bool check_distance_client(int dx, int dy, int distance) { if(distance < 0) distance = 0; @@ -492,7 +492,7 @@ bool check_distance_client(int dx, int dy, int distance) * @param dy: Vertical distance * @return Circular distance */ -int distance_client(int dx, int dy) +static int distance_client(int dx, int dy) { double temp_dist = sqrt((double)(dx*dx + dy*dy)); @@ -505,7 +505,8 @@ int distance_client(int dx, int dy) return ((int)temp_dist); } -void path_defaults(void) { +void path_defaults(void) +{ path = &path_s; path->blownpos = path_blownpos; diff --git a/src/map/pc.c b/src/map/pc.c index c7807a5f0..cd49a6dbf 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -76,15 +76,15 @@ #include <string.h> #include <time.h> -struct pc_interface pc_s; +static struct pc_interface pc_s; struct pc_interface *pc; -struct class_exp_tables exptables; +static struct class_exp_tables exptables; //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pc->db_checkid first! -int pc_class2idx(int class) +static int pc_class2idx(int class) { if (class >= JOB_NOVICE_HIGH) { class += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; @@ -99,7 +99,7 @@ int pc_class2idx(int class) * required to provide a session. * Caller must release dummy on its own when it's no longer needed. */ -struct map_session_data* pc_get_dummy_sd(void) +static struct map_session_data *pc_get_dummy_sd(void) { struct map_session_data *dummy_sd; CREATE(dummy_sd, struct map_session_data, 1); @@ -113,7 +113,7 @@ struct map_session_data* pc_get_dummy_sd(void) * @param group_id Group ID * @return 1 on error, 0 on success */ -int pc_set_group(struct map_session_data *sd, int group_id) +static int pc_set_group(struct map_session_data *sd, int group_id) { GroupSettings *group = pcg->id2group(group_id); nullpo_retr(1, sd); @@ -127,13 +127,13 @@ int pc_set_group(struct map_session_data *sd, int group_id) /** * Checks if commands used by player should be logged. */ -bool pc_should_log_commands(struct map_session_data *sd) +static bool pc_should_log_commands(struct map_session_data *sd) { nullpo_retr(true, sd); return pcg->should_log_commands(sd->group); } -int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) +static int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd = map->id2sd(id); @@ -150,7 +150,7 @@ int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -void pc_setinvincibletimer(struct map_session_data* sd, int val) +static void pc_setinvincibletimer(struct map_session_data *sd, int val) { nullpo_retv(sd); @@ -161,7 +161,7 @@ void pc_setinvincibletimer(struct map_session_data* sd, int val) sd->invincible_timer = timer->add(timer->gettick()+val,pc->invincible_timer,sd->bl.id,0); } -void pc_delinvincibletimer(struct map_session_data* sd) +static void pc_delinvincibletimer(struct map_session_data *sd) { nullpo_retv(sd); @@ -173,7 +173,8 @@ void pc_delinvincibletimer(struct map_session_data* sd) } } -int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); int i; @@ -205,12 +206,13 @@ int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) { } /** -* Get the possible number of spiritball that a player can call. -* @param sd the affected player structure -* @param min the minimum number of spiritball regardless the level of MO_CALLSPIRITS -* @retval total number of spiritball -**/ -int pc_getmaxspiritball(struct map_session_data *sd, int min) { + * Get the possible number of spiritball that a player can call. + * @param sd the affected player structure + * @param min the minimum number of spiritball regardless the level of MO_CALLSPIRITS + * @retval total number of spiritball + */ +static int pc_getmaxspiritball(struct map_session_data *sd, int min) +{ int result; nullpo_ret(sd); @@ -226,7 +228,7 @@ int pc_getmaxspiritball(struct map_session_data *sd, int min) { return result; } -int pc_addspiritball(struct map_session_data *sd,int interval,int max) +static int pc_addspiritball(struct map_session_data *sd, int interval, int max) { int tid, i; @@ -257,7 +259,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) return 0; } -int pc_addspiritball_sub(struct map_session_data *sd) +static int pc_addspiritball_sub(struct map_session_data *sd) { nullpo_ret(sd); if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) @@ -267,7 +269,7 @@ int pc_addspiritball_sub(struct map_session_data *sd) return 0; } -int pc_delspiritball(struct map_session_data *sd,int count,int type) +static int pc_delspiritball(struct map_session_data *sd, int count, int type) { int i; @@ -303,7 +305,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type) return 0; } -int pc_delspiritball_sub(struct map_session_data *sd) +static int pc_delspiritball_sub(struct map_session_data *sd) { nullpo_ret(sd); if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) @@ -313,7 +315,7 @@ int pc_delspiritball_sub(struct map_session_data *sd) return 0; } -int pc_check_banding(struct block_list *bl, va_list ap) +static int pc_check_banding(struct block_list *bl, va_list ap) { int *c, *b_sd; struct block_list *src; @@ -341,7 +343,8 @@ int pc_check_banding(struct block_list *bl, va_list ap) return 0; } -int pc_banding(struct map_session_data *sd, uint16 skill_lv) { +static int pc_banding(struct map_session_data *sd, uint16 skill_lv) +{ int c; int b_sd[MAX_PARTY]; // In case of a full Royal Guard party. int i, j, hp, extra_hp = 0, tmp_qty = 0; @@ -416,7 +419,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { * @param type The fame list type (@see enum fame_list_type). * @param count The amount of points to add. */ -void pc_addfame(struct map_session_data *sd, int ranktype, int count) +static void pc_addfame(struct map_session_data *sd, int ranktype, int count) { nullpo_retv(sd); @@ -456,7 +459,7 @@ void pc_addfame(struct map_session_data *sd, int ranktype, int count) * @return The rank position (1-based index) * @retval 0 if the character isn't in the specified list. */ -int pc_fame_rank(int char_id, int ranktype) +static int pc_fame_rank(int char_id, int ranktype) { int i; @@ -495,7 +498,8 @@ int pc_fame_rank(int char_id, int ranktype) * @return the appropriate fame list type (@see enum fame_list_type). * @retval RANKTYPE_UNKNOWN if no appropriate type exists. */ -int pc_famelist_type(uint16 job_mapid) { +static int pc_famelist_type(uint16 job_mapid) +{ switch (job_mapid & MAPID_UPPERMASK) { case MAPID_BLACKSMITH: return RANKTYPE_BLACKSMITH; @@ -508,7 +512,8 @@ int pc_famelist_type(uint16 job_mapid) { } } -int pc_setrestartvalue(struct map_session_data *sd,int type) { +static int pc_setrestartvalue(struct map_session_data *sd, int type) +{ struct status_data *st, *bst; nullpo_ret(sd); @@ -531,7 +536,8 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) { /*========================================== Rental System *------------------------------------------*/ -int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) { +static int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( sd == NULL ) return 0; @@ -545,7 +551,7 @@ int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) { return 1; } -int pc_inventory_rental_clear(struct map_session_data *sd) +static int pc_inventory_rental_clear(struct map_session_data *sd) { nullpo_ret(sd); if( sd->rental_timer != INVALID_TIMER ) @@ -557,7 +563,8 @@ int pc_inventory_rental_clear(struct map_session_data *sd) return 1; } /* assumes i is valid (from default areas where it is called, it is) */ -void pc_rental_expire(struct map_session_data *sd, int i) { +static void pc_rental_expire(struct map_session_data *sd, int i) +{ short nameid; nullpo_retv(sd); @@ -628,7 +635,7 @@ void pc_rental_expire(struct map_session_data *sd, int i) { clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid); pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_RENTAL); } -void pc_inventory_rentals(struct map_session_data *sd) +static void pc_inventory_rentals(struct map_session_data *sd) { int i, c = 0; int64 expire_tick, next_tick = INT64_MAX; @@ -657,7 +664,7 @@ void pc_inventory_rentals(struct map_session_data *sd) sd->rental_timer = INVALID_TIMER; } -void pc_inventory_rental_add(struct map_session_data *sd, int seconds) +static void pc_inventory_rental_add(struct map_session_data *sd, int seconds) { int tick = seconds * 1000; @@ -681,7 +688,7 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds) /*========================================== * prepares character for saving. *------------------------------------------*/ -int pc_makesavestatus(struct map_session_data *sd) +static int pc_makesavestatus(struct map_session_data *sd) { nullpo_ret(sd); @@ -747,7 +754,7 @@ int pc_makesavestatus(struct map_session_data *sd) /*========================================== * Off init ? Connection? *------------------------------------------*/ -int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd) +static int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd) { nullpo_ret(sd); @@ -770,7 +777,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo } // [4144] probably pc_equippoint should be replaced to pc_item_equippoint -int pc_equippoint(struct map_session_data *sd,int n) +static int pc_equippoint(struct map_session_data *sd, int n) { int ep = 0; @@ -802,7 +809,7 @@ int pc_equippoint(struct map_session_data *sd,int n) return ep; } -int pc_item_equippoint(struct map_session_data *sd, struct item_data* id) +static int pc_item_equippoint(struct map_session_data *sd, struct item_data *id) { int ep = 0; @@ -829,7 +836,7 @@ int pc_item_equippoint(struct map_session_data *sd, struct item_data* id) return ep; } -int pc_setinventorydata(struct map_session_data *sd) +static int pc_setinventorydata(struct map_session_data *sd) { int i; @@ -842,7 +849,7 @@ int pc_setinventorydata(struct map_session_data *sd) return 0; } -int pc_calcweapontype(struct map_session_data *sd) +static int pc_calcweapontype(struct map_session_data *sd) { nullpo_ret(sd); @@ -886,7 +893,7 @@ int pc_calcweapontype(struct map_session_data *sd) return 2; } -int pc_setequipindex(struct map_session_data *sd) +static int pc_setequipindex(struct map_session_data *sd) { int i,j; @@ -935,7 +942,7 @@ int pc_setequipindex(struct map_session_data *sd) return 0; } -bool pc_isequipped(struct map_session_data *sd, int nameid) +static bool pc_isequipped(struct map_session_data *sd, int nameid) { int i, j; @@ -961,7 +968,7 @@ bool pc_isequipped(struct map_session_data *sd, int nameid) return false; } -bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd ) +static bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { if( !p1_sd || !p2_sd || !b_sd ) return false; @@ -1011,7 +1018,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd /*========================================== * Adoption Process *------------------------------------------*/ -bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) +static bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { int class, joblevel; uint64 jobexp; @@ -1056,7 +1063,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, * Checks if the player can equip the item at index n in inventory. * Returns 0 (no) or 1 (yes). *------------------------------------------------*/ -int pc_isequip(struct map_session_data *sd,int n) +static int pc_isequip(struct map_session_data *sd, int n) { struct item_data *item; @@ -1183,7 +1190,7 @@ int pc_isequip(struct map_session_data *sd,int n) * No problem with the session id * set the status that has been sent from char server *------------------------------------------*/ -bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers) +static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers) { int i; int64 tick = timer->gettick(); @@ -1425,7 +1432,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim /*========================================== * Closes a connection because it failed to be authenticated from the char server. *------------------------------------------*/ -void pc_authfail(struct map_session_data *sd) +static void pc_authfail(struct map_session_data *sd) { nullpo_retv(sd); clif->authfail_fd(sd->fd, 0); @@ -1433,7 +1440,7 @@ void pc_authfail(struct map_session_data *sd) } //Attempts to set a mob. -int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) +static int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) { int class_; if (!sd || !bl || pos < 0 || pos >= MAX_PC_FEELHATE) @@ -1461,7 +1468,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) /*========================================== * Invoked once after the char/account/account2 registry variables are received. [Skotlex] *------------------------------------------*/ -int pc_reg_received(struct map_session_data *sd) +static int pc_reg_received(struct map_session_data *sd) { int i, idx = 0; @@ -1589,7 +1596,8 @@ int pc_reg_received(struct map_session_data *sd) return 1; } -int pc_calc_skillpoint(struct map_session_data* sd) { +static int pc_calc_skillpoint(struct map_session_data *sd) +{ int i,inf2,skill_point=0; nullpo_ret(sd); @@ -1612,7 +1620,7 @@ int pc_calc_skillpoint(struct map_session_data* sd) { return skill_point; } -void pc_calc_skilltree_clear(struct map_session_data *sd) +static void pc_calc_skilltree_clear(struct map_session_data *sd) { int i; @@ -1639,7 +1647,7 @@ void pc_calc_skilltree_clear(struct map_session_data *sd) /*========================================== * Calculation of skill level. *------------------------------------------*/ -int pc_calc_skilltree(struct map_session_data *sd) +static int pc_calc_skilltree(struct map_session_data *sd) { int i,id=0,flag; int class = 0, classidx = 0; @@ -1786,7 +1794,7 @@ int pc_calc_skilltree(struct map_session_data *sd) return 0; } -void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) +static void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) { int i; int id = 0; @@ -1822,7 +1830,7 @@ void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) } //Checks if you can learn a new skill after having leveled up a skill. -void pc_check_skilltree(struct map_session_data *sd, int skill_id) +static void pc_check_skilltree(struct map_session_data *sd, int skill_id) { int i,id=0,flag; int c=0; @@ -1893,7 +1901,7 @@ void pc_check_skilltree(struct map_session_data *sd, int skill_id) // Make sure all the skills are in the correct condition // before persisting to the backend.. [MouseJstr] -int pc_clean_skilltree(struct map_session_data *sd) +static int pc_clean_skilltree(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -1911,7 +1919,7 @@ int pc_clean_skilltree(struct map_session_data *sd) return 0; } -int pc_calc_skilltree_normalize_job(struct map_session_data *sd) +static int pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int skill_point, novice_skills; uint16 job; @@ -1987,7 +1995,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) * 2: overweight 90% * It's assumed that SC_WEIGHTOVER50 and SC_WEIGHTOVER90 are only started/stopped here. */ -int pc_updateweightstatus(struct map_session_data *sd) +static int pc_updateweightstatus(struct map_session_data *sd) { int old_overweight; int new_overweight; @@ -2018,7 +2026,7 @@ int pc_updateweightstatus(struct map_session_data *sd) return 0; } -int pc_disguise(struct map_session_data *sd, int class) +static int pc_disguise(struct map_session_data *sd, int class) { nullpo_ret(sd); if (class == -1 && sd->disguise == -1) @@ -2074,7 +2082,7 @@ int pc_disguise(struct map_session_data *sd, int class) return 1; } -int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) +static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) { int i; @@ -2112,7 +2120,7 @@ int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, s return 1; } -int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) +static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) { int i; @@ -2153,7 +2161,7 @@ int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_ski * @retval 1 on success. * @retval 0 on failure. */ -int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration) +static int pc_bonus_addeff(struct s_addeffect *effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration) { int i; @@ -2185,7 +2193,8 @@ int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id, int16 return 1; } -int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target) { +static int pc_bonus_addeff_onskill(struct s_addeffectonskill *effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target) +{ int i; nullpo_ret(effect); @@ -2206,7 +2215,8 @@ int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_ return 1; } -int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race_mask, int rate) { +static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race_mask, int rate) +{ int i; nullpo_ret(drop); @@ -2254,7 +2264,8 @@ int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short return 1; } -int pc_addautobonus(struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short flag,const char *other_script,unsigned short pos,bool onskill) { +static int pc_addautobonus(struct s_autobonus *bonus, char max, const char *bonus_script, short rate, unsigned int dur, short flag, const char *other_script, unsigned short pos, bool onskill) +{ int i; nullpo_ret(bonus); @@ -2291,7 +2302,7 @@ int pc_addautobonus(struct s_autobonus *bonus,char max,const char *bonus_script, return 1; } -int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,char max,bool restore) +static int pc_delautobonus(struct map_session_data *sd, struct s_autobonus *autobonus, char max, bool restore) { int i; nullpo_ret(sd); @@ -2329,7 +2340,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c return 0; } -int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus) +static int pc_exeautobonus(struct map_session_data *sd, struct s_autobonus *autobonus) { nullpo_ret(sd); nullpo_ret(autobonus); @@ -2349,7 +2360,8 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus) return 0; } -int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) { +static int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); struct s_autobonus *autobonus = (struct s_autobonus *)data; @@ -2362,7 +2374,7 @@ int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, short flag) +static int pc_bonus_addele(struct map_session_data *sd, unsigned char ele, short rate, short flag) { int i; struct weapon_data* wd; @@ -2397,7 +2409,7 @@ int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, return 0; } -int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, short flag) +static int pc_bonus_subele(struct map_session_data *sd, unsigned char ele, short rate, short flag) { int i; @@ -2443,7 +2455,8 @@ int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, /*========================================== * Add a bonus(type) to player sd *------------------------------------------*/ -int pc_bonus(struct map_session_data *sd,int type,int val) { +static int pc_bonus(struct map_session_data *sd, int type, int val) +{ struct status_data *bst; int bonus; int i; @@ -3109,7 +3122,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { /*========================================== * Player bonus (type) with args type2 and val, called trough bonus2 (npc) *------------------------------------------*/ -int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) +static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) { int i; @@ -3899,7 +3912,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) return 0; } -int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) +static int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3, int val) { int i; nullpo_ret(sd); @@ -4073,7 +4086,8 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) return 0; } -int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val) { +static int pc_bonus4(struct map_session_data *sd, int type, int type2, int type3, int type4, int val) +{ int i; nullpo_ret(sd); @@ -4168,7 +4182,8 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 return 0; } -int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val) { +static int pc_bonus5(struct map_session_data *sd, int type, int type2, int type3, int type4, int type5, int val) +{ nullpo_ret(sd); switch(type){ @@ -4202,7 +4217,7 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4 * Grants a player a given skill. * Flag values: @see enum pc_skill_flag *------------------------------------------*/ -int pc_skill(struct map_session_data *sd, int id, int level, int flag) +static int pc_skill(struct map_session_data *sd, int id, int level, int flag) { int index = 0; nullpo_ret(sd); @@ -4281,7 +4296,7 @@ int pc_skill(struct map_session_data *sd, int id, int level, int flag) * @param idx_equip The target equipment's inventory index. * @retval true if the card can be inserted. */ -bool pc_can_insert_card_into(struct map_session_data* sd, int idx_card, int idx_equip) +static bool pc_can_insert_card_into(struct map_session_data *sd, int idx_card, int idx_equip) { int i; @@ -4317,7 +4332,7 @@ bool pc_can_insert_card_into(struct map_session_data* sd, int idx_card, int idx_ * @param idx_card The card's inventory index. * @retval true if the card can be inserted. */ -bool pc_can_insert_card(struct map_session_data* sd, int idx_card) +static bool pc_can_insert_card(struct map_session_data *sd, int idx_card) { nullpo_ret(sd); @@ -4336,7 +4351,7 @@ bool pc_can_insert_card(struct map_session_data* sd, int idx_card) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip) +static int pc_insert_card(struct map_session_data *sd, int idx_card, int idx_equip) { int nameid; @@ -4378,7 +4393,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip) /*========================================== * Update buying value by skills *------------------------------------------*/ -int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) +static int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) { int skill_lv, rate1 = 0, rate2 = 0; if (orig_value <= 0) @@ -4399,7 +4414,7 @@ int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) /*========================================== * Update selling value by skills *------------------------------------------*/ -int pc_modifysellvalue(struct map_session_data *sd, int orig_value) +static int pc_modifysellvalue(struct map_session_data *sd, int orig_value) { int skill_lv, rate = 0; if (orig_value <= 0) @@ -4417,7 +4432,7 @@ int pc_modifysellvalue(struct map_session_data *sd, int orig_value) * Checking if we have enough place on inventory for new item * Make sure to take 30k as limit (for client I guess) *------------------------------------------*/ -int pc_checkadditem(struct map_session_data *sd,int nameid,int amount) +static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount) { int i; struct item_data* data; @@ -4451,7 +4466,7 @@ int pc_checkadditem(struct map_session_data *sd,int nameid,int amount) * Return number of available place in inventory * Each non stackable item will reduce place by 1 *------------------------------------------*/ -int pc_inventoryblank(struct map_session_data *sd) +static int pc_inventoryblank(struct map_session_data *sd) { int i,b; @@ -4468,7 +4483,7 @@ int pc_inventoryblank(struct map_session_data *sd) /*========================================== * attempts to remove zeny from player (sd) *------------------------------------------*/ -int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd) +static int pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd) { nullpo_retr(-1,sd); @@ -4505,7 +4520,7 @@ int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, * @return points Leftover kafra points. */ //Changed Kafrapoints calculation. [Normynator] -int pc_paycash(struct map_session_data *sd, int price, int points) +static int pc_paycash(struct map_session_data *sd, int price, int points) { int cash; int mempoints; @@ -4545,7 +4560,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points) return points; } -int pc_getcash(struct map_session_data *sd, int cash, int points) +static int pc_getcash(struct map_session_data *sd, int cash, int points) { char output[128]; nullpo_retr(-1,sd); @@ -4604,7 +4619,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points) * Attempts to give zeny to player (sd) * tsd (optional) from who for log (if null take sd) *------------------------------------------*/ -int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd) +static int pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd) { nullpo_retr(-1,sd); @@ -4643,7 +4658,8 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, * @return the inventory index of the first instance of the requested item. * @retval INDEX_NOT_FOUND if the item wasn't found. */ -int pc_search_inventory(struct map_session_data *sd, int item_id) { +static int pc_search_inventory(struct map_session_data *sd, int item_id) +{ int i; nullpo_retr(INDEX_NOT_FOUND, sd); @@ -4663,7 +4679,7 @@ int pc_search_inventory(struct map_session_data *sd, int item_id) { * 6 = ? * 7 = stack limitation *------------------------------------------*/ -int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) +static int pc_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type) { struct item_data *data; int i; @@ -4782,7 +4798,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l * 0 = success * 1 = invalid itemid or negative amount *------------------------------------------*/ -int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason, e_log_pick_type log_type) +static int pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type) { nullpo_retr(1, sd); Assert_retr(1, n >= 0 && n < MAX_INVENTORY); @@ -4814,7 +4830,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas * 0 = fail * 1 = success *------------------------------------------*/ -int pc_dropitem(struct map_session_data *sd,int n,int amount) +static int pc_dropitem(struct map_session_data *sd, int n, int amount) { nullpo_retr(1, sd); @@ -4857,7 +4873,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) +static int pc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem) { int flag=0; int64 tick = timer->gettick(); @@ -4923,7 +4939,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) * 0 = no * 1 = yes *------------------------------------------*/ -int pc_isUseitem(struct map_session_data *sd,int n) +static int pc_isUseitem(struct map_session_data *sd, int n) { struct item_data *item; int nameid; @@ -5158,7 +5174,8 @@ int pc_isUseitem(struct map_session_data *sd,int n) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_useitem(struct map_session_data *sd,int n) { +static int pc_useitem(struct map_session_data *sd, int n) +{ int64 tick = timer->gettick(); int amount, nameid, i; bool removeItem = false; @@ -5328,7 +5345,7 @@ int pc_useitem(struct map_session_data *sd,int n) { * 0 = success * 1 = fail *------------------------------------------*/ -int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) +static int pc_cart_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type) { struct item_data *data; int i,w; @@ -5397,7 +5414,8 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun * 0 = success * 1 = fail *------------------------------------------*/ -int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type) { +static int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int type, e_log_pick_type log_type) +{ struct item_data * data; nullpo_retr(1, sd); Assert_retr(1, n >= 0 && n < MAX_INVENTORY); @@ -5427,7 +5445,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_ * 0 = fail * 1 = succes *------------------------------------------*/ -int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) +static int pc_putitemtocart(struct map_session_data *sd, int idx, int amount) { struct item *item_data; int flag; @@ -5454,7 +5472,7 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) * -1 = itemid not found or no amount found * x = remaining itemid on cart after get *------------------------------------------*/ -int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) +static int pc_cartitem_amount(struct map_session_data *sd, int idx, int amount) { struct item* item_data; @@ -5474,7 +5492,7 @@ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) * 0 = player not found or (FIXME) succes (from pc->cart_delitem) * 1 = failure *------------------------------------------*/ -int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) +static int pc_getitemfromcart(struct map_session_data *sd, int idx, int amount) { struct item *item_data; int flag; @@ -5495,7 +5513,7 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) return flag; } -void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) +static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) { int i; @@ -5532,7 +5550,7 @@ void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) /*========================================== * Display item stolen msg to player sd *------------------------------------------*/ -int pc_show_steal(struct block_list *bl,va_list ap) +static int pc_show_steal(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL, *tsd = NULL; int itemid; @@ -5562,7 +5580,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) * 0 = fail * 1 = succes *------------------------------------------*/ -int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv) +static int pc_steal_item(struct map_session_data *sd, struct block_list *bl, uint16 skill_lv) { int i,itemid,flag; int rate; @@ -5641,7 +5659,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil * * @return Amount of stolen zeny (0 in case of failure) */ -int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 skill_lv) +static int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 skill_lv) { int rate; struct mob_data *md = BL_CAST(BL_MOB, target); @@ -5673,7 +5691,8 @@ int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 * 1 - Invalid map index. * 2 - Map not in this map-server, and failed to locate alternate map-server. *------------------------------------------*/ -int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype) { +static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype) +{ int16 m; nullpo_ret(sd); @@ -5909,7 +5928,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int * 0 = fail or FIXME success (from pc->setpos) * x(1|2) = fail *------------------------------------------*/ -int pc_randomwarp(struct map_session_data *sd, clr_type type) { +static int pc_randomwarp(struct map_session_data *sd, clr_type type) +{ int x,y,i=0; int16 m; @@ -5935,7 +5955,8 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) { * Records a memo point at sd's current position * pos - entry to replace, (-1: shift oldest entry out) *------------------------------------------*/ -int pc_memo(struct map_session_data* sd, int pos) { +static int pc_memo(struct map_session_data *sd, int pos) +{ int skill_lv; nullpo_ret(sd); @@ -5985,7 +6006,8 @@ int pc_memo(struct map_session_data* sd, int pos) { /*========================================== * Return player sd skill_lv learned for given skill *------------------------------------------*/ -int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { +static int pc_checkskill(struct map_session_data *sd, uint16 skill_id) +{ int index = 0; if(sd == NULL) return 0; if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) { @@ -6004,7 +6026,8 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { return 0; } -int pc_checkskill2(struct map_session_data *sd,uint16 index) { +static int pc_checkskill2(struct map_session_data *sd, uint16 index) +{ if (sd == NULL) return 0; if (index >= MAX_SKILL_DB) { @@ -6030,7 +6053,7 @@ int pc_checkskill2(struct map_session_data *sd,uint16 index) { * Return * 0 - No status found or all done *------------------------------------------*/ -int pc_checkallowskill(struct map_session_data *sd) +static int pc_checkallowskill(struct map_session_data *sd) { const enum sc_type scw_list[] = { SC_TWOHANDQUICKEN, @@ -6088,7 +6111,7 @@ int pc_checkallowskill(struct map_session_data *sd) * -1 : mean nothing equiped * idx : (this index could be used in inventory to found item_data) *------------------------------------------*/ -int pc_checkequip(struct map_session_data *sd,int pos) +static int pc_checkequip(struct map_session_data *sd, int pos) { int i; @@ -6106,7 +6129,7 @@ int pc_checkequip(struct map_session_data *sd,int pos) * Convert's from the client's lame Job ID system * to the map server's 'makes sense' system. [Skotlex] *------------------------------------------*/ -int pc_jobid2mapid(int16 class) +static int pc_jobid2mapid(int16 class) { switch (class) { //Novice And 1-1 Jobs @@ -6248,7 +6271,7 @@ int pc_jobid2mapid(int16 class) } //Reverts the map-style class id to the client-style one. -int pc_mapid2jobid(uint16 job, int sex) +static int pc_mapid2jobid(uint16 job, int sex) { switch (job) { //Novice And 1-1 Jobs @@ -6385,7 +6408,7 @@ int pc_mapid2jobid(uint16 job, int sex) /*==================================================== * This function return the name of the job (by [Yor]) *----------------------------------------------------*/ -const char *job_name(int class) +static const char *job_name(int class) { switch (class) { case JOB_NOVICE: // 550 @@ -6614,7 +6637,8 @@ const char *job_name(int class) } } -int pc_check_job_name(const char *name) { +static int pc_check_job_name(const char *name) +{ int i, len; struct { const char *name; @@ -6748,7 +6772,8 @@ int pc_check_job_name(const char *name) { return names[i].id; } -int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct block_list *tbl; @@ -6786,7 +6811,7 @@ int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_stop_following (struct map_session_data *sd) +static int pc_stop_following(struct map_session_data *sd) { nullpo_ret(sd); @@ -6802,7 +6827,8 @@ int pc_stop_following (struct map_session_data *sd) return 0; } -int pc_follow(struct map_session_data *sd,int target_id) { +static int pc_follow(struct map_session_data *sd, int target_id) +{ struct block_list *bl = map->id2bl(target_id); nullpo_retr(1, sd); if (bl == NULL /*|| bl->type != BL_PC*/) @@ -6816,7 +6842,7 @@ int pc_follow(struct map_session_data *sd,int target_id) { return 0; } -int pc_checkbaselevelup(struct map_session_data *sd) +static int pc_checkbaselevelup(struct map_session_data *sd) { uint64 next = pc->nextbaseexp(sd); @@ -6858,7 +6884,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) return 1; } -void pc_checkbaselevelup_sc(struct map_session_data *sd) +static void pc_checkbaselevelup_sc(struct map_session_data *sd) { nullpo_retv(sd); @@ -6876,7 +6902,8 @@ void pc_checkbaselevelup_sc(struct map_session_data *sd) } } -void pc_baselevelchanged(struct map_session_data *sd) { +static void pc_baselevelchanged(struct map_session_data *sd) +{ int i; nullpo_retv(sd); for( i = 0; i < EQI_MAX; i++ ) { @@ -6887,7 +6914,7 @@ void pc_baselevelchanged(struct map_session_data *sd) { } } -int pc_checkjoblevelup(struct map_session_data *sd) +static int pc_checkjoblevelup(struct map_session_data *sd) { uint64 next = pc->nextjobexp(sd); @@ -6922,7 +6949,8 @@ int pc_checkjoblevelup(struct map_session_data *sd) /** * Alters EXP based on self bonuses that do not get shared with the party **/ -void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src) { +static void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src) +{ int buff_ratio = 0, buff_job_ratio = 0, race_ratio = 0, pk_ratio = 0; int64 jexp, bexp; @@ -6997,7 +7025,7 @@ void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, * @param is_quest Used to let client know that the EXP was from a quest (clif->displayexp) PACKETVER >= 20091027 * @retval true success **/ -bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest) +static bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest) { float nextbp = 0, nextjp = 0; uint64 nextb = 0, nextj = 0; @@ -7086,14 +7114,14 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base /*========================================== * Returns max level for this character. *------------------------------------------*/ -int pc_maxbaselv(const struct map_session_data *sd) +static int pc_maxbaselv(const struct map_session_data *sd) { nullpo_ret(sd); return pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_BASE]->max_level; } -int pc_maxjoblv(const struct map_session_data *sd) +static int pc_maxjoblv(const struct map_session_data *sd) { nullpo_ret(sd); @@ -7105,7 +7133,7 @@ int pc_maxjoblv(const struct map_session_data *sd) *------------------------------------------*/ //Base exp needed for next level. -uint64 pc_nextbaseexp(const struct map_session_data *sd) +static uint64 pc_nextbaseexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7122,7 +7150,7 @@ uint64 pc_nextbaseexp(const struct map_session_data *sd) } //Base exp needed for this level. -uint64 pc_thisbaseexp(const struct map_session_data *sd) +static uint64 pc_thisbaseexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7146,7 +7174,7 @@ uint64 pc_thisbaseexp(const struct map_session_data *sd) *------------------------------------------*/ //Job exp needed for next level. -uint64 pc_nextjobexp(const struct map_session_data *sd) +static uint64 pc_nextjobexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7163,7 +7191,7 @@ uint64 pc_nextjobexp(const struct map_session_data *sd) } //Job exp needed for this level. -uint64 pc_thisjobexp(const struct map_session_data *sd) +static uint64 pc_thisjobexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7178,7 +7206,7 @@ uint64 pc_thisjobexp(const struct map_session_data *sd) } /// Returns the value of the specified stat. -int pc_getstat(struct map_session_data* sd, int type) +static int pc_getstat(struct map_session_data *sd, int type) { nullpo_retr(-1, sd); @@ -7196,7 +7224,7 @@ int pc_getstat(struct map_session_data* sd, int type) /// Sets the specified stat to the specified value. /// Returns the new value. -int pc_setstat(struct map_session_data* sd, int type, int val) +static int pc_setstat(struct map_session_data *sd, int type, int val) { nullpo_retr(-1, sd); @@ -7215,7 +7243,7 @@ int pc_setstat(struct map_session_data* sd, int type, int val) } // Calculates the number of status points PC gets when leveling up (from level to level+1) -int pc_gets_status_point(int level) +static int pc_gets_status_point(int level) { if (battle_config.use_statpoint_table) //Use values from "db/statpoint.txt" return (pc->statp[level+1] - pc->statp[level]); @@ -7226,7 +7254,7 @@ int pc_gets_status_point(int level) /// Returns the number of stat points needed to change the specified stat by val. /// If val is negative, returns the number of stat points that would be needed to /// raise the specified stat from (current value - val) to current value. -int pc_need_status_point(struct map_session_data* sd, int type, int val) +static int pc_need_status_point(struct map_session_data *sd, int type, int val) { int low, high, sp = 0; @@ -7261,7 +7289,8 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val) * @param type Stat to verify. * @return Maximum value the stat could grow by. */ -int pc_maxparameterincrease(struct map_session_data* sd, int type) { +static int pc_maxparameterincrease(struct map_session_data *sd, int type) +{ int base, final, status_points = sd->status.status_point; base = final = pc->getstat(sd, type); @@ -7291,7 +7320,8 @@ int pc_maxparameterincrease(struct map_session_data* sd, int type) { * @retval true if the stat was increased by any amount. * @retval false if there were no changes. */ -bool pc_statusup(struct map_session_data* sd, int type, int increase) { +static bool pc_statusup(struct map_session_data *sd, int type, int increase) +{ int max_increase = 0, current = 0, needed_points = 0, final_value = 0; nullpo_ret(sd); @@ -7350,7 +7380,7 @@ bool pc_statusup(struct map_session_data* sd, int type, int increase) { * @return the stat increase amount. * @retval 0 if no changes were made. */ -int pc_statusup2(struct map_session_data* sd, int type, int val) +static int pc_statusup2(struct map_session_data *sd, int type, int val) { int max, need; nullpo_ret(sd); @@ -7385,7 +7415,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) * Update skill_lv for player sd * Skill point allocation *------------------------------------------*/ -int pc_skillup(struct map_session_data *sd,uint16 skill_id) +static int pc_skillup(struct map_session_data *sd, uint16 skill_id) { int index = 0; nullpo_ret(sd); @@ -7443,7 +7473,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) /*========================================== * /allskill *------------------------------------------*/ -int pc_allskillup(struct map_session_data *sd) +static int pc_allskillup(struct map_session_data *sd) { int i; @@ -7498,7 +7528,7 @@ int pc_allskillup(struct map_session_data *sd) /*========================================== * /resetlvl *------------------------------------------*/ -int pc_resetlvl(struct map_session_data* sd,int type) +static int pc_resetlvl(struct map_session_data *sd, int type) { int i; @@ -7586,7 +7616,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) /*========================================== * /resetstate *------------------------------------------*/ -int pc_resetstate(struct map_session_data* sd) +static int pc_resetstate(struct map_session_data *sd) { nullpo_ret(sd); @@ -7652,7 +7682,7 @@ int pc_resetstate(struct map_session_data* sd) * /resetskill * @param flag: @see enum pc_resetskill_flag *------------------------------------------*/ -int pc_resetskill(struct map_session_data* sd, int flag) +static int pc_resetskill(struct map_session_data *sd, int flag) { int i, inf2, skill_point=0; nullpo_ret(sd); @@ -7764,7 +7794,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) return skill_point; } -bool pc_resetskill_job(struct map_session_data* sd, int index) +static bool pc_resetskill_job(struct map_session_data *sd, int index) { uint16 skill_id; @@ -7791,7 +7821,7 @@ bool pc_resetskill_job(struct map_session_data* sd, int index) /*========================================== * /resetfeel [Komurka] *------------------------------------------*/ -int pc_resetfeel(struct map_session_data* sd) +static int pc_resetfeel(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -7806,7 +7836,7 @@ int pc_resetfeel(struct map_session_data* sd) return 0; } -int pc_resethate(struct map_session_data* sd) +static int pc_resethate(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -7818,7 +7848,7 @@ int pc_resethate(struct map_session_data* sd) return 0; } -int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) +static int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = 0; nullpo_ret(sd); @@ -7832,7 +7862,7 @@ int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) return bonus; } -int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) +static int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = sd->bonus.add_heal_rate; @@ -7873,7 +7903,8 @@ int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) return bonus; } -int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) { +static int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) +{ int i, bonus = sd->bonus.add_heal2_rate; ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_id); @@ -7884,7 +7915,7 @@ int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) { return bonus; } -void pc_respawn(struct map_session_data* sd, clr_type clrtype) +static void pc_respawn(struct map_session_data *sd, clr_type clrtype) { if( !pc_isdead(sd) ) return; // not applicable @@ -7897,7 +7928,8 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype) clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet. } -int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( sd != NULL ) { @@ -7911,7 +7943,7 @@ int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Invoked when a player has received damage *------------------------------------------*/ -void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp) +static void pc_damage(struct map_session_data *sd, struct block_list *src, unsigned int hp, unsigned int sp) { if (sp) clif->updatestatus(sd,SP_SP); if (hp) clif->updatestatus(sd,SP_HP); @@ -7943,7 +7975,8 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h /*========================================== * Invoked when a player has negative current hp *------------------------------------------*/ -int pc_dead(struct map_session_data *sd,struct block_list *src) { +static int pc_dead(struct map_session_data *sd, struct block_list *src) +{ int i=0,j=0; int64 tick = timer->gettick(); @@ -8299,12 +8332,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { return 1; } -bool pc_isDeathPenaltyJob(uint16 job) +static bool pc_isDeathPenaltyJob(uint16 job) { return (job & MAPID_UPPERMASK) != MAPID_NOVICE; // only novices will receive no penalty } -void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { +static void pc_revive(struct map_session_data *sd, unsigned int hp, unsigned int sp) +{ nullpo_retv(sd); if(hp) clif->updatestatus(sd,SP_HP); if(sp) clif->updatestatus(sd,SP_SP); @@ -8325,7 +8359,7 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { /*========================================== * script reading pc status registry *------------------------------------------*/ -int64 pc_readparam(const struct map_session_data *sd, int type) +static int64 pc_readparam(const struct map_session_data *sd, int type) { int64 val = 0; @@ -8478,7 +8512,7 @@ int64 pc_readparam(const struct map_session_data *sd, int type) /*========================================== * script set pc status registry *------------------------------------------*/ -int pc_setparam(struct map_session_data *sd, int type, int64 val) +static int pc_setparam(struct map_session_data *sd, int type, int64 val) { int delta; nullpo_ret(sd); @@ -8655,7 +8689,7 @@ int pc_setparam(struct map_session_data *sd, int type, int64 val) /*========================================== * HP/SP Healing. If flag is passed, the heal type is through clif->heal, otherwise update status. *------------------------------------------*/ -void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type) +static void pc_heal(struct map_session_data *sd, unsigned int hp, unsigned int sp, int type) { nullpo_retv(sd); if (type) { @@ -8677,7 +8711,7 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty * Heal player hp and/or sp linearly. * Calculate bonus by status. *------------------------------------------*/ -int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) +static int pc_itemheal(struct map_session_data *sd, int itemid, int hp, int sp) { int bonus, tmp; @@ -8760,7 +8794,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) * HP/SP Recovery * Heal player hp nad/or sp by rate *------------------------------------------*/ -int pc_percentheal(struct map_session_data *sd,int hp,int sp) +static int pc_percentheal(struct map_session_data *sd, int hp, int sp) { nullpo_ret(sd); @@ -8795,7 +8829,7 @@ int pc_percentheal(struct map_session_data *sd,int hp,int sp) return 0; } -int jobchange_killclone(struct block_list *bl, va_list ap) +static int jobchange_killclone(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int flag = va_arg(ap, int); @@ -8813,7 +8847,7 @@ int jobchange_killclone(struct block_list *bl, va_list ap) * Called when player changes job * Rewrote to make it tidider [Celest] *------------------------------------------*/ -int pc_jobchange(struct map_session_data *sd, int class, int upper) +static int pc_jobchange(struct map_session_data *sd, int class, int upper) { int i, fame_flag=0; int job, idx = 0; @@ -9009,7 +9043,7 @@ int pc_jobchange(struct map_session_data *sd, int class, int upper) /*========================================== * Tell client player sd has change equipement *------------------------------------------*/ -int pc_equiplookall(struct map_session_data *sd) +static int pc_equiplookall(struct map_session_data *sd) { nullpo_ret(sd); @@ -9026,7 +9060,7 @@ int pc_equiplookall(struct map_session_data *sd) /*========================================== * Tell client player sd has change look (hair,equip...) *------------------------------------------*/ -int pc_changelook(struct map_session_data *sd,int type,int val) +static int pc_changelook(struct map_session_data *sd, int type, int val) { nullpo_ret(sd); @@ -9099,7 +9133,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) /*========================================== * Give an option (type) to player (sd) and display it to client *------------------------------------------*/ -int pc_setoption(struct map_session_data *sd,int type) +static int pc_setoption(struct map_session_data *sd, int type) { int p_type, new_look=0; nullpo_ret(sd); @@ -9197,7 +9231,8 @@ int pc_setoption(struct map_session_data *sd,int type) /*========================================== * Give player a cart *------------------------------------------*/ -int pc_setcart(struct map_session_data *sd,int type) { +static int pc_setcart(struct map_session_data *sd, int type) +{ #ifndef NEW_CARTS int cart[6] = {OPTION_NOTHING,OPTION_CART1,OPTION_CART2,OPTION_CART3,OPTION_CART4,OPTION_CART5}; int option; @@ -9260,7 +9295,7 @@ int pc_setcart(struct map_session_data *sd,int type) { * @param sd Target player. * @param flag New state. **/ -void pc_setfalcon(struct map_session_data *sd, bool flag) +static void pc_setfalcon(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9279,7 +9314,7 @@ void pc_setfalcon(struct map_session_data *sd, bool flag) * @param sd Target player. * @param flag New state. **/ -void pc_setridingpeco(struct map_session_data *sd, bool flag) +static void pc_setridingpeco(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9298,7 +9333,7 @@ void pc_setridingpeco(struct map_session_data *sd, bool flag) * @param sd Target player. * @param flag New state. **/ -void pc_setmadogear(struct map_session_data *sd, bool flag) +static void pc_setmadogear(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9317,7 +9352,7 @@ void pc_setmadogear(struct map_session_data *sd, bool flag) * @param sd Target player. * @param type New state. This must be a valid OPTION_DRAGON* or 0. **/ -void pc_setridingdragon(struct map_session_data *sd, unsigned int type) +static void pc_setridingdragon(struct map_session_data *sd, unsigned int type) { nullpo_retv(sd); if (type&OPTION_DRAGON) { @@ -9350,7 +9385,7 @@ void pc_setridingdragon(struct map_session_data *sd, unsigned int type) * @param sd Target player. * @param flag New state. **/ -void pc_setridingwug(struct map_session_data *sd, bool flag) +static void pc_setridingwug(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9369,7 +9404,8 @@ void pc_setridingwug(struct map_session_data *sd, bool flag) * Called from unit_attack and unit_attack_timer_sub * @retval true Can attack **/ -bool pc_can_attack( struct map_session_data *sd, int target_id ) { +static bool pc_can_attack(struct map_session_data *sd, int target_id) +{ nullpo_retr(false, sd); if( sd->sc.data[SC_BASILICA] || @@ -9395,7 +9431,8 @@ bool pc_can_attack( struct map_session_data *sd, int target_id ) { * Called from clif_parse_GlobalMessage and clif_parse_WisMessage * @retval true Can talk **/ -bool pc_can_talk( struct map_session_data *sd ) { +static bool pc_can_talk(struct map_session_data *sd) +{ nullpo_retr(false, sd); if( sd->sc.data[SC_BERSERK] || @@ -9410,7 +9447,7 @@ bool pc_can_talk( struct map_session_data *sd ) { /*========================================== * Check if player can drop an item *------------------------------------------*/ -int pc_candrop(struct map_session_data *sd, struct item *item) +static int pc_candrop(struct map_session_data *sd, struct item *item) { if( item && (item->expire_time || (item->bound && !pc_can_give_bound_items(sd))) ) return 0; @@ -9421,14 +9458,16 @@ int pc_candrop(struct map_session_data *sd, struct item *item) /** * For '@type' variables (temporary numeric char reg) **/ -int pc_readreg(struct map_session_data* sd, int64 reg) { +static int pc_readreg(struct map_session_data *sd, int64 reg) +{ nullpo_ret(sd); return i64db_iget(sd->regs.vars, reg); } /** * For '@type' variables (temporary numeric char reg) **/ -void pc_setreg(struct map_session_data* sd, int64 reg, int val) { +static void pc_setreg(struct map_session_data *sd, int64 reg, int val) +{ unsigned int index = script_getvaridx(reg); nullpo_retv(sd); @@ -9446,7 +9485,8 @@ void pc_setreg(struct map_session_data* sd, int64 reg, int val) { /** * For '@type$' variables (temporary string char reg) **/ -char* pc_readregstr(struct map_session_data* sd, int64 reg) { +static char *pc_readregstr(struct map_session_data *sd, int64 reg) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, sd); @@ -9457,7 +9497,8 @@ char* pc_readregstr(struct map_session_data* sd, int64 reg) { /** * For '@type$' variables (temporary string char reg) **/ -void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) { +static void pc_setregstr(struct map_session_data *sd, int64 reg, const char *str) +{ struct script_reg_str *p = NULL; unsigned int index = script_getvaridx(reg); struct DBData prev; @@ -9496,7 +9537,8 @@ void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) { * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/ -int pc_readregistry(struct map_session_data *sd, int64 reg) { +static int pc_readregistry(struct map_session_data *sd, int64 reg) +{ struct script_reg_num *p = NULL; nullpo_ret(sd); @@ -9518,7 +9560,8 @@ int pc_readregistry(struct map_session_data *sd, int64 reg) { * - '#type$' (permanent str account reg) * - '##type$' (permanent str account reg2) **/ -char* pc_readregistry_str(struct map_session_data *sd, int64 reg) { +static char *pc_readregistry_str(struct map_session_data *sd, int64 reg) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, sd); @@ -9540,7 +9583,8 @@ char* pc_readregistry_str(struct map_session_data *sd, int64 reg) { * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/ -int pc_setregistry(struct map_session_data *sd, int64 reg, int val) { +static int pc_setregistry(struct map_session_data *sd, int64 reg, int val) +{ struct script_reg_num *p = NULL; const char *regname = script->get_str( script_getvarid(reg) ); unsigned int index = script_getvaridx(reg); @@ -9616,7 +9660,8 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val) { * - '#type$' (permanent str account reg) * - '##type$' (permanent str account reg2) **/ -int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) { +static int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) +{ struct script_reg_str *p = NULL; const char *regname = script->get_str( script_getvarid(reg) ); unsigned int index = script_getvaridx(reg); @@ -9672,7 +9717,8 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) /*========================================== * Exec eventtimer for player sd (retrieved from map_session (id)) *------------------------------------------*/ -int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) { +static int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd=map->id2sd(id); char *p = (char *)data; int i; @@ -9696,7 +9742,7 @@ int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Add eventtimer for player sd ? *------------------------------------------*/ -int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) +static int pc_addeventtimer(struct map_session_data *sd, int tick, const char *name) { int i; nullpo_ret(sd); @@ -9715,7 +9761,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) /*========================================== * Del eventtimer for player sd ? *------------------------------------------*/ -int pc_deleventtimer(struct map_session_data *sd,const char *name) +static int pc_deleventtimer(struct map_session_data *sd, const char *name) { char* p = NULL; int i; @@ -9746,7 +9792,7 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name) /*========================================== * Update eventtimer count for player sd *------------------------------------------*/ -int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick) +static int pc_addeventtimercount(struct map_session_data *sd, const char *name, int tick) { int i; @@ -9765,7 +9811,7 @@ int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick) /*========================================== * Remove all eventtimer for player sd *------------------------------------------*/ -int pc_cleareventtimer(struct map_session_data *sd) +static int pc_cleareventtimer(struct map_session_data *sd) { int i; @@ -9785,7 +9831,8 @@ int pc_cleareventtimer(struct map_session_data *sd) return 0; } /* called when a item with combo is worn */ -int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { +static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) +{ int i, j, k, z; int index, success = 0; struct pc_combos *combo; @@ -9864,7 +9911,8 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { } /* called when a item with combo is removed */ -int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { +static int pc_removecombo(struct map_session_data *sd, struct item_data *data) +{ int i, retval = 0; nullpo_ret(sd); @@ -9911,7 +9959,8 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { return retval; } -int pc_load_combo(struct map_session_data *sd) { +static int pc_load_combo(struct map_session_data *sd) +{ int i, ret = 0; nullpo_ret(sd); for( i = 0; i < EQI_MAX; i++ ) { @@ -9938,13 +9987,13 @@ int pc_load_combo(struct map_session_data *sd) { } /** -* Equip item at given position. -* @param sd the affected player structure. Must be checked before. -* @param id item structure for equip. Must be checked before. -* @param n inventory item position. Must be checked before. -* @param pos slot position. Must be checked before. -**/ -void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, int pos) + * Equip item at given position. + * @param sd the affected player structure. Must be checked before. + * @param id item structure for equip. Must be checked before. + * @param n inventory item position. Must be checked before. + * @param pos slot position. Must be checked before. + */ +static void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, int pos) { nullpo_retv(sd); if ((!map_no_view(sd->bl.m,EQP_SHADOW_WEAPON) && pos & EQP_SHADOW_WEAPON) || @@ -10043,7 +10092,7 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, * 0 = fail * 1 = success *------------------------------------------*/ -int pc_equipitem(struct map_session_data *sd,int n,int req_pos) +static int pc_equipitem(struct map_session_data *sd, int n, int req_pos) { int i,pos,flag=0,iflag; struct item_data *id; @@ -10178,12 +10227,12 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } /** -* Unequip an item at the given position. -* @param sd the affected player structure. Must be checked before. -* @param n inventory item position. Must be checked before. -* @param pos slot position. Must be checked before. -**/ -void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) + * Unequip an item at the given position. + * @param sd the affected player structure. Must be checked before. + * @param n inventory item position. Must be checked before. + * @param pos slot position. Must be checked before. + */ +static void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) { nullpo_retv(sd); if (pos & EQP_HAND_R) { @@ -10250,7 +10299,7 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_unequipitem(struct map_session_data *sd,int n,int flag) +static int pc_unequipitem(struct map_session_data *sd, int n, int flag) { int i, iflag; bool status_calc = false; @@ -10397,7 +10446,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) * Checking if player (sd) have unauthorize, invalide item * on inventory, cart, equiped for the map (item_noequip) *------------------------------------------*/ -int pc_checkitem(struct map_session_data *sd) +static int pc_checkitem(struct map_session_data *sd) { int i, calc_flag = 0; @@ -10541,7 +10590,7 @@ int pc_checkitem(struct map_session_data *sd) /*========================================== * Update PVP rank for sd1 in cmp to sd2 *------------------------------------------*/ -int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) +static int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd1 = NULL; struct map_session_data *sd2 = va_arg(ap,struct map_session_data *); @@ -10564,7 +10613,8 @@ int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) * Calculate new rank beetween all present players (map->foreachinarea) * and display result *------------------------------------------*/ -int pc_calc_pvprank(struct map_session_data *sd) { +static int pc_calc_pvprank(struct map_session_data *sd) +{ int old; struct map_data *m; nullpo_ret(sd); @@ -10579,7 +10629,8 @@ int pc_calc_pvprank(struct map_session_data *sd) { /*========================================== * Calculate next sd ranking calculation from config *------------------------------------------*/ -int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; sd=map->id2sd(id); @@ -10603,7 +10654,7 @@ int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) { * partner_id = yes * 0 = no *------------------------------------------*/ -int pc_ismarried(struct map_session_data *sd) +static int pc_ismarried(struct map_session_data *sd) { if(sd == NULL) return -1; @@ -10618,7 +10669,7 @@ int pc_ismarried(struct map_session_data *sd) * -1 = fail * 0 = success *------------------------------------------*/ -int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) +static int pc_marriage(struct map_session_data *sd, struct map_session_data *dstsd) { if(sd == NULL || dstsd == NULL || sd->status.partner_id > 0 || dstsd->status.partner_id > 0 || @@ -10635,7 +10686,7 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) * -1 = fail * 0 = success *------------------------------------------*/ -int pc_divorce(struct map_session_data *sd) +static int pc_divorce(struct map_session_data *sd) { struct map_session_data *p_sd; int i; @@ -10674,7 +10725,8 @@ int pc_divorce(struct map_session_data *sd) /*========================================== * Get sd partner charid. (Married partner) *------------------------------------------*/ -struct map_session_data *pc_get_partner(struct map_session_data *sd) { +static struct map_session_data *pc_get_partner(struct map_session_data *sd) +{ if (sd && pc->ismarried(sd)) // charid2sd returns NULL if not found return map->charid2sd(sd->status.partner_id); @@ -10685,7 +10737,8 @@ struct map_session_data *pc_get_partner(struct map_session_data *sd) { /*========================================== * Get sd father charid. (Need to be baby) *------------------------------------------*/ -struct map_session_data *pc_get_father(struct map_session_data *sd) { +static struct map_session_data *pc_get_father(struct map_session_data *sd) +{ if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.father > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.father); @@ -10696,7 +10749,8 @@ struct map_session_data *pc_get_father(struct map_session_data *sd) { /*========================================== * Get sd mother charid. (Need to be baby) *------------------------------------------*/ -struct map_session_data *pc_get_mother(struct map_session_data *sd) { +static struct map_session_data *pc_get_mother(struct map_session_data *sd) +{ if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.mother > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.mother); @@ -10707,7 +10761,8 @@ struct map_session_data *pc_get_mother(struct map_session_data *sd) { /*========================================== * Get sd children charid. (Need to be married) *------------------------------------------*/ -struct map_session_data *pc_get_child(struct map_session_data *sd) { +static struct map_session_data *pc_get_child(struct map_session_data *sd) +{ if (sd && pc->ismarried(sd) && sd->status.child > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.child); @@ -10718,7 +10773,7 @@ struct map_session_data *pc_get_child(struct map_session_data *sd) { /*========================================== * Set player sd to bleed. (losing hp and/or sp each diff_tick) *------------------------------------------*/ -void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) +static void pc_bleeding(struct map_session_data *sd, unsigned int diff_tick) { int hp = 0, sp = 0; @@ -10753,7 +10808,8 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) //Character regen. Flag is used to know which types of regen can take place. //&1: HP regen //&2: SP regen -void pc_regen (struct map_session_data *sd, unsigned int diff_tick) { +static void pc_regen(struct map_session_data *sd, unsigned int diff_tick) +{ int hp = 0, sp = 0; nullpo_retv(sd); @@ -10782,7 +10838,8 @@ void pc_regen (struct map_session_data *sd, unsigned int diff_tick) { /*========================================== * Memo player sd savepoint. (map,x,y) *------------------------------------------*/ -int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) { +static int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) +{ nullpo_ret(sd); sd->status.save_point.map = map_index; @@ -10795,7 +10852,8 @@ int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) /*========================================== * Save 1 player data at autosave intervall *------------------------------------------*/ -int pc_autosave(int tid, int64 tick, int id, intptr_t data) { +static int pc_autosave(int tid, int64 tick, int id, intptr_t data) +{ int interval; struct s_mapiterator* iter; struct map_session_data* sd; @@ -10833,7 +10891,8 @@ int pc_autosave(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) { +static int pc_daynight_timer_sub(struct map_session_data *sd, va_list ap) +{ nullpo_ret(sd); if (sd->state.night != map->night_flag && map->list[sd->bl.m].flag.nightenabled) { //Night/day state does not match. clif->status_change(&sd->bl, SI_SKE, map->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex] @@ -10846,7 +10905,8 @@ int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) { * timer to do the day [Yor] * data: 0 = called by timer, 1 = gmcommand/script *------------------------------------------------*/ -int map_day_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_day_timer(int tid, int64 tick, int id, intptr_t data) +{ char tmp_soutput[1024]; if (data == 0 && battle_config.day_duration <= 0) // if we want a day @@ -10866,7 +10926,8 @@ int map_day_timer(int tid, int64 tick, int id, intptr_t data) { * timer to do the night [Yor] * data: 0 = called by timer, 1 = gmcommand/script *------------------------------------------------*/ -int map_night_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_night_timer(int tid, int64 tick, int id, intptr_t data) +{ char tmp_soutput[1024]; if (data == 0 && battle_config.night_duration <= 0) // if we want a night @@ -10882,7 +10943,8 @@ int map_night_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void pc_setstand(struct map_session_data *sd) { +static void pc_setstand(struct map_session_data *sd) +{ nullpo_retv(sd); status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER); @@ -10895,7 +10957,8 @@ void pc_setstand(struct map_session_data *sd) { /** * Mechanic (MADO GEAR) **/ -void pc_overheat(struct map_session_data *sd, int val) { +static void pc_overheat(struct map_session_data *sd, int val) +{ int heat = val, skill_lv, limit[] = { 10, 20, 28, 46, 66 }; @@ -10921,7 +10984,7 @@ void pc_overheat(struct map_session_data *sd, int val) { /** * Check if player is autolooting given itemID. */ -bool pc_isautolooting(struct map_session_data *sd, int nameid) +static bool pc_isautolooting(struct map_session_data *sd, int nameid) { int i = 0; @@ -10942,7 +11005,8 @@ bool pc_isautolooting(struct map_session_data *sd, int nameid) * @param sd Player map session data * @param command Command name with @/# and without params */ -bool pc_can_use_command(struct map_session_data *sd, const char *command) { +static bool pc_can_use_command(struct map_session_data *sd, const char *command) +{ return atcommand->can_use(sd,command); } @@ -10951,7 +11015,7 @@ bool pc_can_use_command(struct map_session_data *sd, const char *command) { * * @see TimerFunc */ -int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) +static int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd = map->id2sd(id); int i; @@ -10992,7 +11056,7 @@ int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) * @param max Maximum amount of charms to add. * @param type Charm type (@see spirit_charm_types) */ -void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) +static void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) { int tid, i; @@ -11034,7 +11098,7 @@ void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) * @param count Amount of charms to remove. * @param type Type of charm to remove. */ -void pc_del_charm(struct map_session_data *sd, int count, int type) +static void pc_del_charm(struct map_session_data *sd, int count, int type) { int i; @@ -11081,7 +11145,7 @@ void pc_del_charm(struct map_session_data *sd, int count, int type) * @param type Modifier type (1=exp 2=itemdrop) * @return The percent rate modifier (100 = 100%) */ -int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) +static int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int rate = 100, i; @@ -11111,7 +11175,7 @@ int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) #endif } -bool pc_read_skill_job_skip(short skill_id, int job_id) +static bool pc_read_skill_job_skip(short skill_id, int job_id) { return skill_id == NV_TRICKDEAD && ((pc->jobid2mapid(job_id) & (MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE); // skip trickdead for non-novices } @@ -11129,7 +11193,7 @@ bool pc_read_skill_job_skip(short skill_id, int job_id) * * @author [Ind/Hercules] */ -void pc_read_skill_tree(void) +static void pc_read_skill_tree(void) { struct config_t skill_tree_conf; struct config_setting_t *skt = NULL; @@ -11326,7 +11390,7 @@ void pc_read_skill_tree(void) /** * Clears the skill tree and frees any allocated memory. */ -void pc_clear_skill_tree(void) +static void pc_clear_skill_tree(void) { int i; for (i = 0; i < CLASS_COUNT; i++) { @@ -11340,7 +11404,8 @@ void pc_clear_skill_tree(void) memset(pc->skill_tree, 0, sizeof(pc->skill_tree)); } -bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { +static bool pc_readdb_levelpenalty(char *fields[], int columns, int current) +{ #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int type, race, diff; @@ -11369,7 +11434,7 @@ bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { return true; } -bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) +static bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) { struct class_exp_group entry = { { 0 } }; struct config_setting_t *exp_t = NULL; @@ -11421,7 +11486,7 @@ bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) * @param[in] base boolean switch determining whether to read either base or job exp. * @return total number of valid entries read from the setting. */ -int pc_read_exp_db_sub(struct config_setting_t *t, bool base) +static int pc_read_exp_db_sub(struct config_setting_t *t, bool base) { int i = 0, entry_count = 0; struct config_setting_t *tt = NULL; @@ -11440,7 +11505,7 @@ int pc_read_exp_db_sub(struct config_setting_t *t, bool base) * Description: Initiates reading of the exp_group_db.conf. * @return true success, false on failure. */ -bool pc_read_exp_db(void) +static bool pc_read_exp_db(void) { struct config_t exp_db_conf; struct config_setting_t *edb = NULL; @@ -11484,7 +11549,8 @@ bool pc_read_exp_db(void) * skill_tree.txt - skill tree for every class * attr_fix.txt - elemental adjustment table *------------------------------------------*/ -int pc_readdb(void) { +static int pc_readdb(void) +{ int i,j,k; unsigned int count = 0; FILE *fp; @@ -11609,7 +11675,7 @@ int pc_readdb(void) { return 0; } -bool pc_job_is_dummy(int job) +static bool pc_job_is_dummy(int job) { if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER @@ -11622,7 +11688,8 @@ bool pc_job_is_dummy(int job) return false; } -void pc_validate_levels(void) { +static void pc_validate_levels(void) +{ int i; int j; for (i = 0; i < JOB_MAX; i++) { @@ -11637,7 +11704,8 @@ void pc_validate_levels(void) { } } -void pc_itemcd_do(struct map_session_data *sd, bool load) { +static void pc_itemcd_do(struct map_session_data *sd, bool load) +{ int i,cursor = 0; struct item_cd* cd = NULL; @@ -11672,7 +11740,8 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) { return; } -void pc_bank_deposit(struct map_session_data *sd, int money) { +static void pc_bank_deposit(struct map_session_data *sd, int money) +{ unsigned int limit_check; nullpo_retv(sd); @@ -11695,7 +11764,8 @@ void pc_bank_deposit(struct map_session_data *sd, int money) { clif->bank_deposit(sd,BDA_SUCCESS); } } -void pc_bank_withdraw(struct map_session_data *sd, int money) { +static void pc_bank_withdraw(struct map_session_data *sd, int money) +{ unsigned int limit_check; nullpo_retv(sd); @@ -11722,7 +11792,8 @@ void pc_bank_withdraw(struct map_session_data *sd, int money) { } } /* status change data arrived from char-server */ -void pc_scdata_received(struct map_session_data *sd) { +static void pc_scdata_received(struct map_session_data *sd) +{ nullpo_retv(sd); pc->inventory_rentals(sd); clif->show_modifiers(sd); @@ -11742,7 +11813,8 @@ void pc_scdata_received(struct map_session_data *sd) { pc->autotrade_start(sd); } } -int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( !sd ) return 0; @@ -11758,7 +11830,8 @@ int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) { } /* This timer exists only when a character with an expire timer > 24h is online */ /* It loops through online players once an hour to check whether a new < 24h is available */ -int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) +{ struct s_mapiterator* iter; struct map_session_data* sd; @@ -11771,7 +11844,8 @@ int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void pc_expire_check(struct map_session_data *sd) { +static void pc_expire_check(struct map_session_data *sd) +{ nullpo_retv(sd); /* ongoing timer */ if( sd->expiration_tid != INVALID_TIMER ) @@ -11792,7 +11866,7 @@ void pc_expire_check(struct map_session_data *sd) { /** * Loads autotraders ***/ -void pc_autotrade_load(void) +static void pc_autotrade_load(void) { char *data; @@ -11825,7 +11899,8 @@ void pc_autotrade_load(void) /** * Loads vending data and sets it up, is triggered when char server data that pc_autotrade_load requested arrives **/ -void pc_autotrade_start(struct map_session_data *sd) { +static void pc_autotrade_start(struct map_session_data *sd) +{ unsigned int count = 0; int i; char *data; @@ -11872,7 +11947,8 @@ void pc_autotrade_start(struct map_session_data *sd) { /** * Perform a autotrade action **/ -void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update_action action) { +static void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update_action action) +{ int i; nullpo_retv(sd); @@ -11922,7 +11998,8 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update /** * Handles characters upon @autotrade usage **/ -void pc_autotrade_prepare(struct map_session_data *sd) { +static void pc_autotrade_prepare(struct map_session_data *sd) +{ struct autotrade_vending *data; int i, cursor = 0; int account_id, char_id; @@ -11972,7 +12049,8 @@ void pc_autotrade_prepare(struct map_session_data *sd) { /** * Prepares autotrade data from pc->at_db from a player that has already returned from char server **/ -void pc_autotrade_populate(struct map_session_data *sd) { +static void pc_autotrade_populate(struct map_session_data *sd) +{ struct autotrade_vending *data; int i, j, k, cursor = 0; @@ -12016,7 +12094,7 @@ void pc_autotrade_populate(struct map_session_data *sd) { /** * @see DBApply */ -int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) +static int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) { struct autotrade_vending* at_v = DB->data2ptr(data); nullpo_ret(at_v); @@ -12024,7 +12102,7 @@ int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) return 0; } -void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idletime type) +static void pc_update_idle_time(struct map_session_data *sd, enum e_battle_config_idletime type) { nullpo_retv(sd); if (battle_config.idletime_criteria&type) @@ -12033,7 +12111,7 @@ void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idlet //Checks if the given class value corresponds to a player class. [Skotlex] //JOB_NOVICE isn't checked for class is supposed to be unsigned -bool pc_db_checkid(int class) +static bool pc_db_checkid(int class) { return class < JOB_MAX_BASIC || (class >= JOB_NOVICE_HIGH && class <= JOB_DARK_COLLECTOR ) @@ -12050,7 +12128,7 @@ bool pc_db_checkid(int class) * @param sd map_session_data of Player * @return index of magnifer, INDEX_NOT_FOUND if it is not found */ -int pc_have_magnifier(struct map_session_data *sd) +static int pc_have_magnifier(struct map_session_data *sd) { int n; n = pc->search_inventory(sd, ITEMID_SPECTACLES); @@ -12065,7 +12143,8 @@ int pc_have_magnifier(struct map_session_data *sd) * @param level Required Level of Novice Skill * @return bool true, if requirement is satisfied */ -bool pc_check_basicskill(struct map_session_data *sd, int level) { +static bool pc_check_basicskill(struct map_session_data *sd, int level) +{ if (pc->checkskill(sd, NV_BASIC) >= level || pc->checkskill(sd, SU_BASIC_SKILL)) return true; return false; @@ -12079,7 +12158,7 @@ bool pc_check_basicskill(struct map_session_data *sd, int level) { * @param message The message text. * @return Whether the message is a valid chat message. */ -bool pc_process_chat_message(struct map_session_data *sd, const char *message) +static bool pc_process_chat_message(struct map_session_data *sd, const char *message) { nullpo_retr(false, sd); if (atcommand->exec(sd->fd, sd, message, true)) { @@ -12111,7 +12190,7 @@ bool pc_process_chat_message(struct map_session_data *sd, const char *message) * @param sd The sender character. * @param message The message text. */ -void pc_check_supernovice_call(struct map_session_data *sd, const char *message) +static void pc_check_supernovice_call(struct map_session_data *sd, const char *message) { uint64 next = pc->nextbaseexp(sd); int percent = 0; @@ -12155,7 +12234,7 @@ void pc_check_supernovice_call(struct map_session_data *sd, const char *message) } } -void pc_update_job_and_level(struct map_session_data *sd) +static void pc_update_job_and_level(struct map_session_data *sd) { nullpo_retv(sd); @@ -12173,7 +12252,7 @@ void pc_update_job_and_level(struct map_session_data *sd) } } -void pc_clear_exp_groups(void) +static void pc_clear_exp_groups(void) { int i, k, size; for (k = 0; k < 2; k++) { @@ -12185,7 +12264,7 @@ void pc_clear_exp_groups(void) } } -void pc_init_exp_groups(void) +static void pc_init_exp_groups(void) { int i; for (i = 0; i < 2; i++) { @@ -12193,7 +12272,7 @@ void pc_init_exp_groups(void) } } -void do_final_pc(void) +static void do_final_pc(void) { db_destroy(pc->itemcd_db); @@ -12212,7 +12291,8 @@ void do_final_pc(void) return; } -void do_init_pc(bool minimal) { +static void do_init_pc(bool minimal) +{ if (minimal) return; @@ -12260,12 +12340,14 @@ void do_init_pc(bool minimal) { ers_chunk_size(pc->num_reg_ers, 300); ers_chunk_size(pc->str_reg_ers, 50); } + /*===================================== -* Default Functions : pc.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void pc_defaults(void) { + * Default Functions : pc.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void pc_defaults(void) +{ const struct sg_data sg_info[MAX_PC_FEELHATE] = { { SG_SUN_ANGER, SG_SUN_BLESS, SG_SUN_COMFORT, "PC_FEEL_SUN", "PC_HATE_MOB_SUN", is_day_of_sun }, { SG_MOON_ANGER, SG_MOON_BLESS, SG_MOON_COMFORT, "PC_FEEL_MOON", "PC_HATE_MOB_MOON", is_day_of_moon }, diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index f7ac954de..887c946e3 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -36,7 +36,7 @@ static GroupSettings dummy_group; ///< dummy group used in dummy map sessions @see pc_get_dummy_sd() -struct pc_groups_interface pcg_s; +static struct pc_groups_interface pcg_s; struct pc_groups_interface *pcg; /** @@ -44,7 +44,7 @@ struct pc_groups_interface *pcg; * Used in dummy map sessions. * @see pc_get_dummy_sd() */ -GroupSettings* pc_group_get_dummy_group(void) +static GroupSettings *pc_group_get_dummy_group(void) { return &dummy_group; } @@ -53,7 +53,7 @@ GroupSettings* pc_group_get_dummy_group(void) * @retval NULL if not found * @private */ -static inline GroupSettings* name2group(const char* group_name) +static inline GroupSettings *name2group(const char *group_name) { return strdb_get(pcg->name_db, group_name); } @@ -62,7 +62,8 @@ static inline GroupSettings* name2group(const char* group_name) * Loads group configuration from config file into memory. * @private */ -static void read_config(void) { +static void read_config(void) +{ struct config_t pc_group_config; struct config_setting_t *groups = NULL; const char *config_filename = "conf/groups.conf"; // FIXME hardcoded name @@ -308,7 +309,7 @@ static void read_config(void) { * @param group group * @param permission permission to check */ -bool pc_group_has_permission(GroupSettings *group, unsigned int permission) +static bool pc_group_has_permission(GroupSettings *group, unsigned int permission) { nullpo_retr(false, group); return ((group->e_permissions&permission) != 0); @@ -318,7 +319,7 @@ bool pc_group_has_permission(GroupSettings *group, unsigned int permission) * Checks if commands used by player group should be logged * @param group group */ -bool pc_group_should_log_commands(GroupSettings *group) +static bool pc_group_should_log_commands(GroupSettings *group) { nullpo_retr(true, group); return group->log_commands; @@ -329,7 +330,7 @@ bool pc_group_should_log_commands(GroupSettings *group) * @param group_id group id * @returns true if group exists, false otherwise */ -bool pc_group_exists(int group_id) +static bool pc_group_exists(int group_id) { return idb_exists(pcg->db, group_id); } @@ -337,7 +338,7 @@ bool pc_group_exists(int group_id) /** * @retval NULL if not found */ -GroupSettings* pc_group_id2group(int group_id) +static GroupSettings *pc_group_id2group(int group_id) { return idb_get(pcg->db, group_id); } @@ -348,7 +349,7 @@ GroupSettings* pc_group_id2group(int group_id) * @return group name * @public */ -const char* pc_group_get_name(GroupSettings *group) +static const char *pc_group_get_name(GroupSettings *group) { nullpo_retr(NULL, group); return group->name; @@ -360,7 +361,7 @@ const char* pc_group_get_name(GroupSettings *group) * @return group level * @public */ -int pc_group_get_level(GroupSettings *group) +static int pc_group_get_level(GroupSettings *group) { nullpo_ret(group); return group->level; @@ -372,7 +373,7 @@ int pc_group_get_level(GroupSettings *group) * @return group index * @public */ -int pc_group_get_idx(GroupSettings *group) +static int pc_group_get_idx(GroupSettings *group) { nullpo_ret(group); return group->index; @@ -382,7 +383,8 @@ int pc_group_get_idx(GroupSettings *group) * Insert a new permission * @return inserted key or 0 upon failure. **/ -unsigned int pc_groups_add_permission(const char *name) { +static unsigned int pc_groups_add_permission(const char *name) +{ uint64 key = 0x1; unsigned char i; nullpo_ret(name); @@ -414,7 +416,8 @@ unsigned int pc_groups_add_permission(const char *name) { * Initialize PC Groups: allocate DBMaps and read config. * @public */ -void do_init_pc_groups(void) { +static void do_init_pc_groups(void) +{ const struct { const char *name; unsigned int permission; @@ -484,7 +487,7 @@ static int group_db_clear_sub(union DBKey key, struct DBData *data, va_list args * Finalize PC Groups: free DBMaps and config. * @public */ -void do_final_pc_groups(void) +static void do_final_pc_groups(void) { if (pcg->db != NULL) pcg->db->destroy(pcg->db, group_db_clear_sub); @@ -506,7 +509,8 @@ void do_final_pc_groups(void) * Used in @reloadatcommand * @public */ -void pc_groups_reload(void) { +static void pc_groups_reload(void) +{ struct map_session_data *sd = NULL; struct s_mapiterator *iter; @@ -528,7 +532,8 @@ void pc_groups_reload(void) { /** * Connect Interface **/ -void pc_groups_defaults(void) { +void pc_groups_defaults(void) +{ pcg = &pcg_s; /* */ pcg->db = NULL; diff --git a/src/map/pet.c b/src/map/pet.c index 58c26d1ce..f4ba4e31b 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -54,12 +54,12 @@ #include <stdlib.h> #include <string.h> -struct pet_interface pet_s; +static struct pet_interface pet_s; struct pet_interface *pet; #define MIN_PETTHINKTIME 100 -int pet_hungry_val(struct pet_data *pd) +static int pet_hungry_val(struct pet_data *pd) { nullpo_ret(pd); @@ -75,7 +75,7 @@ int pet_hungry_val(struct pet_data *pd) return 0; } -void pet_set_intimate(struct pet_data *pd, int value) +static void pet_set_intimate(struct pet_data *pd, int value) { int intimate; struct map_session_data *sd; @@ -102,7 +102,7 @@ void pet_set_intimate(struct pet_data *pd, int value) } } -int pet_create_egg(struct map_session_data *sd, int item_id) +static int pet_create_egg(struct map_session_data *sd, int item_id) { int pet_id = pet->search_petDB_index(item_id, PET_EGG); nullpo_ret(sd); @@ -118,7 +118,7 @@ int pet_create_egg(struct map_session_data *sd, int item_id) return 1; } -int pet_unlocktarget(struct pet_data *pd) +static int pet_unlocktarget(struct pet_data *pd) { nullpo_ret(pd); @@ -131,7 +131,8 @@ int pet_unlocktarget(struct pet_data *pd) /*========================================== * Pet Attack Skill [Skotlex] *------------------------------------------*/ -int pet_attackskill(struct pet_data *pd, int target_id) { +static int pet_attackskill(struct pet_data *pd, int target_id) +{ nullpo_ret(pd); if (!battle_config.pet_status_support || !pd->a_skill || (battle_config.pet_equip_required && !pd->pet.equip)) @@ -160,7 +161,8 @@ int pet_attackskill(struct pet_data *pd, int target_id) { return 0; } -int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) { +static int pet_target_check(struct map_session_data *sd, struct block_list *bl, int type) +{ struct pet_data *pd; int rate; @@ -204,7 +206,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) /*========================================== * Pet SC Check [Skotlex] *------------------------------------------*/ -int pet_sc_check(struct map_session_data *sd, int type) +static int pet_sc_check(struct map_session_data *sd, int type) { struct pet_data *pd; @@ -223,7 +225,8 @@ int pet_sc_check(struct map_session_data *sd, int type) return 0; } -int pet_hungry(int tid, int64 tick, int id, intptr_t data) { +static int pet_hungry(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct pet_data *pd; int interval; @@ -279,7 +282,7 @@ int pet_hungry(int tid, int64 tick, int id, intptr_t data) { return 0; } -int search_petDB_index(int key,int type) +static int search_petDB_index(int key, int type) { int i; @@ -300,7 +303,7 @@ int search_petDB_index(int key,int type) return -1; } -int pet_hungry_timer_delete(struct pet_data *pd) +static int pet_hungry_timer_delete(struct pet_data *pd) { nullpo_ret(pd); if(pd->pet_hungry_timer != INVALID_TIMER) { @@ -311,7 +314,7 @@ int pet_hungry_timer_delete(struct pet_data *pd) return 1; } -int pet_performance(struct map_session_data *sd, struct pet_data *pd) +static int pet_performance(struct map_session_data *sd, struct pet_data *pd) { int val; @@ -329,7 +332,7 @@ int pet_performance(struct map_session_data *sd, struct pet_data *pd) return 1; } -int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) +static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) { int i; @@ -355,7 +358,7 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) return 1; } -int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo) +static int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo) { struct pet_data *pd; int i=0,interval=0; @@ -430,7 +433,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *petinfo) return 0; } -int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo) +static int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo) { nullpo_retr(1, sd); nullpo_retr(1, petinfo); @@ -467,7 +470,8 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo) return 0; } -int pet_recv_petdata(int account_id,struct s_pet *p,int flag) { +static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) +{ struct map_session_data *sd; nullpo_retr(1, p); @@ -512,7 +516,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag) { return 0; } -int pet_select_egg(struct map_session_data *sd,short egg_index) +static int pet_select_egg(struct map_session_data *sd, short egg_index) { nullpo_ret(sd); @@ -527,7 +531,7 @@ int pet_select_egg(struct map_session_data *sd,short egg_index) return 0; } -int pet_catch_process1(struct map_session_data *sd,int target_class) +static int pet_catch_process1(struct map_session_data *sd, int target_class) { nullpo_ret(sd); @@ -537,7 +541,8 @@ int pet_catch_process1(struct map_session_data *sd,int target_class) return 0; } -int pet_catch_process2(struct map_session_data* sd, int target_id) { +static int pet_catch_process2(struct map_session_data *sd, int target_id) +{ struct mob_data *md = NULL; struct block_list *bl = NULL; int i = 0, pet_catch_rate = 0; @@ -599,7 +604,8 @@ int pet_catch_process2(struct map_session_data* sd, int target_id) { * pet_id - Should contain pet id otherwise means failure * returns true on success **/ -bool pet_get_egg(int account_id, short pet_class, int pet_id ) { +static bool pet_get_egg(int account_id, short pet_class, int pet_id) +{ struct map_session_data *sd; struct item tmp_item; int i = 0, ret = 0; @@ -639,7 +645,7 @@ bool pet_get_egg(int account_id, short pet_class, int pet_id ) { return true; } -int pet_menu(struct map_session_data *sd,int menunum) +static int pet_menu(struct map_session_data *sd, int menunum) { struct item_data *egg_id; nullpo_ret(sd); @@ -678,7 +684,7 @@ int pet_menu(struct map_session_data *sd,int menunum) return 0; } -int pet_change_name(struct map_session_data *sd, const char *name) +static int pet_change_name(struct map_session_data *sd, const char *name) { int i; struct pet_data *pd; @@ -697,7 +703,7 @@ int pet_change_name(struct map_session_data *sd, const char *name) return intif_rename_pet(sd, name); } -int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag) +static int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag) { struct pet_data *pd; char *newname = NULL; @@ -724,7 +730,8 @@ int pet_change_name_ack(struct map_session_data *sd, const char *name, int flag) return 1; } -int pet_equipitem(struct map_session_data *sd,int index) { +static int pet_equipitem(struct map_session_data *sd, int index) +{ struct pet_data *pd; int nameid; @@ -756,7 +763,8 @@ int pet_equipitem(struct map_session_data *sd,int index) { return 0; } -int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { +static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) +{ struct item tmp_item; int nameid,flag; @@ -797,7 +805,8 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { return 0; } -int pet_food(struct map_session_data *sd, struct pet_data *pd) { +static int pet_food(struct map_session_data *sd, struct pet_data *pd) +{ int i, food_id; nullpo_retr(1, pd); @@ -843,7 +852,7 @@ int pet_food(struct map_session_data *sd, struct pet_data *pd) { return 0; } -int pet_randomwalk(struct pet_data *pd, int64 tick) +static int pet_randomwalk(struct pet_data *pd, int64 tick) { nullpo_ret(pd); Assert_ret(pd->msd == 0 || pd->msd->pd == pd); @@ -884,7 +893,8 @@ int pet_randomwalk(struct pet_data *pd, int64 tick) return 0; } -int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick) { +static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick) +{ struct block_list *target = NULL; nullpo_ret(pd); @@ -997,7 +1007,8 @@ int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, int64 tick return 0; } -int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) { +static int pet_ai_sub_foreachclient(struct map_session_data *sd, va_list ap) +{ int64 tick = va_arg(ap,int64); nullpo_ret(sd); if(sd->status.pet_id && sd->pd) @@ -1006,13 +1017,14 @@ int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap) { return 0; } -int pet_ai_hard(int tid, int64 tick, int id, intptr_t data) { +static int pet_ai_hard(int tid, int64 tick, int id, intptr_t data) +{ map->foreachpc(pet->ai_sub_foreachclient,tick); return 0; } -int pet_ai_sub_hard_lootsearch(struct block_list *bl, va_list ap) +static int pet_ai_sub_hard_lootsearch(struct block_list *bl, va_list ap) { struct pet_data *pd = va_arg(ap,struct pet_data *); struct block_list **target = va_arg(ap,struct block_list**); @@ -1040,7 +1052,8 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl, va_list ap) return 0; } -int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { +static int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) +{ struct item_drop_list *list; struct item_drop *ditem; list=(struct item_drop_list *)data; @@ -1058,7 +1071,7 @@ int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) +static int pet_lootitem_drop(struct pet_data *pd, struct map_session_data *sd) { int i,flag=0; struct item_drop_list *dlist; @@ -1107,7 +1120,8 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) /*========================================== * pet bonus giving skills [Valaris] / Rewritten by [Skotlex] *------------------------------------------*/ -int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) { +static int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd=map->id2sd(id); struct pet_data *pd; int bonus; @@ -1148,7 +1162,8 @@ int pet_skill_bonus_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * pet recovery skills [Valaris] / Rewritten by [Skotlex] *------------------------------------------*/ -int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) { +static int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd=map->id2sd(id); struct pet_data *pd; @@ -1179,7 +1194,8 @@ int pet_recovery_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * pet support skills [Skotlex] *------------------------------------------*/ -int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) { +static int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd=map->id2sd(id); struct pet_data *pd; struct status_data *st; @@ -1222,7 +1238,7 @@ int pet_skill_support_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void pet_read_db(void) +static void pet_read_db(void) { const char *filename[] = { DBPATH"pet_db.conf", @@ -1237,7 +1253,7 @@ void pet_read_db(void) } } -int pet_read_db_libconfig(const char *filename, bool ignore_missing) +static int pet_read_db_libconfig(const char *filename, bool ignore_missing) { struct config_t pet_db_conf; struct config_setting_t *pdb; @@ -1285,7 +1301,7 @@ int pet_read_db_libconfig(const char *filename, bool ignore_missing) return count; } -int pet_read_db_sub(struct config_setting_t *it, int n, const char *source) +static int pet_read_db_sub(struct config_setting_t *it, int n, const char *source) { struct config_setting_t *t = NULL; struct item_data *data = NULL; @@ -1403,7 +1419,7 @@ int pet_read_db_sub(struct config_setting_t *it, int n, const char *source) * @param t libconfig setting * @param n Pet DB Index */ -void pet_read_db_sub_evolution(struct config_setting_t *t, int n) +static void pet_read_db_sub_evolution(struct config_setting_t *t, int n) { struct config_setting_t *pett; int i = 0; @@ -1473,7 +1489,7 @@ void pet_read_db_sub_evolution(struct config_setting_t *t, int n) } } -bool pet_read_db_sub_intimacy(int idx, struct config_setting_t *t) +static bool pet_read_db_sub_intimacy(int idx, struct config_setting_t *t) { int i32 = 0; @@ -1495,7 +1511,7 @@ bool pet_read_db_sub_intimacy(int idx, struct config_setting_t *t) return true; } -void pet_read_db_clear(void) +static void pet_read_db_clear(void) { int i; @@ -1523,7 +1539,8 @@ void pet_read_db_clear(void) /*========================================== * Initialization process relationship skills *------------------------------------------*/ -int do_init_pet(bool minimal) { +static int do_init_pet(bool minimal) +{ if (minimal) return 0; @@ -1543,7 +1560,7 @@ int do_init_pet(bool minimal) { return 0; } -int do_final_pet(void) +static int do_final_pet(void) { int i; for( i = 0; i < MAX_PET_DB; i++ ) @@ -1571,7 +1588,8 @@ int do_final_pet(void) return 0; } -void pet_defaults(void) { +void pet_defaults(void) +{ pet = &pet_s; memset(pet->db,0,sizeof(pet->db)); diff --git a/src/map/quest.c b/src/map/quest.c index 071cab961..614c79cb6 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -52,8 +52,8 @@ #include <string.h> #include <time.h> -struct quest_interface quest_s; -struct quest_db *db_data[MAX_QUEST_DB]; ///< Quest database +static struct quest_interface quest_s; +static struct quest_db *db_data[MAX_QUEST_DB]; ///< Quest database struct quest_interface *quest; @@ -63,7 +63,8 @@ struct quest_interface *quest; * @param quest_id ID to lookup * @return Quest entry (equals to &quest->dummy if the ID is invalid) */ -struct quest_db *quest_db(int quest_id) { +static struct quest_db *quest_db(int quest_id) +{ if (quest_id < 0 || quest_id >= MAX_QUEST_DB || quest->db_data[quest_id] == NULL) return &quest->dummy; return quest->db_data[quest_id]; @@ -75,7 +76,7 @@ struct quest_db *quest_db(int quest_id) { * @param sd Player's data * @return 0 in case of success, nonzero otherwise (i.e. the player has no quests) */ -int quest_pc_login(struct map_session_data *sd) +static int quest_pc_login(struct map_session_data *sd) { #if PACKETVER < 20141022 int i; @@ -108,7 +109,7 @@ int quest_pc_login(struct map_session_data *sd) * @param time_limit Custom time, in UNIX epoch, for this quest * @return 0 in case of success, nonzero otherwise */ -int quest_add(struct map_session_data *sd, int quest_id, unsigned int time_limit) +static int quest_add(struct map_session_data *sd, int quest_id, unsigned int time_limit) { int n; struct quest_db *qi = quest->db(quest_id); @@ -168,7 +169,7 @@ int quest_add(struct map_session_data *sd, int quest_id, unsigned int time_limit * @param qid2 New quest to add * @return 0 in case of success, nonzero otherwise */ -int quest_change(struct map_session_data *sd, int qid1, int qid2) +static int quest_change(struct map_session_data *sd, int qid1, int qid2) { int i; struct quest_db *qi = quest->db(qid2); @@ -224,7 +225,7 @@ int quest_change(struct map_session_data *sd, int qid1, int qid2) * @param quest_id ID of the quest to remove * @return 0 in case of success, nonzero otherwise */ -int quest_delete(struct map_session_data *sd, int quest_id) +static int quest_delete(struct map_session_data *sd, int quest_id) { int i; @@ -268,7 +269,7 @@ int quest_delete(struct map_session_data *sd, int quest_id) * int Party ID * int Mob ID */ -int quest_update_objective_sub(struct block_list *bl, va_list ap) +static int quest_update_objective_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; int party_id = va_arg(ap, int); @@ -295,7 +296,7 @@ int quest_update_objective_sub(struct block_list *bl, va_list ap) * @param sd Character's data * @param mob_id Monster ID */ -void quest_update_objective(struct map_session_data *sd, int mob_id) +static void quest_update_objective(struct map_session_data *sd, int mob_id) { int i,j; @@ -351,7 +352,7 @@ void quest_update_objective(struct map_session_data *sd, int mob_id) * @param qs New quest state * @return 0 in case of success, nonzero otherwise */ -int quest_update_status(struct map_session_data *sd, int quest_id, enum quest_state qs) +static int quest_update_status(struct map_session_data *sd, int quest_id, enum quest_state qs) { int i; @@ -402,7 +403,7 @@ int quest_update_status(struct map_session_data *sd, int quest_id, enum quest_st * 1 if the quest's timeout has expired * 0 otherwise */ -int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type type) +static int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type type) { int i; @@ -444,7 +445,7 @@ int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type * @return The parsed quest entry. * @retval NULL in case of errors. */ -struct quest_db *quest_read_db_sub(struct config_setting_t *cs, int n, const char *source) +static struct quest_db *quest_read_db_sub(struct config_setting_t *cs, int n, const char *source) { struct quest_db *entry = NULL; struct config_setting_t *t = NULL; @@ -544,7 +545,7 @@ struct quest_db *quest_read_db_sub(struct config_setting_t *cs, int n, const cha * * @return Number of loaded quests, or -1 if the file couldn't be read. */ -int quest_read_db(void) +static int quest_read_db(void) { char filepath[256]; struct config_t quest_db_conf; @@ -591,7 +592,8 @@ int quest_read_db(void) * @see map->foreachpc * @param ap Ignored */ -int quest_reload_check_sub(struct map_session_data *sd, va_list ap) { +static int quest_reload_check_sub(struct map_session_data *sd, va_list ap) +{ int i, j; nullpo_ret(sd); @@ -620,7 +622,8 @@ int quest_reload_check_sub(struct map_session_data *sd, va_list ap) { /** * Clears the quest database for shutdown or reload. */ -void quest_clear_db(void) { +static void quest_clear_db(void) +{ int i; for (i = 0; i < MAX_QUEST_DB; i++) { @@ -640,7 +643,8 @@ void quest_clear_db(void) { * * @param minimal Run in minimal mode (skips most of the loading) */ -void do_init_quest(bool minimal) { +static void do_init_quest(bool minimal) +{ if (minimal) return; @@ -650,14 +654,16 @@ void do_init_quest(bool minimal) { /** * Finalizes the quest interface before shutdown. */ -void do_final_quest(void) { +static void do_final_quest(void) +{ quest->clear(); } /** * Reloads the quest database. */ -void do_reload_quest(void) { +static void do_reload_quest(void) +{ quest->clear(); quest->read_db(); @@ -669,7 +675,8 @@ void do_reload_quest(void) { /** * Initializes default values for the quest interface. */ -void quest_defaults(void) { +void quest_defaults(void) +{ quest = &quest_s; quest->db_data = db_data; diff --git a/src/map/rodex.c b/src/map/rodex.c index d1b0191ac..602754d42 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -40,12 +40,12 @@ // Maximun number of messages that can be sent in one day #define DAILY_MAX_MAILS 100 -struct rodex_interface rodex_s; +static struct rodex_interface rodex_s; struct rodex_interface *rodex; /// Checks if RoDEX System is enabled in the server /// Returns true if it's enabled, false otherwise -bool rodex_isenabled(void) +static bool rodex_isenabled(void) { if (battle_config.feature_rodex == 1) return true; @@ -55,7 +55,7 @@ bool rodex_isenabled(void) /// Checks and refreshes the user daily number of Stamps /// @param sd : The player who's being checked -void rodex_refresh_stamps(struct map_session_data *sd) +static void rodex_refresh_stamps(struct map_session_data *sd) { int today = date_get_date(); nullpo_retv(sd); @@ -76,7 +76,7 @@ void rodex_refresh_stamps(struct map_session_data *sd) /// @param sd : The player who's writting /// @param idx : the inventory idx of the item /// @param amount : Amount of the item to be attached -void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount) +static void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount) { int i; bool is_stack = false; @@ -153,7 +153,7 @@ void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount) /// @param sd : The player who's writting the message /// @param idx : The index of the item /// @param amount : How much to remove -void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amount) +static void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amount) { int i; struct item *it; @@ -204,7 +204,7 @@ void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amount) /// @param base_level : Reference to return the character base level, if he exists /// @param char_id : Reference to return the character id, if he exists /// @param class : Reference to return the character class id, if he exists -void rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, short *class) +static void rodex_check_player(struct map_session_data *sd, const char *name, int *base_level, int *char_id, short *class) { intif->rodex_checkname(sd, name); } @@ -221,7 +221,7 @@ void rodex_check_player(struct map_session_data *sd, const char *name, int *base /// RODEX_SEND_MAIL_COUNT_ERROR = 2, /// RODEX_SEND_MAIL_ITEM_ERROR = 3, /// RODEX_SEND_MAIL_RECEIVER_ERROR = 4 -int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, const char *body, const char *title, int64 zeny) +static int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, const char *body, const char *title, int64 zeny) { int i; int64 total_zeny; @@ -342,7 +342,7 @@ int rodex_send_mail(struct map_session_data *sd, const char *receiver_name, cons /// @param ssd : Sender's sd /// @param rsd : Receiver's sd /// @param result : Message sent (true) or failed (false) -void rodex_send_mail_result(struct map_session_data *ssd, struct map_session_data *rsd, bool result) +static void rodex_send_mail_result(struct map_session_data *ssd, struct map_session_data *rsd, bool result) { if (ssd != NULL) { rodex->clean(ssd, 1); @@ -365,7 +365,7 @@ void rodex_send_mail_result(struct map_session_data *ssd, struct map_session_dat /// @param sd : Character /// @param mail_id : Mail ID that's being retrieved /// Returns the message -struct rodex_message *rodex_get_mail(struct map_session_data *sd, int64 mail_id) +static struct rodex_message *rodex_get_mail(struct map_session_data *sd, int64 mail_id) { int i; struct rodex_message *msg; @@ -393,7 +393,7 @@ struct rodex_message *rodex_get_mail(struct map_session_data *sd, int64 mail_id) /// Request to read a mail by its ID /// @param sd : Who's reading /// @param mail_id : Mail ID to be read -void rodex_read_mail(struct map_session_data *sd, int64 mail_id) +static void rodex_read_mail(struct map_session_data *sd, int64 mail_id) { struct rodex_message *msg; @@ -420,7 +420,7 @@ void rodex_read_mail(struct map_session_data *sd, int64 mail_id) /// Deletes a mail /// @param sd : Who's deleting /// @param mail_id : Mail ID to be deleted -void rodex_delete_mail(struct map_session_data *sd, int64 mail_id) +static void rodex_delete_mail(struct map_session_data *sd, int64 mail_id) { struct rodex_message *msg; @@ -438,7 +438,7 @@ void rodex_delete_mail(struct map_session_data *sd, int64 mail_id) /// Gets attached zeny /// @param sd : Who's getting /// @param mail_id : Mail ID that we're getting zeny from -void rodex_get_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id) +static void rodex_get_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id) { struct rodex_message *msg; @@ -471,7 +471,7 @@ void rodex_get_zeny(struct map_session_data *sd, int8 opentype, int64 mail_id) /// Gets attached item /// @param sd : Who's getting /// @param mail_id : Mail ID that we're getting items from -void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 mail_id) +static void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 mail_id) { struct rodex_message *msg; int weight = 0; @@ -558,7 +558,7 @@ void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 mail_id) /// @param flag : /// 0 - clear everything /// 1 - clear tmp only -void rodex_clean(struct map_session_data *sd, int8 flag) +static void rodex_clean(struct map_session_data *sd, int8 flag) { nullpo_retv(sd); @@ -571,7 +571,7 @@ void rodex_clean(struct map_session_data *sd, int8 flag) /// User request to open rodex, load mails from char-server /// @param sd : Who's requesting /// @param open_type : Box Type (see RODEX_OPENTYPE) -void rodex_open(struct map_session_data *sd, int8 open_type, int64 first_mail_id) +static void rodex_open(struct map_session_data *sd, int8 open_type, int64 first_mail_id) { #if PACKETVER >= 20170419 const int type = 1; @@ -589,7 +589,7 @@ void rodex_open(struct map_session_data *sd, int8 open_type, int64 first_mail_id /// @param sd : Who's requesting /// @param open_type : Box Type (see RODEX_OPENTYPE) /// @param last_mail_id : The last mail from the current page -void rodex_next_page(struct map_session_data *sd, int8 open_type, int64 last_mail_id) +static void rodex_next_page(struct map_session_data *sd, int8 open_type, int64 last_mail_id) { int64 msg_count, page_start = 0; nullpo_retv(sd); @@ -619,7 +619,7 @@ void rodex_next_page(struct map_session_data *sd, int8 open_type, int64 last_mai /// @param sd : Who's requesting /// @param open_type : Box Type (See RODEX_OPENTYPE) /// @param first_mail_id : The first mail id known by client, currently unused -void rodex_refresh(struct map_session_data *sd, int8 open_type, int64 first_mail_id) +static void rodex_refresh(struct map_session_data *sd, int8 open_type, int64 first_mail_id) { nullpo_retv(sd); if (open_type == RODEX_OPENTYPE_ACCOUNT && battle_config.feature_rodex_use_accountmail == false) @@ -635,13 +635,13 @@ void rodex_refresh(struct map_session_data *sd, int8 open_type, int64 first_mail } } -void do_init_rodex(bool minimal) +static void do_init_rodex(bool minimal) { if (minimal) return; } -void do_final_rodex(void) +static void do_final_rodex(void) { } diff --git a/src/map/script.c b/src/map/script.c index 9c859ca12..9adf6b44d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -83,7 +83,7 @@ #include <sys/time.h> #endif -struct script_interface script_s; +static struct script_interface script_s; struct script_interface *script; static inline int GETVALUE(const struct script_buf *buf, int i) __attribute__((nonnull (1))); @@ -103,7 +103,8 @@ static inline void SETVALUE(struct script_buf *buf, int i, int n) VECTOR_INDEX(*buf, i+2) = GetByte(n, 2); } -const char* script_op2name(int op) { +const char *script_op2name(int op) +{ #define RETURN_OP_NAME(type) case type: return #type switch( op ) { RETURN_OP_NAME(C_NOP); @@ -162,7 +163,7 @@ const char* script_op2name(int op) { } #ifdef SCRIPT_DEBUG_DUMP_STACK -static void script_dump_stack(struct script_state* st) +static void script_dump_stack(struct script_state *st) { int i; nullpo_retv(st); @@ -205,7 +206,8 @@ static void script_dump_stack(struct script_state* st) #endif /// Reports on the console the src of a script error. -void script_reportsrc(struct script_state *st) { +static void script_reportsrc(struct script_state *st) +{ struct block_list* bl; nullpo_retv(st); @@ -236,7 +238,7 @@ void script_reportsrc(struct script_state *st) { } /// Reports on the console information about the script data. -void script_reportdata(struct script_data* data) +static void script_reportdata(struct script_data *data) { if( data == NULL ) return; @@ -278,7 +280,7 @@ void script_reportdata(struct script_data* data) } /// Reports on the console information about the current built-in function. -void script_reportfunc(struct script_state* st) +static void script_reportfunc(struct script_state *st) { int params, id; struct script_data* data; @@ -313,8 +315,9 @@ void script_reportfunc(struct script_state* st) /*========================================== * Output error message *------------------------------------------*/ -static void disp_error_message2(const char *mes,const char *pos,int report) __attribute__((nonnull (1))) analyzer_noreturn; -static void disp_error_message2(const char *mes,const char *pos,int report) { +static void disp_error_message2(const char *mes, const char *pos, int report) __attribute__((nonnull (1))) analyzer_noreturn; +static void disp_error_message2(const char *mes, const char *pos, int report) +{ script->error_msg = aStrdup(mes); script->error_pos = pos; script->error_report = report; @@ -322,12 +325,13 @@ static void disp_error_message2(const char *mes,const char *pos,int report) { } #define disp_error_message(mes,pos) (disp_error_message2((mes),(pos),1)) -void disp_warning_message(const char *mes, const char *pos) { +static void disp_warning_message(const char *mes, const char *pos) +{ script->warning(script->parser_current_src,script->parser_current_file,script->parser_current_line,mes,pos); } /// Checks event parameter validity -void check_event(struct script_state *st, const char *evt) +static void check_event(struct script_state *st, const char *evt) { if( evt && evt[0] && !stristr(evt, "::On") ) { @@ -339,7 +343,8 @@ void check_event(struct script_state *st, const char *evt) /*========================================== * Hashes the input string *------------------------------------------*/ -unsigned int calc_hash(const char* p) { +static unsigned int calc_hash(const char *p) +{ unsigned int h; nullpo_ret(p); @@ -374,7 +379,8 @@ unsigned int calc_hash(const char* p) { /*========================================== * Hashes the input string in a case insensitive way *------------------------------------------*/ -unsigned int calc_hash_ci(const char* p) { +static unsigned int calc_hash_ci(const char *p) +{ unsigned int h = 0; #ifdef ENABLE_CASE_CHECK @@ -413,14 +419,14 @@ unsigned int calc_hash_ci(const char* p) { *------------------------------------------*/ /// Looks up string using the provided id. -const char* script_get_str(int id) +static const char *script_get_str(int id) { Assert_retr(NULL, id >= LABEL_START && id < script->str_size); return script->str_buf+script->str_data[id].str; } /// Returns the uid of the string, or -1. -int script_search_str(const char* p) +static int script_search_str(const char *p) { int i; @@ -433,7 +439,7 @@ int script_search_str(const char* p) return -1; } -void script_casecheck_clear_sub(struct casecheck_data *ccd) +static void script_casecheck_clear_sub(struct casecheck_data *ccd) { #ifdef ENABLE_CASE_CHECK nullpo_retv(ccd); @@ -453,15 +459,17 @@ void script_casecheck_clear_sub(struct casecheck_data *ccd) #endif // ENABLE_CASE_CHECK } -void script_global_casecheck_clear(void) { +static void script_global_casecheck_clear(void) +{ script_casecheck_clear_sub(&script->global_casecheck); } -void script_local_casecheck_clear(void) { +static void script_local_casecheck_clear(void) +{ script_casecheck_clear_sub(&script->local_casecheck); } -const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char *p) +static const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char *p) { #ifdef ENABLE_CASE_CHECK int len; @@ -518,17 +526,19 @@ const char *script_casecheck_add_str_sub(struct casecheck_data *ccd, const char return NULL; } -const char *script_global_casecheck_add_str(const char *p) { +static const char *script_global_casecheck_add_str(const char *p) +{ return script_casecheck_add_str_sub(&script->global_casecheck, p); } -const char *script_local_casecheck_add_str(const char *p) { +static const char *script_local_casecheck_add_str(const char *p) +{ return script_casecheck_add_str_sub(&script->local_casecheck, p); } /// Stores a copy of the string and returns its id. /// If an identical string is already present, returns its id instead. -int script_add_str(const char* p) +static int script_add_str(const char *p) { int len, h = script->calc_hash(p); #ifdef ENABLE_CASE_CHECK @@ -607,7 +617,7 @@ int script_add_str(const char* p) * * @param a The byte to append. */ -void add_scriptb(int a) +static void add_scriptb(int a) { VECTOR_ENSURE(script->buf, 1, SCRIPT_BLOCK_SIZE); VECTOR_PUSH(script->buf, (uint8)a); @@ -622,7 +632,7 @@ void add_scriptb(int a) * * @param a The value to append. */ -void add_scriptc(int a) +static void add_scriptc(int a) { while( a >= 0x40 ) { @@ -642,7 +652,7 @@ void add_scriptc(int a) * * @param a The value to append. */ -void add_scripti(int a) +static void add_scripti(int a) { while( a >= 0x40 ) { @@ -657,7 +667,7 @@ void add_scripti(int a) * * @param l The id of the script->str_data entry (Maximum up to 16M) */ -void add_scriptl(int l) +static void add_scriptl(int l) { int backpatch = script->str_data[l].backpatch; @@ -695,7 +705,7 @@ void add_scriptl(int l) /*========================================== * Resolve the label *------------------------------------------*/ -void set_label(int l,int pos, const char* script_pos) +static void set_label(int l, int pos, const char *script_pos) { int i; @@ -719,7 +729,7 @@ void set_label(int l,int pos, const char* script_pos) } /// Skips spaces and/or comments. -const char* script_skip_space(const char* p) +static const char *script_skip_space(const char *p) { if( p == NULL ) return NULL; @@ -758,7 +768,7 @@ const char* script_skip_space(const char* p) /// Skips a word. /// A word consists of undercores and/or alphanumeric characters, /// and valid variable prefixes/postfixes. -const char* skip_word(const char* p) +static const char *skip_word(const char *p) { nullpo_retr(NULL, p); // prefix @@ -787,7 +797,8 @@ const char* skip_word(const char* p) /// Adds a word to script->str_data. /// @see skip_word /// @see script->add_str -int add_word(const char* p) { +static int add_word(const char *p) +{ size_t len; int i; @@ -813,8 +824,7 @@ int add_word(const char* p) { /// Parses a function call. /// The argument list can have parenthesis or not. /// The number of arguments is checked. -static -const char* parse_callfunc(const char* p, int require_paren, int is_custom) +static const char *parse_callfunc(const char *p, int require_paren, int is_custom) { const char *p2; char *arg = NULL; @@ -945,7 +955,7 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom) /// Processes end of logical script line. /// @param first When true, only fix up scheduling data is initialized /// @param p Script position for error reporting in set_label -void parse_nextline(bool first, const char* p) +static void parse_nextline(bool first, const char *p) { if( !first ) { @@ -963,7 +973,7 @@ void parse_nextline(bool first, const char* p) * Pushes a variable into stack, processing its array index if needed. * @see parse_variable */ -void parse_variable_sub_push(int word, const char *p2) +static void parse_variable_sub_push(int word, const char *p2) { if( p2 ) { const char* p3 = NULL; @@ -994,7 +1004,7 @@ void parse_variable_sub_push(int word, const char *p2) /// Parse a variable assignment using the direct equals operator /// @param p script position where the function should run from /// @return NULL if not a variable assignment, the new position otherwise -const char* parse_variable(const char* p) +static const char *parse_variable(const char *p) { int word; c_op type = C_NOP; @@ -1150,7 +1160,8 @@ const char* parse_variable(const char* p) * @param p Pointer to the string to check * @return Whether the string is a number literal */ -bool is_number(const char *p) { +static bool is_number(const char *p) +{ const char *np; if (!p) return false; @@ -1181,7 +1192,7 @@ bool is_number(const char *p) { * @param str The string to insert. * @return the string position in the script string list. */ -int script_string_dup(char *str) +static int script_string_dup(char *str) { int len; int pos = script->string_list_pos; @@ -1203,7 +1214,7 @@ int script_string_dup(char *str) /*========================================== * Analysis section *------------------------------------------*/ -const char *parse_simpleexpr(const char *p) +static const char *parse_simpleexpr(const char *p) { p=script->skip_space(p); @@ -1221,7 +1232,7 @@ const char *parse_simpleexpr(const char *p) } } -const char *parse_simpleexpr_paren(const char *p) +static const char *parse_simpleexpr_paren(const char *p) { int i = script->syntax.curly_count - 1; nullpo_retr(NULL, p); @@ -1248,7 +1259,7 @@ const char *parse_simpleexpr_paren(const char *p) return p + 1; } -const char *parse_simpleexpr_number(const char *p) +static const char *parse_simpleexpr_number(const char *p) { char *np = NULL; long long lli; @@ -1270,7 +1281,7 @@ const char *parse_simpleexpr_number(const char *p) return np; } -const char *parse_simpleexpr_string(const char *p) +static const char *parse_simpleexpr_string(const char *p) { const char *start_point = p; @@ -1311,7 +1322,7 @@ const char *parse_simpleexpr_string(const char *p) return p; } -const char *parse_simpleexpr_name(const char *p) +static const char *parse_simpleexpr_name(const char *p) { int l; const char *pv = NULL; @@ -1361,7 +1372,7 @@ const char *parse_simpleexpr_name(const char *p) return p; } -void script_add_translatable_string(const struct script_string_buf *string, const char *start_point) +static void script_add_translatable_string(const struct script_string_buf *string, const char *start_point) { struct string_translation *st = NULL; @@ -1401,7 +1412,7 @@ void script_add_translatable_string(const struct script_string_buf *string, cons /*========================================== * Analysis of the expression *------------------------------------------*/ -const char* script_parse_subexpr(const char* p,int limit) +static const char *script_parse_subexpr(const char *p, int limit) { int op,opl,len; @@ -1470,7 +1481,7 @@ const char* script_parse_subexpr(const char* p,int limit) /*========================================== * Evaluation of the expression *------------------------------------------*/ -const char* parse_expr(const char *p) +static const char *parse_expr(const char *p) { nullpo_retr(NULL, p); switch(*p) { @@ -1485,7 +1496,7 @@ const char* parse_expr(const char *p) /*========================================== * Analysis of the line *------------------------------------------*/ -const char* parse_line(const char* p) +static const char *parse_line(const char *p) { const char* p2; @@ -1548,7 +1559,7 @@ const char* parse_line(const char* p) } // { ... } Closing process -const char* parse_curly_close(const char* p) +static const char *parse_curly_close(const char *p) { nullpo_retr(NULL, p); if(script->syntax.curly_count <= 0) { @@ -1607,7 +1618,7 @@ const char* parse_curly_close(const char* p) // Syntax-related processing // break, case, continue, default, do, for, function, // if, switch, while ? will handle this internally. -const char* parse_syntax(const char* p) +static const char *parse_syntax(const char *p) { const char *p2 = script->skip_word(p); @@ -2037,7 +2048,8 @@ const char* parse_syntax(const char* p) return NULL; } -const char* parse_syntax_close(const char *p) { +static const char *parse_syntax_close(const char *p) +{ // If (...) for (...) hoge (); as to make sure closed closed once again int flag; @@ -2051,7 +2063,7 @@ const char* parse_syntax_close(const char *p) { // Close judgment if, for, while, of do // flag == 1 : closed // flag == 0 : not closed -const char* parse_syntax_close_sub(const char* p,int* flag) +static const char *parse_syntax_close_sub(const char *p, int *flag) { char label[256]; int pos = script->syntax.curly_count - 1; @@ -2224,7 +2236,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag) } /// Retrieves the value of a constant. -bool script_get_constant(const char* name, int* value) +static bool script_get_constant(const char *name, int *value) { int n = script->search_str(name); @@ -2242,7 +2254,7 @@ bool script_get_constant(const char* name, int* value) } /// Creates new constant or parameter with given value. -void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated) +static void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated) { int n = script->add_str(name); @@ -2257,7 +2269,7 @@ void script_set_constant(const char *name, int value, bool is_parameter, bool is } } /* adds data to a existent constant in the database, inserted normally via parse */ -void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated) +static void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated) { int n = script->add_str(name); @@ -2290,7 +2302,7 @@ void script_set_constant2(const char *name, int value, bool is_parameter, bool i /** * Loads the constants database from constants.conf */ -void read_constdb(void) +static void read_constdb(void) { struct config_t constants_conf; char filepath[256]; @@ -2366,12 +2378,12 @@ void read_constdb(void) * * @param comment The comment to set (NULL to unset) */ -void script_constdb_comment(const char *comment) +static void script_constdb_comment(const char *comment) { (void)comment; } -void script_load_parameters(void) +static void script_load_parameters(void) { int i = 0; struct { @@ -2426,7 +2438,7 @@ void script_load_parameters(void) /*========================================== * Display emplacement line of script *------------------------------------------*/ -const char* script_print_line(StringBuf* buf, const char* p, const char* mark, int line) +static const char *script_print_line(StringBuf *buf, const char *p, const char *mark, int line) { int i, mark_pos = 0, tabstop = TAB_SIZE; if( p == NULL || !p[0] ) return NULL; @@ -2465,7 +2477,8 @@ const char* script_print_line(StringBuf* buf, const char* p, const char* mark, i #undef update_tabstop #define CONTEXTLINES 3 -void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_errorwarning_sub(StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ // Find the line where the error occurred int j; int line = start_line; @@ -2501,7 +2514,8 @@ void script_errorwarning_sub(StringBuf *buf, const char* src, const char* file, } #undef CONTEXTLINES -void script_error(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_error(const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ StringBuf buf; StrBuf->Init(&buf); @@ -2513,7 +2527,8 @@ void script_error(const char* src, const char* file, int start_line, const char* StrBuf->Destroy(&buf); } -void script_warning(const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos) { +static void script_warning(const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos) +{ StringBuf buf; StrBuf->Init(&buf); @@ -2527,7 +2542,8 @@ void script_warning(const char* src, const char* file, int start_line, const cha /*========================================== * Analysis of the script *------------------------------------------*/ -struct script_code* parse_script(const char *src,const char *file,int line,int options, int *retval) { +static struct script_code *parse_script(const char *src, const char *file, int line, int options, int *retval) +{ const char *p,*tmpp; int i; struct script_code* code = NULL; @@ -2741,7 +2757,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o /// Returns the player attached to this script, identified by the rid. /// If there is no player attached, the script is terminated. -struct map_session_data *script_rid2sd(struct script_state *st) +static struct map_session_data *script_rid2sd(struct script_state *st) { struct map_session_data *sd; nullpo_retr(NULL, st); @@ -2754,7 +2770,7 @@ struct map_session_data *script_rid2sd(struct script_state *st) return sd; } -struct map_session_data *script_id2sd(struct script_state *st, int account_id) +static struct map_session_data *script_id2sd(struct script_state *st, int account_id) { struct map_session_data *sd; if ((sd = map->id2sd(account_id)) == NULL) { @@ -2765,7 +2781,7 @@ struct map_session_data *script_id2sd(struct script_state *st, int account_id) return sd; } -struct map_session_data *script_charid2sd(struct script_state *st, int char_id) +static struct map_session_data *script_charid2sd(struct script_state *st, int char_id) { struct map_session_data *sd; if ((sd = map->charid2sd(char_id)) == NULL) { @@ -2776,7 +2792,7 @@ struct map_session_data *script_charid2sd(struct script_state *st, int char_id) return sd; } -struct map_session_data *script_nick2sd(struct script_state *st, const char *name) +static struct map_session_data *script_nick2sd(struct script_state *st, const char *name) { struct map_session_data *sd; if ((sd = map->nick2sd(name)) == NULL) { @@ -2787,14 +2803,16 @@ struct map_session_data *script_nick2sd(struct script_state *st, const char *nam return sd; } -char *get_val_npcscope_str(struct script_state* st, struct reg_db *n, struct script_data* data) { +static char *get_val_npcscope_str(struct script_state *st, struct reg_db *n, struct script_data *data) +{ if (n) return (char*)i64db_get(n->vars, reference_getuid(data)); else return NULL; } -char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct script_data *data) { +static char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct script_data *data) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, n); @@ -2802,7 +2820,8 @@ char *get_val_pc_ref_str(struct script_state *st, struct reg_db *n, struct scrip return p ? p->value : NULL; } -char *get_val_instance_str(struct script_state* st, const char* name, struct script_data* data) { +static char *get_val_instance_str(struct script_state *st, const char *name, struct script_data *data) +{ nullpo_retr(NULL, st); if (st->instance_id >= 0) { return (char*)i64db_get(instance->list[st->instance_id].regs.vars, reference_getuid(data)); @@ -2812,14 +2831,16 @@ char *get_val_instance_str(struct script_state* st, const char* name, struct scr } } -int get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data) { +static int get_val_npcscope_num(struct script_state *st, struct reg_db *n, struct script_data *data) +{ if (n) return (int)i64db_iget(n->vars, reference_getuid(data)); else return 0; } -int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_data *data) { +static int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_data *data) +{ struct script_reg_num *p = NULL; nullpo_retr(0, n); @@ -2827,7 +2848,8 @@ int get_val_pc_ref_num(struct script_state *st, struct reg_db *n, struct script_ return p ? p->value : 0; } -int get_val_instance_num(struct script_state* st, const char* name, struct script_data* data) { +static int get_val_instance_num(struct script_state *st, const char *name, struct script_data *data) +{ if (st->instance_id >= 0) return (int)i64db_iget(instance->list[st->instance_id].regs.vars, reference_getuid(data)); else { @@ -2843,7 +2865,8 @@ int get_val_instance_num(struct script_state* st, const char* name, struct scrip * @param data[in,out] variable/constant. * @return pointer to data, for convenience. */ -struct script_data *get_val(struct script_state* st, struct script_data* data) { +static struct script_data *get_val(struct script_state *st, struct script_data *data) +{ const char* name; char prefix; char postfix; @@ -3000,7 +3023,7 @@ struct script_data *get_val(struct script_state* st, struct script_data* data) { * @param ref[in] the container to look up the reference into. * @return the retrieved value of the reference. */ -const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) +static const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) { struct script_data* data; nullpo_retr(NULL, st); @@ -3016,7 +3039,8 @@ const void *get_val2(struct script_state *st, int64 uid, struct reg_db *ref) * Because, currently, array members with key 0 are indifferenciable from normal variables, we should ensure its actually in * Will be gone as soon as undefined var feature is implemented **/ -void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct reg_db *ref) { +static void script_array_ensure_zero(struct script_state *st, struct map_session_data *sd, int64 uid, struct reg_db *ref) +{ const char *name = script->get_str(script_getvarid(uid)); struct reg_db *src = NULL; bool insert = false; @@ -3063,7 +3087,8 @@ void script_array_ensure_zero(struct script_state *st, struct map_session_data * /** * Returns array size by ID **/ -unsigned int script_array_size(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static unsigned int script_array_size(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct script_array *sa = NULL; struct reg_db *src = script->array_src(st, sd, name, ref); @@ -3075,7 +3100,8 @@ unsigned int script_array_size(struct script_state *st, struct map_session_data /** * Returns array's highest key (for that awful getarraysize implementation that doesn't really gets the array size) **/ -unsigned int script_array_highest_key(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static unsigned int script_array_highest_key(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct script_array *sa = NULL; struct reg_db *src = script->array_src(st, sd, name, ref); @@ -3096,7 +3122,7 @@ unsigned int script_array_highest_key(struct script_state *st, struct map_sessio } return 0; } -int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) +static int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) { struct script_array *sa = DB->data2ptr(data); aFree(sa->members); @@ -3106,7 +3132,8 @@ int script_free_array_db(union DBKey key, struct DBData *data, va_list ap) /** * Clears script_array and removes it from script->array_db **/ -void script_array_delete(struct reg_db *src, struct script_array *sa) { +static void script_array_delete(struct reg_db *src, struct script_array *sa) +{ nullpo_retv(src); nullpo_retv(sa); aFree(sa->members); @@ -3118,7 +3145,8 @@ void script_array_delete(struct reg_db *src, struct script_array *sa) { * * @param idx the index of the member in script_array struct list, not of the actual array member **/ -void script_array_remove_member(struct reg_db *src, struct script_array *sa, unsigned int idx) { +static void script_array_remove_member(struct reg_db *src, struct script_array *sa, unsigned int idx) +{ unsigned int i, cursor; nullpo_retv(sa); @@ -3145,7 +3173,8 @@ void script_array_remove_member(struct reg_db *src, struct script_array *sa, uns * * @param idx the index of the array member being inserted **/ -void script_array_add_member(struct script_array *sa, unsigned int idx) { +static void script_array_add_member(struct script_array *sa, unsigned int idx) +{ nullpo_retv(sa); RECREATE(sa->members, unsigned int, ++sa->size); sa->members[sa->size - 1] = idx; @@ -3154,7 +3183,8 @@ void script_array_add_member(struct script_array *sa, unsigned int idx) { * Obtains the source of the array database for this type and scenario * Initializes such database when not yet initialized. **/ -struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) { +static struct reg_db *script_array_src(struct script_state *st, struct map_session_data *sd, const char *name, struct reg_db *ref) +{ struct reg_db *src = NULL; nullpo_retr(NULL, name); @@ -3205,7 +3235,8 @@ struct reg_db *script_array_src(struct script_state *st, struct map_session_data * @param num[in] Variable ID * @param empty[in] Whether the modified member is empty (needs to be removed) **/ -void script_array_update(struct reg_db *src, int64 num, bool empty) { +static void script_array_update(struct reg_db *src, int64 num, bool empty) +{ struct script_array *sa = NULL; int id = script_getvarid(num); unsigned int index = script_getvaridx(num); @@ -3246,7 +3277,7 @@ void script_array_update(struct reg_db *src, int64 num, bool empty) { } } -void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num, const char* name, const char *str) +static void set_reg_npcscope_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) { if (n) { @@ -3263,7 +3294,7 @@ void set_reg_npcscope_str(struct script_state* st, struct reg_db *n, int64 num, } } -void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) +static void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, const char *name, const char *str) { struct script_reg_str *p = NULL; unsigned int index = script_getvaridx(num); @@ -3312,7 +3343,7 @@ void set_reg_pc_ref_str(struct script_state *st, struct reg_db *n, int64 num, co } } -void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) +static void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) { struct script_reg_num *p = NULL; unsigned int index = script_getvaridx(num); @@ -3356,7 +3387,7 @@ void set_reg_pc_ref_num(struct script_state *st, struct reg_db *n, int64 num, co } } -void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num, const char* name, int val) +static void set_reg_npcscope_num(struct script_state *st, struct reg_db *n, int64 num, const char *name, int val) { if (n) { if (val != 0) { @@ -3371,7 +3402,7 @@ void set_reg_npcscope_num(struct script_state* st, struct reg_db *n, int64 num, } } -void set_reg_instance_str(struct script_state* st, int64 num, const char* name, const char *str) +static void set_reg_instance_str(struct script_state *st, int64 num, const char *name, const char *str) { nullpo_retv(st); if (st->instance_id >= 0) { @@ -3390,7 +3421,7 @@ void set_reg_instance_str(struct script_state* st, int64 num, const char* name, } } -void set_reg_instance_num(struct script_state* st, int64 num, const char* name, int val) +static void set_reg_instance_num(struct script_state *st, int64 num, const char *name, int val) { nullpo_retv(st); if (st->instance_id >= 0) { @@ -3423,7 +3454,7 @@ void set_reg_instance_num(struct script_state* st, int64 num, const char* name, * * TODO: return values are screwed up, have been for some time (reaad: years), e.g. some functions return 1 failure and success. *------------------------------------------*/ -int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref) +static int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref) { char prefix; nullpo_ret(name); @@ -3546,18 +3577,18 @@ int set_reg(struct script_state *st, struct map_session_data *sd, int64 num, con } } -int set_var(struct map_session_data *sd, char *name, void *val) +static int set_var(struct map_session_data *sd, char *name, void *val) { return script->set_reg(NULL, sd, reference_uid(script->add_str(name),0), name, val, NULL); } -void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, const void *value, struct reg_db *ref) +static void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, const void *value, struct reg_db *ref) { script->set_reg(st, sd, reference_uid(script->add_str(varname),elem), varname, value, ref); } /// Converts the data to a string -const char *conv_str(struct script_state *st, struct script_data* data) +static const char *conv_str(struct script_state *st, struct script_data *data) { script->get_val(st, data); if (data_isstring(data)) { @@ -3591,7 +3622,7 @@ const char *conv_str(struct script_state *st, struct script_data* data) } /// Converts the data to an int -int conv_num(struct script_state *st, struct script_data *data) +static int conv_num(struct script_state *st, struct script_data *data) { long num; @@ -3649,7 +3680,8 @@ int conv_num(struct script_state *st, struct script_data *data) // /// Increases the size of the stack -void stack_expand(struct script_stack* stack) { +static void stack_expand(struct script_stack *stack) +{ nullpo_retv(stack); stack->sp_max += 64; stack->stack_data = (struct script_data*)aRealloc(stack->stack_data, @@ -3659,7 +3691,8 @@ void stack_expand(struct script_stack* stack) { } /// Pushes a value into the stack (with reference) -struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 val, struct reg_db *ref) { +static struct script_data *push_val(struct script_stack *stack, enum c_op type, int64 val, struct reg_db *ref) +{ nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) script->stack_expand(stack); @@ -3671,7 +3704,7 @@ struct script_data* push_val(struct script_stack* stack, enum c_op type, int64 v } /// Pushes a string into the stack -struct script_data *push_str(struct script_stack *stack, char *str) +static struct script_data *push_str(struct script_stack *stack, char *str) { nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) @@ -3684,7 +3717,7 @@ struct script_data *push_str(struct script_stack *stack, char *str) } /// Pushes a constant string into the stack -struct script_data *push_conststr(struct script_stack *stack, const char *str) +static struct script_data *push_conststr(struct script_stack *stack, const char *str) { nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) @@ -3697,7 +3730,8 @@ struct script_data *push_conststr(struct script_stack *stack, const char *str) } /// Pushes a retinfo into the stack -struct script_data* push_retinfo(struct script_stack* stack, struct script_retinfo* ri, struct reg_db *ref) { +static struct script_data *push_retinfo(struct script_stack *stack, struct script_retinfo *ri, struct reg_db *ref) +{ nullpo_retr(NULL, stack); if( stack->sp >= stack->sp_max ) script->stack_expand(stack); @@ -3709,7 +3743,8 @@ struct script_data* push_retinfo(struct script_stack* stack, struct script_retin } /// Pushes a copy of the target position into the stack -struct script_data* push_copy(struct script_stack* stack, int pos) { +static struct script_data *push_copy(struct script_stack *stack, int pos) +{ nullpo_retr(NULL, stack); switch( stack->stack_data[pos].type ) { case C_CONSTSTR: @@ -3734,7 +3769,8 @@ struct script_data* push_copy(struct script_stack* stack, int pos) { /// Removes the values in indexes [start,end[ from the stack. /// Adjusts all stack pointers. -void pop_stack(struct script_state* st, int start, int end) { +static void pop_stack(struct script_state *st, int start, int end) +{ struct script_stack* stack; struct script_data* data; int i; @@ -3806,7 +3842,7 @@ void pop_stack(struct script_state* st, int start, int end) { /*========================================== * Release script dependent variable, dependent variable of function *------------------------------------------*/ -void script_free_vars(struct DBMap *var_storage) +static void script_free_vars(struct DBMap *var_storage) { if( var_storage ) { // destroy the storage construct containing the variables @@ -3814,7 +3850,7 @@ void script_free_vars(struct DBMap *var_storage) } } -void script_free_code(struct script_code* code) +static void script_free_code(struct script_code *code) { nullpo_retv(code); @@ -3834,7 +3870,8 @@ void script_free_code(struct script_code* code) /// @param rid Who is running the script (attached player) /// @param oid Where the code is being run (npc 'object') /// @return Script state -struct script_state* script_alloc_state(struct script_code* rootscript, int pos, int rid, int oid) { +static struct script_state *script_alloc_state(struct script_code *rootscript, int pos, int rid, int oid) +{ struct script_state* st; st = ers_alloc(script->st_ers, struct script_state); @@ -3876,7 +3913,8 @@ struct script_state* script_alloc_state(struct script_code* rootscript, int pos, /// Frees a script state. /// /// @param st Script state -void script_free_state(struct script_state* st) { +static void script_free_state(struct script_state *st) +{ nullpo_retv(st); if( idb_exists(script->st_db,st->id) ) { struct map_session_data *sd = st->rid ? map->id2sd(st->rid) : NULL; @@ -3938,7 +3976,8 @@ void script_free_state(struct script_state* st) { * @param st[in] Script state. * @param ref[in] Reference to be added. */ -void script_add_pending_ref(struct script_state *st, struct reg_db *ref) { +static void script_add_pending_ref(struct script_state *st, struct reg_db *ref) +{ nullpo_retv(st); RECREATE(st->pending_refs, struct reg_db*, ++st->pending_ref_count); st->pending_refs[st->pending_ref_count-1] = ref; @@ -3950,7 +3989,7 @@ void script_add_pending_ref(struct script_state *st, struct reg_db *ref) { /*========================================== * Read command *------------------------------------------*/ -c_op get_com(const struct script_buf *scriptbuf, int *pos) +static c_op get_com(const struct script_buf *scriptbuf, int *pos) { int i = 0, j = 0; @@ -3967,7 +4006,7 @@ c_op get_com(const struct script_buf *scriptbuf, int *pos) /*========================================== * Income figures *------------------------------------------*/ -int get_num(const struct script_buf *scriptbuf, int *pos) +static int get_num(const struct script_buf *scriptbuf, int *pos) { int i,j; i=0; j=0; @@ -3980,7 +4019,7 @@ int get_num(const struct script_buf *scriptbuf, int *pos) /// Ternary operators /// test ? if_true : if_false -void op_3(struct script_state* st, int op) +static void op_3(struct script_state *st, int op) { struct script_data* data; int flag = 0; @@ -4017,7 +4056,7 @@ void op_3(struct script_state* st, int op) /// s1 RE_EQ s2 -> i /// s1 RE_NE s2 -> i /// s1 ADD s2 -> s -void op_2str(struct script_state* st, int op, const char* s1, const char* s2) +static void op_2str(struct script_state *st, int op, const char *s1, const char *s2) { int a = 0; @@ -4114,7 +4153,7 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) /// Binary number operators /// i OP i -> i -void op_2num(struct script_state* st, int op, int i1, int i2) +static void op_2num(struct script_state *st, int op, int i1, int i2) { int ret; int64 ret64; @@ -4174,7 +4213,7 @@ void op_2num(struct script_state* st, int op, int i1, int i2) } /// Binary operators -void op_2(struct script_state *st, int op) +static void op_2(struct script_state *st, int op) { struct script_data* left, leftref; struct script_data* right; @@ -4248,7 +4287,7 @@ void op_2(struct script_state *st, int op) /// NEG i -> i /// NOT i -> i /// LNOT i -> i -void op_1(struct script_state* st, int op) +static void op_1(struct script_state *st, int op) { struct script_data* data; int i1; @@ -4286,7 +4325,7 @@ void op_1(struct script_state* st, int op) /// /// @param st Script state whose stack arguments should be inspected. /// @param func Built-in function for which the arguments are intended. -bool script_check_buildin_argtype(struct script_state* st, int func) +static bool script_check_buildin_argtype(struct script_state *st, int func) { int idx, invalid = 0; char* sf; @@ -4372,7 +4411,7 @@ bool script_check_buildin_argtype(struct script_state* st, int func) /// Executes a buildin command. /// Stack: C_NAME(<command>) C_ARG <arg0> <arg1> ... <argN> -int run_func(struct script_state *st) +static int run_func(struct script_state *st) { struct script_data* data; int i,start_sp,end_sp,func; @@ -4465,7 +4504,8 @@ int run_func(struct script_state *st) /*========================================== * script execution *------------------------------------------*/ -void run_script(struct script_code *rootscript, int pos, int rid, int oid) { +static void run_script(struct script_code *rootscript, int pos, int rid, int oid) +{ struct script_state *st; if( rootscript == NULL || pos < 0 ) @@ -4479,7 +4519,7 @@ void run_script(struct script_code *rootscript, int pos, int rid, int oid) { script->run_main(st); } -void script_stop_instances(struct script_code *code) +static void script_stop_instances(struct script_code *code) { struct DBIterator *iter; struct script_state* st; @@ -4501,7 +4541,8 @@ void script_stop_instances(struct script_code *code) /*========================================== * Timer function for sleep *------------------------------------------*/ -int run_script_timer(int tid, int64 tick, int id, intptr_t data) { +static int run_script_timer(int tid, int64 tick, int id, intptr_t data) +{ struct script_state *st = idb_get(script->st_db,(int)data); if( st ) { struct map_session_data *sd = map->id2sd(st->rid); @@ -4522,7 +4563,8 @@ int run_script_timer(int tid, int64 tick, int id, intptr_t data) { /// /// @param st Script state to detach. /// @param dequeue_event Whether to schedule any queued events, when there was no previous script. -void script_detach_state(struct script_state* st, bool dequeue_event) { +static void script_detach_state(struct script_state *st, bool dequeue_event) +{ struct map_session_data* sd; nullpo_retv(st); @@ -4556,7 +4598,8 @@ void script_detach_state(struct script_state* st, bool dequeue_event) { /// Attaches script state to possibly attached character and backups it's previous script, if any. /// /// @param st Script state to attach. -void script_attach_state(struct script_state* st) { +static void script_attach_state(struct script_state *st) +{ struct map_session_data* sd; nullpo_retv(st); @@ -4588,7 +4631,8 @@ void script_attach_state(struct script_state* st) { /*========================================== * The main part of the script execution *------------------------------------------*/ -void run_script_main(struct script_state *st) { +static void run_script_main(struct script_state *st) +{ int cmdcount = script->config.check_cmdcount; int gotocount = script->config.check_gotocount; struct map_session_data *sd; @@ -4778,7 +4822,7 @@ void run_script_main(struct script_state *st) { * * @retval false in case of error. */ -bool script_config_read(const char *filename, bool imported) +static bool script_config_read(const char *filename, bool imported) { struct config_t config; struct config_setting_t * setting = NULL; @@ -4825,7 +4869,7 @@ bool script_config_read(const char *filename, bool imported) /** * @see DBApply */ -int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) +static int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) { struct script_code *code = DB->data2ptr(data); if (code) @@ -4833,7 +4877,7 @@ int db_script_free_code_sub(union DBKey key, struct DBData *data, va_list ap) return 0; } -void script_run_autobonus(const char *autobonus, int id, int pos) +static void script_run_autobonus(const char *autobonus, int id, int pos) { struct script_code *scriptroot = (struct script_code *)strdb_get(script->autobonus_db, autobonus); @@ -4843,7 +4887,7 @@ void script_run_autobonus(const char *autobonus, int id, int pos) } } -void script_add_autobonus(const char *autobonus) +static void script_add_autobonus(const char *autobonus) { if( strdb_get(script->autobonus_db, autobonus) == NULL ) { struct script_code *scriptroot = script->parse(autobonus, "autobonus", 0, 0, NULL); @@ -4854,7 +4898,8 @@ void script_add_autobonus(const char *autobonus) } /// resets a temporary character array variable to given value -void script_cleararray_pc(struct map_session_data* sd, const char* varname, void* value) { +static void script_cleararray_pc(struct map_session_data *sd, const char *varname, void *value) +{ struct script_array *sa = NULL; struct reg_db *src = NULL; unsigned int i, *list = NULL, size = 0; @@ -4881,7 +4926,8 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void /// sets a temporary character array variable element idx to given value /// @param refcache Pointer to an int variable, which keeps a copy of the reference to varname and must be initialized to 0. Can be NULL if only one element is set. -void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 idx, void* value, int* refcache) { +static void script_setarray_pc(struct map_session_data *sd, const char *varname, uint32 idx, void *value, int *refcache) +{ int key; if( idx >= SCRIPT_MAX_ARRAYSIZE ) { @@ -4901,7 +4947,7 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint32 /** * Clears persistent variables from memory **/ -int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) +static int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) { struct script_reg_state *src; @@ -4926,7 +4972,8 @@ int script_reg_destroy(union DBKey key, struct DBData *data, va_list ap) /** * Clears a single persistent variable **/ -void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct script_reg_state *data) { +static void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct script_reg_state *data) +{ nullpo_retv(sd); nullpo_retv(data); i64db_remove(sd->regs.vars, reg); @@ -4942,21 +4989,23 @@ void script_reg_destroy_single(struct map_session_data *sd, int64 reg, struct sc ers_free(pc->num_reg_ers,(struct script_reg_num*)data); } } -unsigned int *script_array_cpy_list(struct script_array *sa) { +static unsigned int *script_array_cpy_list(struct script_array *sa) +{ nullpo_retr(NULL, sa); if( sa->size > script->generic_ui_array_size ) script->generic_ui_array_expand(sa->size); memcpy(script->generic_ui_array, sa->members, sizeof(unsigned int)*sa->size); return script->generic_ui_array; } -void script_generic_ui_array_expand (unsigned int plus) { +static void script_generic_ui_array_expand(unsigned int plus) +{ script->generic_ui_array_size += plus + 100; RECREATE(script->generic_ui_array, unsigned int, script->generic_ui_array_size); } /*========================================== * Destructor *------------------------------------------*/ -void do_final_script(void) +static void do_final_script(void) { int i; struct DBIterator *iter; @@ -5091,7 +5140,8 @@ void do_final_script(void) /** * **/ -uint8 script_add_language(const char *name) { +static uint8 script_add_language(const char *name) +{ uint8 lang_id = script->max_lang_id; nullpo_ret(name); @@ -5103,7 +5153,8 @@ uint8 script_add_language(const char *name) { /** * Goes thru db/translations.conf file **/ -void script_load_translations(void) { +static void script_load_translations(void) +{ struct config_t translations_conf; const char *config_filename = "db/translations.conf"; // FIXME hardcoded name struct config_setting_t *translations = NULL; @@ -5187,7 +5238,7 @@ void script_load_translations(void) { * @param file The filename. * @return The corresponding translation name. */ -const char *script_get_translation_file_name(const char *file) +static const char *script_get_translation_file_name(const char *file) { const char *basename = NULL, *last_dot = NULL; @@ -5231,7 +5282,7 @@ const char *script_get_translation_file_name(const char *file) * @return success state * @retval true if a new string was added. */ -bool script_load_translation_addstring(const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr) +static bool script_load_translation_addstring(const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr) { nullpo_retr(false, file); nullpo_retr(false, msgctxt); @@ -5299,7 +5350,7 @@ bool script_load_translation_addstring(const char *file, uint8 lang_id, const ch * @param lang_id The language identifier. * @return The amount of strings loaded. */ -int script_load_translation(const char *file, uint8 lang_id) +static int script_load_translation(const char *file, uint8 lang_id) { int translations = 0; char line[1024]; @@ -5439,7 +5490,8 @@ int script_load_translation(const char *file, uint8 lang_id) /** * **/ -void script_clear_translations(bool reload) { +static void script_clear_translations(bool reload) +{ uint32 i; if( script->string_list ) @@ -5473,7 +5525,7 @@ void script_clear_translations(bool reload) { /** * **/ -int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) +static int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) { struct DBMap *string_db = DB->data2ptr(data); @@ -5494,7 +5546,7 @@ int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_lis /** * **/ -void script_parser_clean_leftovers(void) +static void script_parser_clean_leftovers(void) { VECTOR_CLEAR(script->buf); @@ -5509,7 +5561,8 @@ void script_parser_clean_leftovers(void) /** * Performs cleanup after all parsing is processed **/ -int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { +static int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) +{ script->parser_clean_leftovers(); script->parse_cleanup_timer_id = INVALID_TIMER; @@ -5520,7 +5573,8 @@ int script_parse_cleanup_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Initialization *------------------------------------------*/ -void do_init_script(bool minimal) { +static void do_init_script(bool minimal) +{ script->parse_cleanup_timer_id = INVALID_TIMER; VECTOR_INIT(script->parse_simpleexpr_strbuf); @@ -5550,7 +5604,7 @@ void do_init_script(bool minimal) { script->load_translations(); } -int script_reload(void) +static int script_reload(void) { int i; struct DBIterator *iter; @@ -5602,7 +5656,8 @@ int script_reload(void) return 0; } /* returns name of current function being run, from within the stack [Ind/Hercules] */ -const char *script_getfuncname(struct script_state *st) { +static const char *script_getfuncname(struct script_state *st) +{ struct script_data *data; nullpo_retr(NULL, st); @@ -5626,7 +5681,7 @@ const char *script_getfuncname(struct script_state *st) { * already initialized) * @retval false if an error occurs. */ -bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) +static bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf *out) { const char *format = NULL; const char *p = NULL, *np = NULL; @@ -5851,7 +5906,7 @@ bool script_sprintf_helper(struct script_state *st, int start, struct StringBuf /// If a dialog doesn't exist yet, one is created. /// /// mes "<message>"; -BUILDIN(mes) +static BUILDIN(mes) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5872,7 +5927,7 @@ BUILDIN(mes) * mes "<message>"; * @endcode */ -BUILDIN(mesf) +static BUILDIN(mesf) { struct map_session_data *sd = script->rid2sd(st); struct StringBuf buf; @@ -5897,7 +5952,7 @@ BUILDIN(mesf) /// The dialog text is cleared and the script continues when the button is pressed. /// /// next; -BUILDIN(next) +static BUILDIN(next) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5914,7 +5969,7 @@ BUILDIN(next) /// The dialog is closed when the button is pressed. /// /// close; -BUILDIN(close) +static BUILDIN(close) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5929,7 +5984,7 @@ BUILDIN(close) /// The dialog is closed and the script continues when the button is pressed. /// /// close2; -BUILDIN(close2) +static BUILDIN(close2) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -5949,7 +6004,7 @@ BUILDIN(close2) /// Counts the number of valid and total number of options in 'str' /// If max_count > 0 the counting stops when that valid option is reached /// total is incremented for each option (NULL is supported) -int menu_countoptions(const char* str, int max_count, int* total) +static int menu_countoptions(const char *str, int max_count, int *total) { int count = 0; int bogus_total; @@ -5999,7 +6054,7 @@ int menu_countoptions(const char* str, int max_count, int* total) /// NOTE: the client closes the npc dialog when cancel is pressed /// /// menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...}; -BUILDIN(menu) +static BUILDIN(menu) { int i; const char* text; @@ -6121,7 +6176,7 @@ BUILDIN(menu) /// select(<option_text>{,<option_text>,...}) -> <selected_option> /// /// @see menu -BUILDIN(select) +static BUILDIN(select) { int i; const char* text; @@ -6196,7 +6251,7 @@ BUILDIN(select) /// prompt(<option_text>{,<option_text>,...}) -> <selected_option> /// /// @see menu -BUILDIN(prompt) +static BUILDIN(prompt) { int i; const char *text; @@ -6278,7 +6333,7 @@ BUILDIN(prompt) /// Jumps to the target script label. /// /// goto <label>; -BUILDIN(goto) +static BUILDIN(goto) { if( !data_islabel(script_getdata(st,2)) ) { @@ -6296,7 +6351,7 @@ BUILDIN(goto) /*========================================== * user-defined function call *------------------------------------------*/ -BUILDIN(callfunc) +static BUILDIN(callfunc) { int i, j; struct script_retinfo* ri; @@ -6356,7 +6411,7 @@ BUILDIN(callfunc) /*========================================== * subroutine call *------------------------------------------*/ -BUILDIN(callsub) +static BUILDIN(callsub) { int i,j; struct script_retinfo* ri; @@ -6409,7 +6464,7 @@ BUILDIN(callsub) /// If the argument doesn't exist /// /// getarg(<index>{,<default_value>}) -> <value> -BUILDIN(getarg) +static BUILDIN(getarg) { struct script_retinfo* ri; int idx; @@ -6443,7 +6498,8 @@ BUILDIN(getarg) /// /// return; /// return <value>; -BUILDIN(return) { +static BUILDIN(return) +{ st->state = RETFUNC; if( st->stack->defsp < 1 || st->stack->stack_data[st->stack->defsp-1].type != C_RETINFO ) { @@ -6493,7 +6549,7 @@ BUILDIN(return) { /// If <min> is greater than <max>, their numbers are switched. /// rand(<range>) -> <int> /// rand(<min>,<max>) -> <int> -BUILDIN(rand) +static BUILDIN(rand) { int range; int min; @@ -6522,7 +6578,7 @@ BUILDIN(rand) /*========================================== * Warp sd to str,x,y or Random or SavePoint/Save *------------------------------------------*/ -BUILDIN(warp) +static BUILDIN(warp) { int ret; int x,y; @@ -6558,7 +6614,7 @@ BUILDIN(warp) /*========================================== * Warp a specified area *------------------------------------------*/ -int buildin_areawarp_sub(struct block_list *bl, va_list ap) +static int buildin_areawarp_sub(struct block_list *bl, va_list ap) { int x2,y2,x3,y3; unsigned int index; @@ -6599,7 +6655,7 @@ int buildin_areawarp_sub(struct block_list *bl, va_list ap) } return 0; } -BUILDIN(areawarp) +static BUILDIN(areawarp) { int16 m, x0,y0,x1,y1, x2,y2,x3=0,y3=0; unsigned int index; @@ -6641,7 +6697,7 @@ BUILDIN(areawarp) /*========================================== * areapercentheal <map>,<x1>,<y1>,<x2>,<y2>,<hp>,<sp> *------------------------------------------*/ -int buildin_areapercentheal_sub(struct block_list *bl, va_list ap) +static int buildin_areapercentheal_sub(struct block_list *bl, va_list ap) { int hp = va_arg(ap, int); int sp = va_arg(ap, int); @@ -6655,7 +6711,8 @@ int buildin_areapercentheal_sub(struct block_list *bl, va_list ap) return 0; } -BUILDIN(areapercentheal) { +static BUILDIN(areapercentheal) +{ int hp,sp,m; const char *mapname; int x0,y0,x1,y1; @@ -6681,7 +6738,8 @@ BUILDIN(areapercentheal) { * another player npc-session. * Using: warpchar "mapname",x,y,Char_ID; *------------------------------------------*/ -BUILDIN(warpchar) { +static BUILDIN(warpchar) +{ int x,y,a; const char *str; struct map_session_data *sd; @@ -6711,7 +6769,7 @@ BUILDIN(warpchar) { * If 'from_mapname' is specified, only the party members on that map will be warped * If 'include_leader' option is set to false, the leader will be warped too. *------------------------------------------*/ -BUILDIN(warpparty) +static BUILDIN(warpparty) { struct map_session_data *sd = NULL; struct map_session_data *pl_sd; @@ -6806,7 +6864,7 @@ BUILDIN(warpparty) * Warpguild - [Fredzilla] * Syntax: warpguild "mapname",x,y,Guild_ID,{"from_mapname"}; *------------------------------------------*/ -BUILDIN(warpguild) +static BUILDIN(warpguild) { struct map_session_data *sd = NULL; struct guild* g; @@ -6871,7 +6929,7 @@ BUILDIN(warpguild) /*========================================== * Force Heal a player (hp and sp) *------------------------------------------*/ -BUILDIN(heal) +static BUILDIN(heal) { int hp,sp; struct map_session_data *sd = script->rid2sd(st); @@ -6886,7 +6944,7 @@ BUILDIN(heal) /*========================================== * Heal a player by item (get vit bonus etc) *------------------------------------------*/ -BUILDIN(itemheal) +static BUILDIN(itemheal) { struct map_session_data *sd; int hp,sp; @@ -6909,7 +6967,7 @@ BUILDIN(itemheal) /*========================================== * *------------------------------------------*/ -BUILDIN(percentheal) +static BUILDIN(percentheal) { int hp,sp; struct map_session_data *sd; @@ -6940,7 +6998,7 @@ BUILDIN(percentheal) /*========================================== * *------------------------------------------*/ -BUILDIN(jobchange) +static BUILDIN(jobchange) { int class, upper=-1; @@ -6962,7 +7020,7 @@ BUILDIN(jobchange) /*========================================== * *------------------------------------------*/ -BUILDIN(jobname) +static BUILDIN(jobname) { int class = script_getnum(st,2); script_pushconststr(st, pc->job_name(class)); @@ -6976,7 +7034,7 @@ BUILDIN(jobname) /// shorter than 'min' and 0 otherwise. /// /// input(<var>{,<min>{,<max>}}) -> <int> -BUILDIN(input) +static BUILDIN(input) { struct script_data* data; int64 uid; @@ -7029,13 +7087,13 @@ BUILDIN(input) } // declare the copyarray method here for future reference -BUILDIN(copyarray); +static BUILDIN(copyarray); /// Sets the value of a variable. /// The value is converted to the type of the variable. /// /// set(<variable>,<value>) -> <variable> -BUILDIN(__setr) +static BUILDIN(__setr) { struct map_session_data *sd = NULL; struct script_data* data; @@ -7123,7 +7181,7 @@ BUILDIN(__setr) /// ex: setarray arr[1],1,2,3; /// /// setarray <array variable>,<value1>{,<value2>...}; -BUILDIN(setarray) +static BUILDIN(setarray) { struct script_data* data; const char* name; @@ -7173,7 +7231,7 @@ BUILDIN(setarray) /// ex: cleararray arr[0],0,1; /// /// cleararray <array variable>,<value>,<count>; -BUILDIN(cleararray) +static BUILDIN(cleararray) { struct script_data* data; const char* name; @@ -7221,7 +7279,7 @@ BUILDIN(cleararray) /// ex: copyarray arr[0],arr[2],2; /// /// copyarray <destination array variable>,<source array variable>,<count>; -BUILDIN(copyarray) +static BUILDIN(copyarray) { struct script_data* data1; struct script_data* data2; @@ -7308,7 +7366,7 @@ BUILDIN(copyarray) /// ex: getarraysize(arr[3]) /// /// getarraysize(<array variable>) -> <int> -BUILDIN(getarraysize) +static BUILDIN(getarraysize) { struct script_data* data; @@ -7325,12 +7383,12 @@ BUILDIN(getarraysize) script_pushint(st, script->array_highest_key(st,st->rid ? script->rid2sd(st) : NULL,reference_getname(data),reference_getref(data))); return true; } -int script_array_index_cmp(const void *a, const void *b) +static int script_array_index_cmp(const void *a, const void *b) { return (*(const unsigned int *)a - *(const unsigned int *)b); // FIXME: Is the unsigned difference really intended here? } -BUILDIN(getarrayindex) +static BUILDIN(getarrayindex) { struct script_data *data = script_getdata(st, 2); @@ -7351,7 +7409,7 @@ BUILDIN(getarrayindex) /// /// deletearray <array variable>; /// deletearray <array variable>,<count>; -BUILDIN(deletearray) +static BUILDIN(deletearray) { struct script_data* data; const char* name; @@ -7465,7 +7523,7 @@ BUILDIN(deletearray) /// Equivalent to var[index]. /// /// getelementofarray(<array variable>,<index>) -> <variable reference> -BUILDIN(getelementofarray) +static BUILDIN(getelementofarray) { struct script_data* data; int32 id; @@ -7503,7 +7561,7 @@ BUILDIN(getelementofarray) /*========================================== * *------------------------------------------*/ -BUILDIN(setlook) +static BUILDIN(setlook) { int type,val; struct map_session_data *sd; @@ -7520,7 +7578,7 @@ BUILDIN(setlook) return true; } -BUILDIN(changelook) +static BUILDIN(changelook) { // As setlook but only client side int type,val; struct map_session_data *sd; @@ -7540,7 +7598,7 @@ BUILDIN(changelook) /*========================================== * *------------------------------------------*/ -BUILDIN(cutin) +static BUILDIN(cutin) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -7553,7 +7611,7 @@ BUILDIN(cutin) /*========================================== * *------------------------------------------*/ -BUILDIN(viewpoint) +static BUILDIN(viewpoint) { int type,x,y,id,color; struct map_session_data *sd; @@ -7576,7 +7634,8 @@ BUILDIN(viewpoint) /*========================================== * *------------------------------------------*/ -BUILDIN(countitem) { +static BUILDIN(countitem) +{ int nameid, i; int count = 0; struct item_data* id = NULL; @@ -7613,7 +7672,8 @@ BUILDIN(countitem) { * countitem2(nameID,Identified,Refine,Attribute,Card0,Card1,Card2,Card3) [Lupus] * returns number of items that meet the conditions *------------------------------------------*/ -BUILDIN(countitem2) { +static BUILDIN(countitem2) +{ int nameid, iden, ref, attr, c1, c2, c3, c4; int count = 0; int i; @@ -7667,7 +7727,7 @@ BUILDIN(countitem2) { * 0 : fail * 1 : success (npc side only) *------------------------------------------*/ -BUILDIN(checkweight) +static BUILDIN(checkweight) { int slots, amount2=0; unsigned int weight=0, i, nbargs; @@ -7749,7 +7809,7 @@ BUILDIN(checkweight) return true; } -BUILDIN(checkweight2) +static BUILDIN(checkweight2) { //variable sub checkweight int i=0, amount2=0, slots=0, weight=0; @@ -7853,7 +7913,8 @@ BUILDIN(checkweight2) * getitembound <item id>,<amount>,<type>{,<account ID>}; * getitembound "<item id>",<amount>,<type>{,<account ID>}; *------------------------------------------*/ -BUILDIN(getitem) { +static BUILDIN(getitem) +{ int nameid,amount,get_count,i,flag = 0, offset = 0; struct item it; struct map_session_data *sd; @@ -7938,7 +7999,7 @@ BUILDIN(getitem) { /*========================================== * *------------------------------------------*/ -BUILDIN(getitem2) +static BUILDIN(getitem2) { int nameid,amount,flag = 0, offset = 0; int iden,ref,attr,c1,c2,c3,c4, bound = 0; @@ -8048,7 +8109,8 @@ BUILDIN(getitem2) * rentitem <item id>,<seconds> * rentitem "<item name>",<seconds> *------------------------------------------*/ -BUILDIN(rentitem) { +static BUILDIN(rentitem) +{ struct map_session_data *sd; struct item it; int seconds; @@ -8096,7 +8158,8 @@ BUILDIN(rentitem) { * Returned Qty is always 1, only works on equip-able * equipment *------------------------------------------*/ -BUILDIN(getnameditem) { +static BUILDIN(getnameditem) +{ int nameid; struct item item_tmp; struct map_session_data *sd, *tsd; @@ -8155,7 +8218,8 @@ BUILDIN(getnameditem) { * gets a random item ID from an item group [Skotlex] * groupranditem group_num *------------------------------------------*/ -BUILDIN(grouprandomitem) { +static BUILDIN(grouprandomitem) +{ struct item_data *data; int nameid; @@ -8185,7 +8249,7 @@ BUILDIN(grouprandomitem) { /*========================================== * *------------------------------------------*/ -BUILDIN(makeitem) +static BUILDIN(makeitem) { int nameid,amount; int x,y,m; @@ -8234,9 +8298,9 @@ BUILDIN(makeitem) } /*========================================== -* makeitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,{"<map name>",<X>,<Y>,<range>}; -*------------------------------------------*/ -BUILDIN(makeitem2) + * makeitem2 <item id>, <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>, {"<map name>", <X>, <Y>, <range>}; + *------------------------------------------*/ +static BUILDIN(makeitem2) { struct map_session_data *sd = NULL; struct item_data *i_data; @@ -8320,7 +8384,7 @@ BUILDIN(makeitem2) /// Counts / deletes the current item given by idx. /// Used by buildin_delitem_search /// Relies on all input data being already fully valid. -void buildin_delitem_delete(struct map_session_data* sd, int idx, int* amount, bool delete_items) +static void buildin_delitem_delete(struct map_session_data *sd, int idx, int *amount, bool delete_items) { int delamount; struct item* inv; @@ -8348,7 +8412,7 @@ void buildin_delitem_delete(struct map_session_data* sd, int idx, int* amount, b /// Relies on all input data being already fully valid. /// @param exact_match will also match item attributes and cards, not just name id /// @return true when all items could be deleted, false when there were not enough items to delete -bool buildin_delitem_search(struct map_session_data* sd, struct item* it, bool exact_match) +static bool buildin_delitem_search(struct map_session_data *sd, struct item *it, bool exact_match) { bool delete_items = false; int i, amount; @@ -8457,7 +8521,7 @@ bool buildin_delitem_search(struct map_session_data* sd, struct item* it, bool e /// /// delitem <item id>,<amount>{,<account id>} /// delitem "<item name>",<amount>{,<account id>} -BUILDIN(delitem) +static BUILDIN(delitem) { struct map_session_data *sd; struct item it; @@ -8514,7 +8578,7 @@ BUILDIN(delitem) /// /// delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>} /// delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>} -BUILDIN(delitem2) +static BUILDIN(delitem2) { struct map_session_data *sd; struct item it; @@ -8577,7 +8641,7 @@ BUILDIN(delitem2) /*========================================== * Enables/Disables use of items while in an NPC [Skotlex] *------------------------------------------*/ -BUILDIN(enableitemuse) +static BUILDIN(enableitemuse) { struct map_session_data *sd = script->rid2sd(st); if (sd != NULL) @@ -8585,7 +8649,7 @@ BUILDIN(enableitemuse) return true; } -BUILDIN(disableitemuse) +static BUILDIN(disableitemuse) { struct map_session_data *sd = script->rid2sd(st); if (sd != NULL) @@ -8597,7 +8661,7 @@ BUILDIN(disableitemuse) * return the basic stats of sd * chk pc->readparam for available type *------------------------------------------*/ -BUILDIN(readparam) +static BUILDIN(readparam) { int type; struct map_session_data *sd; @@ -8628,7 +8692,7 @@ BUILDIN(readparam) return true; } -BUILDIN(setparam) +static BUILDIN(setparam) { int type; struct map_session_data *sd; @@ -8675,7 +8739,8 @@ BUILDIN(setparam) * 4 : bg_id * 5 : clan_id *------------------------------------------*/ -BUILDIN(getcharid) { +static BUILDIN(getcharid) +{ int num = script_getnum(st, 2); struct map_session_data *sd; @@ -8719,7 +8784,7 @@ BUILDIN(getcharid) { /*========================================== * returns the GID of an NPC *------------------------------------------*/ -BUILDIN(getnpcid) +static BUILDIN(getnpcid) { int num = script_getnum(st,2); struct npc_data* nd = NULL; @@ -8751,7 +8816,7 @@ BUILDIN(getnpcid) * Return the name of the party_id * null if not found *------------------------------------------*/ -BUILDIN(getpartyname) +static BUILDIN(getpartyname) { int party_id; struct party_data* p; @@ -8777,7 +8842,7 @@ BUILDIN(getpartyname) * 1 : char_id des membres * 2 : account_id des membres *------------------------------------------*/ -BUILDIN(getpartymember) +static BUILDIN(getpartymember) { struct party_data *p; int j=0,type=0; @@ -8814,7 +8879,7 @@ BUILDIN(getpartymember) * Retrieves party leader. if flag is specified, * return some of the leader data. Otherwise, return name. *------------------------------------------*/ -BUILDIN(getpartyleader) +static BUILDIN(getpartyleader) { int party_id, type = 0, i=0; struct party_data *p; @@ -8851,7 +8916,7 @@ BUILDIN(getpartyleader) * Return the name of the @guild_id * null if not found *------------------------------------------*/ -BUILDIN(getguildname) +static BUILDIN(getguildname) { int guild_id; struct guild* g; @@ -8873,7 +8938,7 @@ BUILDIN(getguildname) * Return the name of the guild master of @guild_id * null if not found *------------------------------------------*/ -BUILDIN(getguildmaster) +static BUILDIN(getguildmaster) { int guild_id; struct guild* g; @@ -8891,7 +8956,7 @@ BUILDIN(getguildmaster) return true; } -BUILDIN(getguildmasterid) +static BUILDIN(getguildmasterid) { int guild_id; struct guild* g; @@ -8918,7 +8983,7 @@ BUILDIN(getguildmasterid) * 1 : character ID * 2 : account ID *------------------------------------------*/ -BUILDIN(getguildmember) +static BUILDIN(getguildmember) { struct guild *g = NULL; int j = 0; @@ -8962,7 +9027,7 @@ BUILDIN(getguildmember) * 4 : clan_name or "" * - : "" *------------------------------------------*/ -BUILDIN(strcharinfo) +static BUILDIN(strcharinfo) { struct clan *c; struct guild* g; @@ -9028,7 +9093,7 @@ BUILDIN(strcharinfo) * 3 : ::str * 4 : map name *------------------------------------------*/ -BUILDIN(strnpcinfo) +static BUILDIN(strnpcinfo) { char *buf,*name=NULL; struct npc_data *nd; @@ -9085,7 +9150,7 @@ BUILDIN(strnpcinfo) /** * charid2rid: Returns the RID associated to the given character ID */ -BUILDIN(charid2rid) +static BUILDIN(charid2rid) { int cid = script_getnum(st, 2); struct map_session_data *sd = map->charid2sd(cid); @@ -9102,7 +9167,7 @@ BUILDIN(charid2rid) /*========================================== * GetEquipID(Pos); Pos: 1-SCRIPT_EQUIP_TABLE_SIZE *------------------------------------------*/ -BUILDIN(getequipid) +static BUILDIN(getequipid) { int i, num; struct item_data* item; @@ -9138,7 +9203,7 @@ BUILDIN(getequipid) * Get the equipement name at pos * return item jname or "" *------------------------------------------*/ -BUILDIN(getequipname) +static BUILDIN(getequipname) { int i, num; struct item_data* item; @@ -9173,7 +9238,7 @@ BUILDIN(getequipname) /*========================================== * getbrokenid [Valaris] *------------------------------------------*/ -BUILDIN(getbrokenid) +static BUILDIN(getbrokenid) { int i,num,id=0,brokencounter=0; struct map_session_data *sd = script->rid2sd(st); @@ -9199,7 +9264,7 @@ BUILDIN(getbrokenid) /*========================================== * getbrokencount *------------------------------------------*/ -BUILDIN(getbrokencount) +static BUILDIN(getbrokencount) { int i, counter = 0; struct map_session_data *sd = script->rid2sd(st); @@ -9219,7 +9284,7 @@ BUILDIN(getbrokencount) /*========================================== * repair [Valaris] *------------------------------------------*/ -BUILDIN(repair) +static BUILDIN(repair) { int i,num; int repaircounter=0; @@ -9248,7 +9313,7 @@ BUILDIN(repair) /*========================================== * repairall *------------------------------------------*/ -BUILDIN(repairall) +static BUILDIN(repairall) { int i, repaircounter = 0; struct map_session_data *sd = script->rid2sd(st); @@ -9278,7 +9343,7 @@ BUILDIN(repairall) /*========================================== * Chk if player have something equiped at pos *------------------------------------------*/ -BUILDIN(getequipisequiped) +static BUILDIN(getequipisequiped) { int i = -1,num; struct map_session_data *sd; @@ -9305,7 +9370,7 @@ BUILDIN(getequipisequiped) * 1 : true * 0 : false *------------------------------------------*/ -BUILDIN(getequipisenableref) +static BUILDIN(getequipisenableref) { int i = -1,num; struct map_session_data *sd; @@ -9332,7 +9397,7 @@ BUILDIN(getequipisenableref) * @param equipment_index as the inventory index of the equipment. * @return 1 on enabled 0 on disabled. */ -BUILDIN(getequipisenableopt) +static BUILDIN(getequipisenableopt) { int i = -1, index = script_getnum(st, 2); struct map_session_data *sd = script->rid2sd(st); @@ -9360,7 +9425,7 @@ BUILDIN(getequipisenableopt) * 1 : true * 0 : false *------------------------------------------*/ -BUILDIN(getequipisidentify) +static BUILDIN(getequipisidentify) { int i = -1,num; struct map_session_data *sd; @@ -9386,7 +9451,7 @@ BUILDIN(getequipisidentify) * x : refine amount * 0 : false (not refined) *------------------------------------------*/ -BUILDIN(getequiprefinerycnt) +static BUILDIN(getequiprefinerycnt) { int i = -1,num; struct map_session_data *sd; @@ -9413,7 +9478,7 @@ BUILDIN(getequiprefinerycnt) * x : weapon level * 0 : false *------------------------------------------*/ -BUILDIN(getequipweaponlv) +static BUILDIN(getequipweaponlv) { int i = -1,num; struct map_session_data *sd; @@ -9439,7 +9504,8 @@ BUILDIN(getequipweaponlv) * x : refine chance * 0 : false (max refine level or unequip..) *------------------------------------------*/ -BUILDIN(getequippercentrefinery) { +static BUILDIN(getequippercentrefinery) +{ int i = -1, num; struct map_session_data *sd; int type = 0; @@ -9473,7 +9539,7 @@ BUILDIN(getequippercentrefinery) { /*========================================== * Refine +1 item at pos and log and display refine *------------------------------------------*/ -BUILDIN(successrefitem) +static BUILDIN(successrefitem) { int i = -1 , num, up = 1; struct map_session_data *sd; @@ -9534,7 +9600,7 @@ BUILDIN(successrefitem) /*========================================== * Show a failed Refine +1 attempt *------------------------------------------*/ -BUILDIN(failedrefitem) +static BUILDIN(failedrefitem) { int i=-1,num; struct map_session_data *sd; @@ -9562,7 +9628,7 @@ BUILDIN(failedrefitem) /*========================================== * Downgrades an Equipment Part by -1 . [Masao] *------------------------------------------*/ -BUILDIN(downrefitem) +static BUILDIN(downrefitem) { int i = -1, num, down = 1; struct map_session_data *sd; @@ -9603,7 +9669,7 @@ BUILDIN(downrefitem) /*========================================== * Delete the item equipped at pos. *------------------------------------------*/ -BUILDIN(delequip) +static BUILDIN(delequip) { int i=-1,num; struct map_session_data *sd; @@ -9631,7 +9697,8 @@ BUILDIN(delequip) /*========================================== * *------------------------------------------*/ -BUILDIN(statusup) { +static BUILDIN(statusup) +{ int type; struct map_session_data *sd; @@ -9647,7 +9714,7 @@ BUILDIN(statusup) { /*========================================== * *------------------------------------------*/ -BUILDIN(statusup2) +static BUILDIN(statusup2) { int type,val; struct map_session_data *sd; @@ -9670,7 +9737,8 @@ BUILDIN(statusup2) /// bonus3 <bonus type>,<val1>,<val2>,<val3>; /// bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>; /// bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>; -BUILDIN(bonus) { +static BUILDIN(bonus) +{ int type; int val1; int val2 = 0; @@ -9752,7 +9820,7 @@ BUILDIN(bonus) { return true; } -BUILDIN(autobonus) +static BUILDIN(autobonus) { unsigned int dur; short rate; @@ -9787,7 +9855,7 @@ BUILDIN(autobonus) return true; } -BUILDIN(autobonus2) +static BUILDIN(autobonus2) { unsigned int dur; short rate; @@ -9822,7 +9890,7 @@ BUILDIN(autobonus2) return true; } -BUILDIN(autobonus3) +static BUILDIN(autobonus3) { unsigned int dur; short rate,atk_type; @@ -9865,7 +9933,8 @@ BUILDIN(autobonus3) /// skill <skill id>,<level> /// skill "<skill name>",<level>,<flag> /// skill "<skill name>",<level> -BUILDIN(skill) { +static BUILDIN(skill) +{ int id; int level; int flag = SKILL_GRANT_TEMPORARY; @@ -9891,7 +9960,8 @@ BUILDIN(skill) { /// addtoskill "<skill name>",<amount> /// /// @see skill -BUILDIN(addtoskill) { +static BUILDIN(addtoskill) +{ int id; int level; int flag = SKILL_GRANT_TEMPSTACK; @@ -9912,7 +9982,8 @@ BUILDIN(addtoskill) { /// /// guildskill <skill id>,<amount>; /// guildskill "<skill name>",<amount>; -BUILDIN(guildskill) { +static BUILDIN(guildskill) +{ int skill_id, id, max_points; int level; @@ -9951,7 +10022,7 @@ BUILDIN(guildskill) { /// /// getskilllv(<skill id>) -> <level> /// getskilllv("<skill name>") -> <level> -BUILDIN(getskilllv) +static BUILDIN(getskilllv) { int id; struct map_session_data *sd = script->rid2sd(st); @@ -9968,7 +10039,8 @@ BUILDIN(getskilllv) /// /// getgdskilllv(<guild id>,<skill id>) -> <level> /// getgdskilllv(<guild id>,"<skill name>") -> <level> -BUILDIN(getgdskilllv) { +static BUILDIN(getgdskilllv) +{ int guild_id; uint16 skill_id; struct guild* g; @@ -9989,7 +10061,7 @@ BUILDIN(getgdskilllv) { /// before allowing the basic actions. /// /// basicskillcheck() -> <bool> -BUILDIN(basicskillcheck) +static BUILDIN(basicskillcheck) { script_pushint(st, battle_config.basic_skill_check); return true; @@ -9998,7 +10070,7 @@ BUILDIN(basicskillcheck) /// Returns the GM level of the player. /// /// getgmlevel() -> <level> -BUILDIN(getgmlevel) +static BUILDIN(getgmlevel) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10012,7 +10084,8 @@ BUILDIN(getgmlevel) /// set the group ID of the player. /// setgroupid(<new group id>{,"<character name>"|<account id>}) /// return 1 on success, 0 if failed. -BUILDIN(setgroupid) { +static BUILDIN(setgroupid) +{ struct map_session_data* sd = NULL; int new_group = script_getnum(st, 2); @@ -10036,7 +10109,8 @@ BUILDIN(setgroupid) { /// Returns the group ID of the player. /// /// getgroupid({<account id>}) -> <int> -BUILDIN(getgroupid) { +static BUILDIN(getgroupid) +{ struct map_session_data *sd = NULL; if (script_hasdata(st, 2)) { @@ -10057,7 +10131,8 @@ BUILDIN(getgroupid) { /// Terminates the execution of this script instance. /// /// end -BUILDIN(end) { +static BUILDIN(end) +{ st->state = END; /* are we stopping inside a function? */ @@ -10077,7 +10152,7 @@ BUILDIN(end) { /// Checks if the player has that effect state (option). /// /// checkoption(<option>) -> <bool> -BUILDIN(checkoption) +static BUILDIN(checkoption) { int option; struct map_session_data *sd; @@ -10102,7 +10177,7 @@ BUILDIN(checkoption) /// Checks if the player is in that body state (opt1). /// /// checkoption1(<opt1>) -> <bool> -BUILDIN(checkoption1) +static BUILDIN(checkoption1) { int opt1; struct map_session_data *sd; @@ -10127,7 +10202,7 @@ BUILDIN(checkoption1) /// Checks if the player has that health state (opt2). /// /// checkoption2(<opt2>) -> <bool> -BUILDIN(checkoption2) +static BUILDIN(checkoption2) { int opt2; struct map_session_data *sd; @@ -10156,7 +10231,7 @@ BUILDIN(checkoption2) /// /// setoption <option>,<flag>; /// setoption <option>; -BUILDIN(setoption) +static BUILDIN(setoption) { int option; int flag = 1; @@ -10195,7 +10270,7 @@ BUILDIN(setoption) /// checkcart() -> <bool> /// /// @author Valaris -BUILDIN(checkcart) +static BUILDIN(checkcart) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10220,7 +10295,7 @@ BUILDIN(checkcart) /// /// setcart <type>; /// setcart; -BUILDIN(setcart) +static BUILDIN(setcart) { int type = 1; struct map_session_data *sd = script->rid2sd(st); @@ -10239,7 +10314,7 @@ BUILDIN(setcart) /// checkfalcon() -> <bool> /// /// @author Valaris -BUILDIN(checkfalcon) +static BUILDIN(checkfalcon) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10258,7 +10333,7 @@ BUILDIN(checkfalcon) /// /// setfalcon <flag>; /// setfalcon; -BUILDIN(setfalcon) +static BUILDIN(setfalcon) { bool flag = true; struct map_session_data *sd = script->rid2sd(st); @@ -10295,7 +10370,7 @@ enum setmount_type { * The exact returned values are the same used as flag in setmount, except for * dragons, where SETMOUNT_TYPE_DRAGON is returned, regardless of color. */ -BUILDIN(checkmount) +static BUILDIN(checkmount) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10338,7 +10413,7 @@ BUILDIN(checkmount) * auto-detected. As a result of this, there is no need to specify a flag at * all, unless it is a dragon color other than green. */ -BUILDIN(setmount) +static BUILDIN(setmount) { int flag = SETMOUNT_TYPE_AUTODETECT; struct map_session_data *sd = script->rid2sd(st); @@ -10403,7 +10478,7 @@ BUILDIN(setmount) /// /// checkwug() -> <bool> /// -BUILDIN(checkwug) +static BUILDIN(checkwug) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10421,7 +10496,8 @@ BUILDIN(checkwug) /// /// save "<map name>",<x>,<y> /// savepoint "<map name>",<x>,<y> -BUILDIN(savepoint) { +static BUILDIN(savepoint) +{ int x; int y; short mapid; @@ -10443,7 +10519,9 @@ BUILDIN(savepoint) { /*========================================== * GetTimeTick(0: System Tick, 1: Time Second Tick) *------------------------------------------*/ -BUILDIN(gettimetick) { /* Asgard Version */ +/* Asgard Version */ +static BUILDIN(gettimetick) +{ int type; time_t clock; struct tm *t; @@ -10476,7 +10554,9 @@ BUILDIN(gettimetick) { /* Asgard Version */ * 4: WeekDay 5: MonthDay 6: Month * 7: Year *------------------------------------------*/ -BUILDIN(gettime) { /* Asgard Version */ +/* Asgard Version */ +static BUILDIN(gettime) +{ int type; time_t clock; struct tm *t; @@ -10521,7 +10601,7 @@ BUILDIN(gettime) { /* Asgard Version */ /*========================================== * GetTimeStr("TimeFMT", Length); *------------------------------------------*/ -BUILDIN(gettimestr) +static BUILDIN(gettimestr) { char *tmpstr; const char *fmtstr; @@ -10542,7 +10622,7 @@ BUILDIN(gettimestr) /*========================================== * Open player storage *------------------------------------------*/ -BUILDIN(openstorage) +static BUILDIN(openstorage) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -10560,7 +10640,7 @@ BUILDIN(openstorage) return true; } -BUILDIN(guildopenstorage) +static BUILDIN(guildopenstorage) { int ret; struct map_session_data *sd = script->rid2sd(st); @@ -10577,7 +10657,7 @@ BUILDIN(guildopenstorage) *------------------------------------------*/ /// itemskill <skill id>,<level>{,flag /// itemskill "<skill name>",<level>{,flag -BUILDIN(itemskill) +static BUILDIN(itemskill) { int id; int lv; @@ -10602,7 +10682,7 @@ BUILDIN(itemskill) /*========================================== * Attempt to create an item *------------------------------------------*/ -BUILDIN(produce) +static BUILDIN(produce) { int trigger; struct map_session_data *sd = script->rid2sd(st); @@ -10616,7 +10696,7 @@ BUILDIN(produce) /*========================================== * *------------------------------------------*/ -BUILDIN(cooking) +static BUILDIN(cooking) { int trigger; struct map_session_data *sd = script->rid2sd(st); @@ -10630,7 +10710,7 @@ BUILDIN(cooking) /*========================================== * Create a pet *------------------------------------------*/ -BUILDIN(makepet) +static BUILDIN(makepet) { struct map_session_data *sd; int id,pet_id; @@ -10657,7 +10737,7 @@ BUILDIN(makepet) /*========================================== * Give player exp base,job * quest_exp_rate/100 *------------------------------------------*/ -BUILDIN(getexp) +static BUILDIN(getexp) { int base=0,job=0; struct map_session_data *sd = script->rid2sd(st); @@ -10681,7 +10761,7 @@ BUILDIN(getexp) /*========================================== * Gain guild exp [Celest] *------------------------------------------*/ -BUILDIN(guildgetexp) +static BUILDIN(guildgetexp) { int exp; struct map_session_data *sd = script->rid2sd(st); @@ -10700,7 +10780,7 @@ BUILDIN(guildgetexp) /*========================================== * Changes the guild master of a guild [Skotlex] *------------------------------------------*/ -BUILDIN(guildchangegm) +static BUILDIN(guildchangegm) { struct map_session_data *sd; int guild_id; @@ -10726,7 +10806,7 @@ BUILDIN(guildchangegm) * @amount : nb to spawn * @event : event to attach to mob *------------------------------------------*/ -BUILDIN(monster) +static BUILDIN(monster) { const char *mapn = script_getstr(st,2); int x = script_getnum(st,3); @@ -10798,7 +10878,7 @@ BUILDIN(monster) /*========================================== * Request List of Monster Drops *------------------------------------------*/ -BUILDIN(getmobdrops) +static BUILDIN(getmobdrops) { int class_ = script_getnum(st,2); int i, j = 0; @@ -10833,7 +10913,8 @@ BUILDIN(getmobdrops) /*========================================== * Same as monster but randomize location in x0,x1,y0,y1 area *------------------------------------------*/ -BUILDIN(areamonster) { +static BUILDIN(areamonster) +{ const char *mapn = script_getstr(st,2); int x0 = script_getnum(st,3); int y0 = script_getnum(st,4); @@ -10896,7 +10977,7 @@ BUILDIN(areamonster) { /*========================================== * KillMonster subcheck, verify if mob to kill ain't got an even to handle, could be force kill by allflag *------------------------------------------*/ -int buildin_killmonster_sub_strip(struct block_list *bl, va_list ap) +static int buildin_killmonster_sub_strip(struct block_list *bl, va_list ap) { //same fix but with killmonster instead - stripping events from mobs. struct mob_data *md = NULL; @@ -10919,7 +11000,7 @@ int buildin_killmonster_sub_strip(struct block_list *bl, va_list ap) md->state.npc_killmonster = 0; return 0; } -int buildin_killmonster_sub(struct block_list *bl, va_list ap) +static int buildin_killmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; char *event = va_arg(ap,char *); @@ -10938,7 +11019,8 @@ int buildin_killmonster_sub(struct block_list *bl, va_list ap) } return 0; } -BUILDIN(killmonster) { +static BUILDIN(killmonster) +{ const char *mapname,*event; int16 m,allflag=0; mapname=script_getstr(st,2); @@ -10967,7 +11049,7 @@ BUILDIN(killmonster) { return true; } -int buildin_killmonsterall_sub_strip(struct block_list *bl,va_list ap) +static int buildin_killmonsterall_sub_strip(struct block_list *bl, va_list ap) { //Strips the event from the mob if it's killed the old method. struct mob_data *md; @@ -10979,12 +11061,13 @@ int buildin_killmonsterall_sub_strip(struct block_list *bl,va_list ap) status_kill(bl); return 0; } -int buildin_killmonsterall_sub(struct block_list *bl,va_list ap) +static int buildin_killmonsterall_sub(struct block_list *bl, va_list ap) { status_kill(bl); return 0; } -BUILDIN(killmonsterall) { +static BUILDIN(killmonsterall) +{ const char *mapname; int16 m; mapname=script_getstr(st,2); @@ -11010,7 +11093,8 @@ BUILDIN(killmonsterall) { * Creates a clone of a player. * clone map, x, y, event, char_id, master_id, mode, flag, duration *------------------------------------------*/ -BUILDIN(clone) { +static BUILDIN(clone) +{ struct map_session_data *sd, *msd = NULL; int char_id, master_id = 0, x, y, flag = 0, m; uint32 mode = 0; @@ -11058,7 +11142,7 @@ BUILDIN(clone) { } /*========================================== *------------------------------------------*/ -BUILDIN(doevent) +static BUILDIN(doevent) { const char* event = script_getstr(st,2); struct map_session_data* sd; @@ -11074,7 +11158,7 @@ BUILDIN(doevent) } /*========================================== *------------------------------------------*/ -BUILDIN(donpcevent) +static BUILDIN(donpcevent) { const char* event = script_getstr(st,2); script->check_event(st, event); @@ -11089,7 +11173,7 @@ BUILDIN(donpcevent) /*========================================== *------------------------------------------*/ -BUILDIN(addtimer) +static BUILDIN(addtimer) { int tick = script_getnum(st, 2); const char* event = script_getstr(st, 3); @@ -11118,7 +11202,7 @@ BUILDIN(addtimer) } /*========================================== *------------------------------------------*/ -BUILDIN(deltimer) +static BUILDIN(deltimer) { const char *event; struct map_session_data *sd; @@ -11139,7 +11223,7 @@ BUILDIN(deltimer) } /*========================================== *------------------------------------------*/ -BUILDIN(addtimercount) +static BUILDIN(addtimercount) { const char *event; int tick; @@ -11167,7 +11251,7 @@ enum gettimer_mode { GETTIMER_TICK_LAST = 2, }; -BUILDIN(gettimer) +static BUILDIN(gettimer) { struct map_session_data *sd; const struct TimerData *td; @@ -11255,7 +11339,7 @@ BUILDIN(gettimer) return true; } -int buildin_getunits_sub(struct block_list *bl, va_list ap) +static int buildin_getunits_sub(struct block_list *bl, va_list ap) { struct script_state *st = va_arg(ap, struct script_state *); struct map_session_data *sd = va_arg(ap, struct map_session_data *); @@ -11298,7 +11382,7 @@ static int buildin_getunits_sub_npc(struct npc_data *nd, va_list ap) return buildin_getunits_sub(&nd->bl, ap); } -BUILDIN(getunits) +static BUILDIN(getunits) { const char *name; int32 id; @@ -11394,7 +11478,7 @@ BUILDIN(getunits) /*========================================== *------------------------------------------*/ -BUILDIN(initnpctimer) +static BUILDIN(initnpctimer) { struct npc_data *nd; int flag = 0; @@ -11439,7 +11523,7 @@ BUILDIN(initnpctimer) } /*========================================== *------------------------------------------*/ -BUILDIN(startnpctimer) +static BUILDIN(startnpctimer) { struct npc_data *nd; int flag = 0; @@ -11482,7 +11566,8 @@ BUILDIN(startnpctimer) } /*========================================== *------------------------------------------*/ -BUILDIN(stopnpctimer) { +static BUILDIN(stopnpctimer) +{ struct npc_data *nd; int flag = 0; @@ -11520,7 +11605,7 @@ BUILDIN(stopnpctimer) { } /*========================================== *------------------------------------------*/ -BUILDIN(getnpctimer) +static BUILDIN(getnpctimer) { struct npc_data *nd; struct map_session_data *sd; @@ -11558,7 +11643,7 @@ BUILDIN(getnpctimer) } /*========================================== *------------------------------------------*/ -BUILDIN(setnpctimer) +static BUILDIN(setnpctimer) { int tick; struct npc_data *nd; @@ -11583,7 +11668,7 @@ BUILDIN(setnpctimer) /*========================================== * attaches the player rid to the timer [Celest] *------------------------------------------*/ -BUILDIN(attachnpctimer) +static BUILDIN(attachnpctimer) { struct map_session_data *sd; struct npc_data *nd = map->id2nd(st->oid); @@ -11612,7 +11697,8 @@ BUILDIN(attachnpctimer) /*========================================== * detaches a player rid from the timer [Celest] *------------------------------------------*/ -BUILDIN(detachnpctimer) { +static BUILDIN(detachnpctimer) +{ struct npc_data *nd; if( script_hasdata(st,2) ) @@ -11636,7 +11722,8 @@ BUILDIN(detachnpctimer) { * it checks if there is a player attached to the current script. [Skotlex] * If no, returns 0, if yes, returns the account_id of the attached player. *------------------------------------------*/ -BUILDIN(playerattached) { +static BUILDIN(playerattached) +{ if(st->rid == 0 || map->id2sd(st->rid) == NULL) script_pushint(st,0); else @@ -11646,7 +11733,7 @@ BUILDIN(playerattached) { /*========================================== *------------------------------------------*/ -BUILDIN(announce) +static BUILDIN(announce) { const char *mes = script_getstr(st,2); int flag = script_getnum(st,3); @@ -11694,7 +11781,7 @@ BUILDIN(announce) } /*========================================== *------------------------------------------*/ -int buildin_announce_sub(struct block_list *bl, va_list ap) +static int buildin_announce_sub(struct block_list *bl, va_list ap) { const char *mes = va_arg(ap, const char *); int len = va_arg(ap, int); @@ -11713,7 +11800,7 @@ int buildin_announce_sub(struct block_list *bl, va_list ap) /* Runs item effect on attached character. * itemeffect <item id>; * itemeffect "<item name>"; */ -BUILDIN(itemeffect) +static BUILDIN(itemeffect) { struct npc_data *nd; struct item_data *item_data; @@ -11746,7 +11833,7 @@ BUILDIN(itemeffect) return true; } -BUILDIN(mapannounce) +static BUILDIN(mapannounce) { const char *mapname = script_getstr(st,2); const char *mes = script_getstr(st,3); @@ -11769,7 +11856,7 @@ BUILDIN(mapannounce) } /*========================================== *------------------------------------------*/ -BUILDIN(areaannounce) +static BUILDIN(areaannounce) { const char *mapname = script_getstr(st,2); int x0 = script_getnum(st,3); @@ -11797,7 +11884,8 @@ BUILDIN(areaannounce) /*========================================== *------------------------------------------*/ -BUILDIN(getusers) { +static BUILDIN(getusers) +{ int flag, val = 0; struct map_session_data* sd; struct block_list* bl = NULL; @@ -11833,7 +11921,7 @@ BUILDIN(getusers) { /*========================================== * Works like @WHO - displays all online users names in window *------------------------------------------*/ -BUILDIN(getusersname) +static BUILDIN(getusersname) { struct map_session_data *sd; const struct map_session_data *pl_sd; @@ -11862,7 +11950,7 @@ BUILDIN(getusersname) /*========================================== * getmapguildusers("mapname",guild ID) Returns the number guild members present on a map [Reddozen] *------------------------------------------*/ -BUILDIN(getmapguildusers) +static BUILDIN(getmapguildusers) { const char *str; int16 m; @@ -11890,7 +11978,8 @@ BUILDIN(getmapguildusers) } /*========================================== *------------------------------------------*/ -BUILDIN(getmapusers) { +static BUILDIN(getmapusers) +{ const char *str; int16 m; str=script_getstr(st,2); @@ -11903,7 +11992,7 @@ BUILDIN(getmapusers) { } /*========================================== *------------------------------------------*/ -int buildin_getareausers_sub(struct block_list *bl,va_list ap) +static int buildin_getareausers_sub(struct block_list *bl, va_list ap) { int *users=va_arg(ap,int *); nullpo_ret(users); @@ -11911,7 +12000,7 @@ int buildin_getareausers_sub(struct block_list *bl,va_list ap) return 0; } -BUILDIN(getareausers) +static BUILDIN(getareausers) { int16 m = -1, x0, y0, x1, y1; int users = 0; @@ -11971,7 +12060,7 @@ BUILDIN(getareausers) /*========================================== *------------------------------------------*/ -int buildin_getareadropitem_sub(struct block_list *bl, va_list ap) +static int buildin_getareadropitem_sub(struct block_list *bl, va_list ap) { int item = va_arg(ap, int); int *amount = va_arg(ap, int *); @@ -11987,7 +12076,8 @@ int buildin_getareadropitem_sub(struct block_list *bl, va_list ap) return 0; } -BUILDIN(getareadropitem) { +static BUILDIN(getareadropitem) +{ const char *str; int16 m,x0,y0,x1,y1; int item,amount=0; @@ -12019,7 +12109,7 @@ BUILDIN(getareadropitem) { } /*========================================== *------------------------------------------*/ -BUILDIN(enablenpc) +static BUILDIN(enablenpc) { const char *str; str=script_getstr(st,2); @@ -12028,7 +12118,7 @@ BUILDIN(enablenpc) } /*========================================== *------------------------------------------*/ -BUILDIN(disablenpc) +static BUILDIN(disablenpc) { const char *str; str=script_getstr(st,2); @@ -12038,7 +12128,7 @@ BUILDIN(disablenpc) /*========================================== *------------------------------------------*/ -BUILDIN(hideoffnpc) +static BUILDIN(hideoffnpc) { const char *str; str=script_getstr(st,2); @@ -12047,7 +12137,7 @@ BUILDIN(hideoffnpc) } /*========================================== *------------------------------------------*/ -BUILDIN(hideonnpc) +static BUILDIN(hideonnpc) { const char *str; str=script_getstr(st,2); @@ -12062,7 +12152,7 @@ BUILDIN(hideonnpc) * sc_start4 <effect_id>,<duration>,<val1>,<val2>,<val3>,<val4>{,<rate,<flag>,{<unit_id>}}; * <flag>: @see enum scstart_flag */ -BUILDIN(sc_start) +static BUILDIN(sc_start) { struct npc_data *nd = map->id2nd(st->oid); struct block_list* bl; @@ -12130,7 +12220,8 @@ BUILDIN(sc_start) /// Ends one or all status effects on the target unit or on the attached player. /// /// sc_end <effect_id>{,<unit_id>}; -BUILDIN(sc_end) { +static BUILDIN(sc_end) +{ struct block_list* bl; int type; @@ -12177,7 +12268,8 @@ BUILDIN(sc_end) { /*========================================== * @FIXME atm will return reduced tick, 0 immune, 1 no tick *------------------------------------------*/ -BUILDIN(getscrate) { +static BUILDIN(getscrate) +{ struct block_list *bl; int type,rate; @@ -12198,7 +12290,7 @@ BUILDIN(getscrate) { /*========================================== * getstatus <type>{, <info>}; *------------------------------------------*/ -BUILDIN(getstatus) +static BUILDIN(getstatus) { int id, type; struct map_session_data* sd = script->rid2sd(st); @@ -12249,7 +12341,7 @@ BUILDIN(getstatus) /*========================================== * *------------------------------------------*/ -BUILDIN(debugmes) +static BUILDIN(debugmes) { const char *str; str=script_getstr(st,2); @@ -12259,7 +12351,7 @@ BUILDIN(debugmes) /*========================================== *------------------------------------------*/ -BUILDIN(catchpet) +static BUILDIN(catchpet) { int pet_id; struct map_session_data *sd; @@ -12276,7 +12368,7 @@ BUILDIN(catchpet) /*========================================== * [orn] *------------------------------------------*/ -BUILDIN(homunculus_evolution) +static BUILDIN(homunculus_evolution) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12296,7 +12388,7 @@ BUILDIN(homunculus_evolution) * Checks for vaporized morph state * and deletes ITEMID_STRANGE_EMBRYO. *------------------------------------------*/ -BUILDIN(homunculus_mutate) +static BUILDIN(homunculus_mutate) { bool success = false; struct map_session_data *sd = script->rid2sd(st); @@ -12337,7 +12429,7 @@ BUILDIN(homunculus_mutate) * Puts homunculus into morph state * and gives ITEMID_STRANGE_EMBRYO. *------------------------------------------*/ -BUILDIN(homunculus_morphembryo) +static BUILDIN(homunculus_morphembryo) { bool success = false; struct map_session_data *sd = script->rid2sd(st); @@ -12380,7 +12472,7 @@ BUILDIN(homunculus_morphembryo) * 1 = Homunculus is vaporized (rest) * 2 = Homunculus is in morph state *------------------------------------------*/ -BUILDIN(homunculus_checkcall) +static BUILDIN(homunculus_checkcall) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL || sd->hd == NULL) @@ -12392,7 +12484,7 @@ BUILDIN(homunculus_checkcall) } // [Zephyrus] -BUILDIN(homunculus_shuffle) +static BUILDIN(homunculus_shuffle) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12405,7 +12497,7 @@ BUILDIN(homunculus_shuffle) } //These two functions bring the eA MAPID_* class functionality to scripts. -BUILDIN(eaclass) +static BUILDIN(eaclass) { int class; if (script_hasdata(st,2)) { @@ -12420,7 +12512,7 @@ BUILDIN(eaclass) return true; } -BUILDIN(roclass) +static BUILDIN(roclass) { int job = script_getnum(st,2); int sex; @@ -12440,7 +12532,7 @@ BUILDIN(roclass) /*========================================== * Tells client to open a hatching window, used for pet incubator *------------------------------------------*/ -BUILDIN(birthpet) +static BUILDIN(birthpet) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12463,7 +12555,7 @@ BUILDIN(birthpet) * 3 : don't reset skill, blvl=1 * 4 : jlvl=0 *------------------------------------------*/ -BUILDIN(resetlvl) +static BUILDIN(resetlvl) { int type=script_getnum(st,2); struct map_session_data *sd = script->rid2sd(st); @@ -12476,7 +12568,7 @@ BUILDIN(resetlvl) /*========================================== * Reset a player status point *------------------------------------------*/ -BUILDIN(resetstatus) +static BUILDIN(resetstatus) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12488,7 +12580,7 @@ BUILDIN(resetstatus) /*========================================== * script command resetskill *------------------------------------------*/ -BUILDIN(resetskill) +static BUILDIN(resetskill) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12500,7 +12592,7 @@ BUILDIN(resetskill) /*========================================== * Counts total amount of skill points. *------------------------------------------*/ -BUILDIN(skillpointcount) +static BUILDIN(skillpointcount) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -12512,7 +12604,7 @@ BUILDIN(skillpointcount) /*========================================== * *------------------------------------------*/ -BUILDIN(changebase) +static BUILDIN(changebase) { struct map_session_data *sd = NULL; int vclass; @@ -12558,7 +12650,7 @@ static struct map_session_data *prepareChangeSex(struct script_state *st) /*========================================== * Unequip all item and request for a changesex to char-serv *------------------------------------------*/ -BUILDIN(changesex) +static BUILDIN(changesex) { struct map_session_data *sd = prepareChangeSex(st); if (sd == NULL) @@ -12570,7 +12662,7 @@ BUILDIN(changesex) /*========================================== * Unequip all items and change character sex [4144] *------------------------------------------*/ -BUILDIN(changecharsex) +static BUILDIN(changecharsex) { struct map_session_data *sd = prepareChangeSex(st); if (sd == NULL) @@ -12582,7 +12674,7 @@ BUILDIN(changecharsex) /*========================================== * Works like 'announce' but outputs in the common chat window *------------------------------------------*/ -BUILDIN(globalmes) +static BUILDIN(globalmes) { const char *name=NULL,*mes; @@ -12610,7 +12702,7 @@ BUILDIN(globalmes) /// Creates a waiting room (chat room) for this npc. /// /// waitingroom "<title>",<limit>{,"<event>"{,<trigger>{,<zeny>{,<minlvl>{,<maxlvl>}}}}}; -BUILDIN(waitingroom) +static BUILDIN(waitingroom) { struct npc_data* nd; const char* title = script_getstr(st, 2); @@ -12634,7 +12726,8 @@ BUILDIN(waitingroom) /// /// delwaitingroom "<npc_name>"; /// delwaitingroom; -BUILDIN(delwaitingroom) { +static BUILDIN(delwaitingroom) +{ struct npc_data* nd; if( script_hasdata(st,2) ) nd = npc->name2id(script_getstr(st, 2)); @@ -12649,7 +12742,8 @@ BUILDIN(delwaitingroom) { /// /// kickwaitingroomall "<npc_name>"; /// kickwaitingroomall; -BUILDIN(waitingroomkickall) { +static BUILDIN(waitingroomkickall) +{ struct npc_data* nd; struct chat_data* cd; @@ -12667,7 +12761,8 @@ BUILDIN(waitingroomkickall) { /// /// enablewaitingroomevent "<npc_name>"; /// enablewaitingroomevent; -BUILDIN(enablewaitingroomevent) { +static BUILDIN(enablewaitingroomevent) +{ struct npc_data* nd; struct chat_data* cd; @@ -12685,7 +12780,8 @@ BUILDIN(enablewaitingroomevent) { /// /// disablewaitingroomevent "<npc_name>"; /// disablewaitingroomevent; -BUILDIN(disablewaitingroomevent) { +static BUILDIN(disablewaitingroomevent) +{ struct npc_data *nd; struct chat_data *cd; @@ -12717,7 +12813,7 @@ BUILDIN(disablewaitingroomevent) { /// /// getwaitingroomstate(<type>,"<npc_name>") -> <info> /// getwaitingroomstate(<type>) -> <info> -BUILDIN(getwaitingroomstate) +static BUILDIN(getwaitingroomstate) { const struct npc_data *nd; const struct chat_data *cd; @@ -12773,7 +12869,7 @@ BUILDIN(getwaitingroomstate) /// /// warpwaitingpc "<map name>",<x>,<y>,<number of players>; /// warpwaitingpc "<map name>",<x>,<y>; -BUILDIN(warpwaitingpc) +static BUILDIN(warpwaitingpc) { int x, y, i, n; const char* map_name; @@ -12830,7 +12926,8 @@ BUILDIN(warpwaitingpc) /// Detaches a character from a script. /// /// @param st Script state to detach the character from. -void script_detach_rid(struct script_state* st) { +static void script_detach_rid(struct script_state *st) +{ if(st->rid) { script->detach_state(st, false); st->rid = 0; @@ -12840,7 +12937,8 @@ void script_detach_rid(struct script_state* st) { /*========================================== * Attach sd char id to script and detach current one if any *------------------------------------------*/ -BUILDIN(attachrid) { +static BUILDIN(attachrid) +{ int rid = script_getnum(st,2); if (map->id2sd(rid) != NULL) { @@ -12856,7 +12954,7 @@ BUILDIN(attachrid) { /*========================================== * Detach script to rid *------------------------------------------*/ -BUILDIN(detachrid) +static BUILDIN(detachrid) { script->detach_rid(st); return true; @@ -12864,7 +12962,7 @@ BUILDIN(detachrid) /*========================================== * Chk if account connected, (and charid from account if specified) *------------------------------------------*/ -BUILDIN(isloggedin) +static BUILDIN(isloggedin) { struct map_session_data *sd = map->id2sd(script_getnum(st,2)); if (script_hasdata(st,3) && sd != NULL @@ -12877,7 +12975,8 @@ BUILDIN(isloggedin) /*========================================== * *------------------------------------------*/ -BUILDIN(setmapflagnosave) { +static BUILDIN(setmapflagnosave) +{ int16 m,x,y; unsigned short map_index; const char *str,*str2; @@ -12907,7 +13006,7 @@ enum mapinfo_info { MAPINFO_ZONE }; -BUILDIN(getmapinfo) +static BUILDIN(getmapinfo) { enum mapinfo_info mode = script_getnum(st, 2); int16 m = -1; @@ -12969,7 +13068,7 @@ BUILDIN(getmapinfo) return true; } -BUILDIN(getmapflag) +static BUILDIN(getmapflag) { int16 m,i; const char *str; @@ -13041,7 +13140,7 @@ BUILDIN(getmapflag) return true; } /* pvp timer handling */ -int script_mapflag_pvp_sub(struct block_list *bl, va_list ap) +static int script_mapflag_pvp_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; @@ -13063,7 +13162,8 @@ int script_mapflag_pvp_sub(struct block_list *bl, va_list ap) return 0; } -BUILDIN(setmapflag) { +static BUILDIN(setmapflag) +{ int16 m,i; const char *str, *val2 = NULL; int val=0; @@ -13169,7 +13269,8 @@ BUILDIN(setmapflag) { return true; } -BUILDIN(removemapflag) { +static BUILDIN(removemapflag) +{ int16 m,i; const char *str; @@ -13257,7 +13358,7 @@ BUILDIN(removemapflag) { return true; } -BUILDIN(pvpon) +static BUILDIN(pvpon) { int16 m; const char *str; @@ -13303,7 +13404,7 @@ BUILDIN(pvpon) return true; } -int buildin_pvpoff_sub(struct block_list *bl, va_list ap) +static int buildin_pvpoff_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; @@ -13319,7 +13420,8 @@ int buildin_pvpoff_sub(struct block_list *bl, va_list ap) return 0; } -BUILDIN(pvpoff) { +static BUILDIN(pvpoff) +{ int16 m; const char *str; struct block_list bl; @@ -13343,7 +13445,8 @@ BUILDIN(pvpoff) { return true; } -BUILDIN(gvgon) { +static BUILDIN(gvgon) +{ int16 m; const char *str; @@ -13367,7 +13470,8 @@ BUILDIN(gvgon) { return true; } -BUILDIN(gvgoff) { +static BUILDIN(gvgoff) +{ int16 m; const char *str; @@ -13390,7 +13494,8 @@ BUILDIN(gvgoff) { * emotion emotion#, <target: 0 - NPC, 1 - PC>, <NPC/PC name> *------------------------------------------*/ //Optional second parameter added by [Skotlex] -BUILDIN(emotion) { +static BUILDIN(emotion) +{ int type; int player=0; @@ -13419,7 +13524,7 @@ BUILDIN(emotion) { return true; } -int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list ap) +static int buildin_maprespawnguildid_sub_pc(struct map_session_data *sd, va_list ap) { int16 m=va_arg(ap,int); int g_id=va_arg(ap,int); @@ -13436,7 +13541,7 @@ int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list ap) return 1; } -int buildin_maprespawnguildid_sub_mob(struct block_list *bl, va_list ap) +static int buildin_maprespawnguildid_sub_mob(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; @@ -13450,7 +13555,8 @@ int buildin_maprespawnguildid_sub_mob(struct block_list *bl, va_list ap) return 0; } -BUILDIN(maprespawnguildid) { +static BUILDIN(maprespawnguildid) +{ const char *mapname=script_getstr(st,2); int g_id=script_getnum(st,3); int flag=script_getnum(st,4); @@ -13467,28 +13573,32 @@ BUILDIN(maprespawnguildid) { return true; } -BUILDIN(agitstart) { +static BUILDIN(agitstart) +{ if(map->agit_flag==1) return true; // Agit already Start. map->agit_flag=1; guild->agit_start(); return true; } -BUILDIN(agitend) { +static BUILDIN(agitend) +{ if(map->agit_flag==0) return true; // Agit already End. map->agit_flag=0; guild->agit_end(); return true; } -BUILDIN(agitstart2) { +static BUILDIN(agitstart2) +{ if(map->agit2_flag==1) return true; // Agit2 already Start. map->agit2_flag=1; guild->agit2_start(); return true; } -BUILDIN(agitend2) { +static BUILDIN(agitend2) +{ if(map->agit2_flag==0) return true; // Agit2 already End. map->agit2_flag=0; guild->agit2_end(); @@ -13498,7 +13608,8 @@ BUILDIN(agitend2) { /*========================================== * Returns whether woe is on or off. *------------------------------------------*/ -BUILDIN(agitcheck) { +static BUILDIN(agitcheck) +{ script_pushint(st,map->agit_flag); return true; } @@ -13506,7 +13617,8 @@ BUILDIN(agitcheck) { /*========================================== * Returns whether woese is on or off. *------------------------------------------*/ -BUILDIN(agitcheck2) { +static BUILDIN(agitcheck2) +{ script_pushint(st,map->agit2_flag); return true; } @@ -13514,7 +13626,7 @@ BUILDIN(agitcheck2) { /// Sets the guild_id of this npc. /// /// flagemblem <guild_id>; -BUILDIN(flagemblem) +static BUILDIN(flagemblem) { struct npc_data *nd; int g_id = script_getnum(st,2); @@ -13539,7 +13651,7 @@ BUILDIN(flagemblem) return true; } -BUILDIN(getcastlename) +static BUILDIN(getcastlename) { const char* mapname = mapindex->getmapname(script_getstr(st,2),NULL); struct guild_castle* gc = guild->mapname2gc(mapname); @@ -13548,7 +13660,7 @@ BUILDIN(getcastlename) return true; } -BUILDIN(getcastledata) +static BUILDIN(getcastledata) { const char *mapname = mapindex->getmapname(script_getstr(st,2),NULL); int index = script_getnum(st,3); @@ -13591,7 +13703,7 @@ BUILDIN(getcastledata) return true; } -BUILDIN(setcastledata) +static BUILDIN(setcastledata) { const char *mapname = mapindex->getmapname(script_getstr(st,2),NULL); int index = script_getnum(st,3); @@ -13614,7 +13726,7 @@ BUILDIN(setcastledata) /* ===================================================================== * ---------------------------------------------------------------------*/ -BUILDIN(requestguildinfo) +static BUILDIN(requestguildinfo) { int guild_id=script_getnum(st,2); const char *event=NULL; @@ -13631,7 +13743,7 @@ BUILDIN(requestguildinfo) /// Returns the number of cards that have been compounded onto the specified equipped item. /// getequipcardcnt(<equipment slot>); -BUILDIN(getequipcardcnt) +static BUILDIN(getequipcardcnt) { int i=-1,j,num; struct map_session_data *sd; @@ -13669,7 +13781,7 @@ BUILDIN(getequipcardcnt) /// Removes all cards from the item found in the specified equipment slot of the invoking character, /// and give them to the character. If any cards were removed in this manner, it will also show a success effect. /// successremovecards(<slot>); -BUILDIN(successremovecards) +static BUILDIN(successremovecards) { int i = -1, c, cardflag = 0; @@ -13723,7 +13835,7 @@ BUILDIN(successremovecards) /// <type>=1 : will keep the item, but destroy the cards. /// <type>=2 : will keep the cards, but destroy the item. /// <type>=3 : will just display the failure effect. -BUILDIN(failedremovecards) +static BUILDIN(failedremovecards) { int i = -1, c, cardflag = 0; int num = script_getnum(st, 2); @@ -13787,7 +13899,8 @@ BUILDIN(failedremovecards) * improved by [Lance] * ================================================================*/ // Added by RoVeRT -BUILDIN(mapwarp) { +static BUILDIN(mapwarp) +{ int x,y,m,check_val=0,check_ID=0,i=0; struct guild *g = NULL; struct party_data *p = NULL; @@ -13840,7 +13953,7 @@ BUILDIN(mapwarp) { } // Added by RoVeRT -int buildin_mobcount_sub(struct block_list *bl, va_list ap) +static int buildin_mobcount_sub(struct block_list *bl, va_list ap) { char *event = va_arg(ap,char *); const struct mob_data *md = NULL; @@ -13855,7 +13968,8 @@ int buildin_mobcount_sub(struct block_list *bl, va_list ap) } // Added by RoVeRT -BUILDIN(mobcount) { +static BUILDIN(mobcount) +{ const char *mapname,*event; int16 m; mapname=script_getstr(st,2); @@ -13888,7 +14002,8 @@ BUILDIN(mobcount) { return true; } -BUILDIN(marriage) { +static BUILDIN(marriage) +{ const char *partner=script_getstr(st,2); struct map_session_data *sd = script->rid2sd(st); struct map_session_data *p_sd = script->nick2sd(st, partner); @@ -13900,7 +14015,7 @@ BUILDIN(marriage) { script_pushint(st,1); return true; } -BUILDIN(wedding_effect) +static BUILDIN(wedding_effect) { struct map_session_data *sd = script->rid2sd(st); struct block_list *bl; @@ -13912,7 +14027,7 @@ BUILDIN(wedding_effect) clif->wedding_effect(bl); return true; } -BUILDIN(divorce) +static BUILDIN(divorce) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL || pc->divorce(sd) < 0) { @@ -13923,7 +14038,8 @@ BUILDIN(divorce) return true; } -BUILDIN(ispartneron) { +static BUILDIN(ispartneron) +{ struct map_session_data *sd = script->rid2sd(st); if (sd==NULL || !pc->ismarried(sd) @@ -13936,7 +14052,7 @@ BUILDIN(ispartneron) { return true; } -BUILDIN(getpartnerid) +static BUILDIN(getpartnerid) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -13946,7 +14062,7 @@ BUILDIN(getpartnerid) return true; } -BUILDIN(getchildid) +static BUILDIN(getchildid) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -13956,7 +14072,7 @@ BUILDIN(getchildid) return true; } -BUILDIN(getmotherid) +static BUILDIN(getmotherid) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -13966,7 +14082,8 @@ BUILDIN(getmotherid) return true; } -BUILDIN(getfatherid) { +static BUILDIN(getfatherid) +{ struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; @@ -13975,7 +14092,7 @@ BUILDIN(getfatherid) { return true; } -BUILDIN(warppartner) +static BUILDIN(warppartner) { int x,y; unsigned short map_index; @@ -14005,7 +14122,7 @@ BUILDIN(warppartner) /*================================================ * Script for Displaying MOB Information [Valaris] *------------------------------------------------*/ -BUILDIN(strmobinfo) +static BUILDIN(strmobinfo) { int num=script_getnum(st,2); @@ -14039,7 +14156,8 @@ BUILDIN(strmobinfo) * Summon guardians [Valaris] * guardian("<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"}{,<guardian index>}) -> <id> *------------------------------------------*/ -BUILDIN(guardian) { +static BUILDIN(guardian) +{ int class_ = 0, x = 0, y = 0, guardian = 0; const char *str, *mapname, *evt=""; bool has_index = false; @@ -14080,7 +14198,8 @@ BUILDIN(guardian) { /*========================================== * Invisible Walls [Zephyrus] *------------------------------------------*/ -BUILDIN(setwall) { +static BUILDIN(setwall) +{ const char *mapname, *name; int x, y, m, size, dir; bool shootable; @@ -14100,7 +14219,7 @@ BUILDIN(setwall) { return true; } -BUILDIN(delwall) +static BUILDIN(delwall) { const char *name = script_getstr(st,2); @@ -14119,7 +14238,8 @@ BUILDIN(delwall) /// 1 - maximum hp /// 2 - current hp /// -BUILDIN(guardianinfo) { +static BUILDIN(guardianinfo) +{ const char* mapname = mapindex->getmapname(script_getstr(st,2),NULL); int id = script_getnum(st,3); int type = script_getnum(st,4); @@ -14151,7 +14271,8 @@ BUILDIN(guardianinfo) { /*========================================== * Get the item name by item_id or null *------------------------------------------*/ -BUILDIN(getitemname) { +static BUILDIN(getitemname) +{ int item_id=0; struct item_data *i_data; char *item_name; @@ -14179,7 +14300,7 @@ BUILDIN(getitemname) { /*========================================== * Returns number of slots an item has. [Skotlex] *------------------------------------------*/ -BUILDIN(getitemslots) +static BUILDIN(getitemslots) { int item_id; struct item_data *i_data; @@ -14201,7 +14322,7 @@ BUILDIN(getitemslots) * Returns some values of an item [Lupus] * Price, Weight, etc... *------------------------------------------*/ -BUILDIN(getiteminfo) +static BUILDIN(getiteminfo) { int item_id = script_getnum(st, 2); int n = script_getnum(st, 3); @@ -14283,7 +14404,7 @@ BUILDIN(getiteminfo) * IT_OPT_VALUE Amount of the bonus to be added. * @return value of the type or -1. */ -BUILDIN(getequippedoptioninfo) +static BUILDIN(getequippedoptioninfo) { int val = 0, type = script_getnum(st, 2); struct map_session_data *sd = NULL; @@ -14321,7 +14442,7 @@ BUILDIN(getequippedoptioninfo) * @param type IT_OPT_INDEX or IT_OPT_VALUE. * @return (int) value or -1 on failure. */ -BUILDIN(getequipoption) +static BUILDIN(getequipoption) { int val = 0, equip_index = script_getnum(st, 2); int slot = script_getnum(st, 3); @@ -14385,7 +14506,7 @@ BUILDIN(getequipoption) * For IT_OPT_VALUE, the value of the script bonus. * @return 0 on failure, 1 on success. */ -BUILDIN(setequipoption) +static BUILDIN(setequipoption) { int equip_index = script_getnum(st, 2); int slot = script_getnum(st, 3); @@ -14465,7 +14586,7 @@ BUILDIN(setequipoption) * Set some values of an item [Lupus] * Price, Weight, etc... *------------------------------------------*/ -BUILDIN(setiteminfo) +static BUILDIN(setiteminfo) { // TODO: Validate data in a similar way as during database load int item_id = script_getnum(st, 2); @@ -14551,7 +14672,7 @@ BUILDIN(setiteminfo) * Useful for such quests as "Sign this refined item with players name" etc * Hat[0] +4 -> Player's Hat[0] +4 *------------------------------------------*/ -BUILDIN(getequipcardid) +static BUILDIN(getequipcardid) { int i=-1,num,slot; struct map_session_data *sd; @@ -14576,7 +14697,7 @@ BUILDIN(getequipcardid) /*========================================== * petskillbonus [Valaris] //Rewritten by [Skotlex] *------------------------------------------*/ -BUILDIN(petskillbonus) +static BUILDIN(petskillbonus) { struct pet_data *pd; @@ -14613,7 +14734,7 @@ BUILDIN(petskillbonus) /*========================================== * pet looting [Valaris] //Rewritten by [Skotlex] *------------------------------------------*/ -BUILDIN(petloot) +static BUILDIN(petloot) { int max; struct pet_data *pd; @@ -14653,7 +14774,7 @@ BUILDIN(petloot) * @inventorylist_card(0..3), @inventorylist_expire * @inventorylist_count = scalar *------------------------------------------*/ -BUILDIN(getinventorylist) +static BUILDIN(getinventorylist) { struct map_session_data *sd = script->rid2sd(st); char card_var[SCRIPT_VARNAME_LENGTH]; @@ -14694,7 +14815,7 @@ BUILDIN(getinventorylist) return true; } -BUILDIN(getcartinventorylist) +static BUILDIN(getcartinventorylist) { struct map_session_data *sd = script->rid2sd(st); char card_var[SCRIPT_VARNAME_LENGTH]; @@ -14731,7 +14852,7 @@ BUILDIN(getcartinventorylist) return true; } -BUILDIN(getskilllist) +static BUILDIN(getskilllist) { struct map_session_data *sd = script->rid2sd(st); int i,j=0; @@ -14749,7 +14870,7 @@ BUILDIN(getskilllist) return true; } -BUILDIN(clearitem) +static BUILDIN(clearitem) { struct map_session_data *sd = script->rid2sd(st); int i; @@ -14766,7 +14887,7 @@ BUILDIN(clearitem) /*========================================== * Disguise Player (returns Mob/NPC ID if success, 0 on fail) *------------------------------------------*/ -BUILDIN(disguise) +static BUILDIN(disguise) { int id; struct map_session_data *sd = script->rid2sd(st); @@ -14787,7 +14908,7 @@ BUILDIN(disguise) /*========================================== * Undisguise Player (returns 1 if success, 0 on fail) *------------------------------------------*/ -BUILDIN(undisguise) +static BUILDIN(undisguise) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -14806,7 +14927,7 @@ BUILDIN(undisguise) * Transform a bl to another class, * @type unused *------------------------------------------*/ -BUILDIN(classchange) +static BUILDIN(classchange) { int class, type, target; struct block_list *bl = map->id2bl(st->oid); @@ -14832,7 +14953,7 @@ BUILDIN(classchange) /*========================================== * Display an effect *------------------------------------------*/ -BUILDIN(misceffect) +static BUILDIN(misceffect) { int type; @@ -14851,7 +14972,7 @@ BUILDIN(misceffect) /*========================================== * Play a BGM on a single client [Rikter/Yommy] *------------------------------------------*/ -BUILDIN(playbgm) +static BUILDIN(playbgm) { struct map_session_data* sd = script->rid2sd(st); @@ -14864,7 +14985,7 @@ BUILDIN(playbgm) return true; } -int playbgm_sub(struct block_list* bl,va_list ap) +static int playbgm_sub(struct block_list *bl, va_list ap) { const char* name = va_arg(ap,const char*); @@ -14873,7 +14994,7 @@ int playbgm_sub(struct block_list* bl,va_list ap) return 0; } -int playbgm_foreachpc_sub(struct map_session_data* sd, va_list args) +static int playbgm_foreachpc_sub(struct map_session_data *sd, va_list args) { const char* name = va_arg(args, const char*); @@ -14885,7 +15006,8 @@ int playbgm_foreachpc_sub(struct map_session_data* sd, va_list args) /*========================================== * Play a BGM on multiple client [Rikter/Yommy] *------------------------------------------*/ -BUILDIN(playbgmall) { +static BUILDIN(playbgmall) +{ const char* name; name = script_getstr(st,2); @@ -14927,7 +15049,7 @@ BUILDIN(playbgmall) { /*========================================== * Play a .wav sound for sd *------------------------------------------*/ -BUILDIN(soundeffect) +static BUILDIN(soundeffect) { struct map_session_data *sd = script->rid2sd(st); const char* name = script_getstr(st,2); @@ -14939,7 +15061,7 @@ BUILDIN(soundeffect) return true; } -int soundeffect_sub(struct block_list *bl, va_list ap) +static int soundeffect_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; char *name = va_arg(ap, char *); @@ -14958,7 +15080,8 @@ int soundeffect_sub(struct block_list *bl, va_list ap) * Play a sound effect (.wav) on multiple clients * soundeffectall "<filepath>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>}; *------------------------------------------*/ -BUILDIN(soundeffectall) { +static BUILDIN(soundeffectall) +{ struct block_list* bl; const char* name; int type; @@ -15009,7 +15132,7 @@ BUILDIN(soundeffectall) { /*========================================== * pet status recovery [Valaris] / Rewritten by [Skotlex] *------------------------------------------*/ -BUILDIN(petrecovery) +static BUILDIN(petrecovery) { struct pet_data *pd; struct map_session_data *sd = script->rid2sd(st); @@ -15038,7 +15161,7 @@ BUILDIN(petrecovery) *------------------------------------------*/ /// petskillattack <skill id>,<level>,<div>,<rate>,<bonusrate> /// petskillattack "<skill name>",<level>,<div>,<rate>,<bonusrate> -BUILDIN(petskillattack) +static BUILDIN(petskillattack) { struct pet_data *pd; struct map_session_data *sd = script->rid2sd(st); @@ -15064,7 +15187,7 @@ BUILDIN(petskillattack) *------------------------------------------*/ /// petskillsupport <skill id>,<level>,<delay>,<hp>,<sp> /// petskillsupport "<skill name>",<level>,<delay>,<hp>,<sp> -BUILDIN(petskillsupport) +static BUILDIN(petskillsupport) { struct pet_data *pd; struct map_session_data *sd = script->rid2sd(st); @@ -15103,7 +15226,7 @@ BUILDIN(petskillsupport) *------------------------------------------*/ /// skilleffect <skill id>,<level> /// skilleffect "<skill name>",<level> -BUILDIN(skilleffect) +static BUILDIN(skilleffect) { struct map_session_data *sd; @@ -15131,7 +15254,8 @@ BUILDIN(skilleffect) *------------------------------------------*/ /// npcskilleffect <skill id>,<level>,<x>,<y> /// npcskilleffect "<skill name>",<level>,<x>,<y> -BUILDIN(npcskilleffect) { +static BUILDIN(npcskilleffect) +{ struct block_list *bl= map->id2bl(st->oid); uint16 skill_id=( script_isstringtype(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) ); @@ -15148,7 +15272,8 @@ BUILDIN(npcskilleffect) { /*========================================== * Special effects [Valaris] *------------------------------------------*/ -BUILDIN(specialeffect) { +static BUILDIN(specialeffect) +{ struct block_list *bl = NULL; int type = script_getnum(st, 2); enum send_target target = AREA; @@ -15191,7 +15316,8 @@ BUILDIN(specialeffect) { return true; } -BUILDIN(specialeffect2) { +static BUILDIN(specialeffect2) +{ struct map_session_data *sd; int type = script_getnum(st,2); enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA; @@ -15210,7 +15336,7 @@ BUILDIN(specialeffect2) { /*========================================== * Nude [Valaris] *------------------------------------------*/ -BUILDIN(nude) +static BUILDIN(nude) { struct map_session_data *sd = script->rid2sd(st); int i, calcflag = 0; @@ -15235,7 +15361,7 @@ BUILDIN(nude) /*========================================== * gmcommand [MouseJstr] *------------------------------------------*/ -BUILDIN(atcommand) +static BUILDIN(atcommand) { struct map_session_data *sd, *dummy_sd = NULL; int fd; @@ -15277,7 +15403,7 @@ BUILDIN(atcommand) * dispbottom "<message>"{,<color>}; * @endcode */ -BUILDIN(dispbottom) +static BUILDIN(dispbottom) { struct map_session_data *sd = script->rid2sd(st); const char *message = script_getstr(st,2); @@ -15299,7 +15425,7 @@ BUILDIN(dispbottom) * All The Players Full Recovery * (HP/SP full restore and resurrect if need) *------------------------------------------*/ -int buildin_recovery_sub(struct map_session_data *sd) +static int buildin_recovery_sub(struct map_session_data *sd) { nullpo_retr(0, sd); @@ -15312,17 +15438,17 @@ int buildin_recovery_sub(struct map_session_data *sd) return 0; } -int buildin_recovery_pc_sub(struct map_session_data *sd, va_list ap) +static int buildin_recovery_pc_sub(struct map_session_data *sd, va_list ap) { return script->buildin_recovery_sub(sd); } -int buildin_recovery_bl_sub(struct block_list *bl, va_list ap) +static int buildin_recovery_bl_sub(struct block_list *bl, va_list ap) { return script->buildin_recovery_sub(BL_CAST(BL_PC, bl)); } -BUILDIN(recovery) +static BUILDIN(recovery) { if (script_hasdata(st, 2)) { if (script_isstringtype(st, 2)) { @@ -15360,7 +15486,7 @@ BUILDIN(recovery) * n -> 0:pet_id 1:pet_class 2:pet_name * 3:friendly 4:hungry, 5: rename flag. *------------------------------------------*/ -BUILDIN(getpetinfo) +static BUILDIN(getpetinfo) { struct map_session_data *sd = script->rid2sd(st); struct pet_data *pd; @@ -15394,7 +15520,7 @@ BUILDIN(getpetinfo) * 3:friendly 4:hungry, 5: rename flag. * 6: level *------------------------------------------*/ -BUILDIN(gethominfo) +static BUILDIN(gethominfo) { struct map_session_data *sd = script->rid2sd(st); int type = script_getnum(st,2); @@ -15424,7 +15550,7 @@ BUILDIN(gethominfo) /// Retrieves information about character's mercenary /// getmercinfo <type>[,<char id>]; -BUILDIN(getmercinfo) +static BUILDIN(getmercinfo) { int type; struct map_session_data* sd; @@ -15475,7 +15601,7 @@ BUILDIN(getmercinfo) * selected card or not. * checkequipedcard(4001); *------------------------------------------*/ -BUILDIN(checkequipedcard) +static BUILDIN(checkequipedcard) { int n,i,c=0; struct map_session_data *sd = script->rid2sd(st); @@ -15502,7 +15628,7 @@ BUILDIN(checkequipedcard) return true; } -BUILDIN(__jump_zero) +static BUILDIN(__jump_zero) { int sel; sel=script_getnum(st,2); @@ -15524,7 +15650,7 @@ BUILDIN(__jump_zero) /*========================================== * movenpc [MouseJstr] *------------------------------------------*/ -BUILDIN(movenpc) +static BUILDIN(movenpc) { struct npc_data *nd = NULL; const char *npc_name; @@ -15546,7 +15672,7 @@ BUILDIN(movenpc) /*========================================== * message [MouseJstr] *------------------------------------------*/ -BUILDIN(message) +static BUILDIN(message) { const char *message; struct map_session_data *sd = NULL; @@ -15569,7 +15695,7 @@ BUILDIN(message) * npctalk (sends message to surrounding area) * usage: npctalk("<message>"{, "<npc name>"{, <show_name>}}); *------------------------------------------*/ -BUILDIN(npctalk) +static BUILDIN(npctalk) { struct npc_data* nd; const char *str = script_getstr(st,2); @@ -15601,7 +15727,8 @@ BUILDIN(npctalk) } // change npc walkspeed [Valaris] -BUILDIN(npcspeed) { +static BUILDIN(npcspeed) +{ struct npc_data* nd; int speed; @@ -15617,7 +15744,7 @@ BUILDIN(npcspeed) { return true; } // make an npc walk to a position [Valaris] -BUILDIN(npcwalkto) +static BUILDIN(npcwalkto) { struct npc_data *nd = map->id2nd(st->oid); int x=0,y=0; @@ -15638,7 +15765,7 @@ BUILDIN(npcwalkto) return true; } // stop an npc's movement [Valaris] -BUILDIN(npcstop) +static BUILDIN(npcstop) { struct npc_data *nd = map->id2nd(st->oid); @@ -15651,7 +15778,7 @@ BUILDIN(npcstop) } // set click npc distance [4144] -BUILDIN(setnpcdistance) +static BUILDIN(setnpcdistance) { struct npc_data *nd = map->id2nd(st->oid); if (nd == NULL) @@ -15663,7 +15790,7 @@ BUILDIN(setnpcdistance) } // return current npc direction [4144] -BUILDIN(getnpcdir) +static BUILDIN(getnpcdir) { const struct npc_data *nd = NULL; @@ -15689,7 +15816,7 @@ BUILDIN(getnpcdir) } // set npc direction [4144] -BUILDIN(setnpcdir) +static BUILDIN(setnpcdir) { int newdir; struct npc_data *nd = NULL; @@ -15723,7 +15850,7 @@ BUILDIN(setnpcdir) } // return npc class [4144] -BUILDIN(getnpcclass) +static BUILDIN(getnpcclass) { const struct npc_data *nd = NULL; @@ -15751,7 +15878,7 @@ BUILDIN(getnpcclass) /*========================================== * getlook char info. getlook(arg) *------------------------------------------*/ -BUILDIN(getlook) +static BUILDIN(getlook) { int type,val = -1; struct map_session_data *sd = script->rid2sd(st); @@ -15780,7 +15907,7 @@ BUILDIN(getlook) /*========================================== * get char save point. argument: 0- map name, 1- x, 2- y *------------------------------------------*/ -BUILDIN(getsavepoint) +static BUILDIN(getsavepoint) { int type; struct map_session_data *sd = script->rid2sd(st); @@ -15823,7 +15950,7 @@ BUILDIN(getsavepoint) * 0 - success * -1 - some error, MapName$,MapX,MapY contains unknown value. *------------------------------------------*/ -BUILDIN(getmapxy) +static BUILDIN(getmapxy) { struct block_list *bl = NULL; struct map_session_data *sd = NULL; @@ -16027,7 +16154,7 @@ enum logmes_type { /*========================================== * Allows player to write logs (i.e. Bank NPC, etc) [Lupus] *------------------------------------------*/ -BUILDIN(logmes) +static BUILDIN(logmes) { const char *str = script_getstr(st, 2); struct map_session_data *sd = script->rid2sd(st); @@ -16054,7 +16181,7 @@ BUILDIN(logmes) return true; } -BUILDIN(summon) +static BUILDIN(summon) { int class_, timeout=0; const char *str,*event=""; @@ -16092,7 +16219,8 @@ BUILDIN(summon) /*========================================== * Checks whether it is daytime/nighttime *------------------------------------------*/ -BUILDIN(isnight) { +static BUILDIN(isnight) +{ script_pushint(st,(map->night_flag == 1)); return true; } @@ -16101,7 +16229,7 @@ BUILDIN(isnight) { * Check how many items/cards in the list are * equipped - used for 2/15's cards patch [celest] *------------------------------------------------*/ -BUILDIN(isequippedcnt) +static BUILDIN(isequippedcnt) { int i, j, k, id = 1; int ret = 0; @@ -16150,7 +16278,7 @@ BUILDIN(isequippedcnt) * -- Items checked cannot be reused in another * card set to prevent exploits *------------------------------------------------*/ -BUILDIN(isequipped) +static BUILDIN(isequipped) { int i, j, k, id = 1; int index, flag; @@ -16230,7 +16358,7 @@ BUILDIN(isequipped) * Check how many given inserted cards in the CURRENT * weapon - used for 2/15's cards patch [Lupus] *------------------------------------------------*/ -BUILDIN(cardscnt) +static BUILDIN(cardscnt) { int i, k, id = 1; int ret = 0; @@ -16272,7 +16400,7 @@ BUILDIN(cardscnt) * Returns the refined number of the current item, or an * item with inventory index specified *-------------------------------------------------------*/ -BUILDIN(getrefine) +static BUILDIN(getrefine) { struct map_session_data *sd = script->rid2sd(st); @@ -16289,11 +16417,13 @@ BUILDIN(getrefine) /*======================================================= * Day/Night controls *-------------------------------------------------------*/ -BUILDIN(night) { +static BUILDIN(night) +{ if (map->night_flag != 1) pc->map_night_timer(pc->night_timer_tid, 0, 0, 1); return true; } -BUILDIN(day) { +static BUILDIN(day) +{ if (map->night_flag != 0) pc->map_day_timer(pc->day_timer_tid, 0, 0, 1); return true; } @@ -16301,7 +16431,7 @@ BUILDIN(day) { //======================================================= // Unequip [Spectre] //------------------------------------------------------- -BUILDIN(unequip) +static BUILDIN(unequip) { size_t num; struct map_session_data *sd; @@ -16316,7 +16446,7 @@ BUILDIN(unequip) return true; } -BUILDIN(equip) +static BUILDIN(equip) { int nameid=0,i; struct item_data *item_data; @@ -16337,7 +16467,7 @@ BUILDIN(equip) return true; } -BUILDIN(autoequip) +static BUILDIN(autoequip) { int nameid, flag; struct item_data *item_data; @@ -16364,7 +16494,7 @@ BUILDIN(autoequip) * Equip2 * equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>; *-------------------------------------------------------*/ -BUILDIN(equip2) +static BUILDIN(equip2) { int i,nameid,ref,attr,c0,c1,c2,c3; struct item_data *item_data; @@ -16409,7 +16539,7 @@ BUILDIN(equip2) return true; } -BUILDIN(setbattleflag) +static BUILDIN(setbattleflag) { const char *flag, *value; @@ -16424,7 +16554,7 @@ BUILDIN(setbattleflag) return true; } -BUILDIN(getbattleflag) +static BUILDIN(getbattleflag) { const char *flag; int value; @@ -16446,7 +16576,7 @@ BUILDIN(getbattleflag) //======================================================= // strlen [Valaris] //------------------------------------------------------- -BUILDIN(getstrlen) +static BUILDIN(getstrlen) { const char *str = script_getstr(st,2); @@ -16459,7 +16589,7 @@ BUILDIN(getstrlen) //======================================================= // isalpha [Valaris] //------------------------------------------------------- -BUILDIN(charisalpha) +static BUILDIN(charisalpha) { const char *str=script_getstr(st,2); int pos=script_getnum(st,3); @@ -16473,7 +16603,7 @@ BUILDIN(charisalpha) //======================================================= // charisupper <str>, <index> //------------------------------------------------------- -BUILDIN(charisupper) +static BUILDIN(charisupper) { const char *str = script_getstr(st,2); int pos = script_getnum(st,3); @@ -16487,7 +16617,7 @@ BUILDIN(charisupper) //======================================================= // charislower <str>, <index> //------------------------------------------------------- -BUILDIN(charislower) +static BUILDIN(charislower) { const char *str = script_getstr(st,2); int pos = script_getnum(st,3); @@ -16501,7 +16631,8 @@ BUILDIN(charislower) //======================================================= // charat <str>, <index> //------------------------------------------------------- -BUILDIN(charat) { +static BUILDIN(charat) +{ const char *str = script_getstr(st,2); int pos = script_getnum(st,3); @@ -16523,7 +16654,7 @@ BUILDIN(charat) { // 1 - string // 2 - other //------------------------------------------------------- -BUILDIN(isstr) +static BUILDIN(isstr) { if (script_isinttype(st, 2)) { script_pushint(st, 0); @@ -16545,7 +16676,8 @@ enum datatype { DATATYPE_LABEL = 1 << 13, }; -BUILDIN(getdatatype) { +static BUILDIN(getdatatype) +{ int type; if (script_hasdata(st, 2)) { @@ -16592,7 +16724,7 @@ BUILDIN(getdatatype) { //======================================================= // chr <int> //------------------------------------------------------- -BUILDIN(chr) +static BUILDIN(chr) { char output[2]; output[0] = script_getnum(st, 2); @@ -16605,7 +16737,7 @@ BUILDIN(chr) //======================================================= // ord <chr> //------------------------------------------------------- -BUILDIN(ord) +static BUILDIN(ord) { const char *chr = script_getstr(st, 2); script_pushint(st, *chr); @@ -16615,7 +16747,7 @@ BUILDIN(ord) //======================================================= // setchar <string>, <char>, <index> //------------------------------------------------------- -BUILDIN(setchar) +static BUILDIN(setchar) { const char *str = script_getstr(st,2); const char *c = script_getstr(st,3); @@ -16632,7 +16764,7 @@ BUILDIN(setchar) //======================================================= // insertchar <string>, <char>, <index> //------------------------------------------------------- -BUILDIN(insertchar) +static BUILDIN(insertchar) { const char *str = script_getstr(st,2); const char *c = script_getstr(st,3); @@ -16659,7 +16791,7 @@ BUILDIN(insertchar) //======================================================= // delchar <string>, <index> //------------------------------------------------------- -BUILDIN(delchar) +static BUILDIN(delchar) { const char *str = script_getstr(st,2); int index = script_getnum(st,3); @@ -16685,7 +16817,7 @@ BUILDIN(delchar) //======================================================= // strtoupper <str> //------------------------------------------------------- -BUILDIN(strtoupper) +static BUILDIN(strtoupper) { const char *str = script_getstr(st,2); char *output = aStrdup(str); @@ -16703,7 +16835,7 @@ BUILDIN(strtoupper) //======================================================= // strtolower <str> //------------------------------------------------------- -BUILDIN(strtolower) +static BUILDIN(strtolower) { const char *str = script_getstr(st,2); char *output = aStrdup(str); @@ -16721,7 +16853,7 @@ BUILDIN(strtolower) //======================================================= // substr <str>, <start>, <end> //------------------------------------------------------- -BUILDIN(substr) +static BUILDIN(substr) { const char *str = script_getstr(st,2); char *output; @@ -16747,7 +16879,7 @@ BUILDIN(substr) // explode <dest_string_array>, <str>, <delimiter> // Note: delimiter is limited to 1 char //------------------------------------------------------- -BUILDIN(explode) +static BUILDIN(explode) { struct script_data* data = script_getdata(st, 2); const char *str = script_getstr(st,3); @@ -16812,7 +16944,7 @@ BUILDIN(explode) // implode <string_array> // implode <string_array>, <glue> //------------------------------------------------------- -BUILDIN(implode) +static BUILDIN(implode) { struct script_data* data = script_getdata(st, 2); const char *name; @@ -16904,7 +17036,7 @@ BUILDIN(implode) // Implements C sprintf, except format %n. The resulting string is // returned, instead of being saved in variable by reference. //------------------------------------------------------- -BUILDIN(sprintf) +static BUILDIN(sprintf) { struct StringBuf buf; StrBuf->Init(&buf); @@ -16925,7 +17057,8 @@ BUILDIN(sprintf) // sscanf(<str>, <format>, ...); // Implements C sscanf. //------------------------------------------------------- -BUILDIN(sscanf) { +static BUILDIN(sscanf) +{ unsigned int argc, arg = 0; struct script_data* data; struct map_session_data* sd = NULL; @@ -17038,7 +17171,8 @@ BUILDIN(sscanf) { // Implements PHP style strpos. Adapted from code from // http://www.daniweb.com/code/snippet313.html, Dave Sinkula //------------------------------------------------------- -BUILDIN(strpos) { +static BUILDIN(strpos) +{ const char *haystack = script_getstr(st,2); const char *needle = script_getstr(st,3); int i; @@ -17082,7 +17216,7 @@ BUILDIN(strpos) { // instances as specified in <count>. By default will be case // sensitive. //--------------------------------------------------------------- -BUILDIN(replacestr) +static BUILDIN(replacestr) { const char *input = script_getstr(st, 2); const char *find = script_getstr(st, 3); @@ -17165,7 +17299,7 @@ BUILDIN(replacestr) // Note: Counts the number of times <search> occurs in // <input>. By default will be case sensitive. //-------------------------------------------------------- -BUILDIN(countstr) +static BUILDIN(countstr) { const char *input = script_getstr(st, 2); const char *find = script_getstr(st, 3); @@ -17222,7 +17356,8 @@ BUILDIN(countstr) /// setnpcdisplay("<npc name>", "<new display name>", <new class id>) -> <int> /// setnpcdisplay("<npc name>", "<new display name>") -> <int> /// setnpcdisplay("<npc name>", <new class id>) -> <int> -BUILDIN(setnpcdisplay) { +static BUILDIN(setnpcdisplay) +{ const char* name; const char* newname = NULL; int class_ = -1, size = -1; @@ -17268,14 +17403,16 @@ BUILDIN(setnpcdisplay) { return true; } -BUILDIN(atoi) { +static BUILDIN(atoi) +{ const char *value; value = script_getstr(st,2); script_pushint(st,atoi(value)); return true; } -BUILDIN(axtoi) { +static BUILDIN(axtoi) +{ const char *hex = script_getstr(st,2); long value = strtol(hex, NULL, 16); #if LONG_MAX > INT_MAX || LONG_MIN < INT_MIN @@ -17285,7 +17422,8 @@ BUILDIN(axtoi) { return true; } -BUILDIN(strtol) { +static BUILDIN(strtol) +{ const char *string = script_getstr(st, 2); int base = script_getnum(st, 3); long value = strtol(string, NULL, base); @@ -17297,7 +17435,7 @@ BUILDIN(strtol) { } // case-insensitive substring search [lordalfa] -BUILDIN(compare) +static BUILDIN(compare) { const char *message; const char *cmpstring; @@ -17307,7 +17445,7 @@ BUILDIN(compare) return true; } -BUILDIN(strcmp) +static BUILDIN(strcmp) { const char *str1 = script_getstr(st,2); const char *str2 = script_getstr(st,3); @@ -17317,7 +17455,7 @@ BUILDIN(strcmp) // List of mathematics commands ---> -BUILDIN(log10) +static BUILDIN(log10) { double i, a; i = script_getnum(st,2); @@ -17326,7 +17464,7 @@ BUILDIN(log10) return true; } -BUILDIN(sqrt) //[zBuffer] +static BUILDIN(sqrt) //[zBuffer] { double i, a; i = script_getnum(st,2); @@ -17339,7 +17477,7 @@ BUILDIN(sqrt) //[zBuffer] return true; } -BUILDIN(pow) //[zBuffer] +static BUILDIN(pow) //[zBuffer] { double i, a, b; a = script_getnum(st,2); @@ -17349,7 +17487,7 @@ BUILDIN(pow) //[zBuffer] return true; } -BUILDIN(distance) //[zBuffer] +static BUILDIN(distance) //[zBuffer] { int x0, y0, x1, y1; @@ -17364,7 +17502,7 @@ BUILDIN(distance) //[zBuffer] // <--- List of mathematics commands -BUILDIN(min) +static BUILDIN(min) { int i, min; @@ -17379,7 +17517,7 @@ BUILDIN(min) return true; } -BUILDIN(max) +static BUILDIN(max) { int i, max; @@ -17394,7 +17532,7 @@ BUILDIN(max) return true; } -BUILDIN(md5) +static BUILDIN(md5) { const char *tmpstr; char *md5str; @@ -17406,7 +17544,7 @@ BUILDIN(md5) return true; } -BUILDIN(swap) +static BUILDIN(swap) { struct map_session_data *sd = NULL; struct script_data *data1, *data2; @@ -17481,7 +17619,7 @@ BUILDIN(swap) // [zBuffer] List of dynamic var commands ---> -BUILDIN(setd) +static BUILDIN(setd) { struct map_session_data *sd = NULL; char varname[100]; @@ -17511,7 +17649,7 @@ BUILDIN(setd) return true; } -int buildin_query_sql_sub(struct script_state *st, struct Sql *handle) +static int buildin_query_sql_sub(struct script_state *st, struct Sql *handle) { int i, j; struct map_session_data *sd = NULL; @@ -17593,11 +17731,13 @@ int buildin_query_sql_sub(struct script_state *st, struct Sql *handle) return true; } -BUILDIN(query_sql) { +static BUILDIN(query_sql) +{ return script->buildin_query_sql_sub(st, map->mysql_handle); } -BUILDIN(query_logsql) { +static BUILDIN(query_logsql) +{ if( !logs->config.sql_logs ) {// logs->mysql_handle == NULL ShowWarning("buildin_query_logsql: SQL logs are disabled, query '%s' will not be executed.\n", script_getstr(st,2)); script_pushint(st,-1); @@ -17607,7 +17747,7 @@ BUILDIN(query_logsql) { } //Allows escaping of a given string. -BUILDIN(escape_sql) +static BUILDIN(escape_sql) { const char *str; char *esc_str; @@ -17621,7 +17761,8 @@ BUILDIN(escape_sql) return true; } -BUILDIN(getd) { +static BUILDIN(getd) +{ char varname[100]; const char *buffer; int elem; @@ -17639,7 +17780,7 @@ BUILDIN(getd) { // <--- [zBuffer] List of dynamic var commands // Pet stat [Lance] -BUILDIN(petstat) +static BUILDIN(petstat) { struct pet_data *pd; int flag = script_getnum(st,2); @@ -17665,7 +17806,7 @@ BUILDIN(petstat) return true; } -BUILDIN(callshop) +static BUILDIN(callshop) { struct npc_data *nd; const char *shopname; @@ -17705,7 +17846,7 @@ BUILDIN(callshop) return true; } -BUILDIN(npcshopitem) +static BUILDIN(npcshopitem) { const char* npcname = script_getstr(st, 2); struct npc_data* nd = npc->name2id(npcname); @@ -17734,7 +17875,7 @@ BUILDIN(npcshopitem) return true; } -BUILDIN(npcshopadditem) +static BUILDIN(npcshopadditem) { const char* npcname = script_getstr(st,2); struct npc_data* nd = npc->name2id(npcname); @@ -17763,7 +17904,7 @@ BUILDIN(npcshopadditem) return true; } -BUILDIN(npcshopdelitem) +static BUILDIN(npcshopdelitem) { const char* npcname = script_getstr(st,2); struct npc_data* nd = npc->name2id(npcname); @@ -17799,7 +17940,8 @@ BUILDIN(npcshopdelitem) } //Sets a script to attach to a shop npc. -BUILDIN(npcshopattach) { +static BUILDIN(npcshopattach) +{ const char* npcname = script_getstr(st,2); struct npc_data* nd = npc->name2id(npcname); int flag = 1; @@ -17831,7 +17973,7 @@ BUILDIN(npcshopattach) { * 1 - Equip script * 2 - Unequip script *------------------------------------------*/ -BUILDIN(setitemscript) +static BUILDIN(setitemscript) { int item_id,n=0; const char *new_bonus_script; @@ -17877,7 +18019,8 @@ BUILDIN(setitemscript) * is updated to the new rate. Rate must be in the range [1:10000] * Returns 1 if succeeded (added/updated a mob drop) *-------------------------------------------------------*/ -BUILDIN(addmonsterdrop) { +static BUILDIN(addmonsterdrop) +{ struct mob_db *monster; int item_id, rate, i, c = MAX_MOB_DROP; @@ -17937,7 +18080,8 @@ BUILDIN(addmonsterdrop) { * * Returns 1 if succeeded (deleted a mob drop) *-------------------------------------------------------*/ -BUILDIN(delmonsterdrop) { +static BUILDIN(delmonsterdrop) +{ struct mob_db *monster; int item_id, i; @@ -17979,7 +18123,7 @@ BUILDIN(delmonsterdrop) { * Name, Level, race, size, etc... * getmonsterinfo(monsterID,queryIndex); *------------------------------------------*/ -BUILDIN(getmonsterinfo) +static BUILDIN(getmonsterinfo) { struct mob_db *monster; int mob_id; @@ -18023,7 +18167,7 @@ BUILDIN(getmonsterinfo) return true; } -BUILDIN(checkvending) // check vending [Nab4] +static BUILDIN(checkvending) // check vending [Nab4] { struct map_session_data *sd = NULL; @@ -18041,7 +18185,8 @@ BUILDIN(checkvending) // check vending [Nab4] } // check chatting [Marka] -BUILDIN(checkchatting) { +static BUILDIN(checkchatting) +{ struct map_session_data *sd = NULL; if (script_hasdata(st,2)) @@ -18057,7 +18202,8 @@ BUILDIN(checkchatting) { return true; } -BUILDIN(checkidle) { +static BUILDIN(checkidle) +{ struct map_session_data *sd = NULL; if (script_hasdata(st, 2)) @@ -18073,7 +18219,7 @@ BUILDIN(checkidle) { return true; } -BUILDIN(searchitem) +static BUILDIN(searchitem) { struct script_data* data = script_getdata(st, 2); const char *itemname = script_getstr(st,3); @@ -18136,7 +18282,7 @@ BUILDIN(searchitem) } // [zBuffer] List of player cont commands ---> -BUILDIN(rid2name) +static BUILDIN(rid2name) { struct block_list *bl = NULL; int rid = script_getnum(st,2); @@ -18160,7 +18306,8 @@ BUILDIN(rid2name) return true; } -BUILDIN(pcblockmove) { +static BUILDIN(pcblockmove) +{ int id, flag; struct map_session_data *sd = NULL; @@ -18183,7 +18330,7 @@ BUILDIN(pcblockmove) { return true; } -BUILDIN(setpcblock) +static BUILDIN(setpcblock) { struct map_session_data *sd = script->rid2sd(st); enum pcblock_action_flag type = script_getnum(st, 2); @@ -18219,7 +18366,7 @@ BUILDIN(setpcblock) return true; } -BUILDIN(checkpcblock) +static BUILDIN(checkpcblock) { struct map_session_data *sd = script->rid2sd(st); int retval = PCBLOCK_NONE; @@ -18257,7 +18404,7 @@ BUILDIN(checkpcblock) return true; } -BUILDIN(pcfollow) +static BUILDIN(pcfollow) { int id, targetid; struct map_session_data *sd = NULL; @@ -18276,7 +18423,7 @@ BUILDIN(pcfollow) return true; } -BUILDIN(pcstopfollow) +static BUILDIN(pcstopfollow) { int id; struct map_session_data *sd = NULL; @@ -18297,7 +18444,8 @@ BUILDIN(pcstopfollow) // [zBuffer] List of mob control commands ---> //## TODO always return if the request/whatever was successfull [FlavioJS] -BUILDIN(getunittype) { +static BUILDIN(getunittype) +{ struct block_list* bl; int value; @@ -18334,7 +18482,7 @@ BUILDIN(getunittype) { * @param5 Value#3 Optional int value to be passed for certain data types. * @return 1 on success, 0 on failure. */ -BUILDIN(setunitdata) +static BUILDIN(setunitdata) { struct block_list *bl = NULL; const char *mapname = NULL, *udtype = NULL; @@ -19451,7 +19599,7 @@ BUILDIN(setunitdata) * @param3 Variable array reference to store data into. (used for UDT_MAPIDXY) * @return 0 on failure, <value> on success */ -BUILDIN(getunitdata) +static BUILDIN(getunitdata) { struct block_list *bl; const char *udtype = NULL; @@ -19875,7 +20023,7 @@ BUILDIN(getunitdata) * @param GUID Game Object Unique ID. * @return boolean or Name of the game object. */ -BUILDIN(getunitname) +static BUILDIN(getunitname) { const struct block_list* bl = NULL; @@ -19902,7 +20050,7 @@ BUILDIN(getunitname) * @param Name as string. * @return boolean. */ -BUILDIN(setunitname) +static BUILDIN(setunitname) { struct block_list* bl = map->id2bl(script_getnum(st, 2)); @@ -19963,7 +20111,8 @@ BUILDIN(setunitname) /// /// unitwalk(<unit_id>,<x>,<y>) -> <bool> /// unitwalk(<unit_id>,<target_id>) -> <bool> -BUILDIN(unitwalk) { +static BUILDIN(unitwalk) +{ struct block_list* bl; bl = map->id2bl(script_getnum(st,2)); @@ -19990,7 +20139,7 @@ BUILDIN(unitwalk) { /// Kills the unit /// /// unitkill <unit_id>; -BUILDIN(unitkill) +static BUILDIN(unitkill) { struct block_list* bl = map->id2bl(script_getnum(st,2)); if( bl != NULL ) @@ -20003,7 +20152,8 @@ BUILDIN(unitkill) /// Returns if it was successfull /// /// unitwarp(<unit_id>,"<map name>",<x>,<y>) -> <bool> -BUILDIN(unitwarp) { +static BUILDIN(unitwarp) +{ int unit_id; int mapid; short x; @@ -20043,7 +20193,8 @@ BUILDIN(unitwarp) { /// /// unitattack(<unit_id>,"<target name>"{,<action type>}) -> <bool> /// unitattack(<unit_id>,<target_id>{,<action type>}) -> <bool> -BUILDIN(unitattack) { +static BUILDIN(unitattack) +{ struct block_list* unit_bl; struct block_list* target_bl = NULL; int actiontype = 0; @@ -20097,7 +20248,8 @@ BUILDIN(unitattack) { /// Makes the unit stop attacking and moving /// /// unitstop <unit_id>; -BUILDIN(unitstop) { +static BUILDIN(unitstop) +{ int unit_id; struct block_list* bl; @@ -20118,7 +20270,8 @@ BUILDIN(unitstop) { /// Makes the unit say the message /// /// unittalk(<unit_id>,"<message>"{, show_name{, <send_target>{, <target_id>}}}); -BUILDIN(unittalk) { +static BUILDIN(unittalk) +{ int unit_id; const char* message; struct block_list *bl, *target_bl = NULL; @@ -20170,7 +20323,8 @@ BUILDIN(unittalk) { /// unitemote <unit_id>,<emotion>; /// /// @see e_* in const.txt -BUILDIN(unitemote) { +static BUILDIN(unitemote) +{ int unit_id; int emotion; struct block_list* bl; @@ -20188,7 +20342,8 @@ BUILDIN(unitemote) { /// /// unitskilluseid <unit_id>,<skill_id>,<skill_lv>{,<target_id>}; /// unitskilluseid <unit_id>,"<skill name>",<skill_lv>{,<target_id>}; -BUILDIN(unitskilluseid) { +static BUILDIN(unitskilluseid) +{ int unit_id; uint16 skill_id; uint16 skill_lv; @@ -20221,7 +20376,8 @@ BUILDIN(unitskilluseid) { /// /// unitskillusepos <unit_id>,<skill_id>,<skill_lv>,<target_x>,<target_y>; /// unitskillusepos <unit_id>,"<skill name>",<skill_lv>,<target_x>,<target_y>; -BUILDIN(unitskillusepos) { +static BUILDIN(unitskillusepos) +{ int unit_id; uint16 skill_id; uint16 skill_lv; @@ -20257,7 +20413,7 @@ BUILDIN(unitskillusepos) { /// Pauses the execution of the script, detaching the player /// /// sleep <mili seconds>; -BUILDIN(sleep) +static BUILDIN(sleep) { int ticks; @@ -20286,7 +20442,8 @@ BUILDIN(sleep) /// Returns if a player is still attached /// /// sleep2(<mili secconds>) -> <bool> -BUILDIN(sleep2) { +static BUILDIN(sleep2) +{ int ticks; ticks = script_getnum(st,2); @@ -20310,7 +20467,7 @@ BUILDIN(sleep2) { /// Awakes all the sleep timers of the target npc /// /// awake "<npc name>"; -BUILDIN(awake) +static BUILDIN(awake) { struct DBIterator *iter; struct script_state *tst; @@ -20353,7 +20510,7 @@ BUILDIN(awake) /// Returns 0 if an error occurs. /// /// getvariableofnpc(<variable>, "<npc name>") -> <reference> -BUILDIN(getvariableofnpc) +static BUILDIN(getvariableofnpc) { struct script_data* data; const char* name; @@ -20395,7 +20552,7 @@ BUILDIN(getvariableofnpc) return true; } -BUILDIN(getvariableofpc) +static BUILDIN(getvariableofpc) { const char* name; struct script_data* data = script_getdata(st, 2); @@ -20449,7 +20606,8 @@ BUILDIN(getvariableofpc) /// warpportal <source x>,<source y>,"<target map>",<target x>,<target y>; /// /// @author blackhole89 -BUILDIN(warpportal) { +static BUILDIN(warpportal) +{ int spx; int spy; unsigned short map_index; @@ -20486,7 +20644,7 @@ BUILDIN(warpportal) { return true; } -BUILDIN(openmail) +static BUILDIN(openmail) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -20497,7 +20655,7 @@ BUILDIN(openmail) return true; } -BUILDIN(openauction) +static BUILDIN(openauction) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -20513,7 +20671,8 @@ BUILDIN(openauction) /// checkcell("<map name>",<x>,<y>,<type>) -> <bool> /// /// @see cell_chk* constants in const.txt for the types -BUILDIN(checkcell) { +static BUILDIN(checkcell) +{ int16 m = map->mapname2mapid(script_getstr(st,2)); int16 x = script_getnum(st,3); int16 y = script_getnum(st,4); @@ -20534,7 +20693,8 @@ BUILDIN(checkcell) { /// setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>; /// /// @see cell_* constants in const.txt for the types -BUILDIN(setcell) { +static BUILDIN(setcell) +{ int16 m = map->mapname2mapid(script_getstr(st,2)); int16 x1 = script_getnum(st,3); int16 y1 = script_getnum(st,4); @@ -20563,7 +20723,7 @@ BUILDIN(setcell) { /*========================================== * Mercenary Commands *------------------------------------------*/ -BUILDIN(mercenary_create) +static BUILDIN(mercenary_create) { struct map_session_data *sd; int class_, contract_time; @@ -20581,7 +20741,8 @@ BUILDIN(mercenary_create) return true; } -BUILDIN(mercenary_heal) { +static BUILDIN(mercenary_heal) +{ struct map_session_data *sd = script->rid2sd(st); int hp, sp; @@ -20594,7 +20755,8 @@ BUILDIN(mercenary_heal) { return true; } -BUILDIN(mercenary_sc_start) { +static BUILDIN(mercenary_sc_start) +{ struct map_session_data *sd = script->rid2sd(st); enum sc_type type; int tick, val1; @@ -20610,7 +20772,8 @@ BUILDIN(mercenary_sc_start) { return true; } -BUILDIN(mercenary_get_calls) { +static BUILDIN(mercenary_get_calls) +{ struct map_session_data *sd = script->rid2sd(st); int guild_id; @@ -20636,7 +20799,8 @@ BUILDIN(mercenary_get_calls) { return true; } -BUILDIN(mercenary_set_calls) { +static BUILDIN(mercenary_set_calls) +{ struct map_session_data *sd = script->rid2sd(st); int guild_id, value, *calls; @@ -20666,7 +20830,8 @@ BUILDIN(mercenary_set_calls) { return true; } -BUILDIN(mercenary_get_faith) { +static BUILDIN(mercenary_get_faith) +{ struct map_session_data *sd = script->rid2sd(st); int guild_id; @@ -20692,7 +20857,8 @@ BUILDIN(mercenary_get_faith) { return true; } -BUILDIN(mercenary_set_faith) { +static BUILDIN(mercenary_set_faith) +{ struct map_session_data *sd = script->rid2sd(st); int guild_id, value, *calls; @@ -20727,7 +20893,7 @@ BUILDIN(mercenary_set_faith) { /*------------------------------------------ * Book Reading *------------------------------------------*/ -BUILDIN(readbook) +static BUILDIN(readbook) { struct map_session_data *sd; int book_id, page; @@ -20746,7 +20912,7 @@ BUILDIN(readbook) * Questlog script commands * ****************************/ -BUILDIN(questinfo) +static BUILDIN(questinfo) { struct npc_data *nd = map->id2nd(st->oid); int quest_id, icon; @@ -20803,7 +20969,7 @@ BUILDIN(questinfo) return true; } -BUILDIN(setquest) +static BUILDIN(setquest) { unsigned short i; int quest_id; @@ -20833,7 +20999,7 @@ BUILDIN(setquest) return true; } -BUILDIN(erasequest) +static BUILDIN(erasequest) { struct map_session_data *sd = script->rid2sd(st); @@ -20856,7 +21022,7 @@ BUILDIN(erasequest) return true; } -BUILDIN(completequest) +static BUILDIN(completequest) { struct map_session_data *sd = script->rid2sd(st); @@ -20879,7 +21045,7 @@ BUILDIN(completequest) return true; } -BUILDIN(changequest) +static BUILDIN(changequest) { struct map_session_data *sd = script->rid2sd(st); @@ -20890,7 +21056,7 @@ BUILDIN(changequest) return true; } -BUILDIN(questactive) +static BUILDIN(questactive) { struct map_session_data *sd = script->rid2sd(st); int qid, i; @@ -20916,7 +21082,7 @@ BUILDIN(questactive) return true; } -BUILDIN(questprogress) +static BUILDIN(questprogress) { struct map_session_data *sd = script->rid2sd(st); enum quest_check_type type = HAVEQUEST; @@ -20944,7 +21110,7 @@ BUILDIN(questprogress) return true; } -BUILDIN(showevent) +static BUILDIN(showevent) { struct map_session_data *sd = script->rid2sd(st); struct npc_data *nd = map->id2nd(st->oid); @@ -20983,7 +21149,8 @@ BUILDIN(showevent) /*========================================== * BattleGround System *------------------------------------------*/ -BUILDIN(waitingroom2bg) { +static BUILDIN(waitingroom2bg) +{ struct npc_data *nd; struct chat_data *cd; const char *map_name, *ev = "", *dev = ""; @@ -21037,7 +21204,8 @@ BUILDIN(waitingroom2bg) { return true; } -BUILDIN(waitingroom2bg_single) { +static BUILDIN(waitingroom2bg_single) +{ const char* map_name; struct npc_data *nd; struct chat_data *cd; @@ -21070,7 +21238,7 @@ BUILDIN(waitingroom2bg_single) { return true; } -BUILDIN(bg_team_setxy) +static BUILDIN(bg_team_setxy) { struct battleground_data *bgd; int bg_id; @@ -21084,7 +21252,7 @@ BUILDIN(bg_team_setxy) return true; } -BUILDIN(bg_warp) +static BUILDIN(bg_warp) { int x, y, map_index, bg_id; const char* map_name; @@ -21099,7 +21267,7 @@ BUILDIN(bg_warp) return true; } -BUILDIN(bg_monster) +static BUILDIN(bg_monster) { int class_ = 0, x = 0, y = 0, bg_id = 0; const char *str, *mapname, *evt=""; @@ -21116,7 +21284,7 @@ BUILDIN(bg_monster) return true; } -BUILDIN(bg_monster_set_team) +static BUILDIN(bg_monster_set_team) { int id = script_getnum(st,2), bg_id = script_getnum(st,3); @@ -21135,7 +21303,7 @@ BUILDIN(bg_monster_set_team) return true; } -BUILDIN(bg_leave) +static BUILDIN(bg_leave) { struct map_session_data *sd = script->rid2sd(st); if( sd == NULL || !sd->bg_id ) @@ -21145,14 +21313,14 @@ BUILDIN(bg_leave) return true; } -BUILDIN(bg_destroy) +static BUILDIN(bg_destroy) { int bg_id = script_getnum(st,2); bg->team_delete(bg_id); return true; } -BUILDIN(bg_getareausers) +static BUILDIN(bg_getareausers) { const char *str; int16 m, x0, y0, x1, y1; @@ -21186,7 +21354,7 @@ BUILDIN(bg_getareausers) return true; } -BUILDIN(bg_updatescore) +static BUILDIN(bg_updatescore) { const char *str; int16 m; @@ -21202,7 +21370,7 @@ BUILDIN(bg_updatescore) return true; } -BUILDIN(bg_get_data) +static BUILDIN(bg_get_data) { struct battleground_data *bgd; int bg_id = script_getnum(st,2), @@ -21229,7 +21397,7 @@ BUILDIN(bg_get_data) * Instancing Script Commands *------------------------------------------*/ -BUILDIN(instance_create) +static BUILDIN(instance_create) { const char *name; int owner_id, res; @@ -21288,7 +21456,7 @@ BUILDIN(instance_create) return true; } -BUILDIN(instance_destroy) +static BUILDIN(instance_destroy) { int instance_id = -1; @@ -21307,7 +21475,7 @@ BUILDIN(instance_destroy) return true; } -BUILDIN(instance_attachmap) +static BUILDIN(instance_attachmap) { const char *map_name = NULL; int16 m; @@ -21331,7 +21499,8 @@ BUILDIN(instance_attachmap) return true; } -BUILDIN(instance_detachmap) { +static BUILDIN(instance_detachmap) +{ const char *str; int16 m; int instance_id = -1; @@ -21352,7 +21521,7 @@ BUILDIN(instance_detachmap) { return true; } -BUILDIN(instance_attach) +static BUILDIN(instance_attach) { int instance_id = script_getnum(st, 2); @@ -21363,12 +21532,13 @@ BUILDIN(instance_attach) return true; } -BUILDIN(instance_id) { +static BUILDIN(instance_id) +{ script_pushint(st, st->instance_id); return true; } -BUILDIN(instance_set_timeout) +static BUILDIN(instance_set_timeout) { int progress_timeout, idle_timeout; int instance_id = -1; @@ -21388,7 +21558,7 @@ BUILDIN(instance_set_timeout) return true; } -BUILDIN(instance_init) +static BUILDIN(instance_init) { int instance_id = script_getnum(st, 2); @@ -21406,7 +21576,7 @@ BUILDIN(instance_init) return true; } -BUILDIN(instance_announce) +static BUILDIN(instance_announce) { int instance_id = script_getnum(st,2); const char *mes = script_getstr(st,3); @@ -21437,7 +21607,7 @@ BUILDIN(instance_announce) return true; } -BUILDIN(instance_npcname) +static BUILDIN(instance_npcname) { const char *str; int instance_id = -1; @@ -21462,7 +21632,7 @@ BUILDIN(instance_npcname) return true; } -BUILDIN(has_instance) +static BUILDIN(has_instance) { struct map_session_data *sd; const char *str; @@ -21555,7 +21725,7 @@ BUILDIN(has_instance) return true; } -int buildin_instance_warpall_sub(struct block_list *bl, va_list ap) +static int buildin_instance_warpall_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL; int map_index = va_arg(ap,int); @@ -21571,7 +21741,7 @@ int buildin_instance_warpall_sub(struct block_list *bl, va_list ap) return 0; } -BUILDIN(instance_warpall) +static BUILDIN(instance_warpall) { int16 m; int instance_id = -1; @@ -21610,7 +21780,7 @@ BUILDIN(instance_warpall) * Example: instance_check_party (getcharid(1){,amount}{,min}{,max}); * Example 2: instance_check_party (getcharid(1),1,1,99); *------------------------------------------*/ -BUILDIN(instance_check_party) +static BUILDIN(instance_check_party) { int amount, min, max, i, party_id, c = 0; struct party_data *p = NULL; @@ -21669,7 +21839,7 @@ BUILDIN(instance_check_party) * Example: instance_check_guild (getcharid(2){,amount}{,min}{,max}); * Example 2: instance_check_guild (getcharid(2),1,1,99); *------------------------------------------*/ -BUILDIN(instance_check_guild) +static BUILDIN(instance_check_guild) { int amount, min, max, i, guild_id, c = 0; struct guild *g = NULL; @@ -21721,7 +21891,7 @@ BUILDIN(instance_check_guild) /*========================================== * Custom Fonts *------------------------------------------*/ -BUILDIN(setfont) +static BUILDIN(setfont) { struct map_session_data *sd = script->rid2sd(st); int font = script_getnum(st,2); @@ -21737,7 +21907,7 @@ BUILDIN(setfont) return true; } -int buildin_mobuseskill_sub(struct block_list *bl, va_list ap) +static int buildin_mobuseskill_sub(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; struct block_list *tbl; @@ -21784,7 +21954,7 @@ int buildin_mobuseskill_sub(struct block_list *bl, va_list ap) /*========================================== * areamobuseskill "Map Name",<x>,<y>,<range>,<Mob ID>,"Skill Name"/<Skill ID>,<Skill Lv>,<Cast Time>,<Cancelable>,<Emotion>,<Target Type>; *------------------------------------------*/ -BUILDIN(areamobuseskill) +static BUILDIN(areamobuseskill) { struct block_list center; int16 m; @@ -21814,7 +21984,7 @@ BUILDIN(areamobuseskill) return true; } -BUILDIN(progressbar) +static BUILDIN(progressbar) { struct map_session_data * sd = script->rid2sd(st); const char * color; @@ -21835,7 +22005,7 @@ BUILDIN(progressbar) clif->progressbar(sd, (unsigned int)strtoul(color, (char **)NULL, 0), second); return true; } -BUILDIN(progressbar_unit) +static BUILDIN(progressbar_unit) { const char *color = script_getstr(st, 2); uint32 second = script_getnum(st, 3); @@ -21858,7 +22028,7 @@ BUILDIN(progressbar_unit) } return true; } -BUILDIN(pushpc) +static BUILDIN(pushpc) { uint8 dir; int cells, dx, dy; @@ -21898,7 +22068,7 @@ BUILDIN(pushpc) /// Invokes buying store preparation window /// buyingstore <slots>; -BUILDIN(buyingstore) +static BUILDIN(buyingstore) { struct map_session_data* sd; @@ -21912,7 +22082,7 @@ BUILDIN(buyingstore) /// Invokes search store info window /// searchstores <uses>,<effect>; -BUILDIN(searchstores) +static BUILDIN(searchstores) { unsigned short effect; unsigned int uses; @@ -21943,7 +22113,7 @@ BUILDIN(searchstores) } /// Displays a number as large digital clock. /// showdigit <value>[,<type>]; -BUILDIN(showdigit) +static BUILDIN(showdigit) { unsigned int type = 0; int value; @@ -21973,7 +22143,7 @@ BUILDIN(showdigit) /** * Rune Knight **/ -BUILDIN(makerune) +static BUILDIN(makerune) { struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -21986,7 +22156,7 @@ BUILDIN(makerune) /** * hascashmount() returns 1 if mounting a cash mount or 0 otherwise **/ -BUILDIN(hascashmount) +static BUILDIN(hascashmount) { struct map_session_data *sd = script->rid2sd(st); @@ -22009,7 +22179,7 @@ BUILDIN(hascashmount) * - Will fail if the player is already riding a standard mount e.g. dragon, peco, wug, mado, etc. * - Will unmount the player is he is already mounting a cash mount **/ -BUILDIN(setcashmount) +static BUILDIN(setcashmount) { struct map_session_data *sd = script->rid2sd(st); @@ -22037,7 +22207,7 @@ BUILDIN(setcashmount) * Retrieves quantity of arguments provided to callfunc/callsub. * getargcount() -> amount of arguments received in a function **/ -BUILDIN(getargcount) +static BUILDIN(getargcount) { struct script_retinfo* ri; @@ -22056,7 +22226,7 @@ BUILDIN(getargcount) /** * getcharip(<account ID>/<character ID>/<character name>) **/ -BUILDIN(getcharip) +static BUILDIN(getcharip) { struct map_session_data* sd = NULL; @@ -22094,7 +22264,7 @@ BUILDIN(getcharip) /** * is_function(<function name>) -> 1 if function exists, 0 otherwise **/ -BUILDIN(is_function) +static BUILDIN(is_function) { const char* str = script_getstr(st,2); @@ -22109,7 +22279,7 @@ BUILDIN(is_function) /** * freeloop(<toggle>) -> toggles this script instance's looping-check ability **/ -BUILDIN(freeloop) +static BUILDIN(freeloop) { if( script_getnum(st,2) ) st->freeloop = 1; @@ -22121,7 +22291,7 @@ BUILDIN(freeloop) return true; } -BUILDIN(sit) +static BUILDIN(sit) { struct map_session_data *sd = NULL; @@ -22142,7 +22312,7 @@ BUILDIN(sit) return true; } -BUILDIN(stand) +static BUILDIN(stand) { struct map_session_data *sd = NULL; @@ -22163,7 +22333,7 @@ BUILDIN(stand) return true; } -BUILDIN(issit) +static BUILDIN(issit) { struct map_session_data *sd = NULL; @@ -22182,7 +22352,7 @@ BUILDIN(issit) return true; } -BUILDIN(add_group_command) +static BUILDIN(add_group_command) { AtCommandInfo *acmd_d; struct atcmd_binding_data *bcmd_d; @@ -22222,7 +22392,7 @@ BUILDIN(add_group_command) /** * @commands (script based) **/ -BUILDIN(bindatcmd) +static BUILDIN(bindatcmd) { const char* atcmd; const char* eventName; @@ -22275,7 +22445,7 @@ BUILDIN(bindatcmd) return true; } -BUILDIN(unbindatcmd) +static BUILDIN(unbindatcmd) { const char* atcmd; int i = 0; @@ -22319,7 +22489,7 @@ BUILDIN(unbindatcmd) return true; } -BUILDIN(useatcmd) +static BUILDIN(useatcmd) { struct map_session_data *sd, *dummy_sd = NULL; int fd; @@ -22357,7 +22527,7 @@ BUILDIN(useatcmd) return true; } -BUILDIN(has_permission) +static BUILDIN(has_permission) { struct map_session_data *sd; enum e_pc_permission perm; @@ -22398,7 +22568,7 @@ BUILDIN(has_permission) return true; } -BUILDIN(can_use_command) +static BUILDIN(can_use_command) { struct map_session_data *sd; const char *cmd = script_getstr(st, 2); @@ -22419,7 +22589,7 @@ BUILDIN(can_use_command) } /* getrandgroupitem <container_item_id>,<quantity> */ -BUILDIN(getrandgroupitem) +static BUILDIN(getrandgroupitem) { struct item_data *data = NULL; struct map_session_data *sd = NULL; @@ -22473,14 +22643,14 @@ BUILDIN(getrandgroupitem) /* cleanmap <map_name>; * cleanarea <map_name>, <x0>, <y0>, <x1>, <y1>; */ -int script_cleanfloor_sub(struct block_list *bl, va_list ap) +static int script_cleanfloor_sub(struct block_list *bl, va_list ap) { map->clearflooritem(bl); return 0; } -BUILDIN(cleanmap) +static BUILDIN(cleanmap) { const char *mapname = script_getstr(st, 2); int16 m = map->mapname2mapid(mapname); @@ -22509,7 +22679,7 @@ BUILDIN(cleanmap) /* Cast a skill on the attached player. * npcskill <skill id>, <skill lvl>, <stat point>, <NPC level>; * npcskill "<skill name>", <skill lvl>, <stat point>, <NPC level>; */ -BUILDIN(npcskill) +static BUILDIN(npcskill) { struct npc_data *nd; uint16 skill_id = script_isstringtype(st, 2) ? skill->name2id(script_getstr(st, 2)) : script_getnum(st, 2); @@ -22555,7 +22725,7 @@ BUILDIN(npcskill) /* Turns a player into a monster and grants SC attribute effect. [malufett/Hercules] * montransform <monster name/id>, <duration>, <sc type>, <val1>, <val2>, <val3>, <val4>; */ -BUILDIN(montransform) +static BUILDIN(montransform) { int tick; enum sc_type type; @@ -22639,7 +22809,7 @@ BUILDIN(montransform) * * @return The queue, or NULL if it doesn't exist. */ -struct script_queue *script_hqueue_get(int idx) +static struct script_queue *script_hqueue_get(int idx) { if (idx < 0 || idx >= VECTOR_LENGTH(script->hq) || !VECTOR_INDEX(script->hq, idx).valid) return NULL; @@ -22651,7 +22821,7 @@ struct script_queue *script_hqueue_get(int idx) * * @return The index of the created queue. */ -int script_hqueue_create(void) +static int script_hqueue_create(void) { struct script_queue *queue = NULL; int i; @@ -22678,7 +22848,7 @@ int script_hqueue_create(void) * .@queue_id = queue(); * @endcode */ -BUILDIN(queue) +static BUILDIN(queue) { script_pushint(st,script->queue_create()); return true; @@ -22693,7 +22863,7 @@ BUILDIN(queue) * .@size = queuesize(<queue id>); * \endcode */ -BUILDIN(queuesize) +static BUILDIN(queuesize) { int idx = script_getnum(st, 2); @@ -22715,7 +22885,7 @@ BUILDIN(queuesize) * @retval false if the queue is invalid or the entry is already in the queue. * @retval true in case of success. */ -bool script_hqueue_add(int idx, int var) +static bool script_hqueue_add(int idx, int var) { int i; struct map_session_data *sd = NULL; @@ -22753,7 +22923,7 @@ bool script_hqueue_add(int idx, int var) * .@size = queuesize(.@queue_id); * @endcode */ -BUILDIN(queueadd) +static BUILDIN(queueadd) { int idx = script_getnum(st, 2); int var = script_getnum(st, 3); @@ -22774,7 +22944,7 @@ BUILDIN(queueadd) * @retval true if the entry was removed. * @retval false if the entry wasn't in queue. */ -bool script_hqueue_remove(int idx, int var) +static bool script_hqueue_remove(int idx, int var) { int i; struct map_session_data *sd = NULL; @@ -22811,7 +22981,7 @@ bool script_hqueue_remove(int idx, int var) * queueremove(.@queue_id, .@value); * @endcode */ -BUILDIN(queueremove) +static BUILDIN(queueremove) { int idx = script_getnum(st, 2); int var = script_getnum(st, 3); @@ -22843,7 +23013,7 @@ BUILDIN(queueremove) * queueopt(.@queue_id, optionType{, <event label>}); * @endcode */ -BUILDIN(queueopt) +static BUILDIN(queueopt) { int idx = script_getnum(st, 2); int var = script_getnum(st, 3); @@ -22893,7 +23063,7 @@ BUILDIN(queueopt) * @retval true if the queue was correctly deleted. * @retval false if the queue didn't exist. */ -bool script_hqueue_del(int idx) +static bool script_hqueue_del(int idx) { if (!script->queue_clear(idx)) return false; @@ -22912,7 +23082,7 @@ bool script_hqueue_del(int idx) * queuedel(.@queue_id); * @endcode */ -BUILDIN(queuedel) +static BUILDIN(queuedel) { int idx = script_getnum(st, 2); @@ -22932,7 +23102,7 @@ BUILDIN(queuedel) * @retval true if the queue was correctly cleared. * @retval false if the queue didn't exist. */ -bool script_hqueue_clear(int idx) +static bool script_hqueue_clear(int idx) { struct script_queue *queue = NULL; @@ -22969,7 +23139,7 @@ bool script_hqueue_clear(int idx) * .@id = queueiterator(.@queue_id); * @endcode */ -BUILDIN(queueiterator) +static BUILDIN(queueiterator) { int qid = script_getnum(st, 2); struct script_queue *queue = NULL; @@ -23012,7 +23182,7 @@ BUILDIN(queueiterator) * } * @endcode */ -BUILDIN(qiget) +static BUILDIN(qiget) { int idx = script_getnum(st, 2); struct script_queue_iterator *it = NULL; @@ -23046,7 +23216,7 @@ BUILDIN(qiget) * } * @endcode */ -BUILDIN(qicheck) +static BUILDIN(qicheck) { int idx = script_getnum(st, 2); struct script_queue_iterator *it = NULL; @@ -23077,7 +23247,7 @@ BUILDIN(qicheck) * qiclear(.@iter); * @endcode */ -BUILDIN(qiclear) +static BUILDIN(qiclear) { int idx = script_getnum(st, 2); struct script_queue_iterator *it = NULL; @@ -23102,7 +23272,8 @@ BUILDIN(qiclear) * packageitem({<optional container_item_id>}) * when no item id is provided it tries to assume it comes from the current item id being processed (if any) **/ -BUILDIN(packageitem) { +static BUILDIN(packageitem) +{ struct item_data *data = NULL; struct map_session_data *sd = NULL; int nameid; @@ -23136,7 +23307,8 @@ BUILDIN(packageitem) { /* New Battlegrounds Stuff */ /* bg_team_create(map_name,respawn_x,respawn_y) */ /* returns created team id or -1 when fails */ -BUILDIN(bg_create_team) { +static BUILDIN(bg_create_team) +{ const char *map_name, *ev = "", *dev = "";//ev and dev will be dropped. int x, y, map_index = 0, bg_id; @@ -23163,7 +23335,8 @@ BUILDIN(bg_create_team) { /* bg_join_team(team_id{,optional account id}) */ /* when account id is not present it tries to autodetect from the attached player (if any) */ /* returns 0 when successful, 1 otherwise */ -BUILDIN(bg_join_team) { +static BUILDIN(bg_join_team) +{ struct map_session_data *sd; int team_id = script_getnum(st, 2); @@ -23189,7 +23362,7 @@ BUILDIN(bg_join_team) { * 3 - Party Bound * 4 - Character Bound *------------------------------------------*/ -BUILDIN(countbound) +static BUILDIN(countbound) { int i, type, j=0, k=0; struct map_session_data *sd = script->rid2sd(st); @@ -23224,7 +23397,7 @@ BUILDIN(countbound) * 3 - Party Bound * 4 - Character Bound *------------------------------------------*/ -BUILDIN(checkbound) +static BUILDIN(checkbound) { int i, nameid = script_getnum(st,2); int bound_type = 0; @@ -23265,7 +23438,7 @@ BUILDIN(checkbound) /* bg_match_over( arena_name {, optional canceled } ) */ /* returns 0 when successful, 1 otherwise */ -BUILDIN(bg_match_over) +static BUILDIN(bg_match_over) { bool canceled = script_hasdata(st,3) ? true : false; struct bg_arena *arena = bg->name2arena(script_getstr(st, 2)); @@ -23279,7 +23452,7 @@ BUILDIN(bg_match_over) return true; } -BUILDIN(instance_mapname) +static BUILDIN(instance_mapname) { const char *map_name; int m; @@ -23304,7 +23477,7 @@ BUILDIN(instance_mapname) /* modify an instances' reload-spawn point */ /* instance_set_respawn <map_name>,<x>,<y>{,<instance_id>} */ /* returns 1 when successful, 0 otherwise. */ -BUILDIN(instance_set_respawn) +static BUILDIN(instance_set_respawn) { const char *map_name; short instance_id = -1; @@ -23352,7 +23525,7 @@ BUILDIN(instance_set_respawn) * * @return 1 on success, 0 otherwise. **/ -BUILDIN(openshop) +static BUILDIN(openshop) { struct npc_data *nd; struct map_session_data *sd; @@ -23389,7 +23562,7 @@ BUILDIN(openshop) * adds <Item_ID> (or modifies if present) to shop * if price not provided (or -1) uses the item's value_sell **/ -BUILDIN(sellitem) +static BUILDIN(sellitem) { struct npc_data *nd; struct item_data *it; @@ -23465,7 +23638,7 @@ BUILDIN(sellitem) * * @return 1 on success, 0 otherwise **/ -BUILDIN(stopselling) +static BUILDIN(stopselling) { struct npc_data *nd; int i, id = script_getnum(st,2); @@ -23516,7 +23689,7 @@ BUILDIN(stopselling) * updates currently-attached player shop currency **/ /* setcurrency(<Val1>,{<Val2>}) */ -BUILDIN(setcurrency) +static BUILDIN(setcurrency) { int val1 = script_getnum(st,2), val2 = script_hasdata(st, 3) ? script_getnum(st,3) : 0; @@ -23540,7 +23713,7 @@ BUILDIN(setcurrency) * check enum npc_shop_types for list * cleans shop list on use **/ -BUILDIN(tradertype) +static BUILDIN(tradertype) { int type = script_getnum(st, 2); struct npc_data *nd; @@ -23583,7 +23756,7 @@ BUILDIN(tradertype) * * signs the transaction can proceed **/ -BUILDIN(purchaseok) +static BUILDIN(purchaseok) { struct npc_data *nd; @@ -23602,7 +23775,7 @@ BUILDIN(purchaseok) * * @return number of available items in the script's attached shop **/ -BUILDIN(shopcount) +static BUILDIN(shopcount) { struct npc_data *nd; int id = script_getnum(st, 2); @@ -23640,7 +23813,7 @@ BUILDIN(shopcount) * Sends a message through the specified chat channel. * */ -BUILDIN(channelmes) +static BUILDIN(channelmes) { struct map_session_data *sd = map->id2sd(st->rid); const char *channelname = script_getstr(st, 2); @@ -23657,7 +23830,7 @@ BUILDIN(channelmes) return true; } -BUILDIN(addchannelhandler) +static BUILDIN(addchannelhandler) { int i; struct map_session_data *sd = map->id2sd(st->rid); @@ -23683,7 +23856,7 @@ BUILDIN(addchannelhandler) return true; } -BUILDIN(removechannelhandler) +static BUILDIN(removechannelhandler) { int i; struct map_session_data *sd = map->id2sd(st->rid); @@ -23709,10 +23882,10 @@ BUILDIN(removechannelhandler) } /** By Cydh -Display script message -showscript "<message>"{,<GID>}; -*/ -BUILDIN(showscript) + * Display script message + * showscript "<message>"{, <GID>}; + */ +static BUILDIN(showscript) { struct block_list *bl = NULL; const char *msg = script_getstr(st, 2); @@ -23739,7 +23912,7 @@ BUILDIN(showscript) return true; } -BUILDIN(mergeitem) +static BUILDIN(mergeitem) { struct map_session_data *sd = script->rid2sd(st); @@ -23753,7 +23926,7 @@ BUILDIN(mergeitem) // getcalendartime(<day of month>, <day of week>{, <hour>{, <minute>}}); // Returns the UNIX Timestamp of next ocurrency of given time -BUILDIN(getcalendartime) +static BUILDIN(getcalendartime) { struct tm info = { 0 }; int day_of_month = script_hasdata(st, 4) ? script_getnum(st, 4) : -1; @@ -23846,7 +24019,7 @@ BUILDIN(getcalendartime) } /** place holder for the translation macro **/ -BUILDIN(_) +static BUILDIN(_) { return true; } @@ -23865,7 +24038,7 @@ enum dressroom_mode { /** * dressroom({<enum dressroom_mode>}); */ -BUILDIN(dressroom) +static BUILDIN(dressroom) { #if PACKETVER >= 20150513 struct map_session_data *sd = script->rid2sd(st); @@ -23901,7 +24074,7 @@ BUILDIN(dressroom) #endif } -BUILDIN(pcre_match) +static BUILDIN(pcre_match) { const char *input = script_getstr(st, 2); const char *regex = script_getstr(st, 3); @@ -23913,7 +24086,7 @@ BUILDIN(pcre_match) /** * navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>}); */ -BUILDIN(navigateto) +static BUILDIN(navigateto) { #if PACKETVER >= 20111010 struct map_session_data* sd; @@ -23952,7 +24125,7 @@ BUILDIN(navigateto) #endif } -bool rodex_sendmail_sub(struct script_state* st, struct rodex_message *msg) +static bool rodex_sendmail_sub(struct script_state *st, struct rodex_message *msg) { const char *sender_name, *title, *body; @@ -23993,7 +24166,7 @@ bool rodex_sendmail_sub(struct script_state* st, struct rodex_message *msg) return true; } -BUILDIN(rodex_sendmail) +static BUILDIN(rodex_sendmail) { struct rodex_message msg = { 0 }; int item_count = 0, i = 0, param = 7; @@ -24049,7 +24222,7 @@ BUILDIN(rodex_sendmail) return true; } -BUILDIN(rodex_sendmail2) +static BUILDIN(rodex_sendmail2) { struct rodex_message msg = { 0 }; int item_count = 0, i = 0, param = 7; @@ -24130,7 +24303,7 @@ BUILDIN(rodex_sendmail2) /** * Clan System: Add a player to a clan */ -BUILDIN(clan_join) +static BUILDIN(clan_join) { struct map_session_data *sd = NULL; int clan_id = script_getnum(st, 2); @@ -24156,7 +24329,7 @@ BUILDIN(clan_join) /** * Clan System: Remove a player from clan */ -BUILDIN(clan_leave) +static BUILDIN(clan_leave) { struct map_session_data *sd = NULL; @@ -24181,7 +24354,7 @@ BUILDIN(clan_leave) /** * Clan System: Show clan emblem next to npc name */ -BUILDIN(clan_master) +static BUILDIN(clan_master) { struct npc_data *nd = map->id2nd(st->oid); int clan_id = script_getnum(st, 2); @@ -24206,7 +24379,7 @@ BUILDIN(clan_master) return true; } -BUILDIN(airship_respond) +static BUILDIN(airship_respond) { struct map_session_data *sd = map->id2sd(st->rid); int32 flag = script_getnum(st, 2); @@ -24226,7 +24399,7 @@ BUILDIN(airship_respond) /** * hateffect(EffectID, Enable_State) */ -BUILDIN(hateffect) +static BUILDIN(hateffect) { #if PACKETVER >= 20150422 struct map_session_data *sd = script_rid2sd(st); @@ -24259,7 +24432,7 @@ BUILDIN(hateffect) return true; } -BUILDIN(openstylist) +static BUILDIN(openstylist) { struct map_session_data *sd = script_rid2sd(st); @@ -24280,7 +24453,7 @@ BUILDIN(openstylist) * (i.e. a plugin overriding a built-in function) * @return Whether the function was successfully added. */ -bool script_add_builtin(const struct script_function *buildin, bool override) +static bool script_add_builtin(const struct script_function *buildin, bool override) { int n = 0, offset = 0; size_t slen; @@ -24362,7 +24535,7 @@ bool script_add_builtin(const struct script_function *buildin, bool override) return true; } -bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated) +static bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated) { struct script_function buildin; buildin.name = name; @@ -24372,7 +24545,7 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st) return script->add_builtin(&buildin, true); } -void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1))); +static void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1))); /** * Run use script for item. @@ -24381,7 +24554,7 @@ void script_run_use_script(struct map_session_data *sd, struct item_data *data, * @param n item index in inventory. Must be correct and checked before. * @param oid npc id. Can be also 0 or fake npc id. */ -void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) +static void script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) { nullpo_retv(data); script->current_item_id = data->nameid; @@ -24389,7 +24562,7 @@ void script_run_use_script(struct map_session_data *sd, struct item_data *data, script->current_item_id = 0; } -void script_run_item_equip_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1, 2))); +static void script_run_item_equip_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1, 2))); /** * Run item equip script for item. @@ -24398,14 +24571,14 @@ void script_run_item_equip_script(struct map_session_data *sd, struct item_data * @param data equipped item data. Must be correct and checked before. * @param oid npc id. Can be also 0 or fake npc id. */ -void script_run_item_equip_script(struct map_session_data *sd, struct item_data *data, int oid) +static void script_run_item_equip_script(struct map_session_data *sd, struct item_data *data, int oid) { script->current_item_id = data->nameid; script->run(data->equip_script, 0, sd->bl.id, oid); script->current_item_id = 0; } -void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1, 2))); +static void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) __attribute__((nonnull (1, 2))); /** * Run item unequip script for item. @@ -24414,7 +24587,7 @@ void script_run_item_unequip_script(struct map_session_data *sd, struct item_dat * @param data unequipped item data. Must be correct and checked before. * @param oid npc id. Can be also 0 or fake npc id. */ -void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) +static void script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) { script->current_item_id = data->nameid; script->run(data->unequip_script, 0, sd->bl.id, oid); @@ -24425,7 +24598,8 @@ void script_run_item_unequip_script(struct map_session_data *sd, struct item_dat #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args, false } #define BUILDIN_DEF_DEPRECATED(x,args) { buildin_ ## x , #x , args, true } #define BUILDIN_DEF2_DEPRECATED(x,x2,args) { buildin_ ## x , x2 , args, true } -void script_parse_builtin(void) { +static void script_parse_builtin(void) +{ struct script_function BUILDIN[] = { /* Commands for internal use by the script engine */ BUILDIN_DEF(__jump_zero,"il"), @@ -25006,7 +25180,7 @@ void script_parse_builtin(void) { #undef BUILDIN_DEF #undef BUILDIN_DEF2 -void script_label_add(int key, int pos) +static void script_label_add(int key, int pos) { int idx = script->label_count; @@ -25023,7 +25197,7 @@ void script_label_add(int key, int pos) /** * Sets source-end constants for scripts to play with **/ -void script_hardcoded_constants(void) +static void script_hardcoded_constants(void) { script->constdb_comment("Boolean"); script->set_constant("true", 1, false, false); @@ -25427,7 +25601,7 @@ void script_hardcoded_constants(void) /** * a mapindex_name2id wrapper meant to help with invalid name handling **/ -unsigned short script_mapindexname2id (struct script_state *st, const char* name) +static unsigned short script_mapindexname2id(struct script_state *st, const char *name) { unsigned short index; diff --git a/src/map/searchstore.c b/src/map/searchstore.c index c80f2f575..2243ffe04 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -31,7 +31,7 @@ #include "common/showmsg.h" // ShowError, ShowWarning #include "common/strlib.h" // safestrncpy -struct searchstore_interface searchstore_s; +static struct searchstore_interface searchstore_s; struct searchstore_interface *searchstore; /// retrieves search function by type @@ -55,7 +55,7 @@ static inline searchstore_searchall_t searchstore_getsearchallfunc(unsigned char } /// checks if the player has a store by type -static inline bool searchstore_hasstore(struct map_session_data* sd, unsigned char type) +static inline bool searchstore_hasstore(struct map_session_data *sd, unsigned char type) { nullpo_retr(false, sd); switch( type ) { @@ -66,7 +66,7 @@ static inline bool searchstore_hasstore(struct map_session_data* sd, unsigned ch } /// returns player's store id by type -static inline unsigned int searchstore_getstoreid(struct map_session_data* sd, unsigned char type) +static inline unsigned int searchstore_getstoreid(struct map_session_data *sd, unsigned char type) { nullpo_retr(false, sd); switch( type ) { @@ -76,7 +76,7 @@ static inline unsigned int searchstore_getstoreid(struct map_session_data* sd, u return 0; } -bool searchstore_open(struct map_session_data* sd, unsigned int uses, unsigned short effect) +static bool searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) { nullpo_retr(false, sd); if( !battle_config.feature_search_stores || sd->searchstore.open ) { @@ -96,7 +96,7 @@ bool searchstore_open(struct map_session_data* sd, unsigned int uses, unsigned s return true; } -void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned int min_price, unsigned int max_price, const unsigned short* itemlist, unsigned int item_count, const unsigned short* cardlist, unsigned int card_count) +static void searchstore_query(struct map_session_data *sd, unsigned char type, unsigned int min_price, unsigned int max_price, const unsigned short *itemlist, unsigned int item_count, const unsigned short *cardlist, unsigned int card_count) { unsigned int i; struct map_session_data* pl_sd; @@ -209,7 +209,7 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned } /// checks whether or not more results are available for the client -bool searchstore_querynext(struct map_session_data* sd) +static bool searchstore_querynext(struct map_session_data *sd) { nullpo_retr(false, sd); if( sd->searchstore.count && ( sd->searchstore.count-1 )/SEARCHSTORE_RESULTS_PER_PAGE < sd->searchstore.pages ) { @@ -219,7 +219,7 @@ bool searchstore_querynext(struct map_session_data* sd) return false; } -void searchstore_next(struct map_session_data* sd) +static void searchstore_next(struct map_session_data *sd) { nullpo_retv(sd); if( !battle_config.feature_search_stores || !sd->searchstore.open || sd->searchstore.count <= sd->searchstore.pages*SEARCHSTORE_RESULTS_PER_PAGE ) @@ -234,7 +234,7 @@ void searchstore_next(struct map_session_data* sd) sd->searchstore.pages++; } -void searchstore_clear(struct map_session_data* sd) +static void searchstore_clear(struct map_session_data *sd) { nullpo_retv(sd); searchstore->clearremote(sd); @@ -248,7 +248,7 @@ void searchstore_clear(struct map_session_data* sd) sd->searchstore.pages = 0; } -void searchstore_close(struct map_session_data* sd) +static void searchstore_close(struct map_session_data *sd) { nullpo_retv(sd); if( sd->searchstore.open ) { @@ -259,7 +259,7 @@ void searchstore_close(struct map_session_data* sd) } } -void searchstore_click(struct map_session_data* sd, int account_id, int store_id, unsigned short nameid) +static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, unsigned short nameid) { unsigned int i; struct map_session_data* pl_sd; @@ -327,20 +327,21 @@ void searchstore_click(struct map_session_data* sd, int account_id, int store_id } /// checks whether or not sd has opened account_id's shop remotely -bool searchstore_queryremote(struct map_session_data* sd, int account_id) +static bool searchstore_queryremote(struct map_session_data *sd, int account_id) { nullpo_retr(false, sd); return (bool)( sd->searchstore.open && sd->searchstore.count && sd->searchstore.remote_id == account_id ); } /// removes range-check bypassing for remotely opened stores -void searchstore_clearremote(struct map_session_data* sd) { +static void searchstore_clearremote(struct map_session_data *sd) +{ nullpo_retv(sd); sd->searchstore.remote_id = 0; } /// receives results from a store-specific callback -bool searchstore_result(struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine, const struct item_option *option) +static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short *card, unsigned char refine, const struct item_option *option) { struct s_search_store_info_item* ssitem; @@ -365,7 +366,7 @@ bool searchstore_result(struct map_session_data* sd, unsigned int store_id, int return true; } -void searchstore_defaults (void) +void searchstore_defaults(void) { searchstore = &searchstore_s; diff --git a/src/map/skill.c b/src/map/skill.c index b03b49bb6..3660cb0d0 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -80,13 +80,13 @@ #error GD_SKILLRANGEMAX is greater than 999 #endif -struct skill_interface skill_s; +static struct skill_interface skill_s; struct s_skill_dbs skilldbs; struct skill_interface *skill; //Since only mob-casted splash skills can hit ice-walls -int skill_splash_target(struct block_list* bl) +static int skill_splash_target(struct block_list *bl) { nullpo_retr(BL_CHAR, bl); #ifndef RENEWAL @@ -97,7 +97,7 @@ int skill_splash_target(struct block_list* bl) } /// Returns the id of the skill, or 0 if not found. -int skill_name2id(const char* name) +static int skill_name2id(const char *name) { if( name == NULL ) return 0; @@ -107,7 +107,7 @@ int skill_name2id(const char* name) /// Maps skill ids to skill db offsets. /// Returns the skill's array index, or 0 (Unknown Skill). -int skill_get_index(int skill_id) +static int skill_get_index(int skill_id) { // avoid ranges reserved for mapping guild/homun/mercenary skills if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) @@ -146,12 +146,12 @@ int skill_get_index(int skill_id) return skill_id; } -const char *skill_get_name(int skill_id) +static const char *skill_get_name(int skill_id) { return skill->dbs->db[skill->get_index(skill_id)].name; } -const char *skill_get_desc(int skill_id) +static const char *skill_get_desc(int skill_id) { return skill->dbs->db[skill->get_index(skill_id)].desc; } @@ -161,7 +161,7 @@ const char *skill_get_desc(int skill_id) // Skill DB -int skill_get_hit(int skill_id) +static int skill_get_hit(int skill_id) { int idx; if (skill_id == 0) @@ -171,7 +171,7 @@ int skill_get_hit(int skill_id) return skill->dbs->db[idx].hit; } -int skill_get_inf(int skill_id) +static int skill_get_inf(int skill_id) { int idx; if (skill_id == 0) @@ -181,7 +181,7 @@ int skill_get_inf(int skill_id) return skill->dbs->db[idx].inf; } -int skill_get_ele(int skill_id, int skill_lv) +static int skill_get_ele(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -192,7 +192,7 @@ int skill_get_ele(int skill_id, int skill_lv) return skill->dbs->db[idx].element[skill_get_lvl_idx(skill_lv)]; } -int skill_get_nk(int skill_id) +static int skill_get_nk(int skill_id) { int idx; if (skill_id == 0) @@ -202,7 +202,7 @@ int skill_get_nk(int skill_id) return skill->dbs->db[idx].nk; } -int skill_get_max(int skill_id) +static int skill_get_max(int skill_id) { int idx; if (skill_id == 0) @@ -212,7 +212,7 @@ int skill_get_max(int skill_id) return skill->dbs->db[idx].max; } -int skill_get_range(int skill_id, int skill_lv) +static int skill_get_range(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -227,7 +227,7 @@ int skill_get_range(int skill_id, int skill_lv) return skill->dbs->db[idx].range[skill_get_lvl_idx(skill_lv)]; } -int skill_get_splash(int skill_id, int skill_lv) +static int skill_get_splash(int skill_id, int skill_lv) { int idx, val; if (skill_id == 0) @@ -245,7 +245,7 @@ int skill_get_splash(int skill_id, int skill_lv) return val; } -int skill_get_hp(int skill_id, int skill_lv) +static int skill_get_hp(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -260,7 +260,7 @@ int skill_get_hp(int skill_id, int skill_lv) return skill->dbs->db[idx].hp[skill_get_lvl_idx(skill_lv)]; } -int skill_get_sp(int skill_id, int skill_lv) +static int skill_get_sp(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -275,7 +275,7 @@ int skill_get_sp(int skill_id, int skill_lv) return skill->dbs->db[idx].sp[skill_get_lvl_idx(skill_lv)]; } -int skill_get_hp_rate(int skill_id, int skill_lv) +static int skill_get_hp_rate(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -290,7 +290,7 @@ int skill_get_hp_rate(int skill_id, int skill_lv) return skill->dbs->db[idx].hp_rate[skill_get_lvl_idx(skill_lv)]; } -int skill_get_sp_rate(int skill_id, int skill_lv) +static int skill_get_sp_rate(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -305,7 +305,7 @@ int skill_get_sp_rate(int skill_id, int skill_lv) return skill->dbs->db[idx].sp_rate[skill_get_lvl_idx(skill_lv)]; } -int skill_get_state(int skill_id) +static int skill_get_state(int skill_id) { int idx; if (skill_id == 0) @@ -315,7 +315,7 @@ int skill_get_state(int skill_id) return skill->dbs->db[idx].state; } -int skill_get_spiritball(int skill_id, int skill_lv) +static int skill_get_spiritball(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -330,7 +330,7 @@ int skill_get_spiritball(int skill_id, int skill_lv) return skill->dbs->db[idx].spiritball[skill_get_lvl_idx(skill_lv)]; } -int skill_get_itemid(int skill_id, int item_idx) +static int skill_get_itemid(int skill_id, int item_idx) { int idx; if (skill_id == 0) @@ -341,7 +341,7 @@ int skill_get_itemid(int skill_id, int item_idx) return skill->dbs->db[idx].itemid[item_idx]; } -int skill_get_itemqty(int skill_id, int item_idx) +static int skill_get_itemqty(int skill_id, int item_idx) { int idx; if (skill_id == 0) @@ -352,7 +352,7 @@ int skill_get_itemqty(int skill_id, int item_idx) return skill->dbs->db[idx].amount[item_idx]; } -int skill_get_zeny(int skill_id, int skill_lv) +static int skill_get_zeny(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -367,7 +367,7 @@ int skill_get_zeny(int skill_id, int skill_lv) return skill->dbs->db[idx].zeny[skill_get_lvl_idx(skill_lv)]; } -int skill_get_num(int skill_id, int skill_lv) +static int skill_get_num(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -382,7 +382,7 @@ int skill_get_num(int skill_id, int skill_lv) return skill->dbs->db[idx].num[skill_get_lvl_idx(skill_lv)]; } -int skill_get_cast(int skill_id, int skill_lv) +static int skill_get_cast(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -397,7 +397,7 @@ int skill_get_cast(int skill_id, int skill_lv) return skill->dbs->db[idx].cast[skill_get_lvl_idx(skill_lv)]; } -int skill_get_delay(int skill_id, int skill_lv) +static int skill_get_delay(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -412,7 +412,7 @@ int skill_get_delay(int skill_id, int skill_lv) return skill->dbs->db[idx].delay[skill_get_lvl_idx(skill_lv)]; } -int skill_get_walkdelay(int skill_id, int skill_lv) +static int skill_get_walkdelay(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -427,7 +427,7 @@ int skill_get_walkdelay(int skill_id, int skill_lv) return skill->dbs->db[idx].walkdelay[skill_get_lvl_idx(skill_lv)]; } -int skill_get_time(int skill_id, int skill_lv) +static int skill_get_time(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -442,7 +442,7 @@ int skill_get_time(int skill_id, int skill_lv) return skill->dbs->db[idx].upkeep_time[skill_get_lvl_idx(skill_lv)]; } -int skill_get_time2(int skill_id, int skill_lv) +static int skill_get_time2(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -457,7 +457,7 @@ int skill_get_time2(int skill_id, int skill_lv) return skill->dbs->db[idx].upkeep_time2[skill_get_lvl_idx(skill_lv)]; } -int skill_get_castdef(int skill_id) +static int skill_get_castdef(int skill_id) { int idx; if (skill_id == 0) @@ -467,7 +467,7 @@ int skill_get_castdef(int skill_id) return skill->dbs->db[idx].cast_def_rate; } -int skill_get_weapontype(int skill_id) +static int skill_get_weapontype(int skill_id) { int idx; if (skill_id == 0) @@ -477,7 +477,7 @@ int skill_get_weapontype(int skill_id) return skill->dbs->db[idx].weapon; } -int skill_get_ammotype(int skill_id) +static int skill_get_ammotype(int skill_id) { int idx; if (skill_id == 0) @@ -487,7 +487,7 @@ int skill_get_ammotype(int skill_id) return skill->dbs->db[idx].ammo; } -int skill_get_ammo_qty(int skill_id, int skill_lv) +static int skill_get_ammo_qty(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -502,7 +502,7 @@ int skill_get_ammo_qty(int skill_id, int skill_lv) return skill->dbs->db[idx].ammo_qty[skill_get_lvl_idx(skill_lv)]; } -int skill_get_inf2(int skill_id) +static int skill_get_inf2(int skill_id) { int idx; if (skill_id == 0) @@ -512,7 +512,7 @@ int skill_get_inf2(int skill_id) return skill->dbs->db[idx].inf2; } -int skill_get_castcancel(int skill_id) +static int skill_get_castcancel(int skill_id) { int idx; if (skill_id == 0) @@ -522,7 +522,7 @@ int skill_get_castcancel(int skill_id) return skill->dbs->db[idx].castcancel; } -int skill_get_maxcount(int skill_id, int skill_lv) +static int skill_get_maxcount(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -537,7 +537,7 @@ int skill_get_maxcount(int skill_id, int skill_lv) return skill->dbs->db[idx].maxcount[skill_get_lvl_idx(skill_lv)]; } -int skill_get_blewcount(int skill_id, int skill_lv) +static int skill_get_blewcount(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -552,7 +552,7 @@ int skill_get_blewcount(int skill_id, int skill_lv) return skill->dbs->db[idx].blewcount[skill_get_lvl_idx(skill_lv)]; } -int skill_get_mhp(int skill_id, int skill_lv) +static int skill_get_mhp(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -567,7 +567,7 @@ int skill_get_mhp(int skill_id, int skill_lv) return skill->dbs->db[idx].mhp[skill_get_lvl_idx(skill_lv)]; } -int skill_get_castnodex(int skill_id, int skill_lv) +static int skill_get_castnodex(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -582,7 +582,7 @@ int skill_get_castnodex(int skill_id, int skill_lv) return skill->dbs->db[idx].castnodex[skill_get_lvl_idx(skill_lv)]; } -int skill_get_delaynodex(int skill_id, int skill_lv) +static int skill_get_delaynodex(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -597,7 +597,7 @@ int skill_get_delaynodex(int skill_id, int skill_lv) return skill->dbs->db[idx].delaynodex[skill_get_lvl_idx(skill_lv)]; } -int skill_get_type(int skill_id) +static int skill_get_type(int skill_id) { int idx; if (skill_id == 0) @@ -607,7 +607,7 @@ int skill_get_type(int skill_id) return skill->dbs->db[idx].skill_type; } -int skill_get_unit_id(int skill_id, int flag) +static int skill_get_unit_id(int skill_id, int flag) { int idx; if (skill_id == 0) @@ -618,7 +618,7 @@ int skill_get_unit_id(int skill_id, int flag) return skill->dbs->db[idx].unit_id[flag]; } -int skill_get_unit_interval(int skill_id) +static int skill_get_unit_interval(int skill_id) { int idx; if (skill_id == 0) @@ -628,7 +628,7 @@ int skill_get_unit_interval(int skill_id) return skill->dbs->db[idx].unit_interval; } -int skill_get_unit_range(int skill_id, int skill_lv) +static int skill_get_unit_range(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -643,7 +643,7 @@ int skill_get_unit_range(int skill_id, int skill_lv) return skill->dbs->db[idx].unit_range[skill_get_lvl_idx(skill_lv)]; } -int skill_get_unit_target(int skill_id) +static int skill_get_unit_target(int skill_id) { int idx; if (skill_id == 0) @@ -653,7 +653,7 @@ int skill_get_unit_target(int skill_id) return skill->dbs->db[idx].unit_target & BCT_ALL; } -int skill_get_unit_bl_target(int skill_id) +static int skill_get_unit_bl_target(int skill_id) { int idx; if (skill_id == 0) @@ -663,7 +663,7 @@ int skill_get_unit_bl_target(int skill_id) return skill->dbs->db[idx].unit_target & BL_ALL; } -int skill_get_unit_flag(int skill_id) +static int skill_get_unit_flag(int skill_id) { int idx; if (skill_id == 0) @@ -673,7 +673,7 @@ int skill_get_unit_flag(int skill_id) return skill->dbs->db[idx].unit_flag; } -int skill_get_unit_layout_type(int skill_id, int skill_lv) +static int skill_get_unit_layout_type(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -688,7 +688,7 @@ int skill_get_unit_layout_type(int skill_id, int skill_lv) return skill->dbs->db[idx].unit_layout_type[skill_get_lvl_idx(skill_lv)]; } -int skill_get_cooldown(int skill_id, int skill_lv) +static int skill_get_cooldown(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -703,7 +703,7 @@ int skill_get_cooldown(int skill_id, int skill_lv) return skill->dbs->db[idx].cooldown[skill_get_lvl_idx(skill_lv)]; } -int skill_get_fixed_cast(int skill_id, int skill_lv) +static int skill_get_fixed_cast(int skill_id, int skill_lv) { int idx; if (skill_id == 0) @@ -722,7 +722,7 @@ int skill_get_fixed_cast(int skill_id, int skill_lv) #endif } -int skill_tree_get_max(int skill_id, int class) +static int skill_tree_get_max(int skill_id, int class) { int i; int class_idx = pc->class2idx(class); @@ -734,7 +734,7 @@ int skill_tree_get_max(int skill_id, int class) return skill->get_max(skill_id); } -int skill_get_casttype(int skill_id) +static int skill_get_casttype(int skill_id) { int inf = skill->get_inf(skill_id); if (inf&(INF_GROUND_SKILL)) @@ -751,7 +751,7 @@ int skill_get_casttype(int skill_id) return CAST_DAMAGE; } -int skill_get_casttype2(int index) +static int skill_get_casttype2(int index) { int inf; Assert_retr(CAST_NODAMAGE, index < MAX_SKILL_DB); @@ -771,7 +771,7 @@ int skill_get_casttype2(int index) } //Returns actual skill range taking into account attack range and AC_OWL [Skotlex] -int skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) +static int skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) { int range; struct map_session_data *sd = BL_CAST(BL_PC, bl); @@ -860,7 +860,8 @@ int skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) return range; } -int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal) { +static int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal) +{ int skill2_lv, hp; struct map_session_data *sd = BL_CAST(BL_PC, src); struct map_session_data *tsd = BL_CAST(BL_PC, target); @@ -955,7 +956,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk } // Making plagiarize check its own function [Aru] -int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* bl) +static int can_copy(struct map_session_data *sd, uint16 skill_id, struct block_list *bl) { nullpo_ret(sd); // Never copy NPC/Wedding Skills @@ -992,7 +993,7 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b } // [MouseJstr] - skill ok to cast? and when? -int skillnotok (uint16 skill_id, struct map_session_data *sd) +static int skillnotok(uint16 skill_id, struct map_session_data *sd) { int16 idx,m; nullpo_retr (1, sd); @@ -1113,7 +1114,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) return (map->list[m].flag.noskill); } -int skill_notok_unknown(uint16 skill_id, struct map_session_data *sd) +static int skill_notok_unknown(uint16 skill_id, struct map_session_data *sd) { int16 m; nullpo_retr (1, sd); @@ -1121,7 +1122,7 @@ int skill_notok_unknown(uint16 skill_id, struct map_session_data *sd) return (map->list[m].flag.noskill); } -int skillnotok_hom(uint16 skill_id, struct homun_data *hd) +static int skillnotok_hom(uint16 skill_id, struct homun_data *hd) { uint16 idx = skill->get_index(skill_id); nullpo_retr(1,hd); @@ -1155,14 +1156,14 @@ int skillnotok_hom(uint16 skill_id, struct homun_data *hd) return skill->not_ok(skill_id, hd->master); } -int skillnotok_hom_unknown(uint16 skill_id, struct homun_data *hd) +static int skillnotok_hom_unknown(uint16 skill_id, struct homun_data *hd) { nullpo_retr(1, hd); //Use master's criteria. return skill->not_ok(skill_id, hd->master); } -int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) +static int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) { uint16 idx = skill->get_index(skill_id); nullpo_retr(1,md); @@ -1175,7 +1176,7 @@ int skillnotok_mercenary(uint16 skill_id, struct mercenary_data *md) return skill->not_ok(skill_id, md->master); } -struct s_skill_unit_layout* skill_get_unit_layout(uint16 skill_id, uint16 skill_lv, struct block_list* src, int x, int y) +static struct s_skill_unit_layout *skill_get_unit_layout(uint16 skill_id, uint16 skill_lv, struct block_list *src, int x, int y) { int pos = skill->get_unit_layout_type(skill_id,skill_lv); uint8 dir; @@ -1205,7 +1206,8 @@ struct s_skill_unit_layout* skill_get_unit_layout(uint16 skill_id, uint16 skill_ /*========================================== * *------------------------------------------*/ -int skill_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, int64 tick) { +static int skill_additional_effect(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int dmg_lv, int64 tick) +{ struct map_session_data *sd, *dstsd; struct mob_data *md, *dstmd; struct status_data *sstatus, *tstatus; @@ -2175,10 +2177,12 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 return 0; } -void skill_additional_effect_unknown(struct block_list* src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int *attack_type, int *dmg_lv, int64 *tick) { +static void skill_additional_effect_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int *attack_type, int *dmg_lv, int64 *tick) +{ } -int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, int64 tick) { +static int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint16 skill_id, int64 tick) +{ int temp, skill_lv, i, type, notok; struct block_list *tbl; @@ -2272,7 +2276,8 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1 * type of skills, so not every instance of skill->additional_effect needs a call * to this one. */ -int skill_counter_additional_effect(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int64 tick) { +static int skill_counter_additional_effect(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int attack_type, int64 tick) +{ int rate; struct map_session_data *sd=NULL; struct map_session_data *dstsd=NULL; @@ -2489,7 +2494,8 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b return 0; } -void skill_counter_additional_effect_unknown(struct block_list* src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int *attack_type, int64 *tick) { +static void skill_counter_additional_effect_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int *attack_type, int64 *tick) +{ } /*========================================================================= @@ -2498,7 +2504,7 @@ void skill_counter_additional_effect_unknown(struct block_list* src, struct bloc * - flag is a BCT_ flag to indicate which type of adjustment should be used * (BCT_ENEMY/BCT_PARTY/BCT_SELF) are the valid values. *------------------------------------------------------------------------*/ -int skill_break_equip (struct block_list *bl, unsigned short where, int rate, int flag) +static int skill_break_equip(struct block_list *bl, unsigned short where, int rate, int flag) { const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM}; const enum sc_type scatk[4] = {SC_NOEQUIPWEAPON, SC_NOEQUIPARMOR, SC_NOEQUIPSHIELD, SC_NOEQUIPHELM}; @@ -2588,7 +2594,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in return where; //Return list of pieces broken. } -int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time) +static int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time) { struct status_change *sc; const int pos[5] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM, EQP_ACC}; @@ -2623,7 +2629,7 @@ int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int * if 'flag&0x1', position update packets must not be sent. * if 'flag&0x2', skill blown ignores players' special_state.no_knockback */ -int skill_blown(struct block_list* src, struct block_list* target, int count, int8 dir, int flag) +static int skill_blown(struct block_list *src, struct block_list *target, int count, int8 dir, int flag) { int dx = 0, dy = 0; struct status_change *tsc = status->get_sc(target); @@ -2687,7 +2693,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in 1 - Regular reflection (Maya) 2 - SL_KAITE reflection */ -int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) +static int skill_magic_reflect(struct block_list *src, struct block_list *bl, int type) { struct status_change *sc = status->get_sc(bl); struct map_session_data* sd = BL_CAST(BL_PC, bl); @@ -2736,7 +2742,7 @@ int skill_magic_reflect(struct block_list* src, struct block_list* bl, int type) * client (causes player characters to not scream skill name) * flag&0x4000 - Return 0 if damage was reflected *-------------------------------------------------------------------------*/ -int skill_attack(int attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static int skill_attack(int attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { struct Damage dmg; struct status_data *sstatus, *tstatus; @@ -3432,17 +3438,17 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr return (int)cap_value(damage,INT_MIN,INT_MAX); } -void skill_attack_combo1_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_change_entry *sce, int *combo) +static void skill_attack_combo1_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_change_entry *sce, int *combo) { if (src == dsrc) // Ground skills are exceptions. [Inkfish] status_change_end(src, SC_COMBOATTACK, INVALID_TIMER); } -void skill_attack_combo2_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *combo) +static void skill_attack_combo2_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *combo) { } -void skill_attack_display_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage) +static void skill_attack_display_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage) { nullpo_retv(bl); nullpo_retv(dmg); @@ -3463,18 +3469,18 @@ void skill_attack_display_unknown(int *attack_type, struct block_list* src, stru dmg->dmotion = clif->skill_damage(dsrc, bl, *tick, dmg->amotion, dmg->dmotion, *damage, dmg->div_, *skill_id, (*flag & SD_LEVEL) ? -1 : *skill_lv, *type); } -int skill_attack_copy_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static int skill_attack_copy_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { nullpo_ret(skill_id); return *skill_id; } -int skill_attack_dir_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static int skill_attack_dir_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { return -1; } -void skill_attack_blow_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage, int8 *dir) +static void skill_attack_blow_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, int *type, struct Damage *dmg, int64 *damage, int8 *dir) { nullpo_retv(bl); nullpo_retv(dmg); @@ -3489,7 +3495,7 @@ void skill_attack_blow_unknown(int *attack_type, struct block_list* src, struct } } -void skill_attack_post_unknown(int *attack_type, struct block_list* src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static void skill_attack_post_unknown(int *attack_type, struct block_list *src, struct block_list *dsrc, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { } @@ -3498,7 +3504,7 @@ void skill_attack_post_unknown(int *attack_type, struct block_list* src, struct * Checking bl battle flag and display damage * then call func with source,target,skill_id,skill_lv,tick,flag *------------------------------------------*/ -int skill_area_sub(struct block_list *bl, va_list ap) +static int skill_area_sub(struct block_list *bl, va_list ap) { struct block_list *src; uint16 skill_id,skill_lv; @@ -3528,7 +3534,7 @@ int skill_area_sub(struct block_list *bl, va_list ap) return 0; } -int skill_check_unit_range_sub(struct block_list *bl, va_list ap) +static int skill_check_unit_range_sub(struct block_list *bl, va_list ap) { const struct skill_unit *su = NULL; uint16 skill_id,g_skill_id; @@ -3599,7 +3605,8 @@ int skill_check_unit_range_sub(struct block_list *bl, va_list ap) return 1; } -int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) { +static int skill_check_unit_range(struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) +{ //Non players do not check for the skill's splash-trigger area. int range = bl->type == BL_PC ? skill->get_unit_range(skill_id, skill_lv):0; int layout_type = skill->get_unit_layout_type(skill_id,skill_lv); @@ -3612,7 +3619,8 @@ int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id return map->foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id); } -int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { +static int skill_check_unit_range2_sub(struct block_list *bl, va_list ap) +{ uint16 skill_id; if(bl->prev == NULL) @@ -3631,7 +3639,8 @@ int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) { return 1; } -int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) { +static int skill_check_unit_range2(struct block_list *bl, int x, int y, uint16 skill_id, uint16 skill_lv) +{ int range, type; switch (skill_id) { @@ -3674,7 +3683,8 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i * &1: finished casting the skill (invoke hp/sp/item consumption) * &2: picked menu entry (Warp Portal, Teleport and other menu based skills) *------------------------------------------*/ -int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, int type) { +static int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, int type) +{ struct status_data *st; struct map_session_data *sd = NULL; int i, hp, sp, hp_rate, sp_rate, state, mhp; @@ -3781,14 +3791,16 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, /*========================================== * what the hell it doesn't need to receive this many params, it doesn't do anything ~_~ *------------------------------------------*/ -int skill_area_sub_count(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { +static int skill_area_sub_count(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +{ return 1; } /*========================================== * *------------------------------------------*/ -int skill_timerskill(int tid, int64 tick, int id, intptr_t data) { +static int skill_timerskill(int tid, int64 tick, int id, intptr_t data) +{ struct block_list *src = map->id2bl(id),*target = NULL; struct unit_data *ud = unit->bl2ud(src); struct skill_timerskill *skl; @@ -4021,25 +4033,25 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) { return 0; } -bool skill_timerskill_dead_unknown(struct block_list *src, struct unit_data *ud, struct skill_timerskill *skl) +static bool skill_timerskill_dead_unknown(struct block_list *src, struct unit_data *ud, struct skill_timerskill *skl) { return false; } -void skill_timerskill_target_unknown(int tid, int64 tick, struct block_list *src, struct block_list *target, struct unit_data *ud, struct skill_timerskill *skl) +static void skill_timerskill_target_unknown(int tid, int64 tick, struct block_list *src, struct block_list *target, struct unit_data *ud, struct skill_timerskill *skl) { nullpo_retv(skl); skill->attack(skl->type, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag); } -void skill_timerskill_notarget_unknown(int tid, int64 tick, struct block_list *src, struct unit_data *ud, struct skill_timerskill *skl) +static void skill_timerskill_notarget_unknown(int tid, int64 tick, struct block_list *src, struct unit_data *ud, struct skill_timerskill *skl) { } /*========================================== * *------------------------------------------*/ -int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x,int y, uint16 skill_id, uint16 skill_lv, int type, int flag) +static int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x, int y, uint16 skill_id, uint16 skill_lv, int type, int flag) { int i; struct unit_data *ud; @@ -4069,7 +4081,7 @@ int skill_addtimerskill(struct block_list *src, int64 tick, int target, int x,in /*========================================== * *------------------------------------------*/ -int skill_cleartimerskill (struct block_list *src) +static int skill_cleartimerskill(struct block_list *src) { int i; struct unit_data *ud; @@ -4102,12 +4114,12 @@ int skill_cleartimerskill (struct block_list *src) return 1; } -bool skill_cleartimerskill_exception(int skill_id) +static bool skill_cleartimerskill_exception(int skill_id) { return false; } -int skill_activate_reverberation(struct block_list *bl, va_list ap) +static int skill_activate_reverberation(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; struct skill_unit_group *sg = NULL; @@ -4127,7 +4139,7 @@ int skill_activate_reverberation(struct block_list *bl, va_list ap) return 0; } -int skill_reveal_trap(struct block_list *bl, va_list ap) +static int skill_reveal_trap(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; @@ -4144,7 +4156,7 @@ int skill_reveal_trap(struct block_list *bl, va_list ap) return 0; } -void skill_castend_type(int type, struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static void skill_castend_type(int type, struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { switch (type) { case CAST_GROUND: @@ -4164,7 +4176,7 @@ void skill_castend_type(int type, struct block_list *src, struct block_list *bl, * * *------------------------------------------*/ -int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static int skill_castend_damage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { struct map_session_data *sd = NULL; struct status_data *tstatus; @@ -5506,7 +5518,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 return 0; } -bool skill_castend_damage_id_unknown(struct block_list* src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_data *tstatus, struct status_change *sc) +static bool skill_castend_damage_id_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag, struct status_data *tstatus, struct status_change *sc) { nullpo_retr(true, skill_id); nullpo_retr(true, skill_lv); @@ -5523,7 +5535,7 @@ bool skill_castend_damage_id_unknown(struct block_list* src, struct block_list * /*========================================== * *------------------------------------------*/ -int skill_castend_id(int tid, int64 tick, int id, intptr_t data) +static int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { struct block_list *target, *src; struct map_session_data *sd; @@ -5862,7 +5874,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) return 0; } -bool skill_castend_id_unknown(struct unit_data *ud, struct block_list *src, struct block_list *target) +static bool skill_castend_id_unknown(struct unit_data *ud, struct block_list *src, struct block_list *target) { return false; } @@ -5870,7 +5882,7 @@ bool skill_castend_id_unknown(struct unit_data *ud, struct block_list *src, stru /*========================================== * *------------------------------------------*/ -int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { struct map_session_data *sd, *dstsd; struct mob_data *md, *dstmd; @@ -10592,22 +10604,22 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin return 0; } -bool skill_castend_nodamage_id_dead_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static bool skill_castend_nodamage_id_dead_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { return true; } -bool skill_castend_nodamage_id_undead_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static bool skill_castend_nodamage_id_undead_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { return true; } -bool skill_castend_nodamage_id_mado_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static bool skill_castend_nodamage_id_mado_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { return false; } -bool skill_castend_nodamage_id_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +static bool skill_castend_nodamage_id_unknown(struct block_list *src, struct block_list *bl, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { nullpo_retr(true, skill_id); nullpo_retr(true, skill_lv); @@ -10620,7 +10632,7 @@ bool skill_castend_nodamage_id_unknown(struct block_list *src, struct block_list /*========================================== * *------------------------------------------*/ -int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) +static int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) { struct block_list* src = map->id2bl(id); struct map_session_data *sd; @@ -10781,7 +10793,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) } -int skill_check_npc_chaospanic(struct block_list *bl, va_list args) +static int skill_check_npc_chaospanic(struct block_list *bl, va_list args) { const struct npc_data *nd = NULL; @@ -10796,7 +10808,7 @@ int skill_check_npc_chaospanic(struct block_list *bl, va_list args) } /* skill count without self */ -int skill_count_wos(struct block_list *bl, va_list ap) +static int skill_count_wos(struct block_list *bl, va_list ap) { struct block_list* src = va_arg(ap, struct block_list*); nullpo_retr(1, bl); @@ -10810,7 +10822,7 @@ int skill_count_wos(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *mapname) +static int skill_castend_map(struct map_session_data *sd, uint16 skill_id, const char *mapname) { nullpo_ret(sd); nullpo_ret(mapname); @@ -10950,7 +10962,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char /*========================================== * *------------------------------------------*/ -int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { struct map_session_data* sd; struct status_change* sc; @@ -11735,20 +11747,22 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 0; } -void skill_castend_pos2_effect_unknown(struct block_list* src, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { +static void skill_castend_pos2_effect_unknown(struct block_list *src, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +{ if (skill->get_inf(*skill_id) & INF_SELF_SKILL) clif->skill_nodamage(src, src, *skill_id, *skill_lv, 1); else clif->skill_poseffect(src, *skill_id, *skill_lv, *x, *y, *tick); } -bool skill_castend_pos2_unknown(struct block_list* src, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) { +static bool skill_castend_pos2_unknown(struct block_list *src, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int64 *tick, int *flag) +{ ShowWarning("skill_castend_pos2: Unknown skill used:%d\n", *skill_id); return true; } /// transforms 'target' skill unit into dissonance (if conditions are met) -int skill_dance_overlap_sub(struct block_list *bl, va_list ap) +static int skill_dance_overlap_sub(struct block_list *bl, va_list ap) { struct skill_unit *target = NULL; struct skill_unit *src = va_arg(ap, struct skill_unit*); @@ -11778,7 +11792,7 @@ int skill_dance_overlap_sub(struct block_list *bl, va_list ap) //Does the song/dance overlapping -> dissonance check. [Skotlex] //When flag is 0, this unit is about to be removed, cancel the dissonance effect //When 1, this unit has been positioned, so start the cancel effect. -int skill_dance_overlap(struct skill_unit* su, int flag) +static int skill_dance_overlap(struct skill_unit *su, int flag) { if (!su || !su->group || !(su->group->state.song_dance&0x1)) return 0; @@ -11801,7 +11815,7 @@ int skill_dance_overlap(struct skill_unit* su, int flag) * @param flag 1 Revert * @retval true success **/ -bool skill_dance_switch(struct skill_unit* su, int flag) +static bool skill_dance_switch(struct skill_unit *su, int flag) { static int prevflag = 1; // by default the backup is empty static struct skill_unit_group backup; @@ -11858,7 +11872,7 @@ bool skill_dance_switch(struct skill_unit* su, int flag) * Initializes and sets a ground skill. * flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active) *------------------------------------------*/ -struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) +static struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag) { struct skill_unit_group *group; int i,limit,val1=0,val2=0,val3=0; @@ -12379,11 +12393,11 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ return group; } -void skill_unitsetting1_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *val1, int *val2, int *val3) +static void skill_unitsetting1_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *val1, int *val2, int *val3) { } -void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *unit_flag, int *val1, int *val2, int *val3, struct skill_unit_group *group) +static void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16 *skill_lv, int16 *x, int16 *y, int *flag, int *unit_flag, int *val1, int *val2, int *val3, struct skill_unit_group *group) { nullpo_retv(group); nullpo_retv(val2); @@ -12395,7 +12409,7 @@ void skill_unitsetting2_unknown(struct block_list *src, uint16 *skill_id, uint16 /*========================================== * *------------------------------------------*/ -int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick) +static int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick) { struct skill_unit_group *sg; struct block_list *ss; @@ -12650,14 +12664,14 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick return skill_id; } -void skill_unit_onplace_unknown(struct skill_unit *src, struct block_list *bl, int64 *tick) +static void skill_unit_onplace_unknown(struct skill_unit *src, struct block_list *bl, int64 *tick) { } /*========================================== * *------------------------------------------*/ -int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int64 tick) +static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int64 tick) { struct skill_unit_group *sg; struct block_list *ss; @@ -13455,14 +13469,14 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 return skill_id; } -void skill_unit_onplace_timer_unknown(struct skill_unit *src, struct block_list *bl, int64 *tick) +static void skill_unit_onplace_timer_unknown(struct skill_unit *src, struct block_list *bl, int64 *tick) { } /*========================================== * Triggered when a char steps out of a skill cell *------------------------------------------*/ -int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) +static int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) { struct skill_unit_group *sg; struct status_change *sc; @@ -13528,7 +13542,7 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) /*========================================== * Triggered when a char steps out of a skill group (entirely) [Skotlex] *------------------------------------------*/ -int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) +static int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) { struct status_change *sc; struct status_change_entry *sce; @@ -13643,7 +13657,7 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) * flag&1: Invoke onplace function (otherwise invoke onout) * flag&4: Invoke a onleft call (the unit might be scheduled for deletion) *------------------------------------------*/ -int skill_unit_effect(struct block_list* bl, va_list ap) +static int skill_unit_effect(struct block_list *bl, va_list ap) { struct skill_unit* su = va_arg(ap,struct skill_unit*); struct skill_unit_group* group; @@ -13687,7 +13701,7 @@ int skill_unit_effect(struct block_list* bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick) +static int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 damage, int64 tick) { struct skill_unit_group *sg; @@ -13722,7 +13736,7 @@ int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl, int64 da /*========================================== * *------------------------------------------*/ -int skill_check_condition_char_sub (struct block_list *bl, va_list ap) +static int skill_check_condition_char_sub(struct block_list *bl, va_list ap) { struct map_session_data *tsd = NULL; struct block_list *src = va_arg(ap, struct block_list *); @@ -13808,7 +13822,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) /*========================================== * Checks and stores partners for ensemble skills [Skotlex] *------------------------------------------*/ -int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16* skill_lv, int range, int cast_flag) +static int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16 *skill_lv, int range, int cast_flag) { static int c=0; static int p_sd[2] = { 0, 0 }; @@ -13867,7 +13881,7 @@ int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16* /*========================================== * *------------------------------------------*/ -int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) +static int skill_check_condition_mob_master_sub(struct block_list *bl, va_list ap) { const struct mob_data *md = NULL; int src_id = va_arg(ap, int); @@ -13892,7 +13906,7 @@ int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) * Determines if a given skill should be made to consume ammo * when used by the player. [Skotlex] *------------------------------------------*/ -int skill_isammotype (struct map_session_data *sd, int skill_id) +static int skill_isammotype(struct map_session_data *sd, int skill_id) { nullpo_ret(sd); return ( @@ -13908,7 +13922,7 @@ int skill_isammotype (struct map_session_data *sd, int skill_id) /** * Checks whether a skill can be used in combos or not **/ -bool skill_is_combo( int skill_id ) +static bool skill_is_combo(int skill_id) { switch( skill_id ) { @@ -13934,7 +13948,7 @@ bool skill_is_combo( int skill_id ) return false; } -int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) +static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct status_data *st; struct status_change *sc; @@ -14903,27 +14917,27 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id return 1; } -int skill_check_condition_castbegin_off_unknown(struct status_change *sc, uint16 *skill_id) +static int skill_check_condition_castbegin_off_unknown(struct status_change *sc, uint16 *skill_id) { return -1; } -int skill_check_condition_castbegin_mount_unknown(struct status_change *sc, uint16 *skill_id) +static int skill_check_condition_castbegin_mount_unknown(struct status_change *sc, uint16 *skill_id) { return 0; } -int skill_check_condition_castbegin_madogear_unknown(struct status_change *sc, uint16 *skill_id) +static int skill_check_condition_castbegin_madogear_unknown(struct status_change *sc, uint16 *skill_id) { return 0; } -int skill_check_condition_castbegin_unknown(struct status_change *sc, uint16 *skill_id) +static int skill_check_condition_castbegin_unknown(struct status_change *sc, uint16 *skill_id) { return -1; } -int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) +static int skill_check_condition_castend(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct skill_condition require; struct status_data *st; @@ -15129,14 +15143,14 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id, return 1; } -bool skill_check_condition_castend_unknown(struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv) +static bool skill_check_condition_castend_unknown(struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv) { return false; } // type&2: consume items (after skill was used) // type&1: consume the others (before skill was used) -int skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) +static int skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type) { struct skill_condition req; @@ -15218,7 +15232,7 @@ int skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint return 1; } -struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 skill_id, uint16 skill_lv) +static struct skill_condition skill_get_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct skill_condition req; struct status_data *st; @@ -15549,24 +15563,24 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 return req; } -bool skill_get_requirement_off_unknown(struct status_change *sc, uint16 *skill_id) +static bool skill_get_requirement_off_unknown(struct status_change *sc, uint16 *skill_id) { return false; } -bool skill_get_requirement_item_unknown(struct status_change *sc, struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv, uint16 *idx, int *i) +static bool skill_get_requirement_item_unknown(struct status_change *sc, struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv, uint16 *idx, int *i) { return false; } -void skill_get_requirement_unknown(struct status_change *sc, struct map_session_data* sd, uint16 *skill_id, uint16 *skill_lv, struct skill_condition *req) +static void skill_get_requirement_unknown(struct status_change *sc, struct map_session_data *sd, uint16 *skill_id, uint16 *skill_lv, struct skill_condition *req) { } /*========================================== * Does cast-time reductions based on dex, item bonuses and config setting *------------------------------------------*/ -int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) +static int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int time = skill->get_cast(skill_id, skill_lv); @@ -15617,7 +15631,7 @@ int skill_castfix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) /*========================================== * Does cast-time reductions based on sc data. *------------------------------------------*/ -int skill_castfix_sc (struct block_list *bl, int time) +static int skill_castfix_sc(struct block_list *bl, int time) { struct status_change *sc = status->get_sc(bl); @@ -15653,7 +15667,7 @@ int skill_castfix_sc (struct block_list *bl, int time) return time; } -int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) +static int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv) { #ifdef RENEWAL_CAST struct status_change *sc = status->get_sc(bl); @@ -15796,7 +15810,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 /*========================================== * Does delay reductions based on dex/agi, sc data, item bonuses, ... *------------------------------------------*/ -int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) +static int skill_delay_fix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) { int delaynodex = skill->get_delaynodex(skill_id, skill_lv); int time = skill->get_delay(skill_id, skill_lv); @@ -15896,7 +15910,7 @@ struct square { int val2[5]; }; -void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y) +static void skill_brandishspear_first(struct square *tc, uint8 dir, int16 x, int16 y) { nullpo_retv(tc); @@ -15992,7 +16006,7 @@ void skill_brandishspear_first (struct square *tc, uint8 dir, int16 x, int16 y) } -void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) +static void skill_brandishspear_dir(struct square *tc, uint8 dir, int are) { int c; nullpo_retv(tc); @@ -16011,7 +16025,7 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) } } -void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) +static void skill_brandishspear(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int64 tick, int flag) { int c,n=4; uint8 dir; @@ -16066,7 +16080,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s /*========================================== * Weapon Repair [Celest/DracoRPG] *------------------------------------------*/ -void skill_repairweapon (struct map_session_data *sd, int idx) +static void skill_repairweapon(struct map_session_data *sd, int idx) { int material; int materials[4] = { @@ -16124,7 +16138,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) /*========================================== * Item Appraisal *------------------------------------------*/ -void skill_identify (struct map_session_data *sd, int idx) +static void skill_identify(struct map_session_data *sd, int idx) { int flag=1; @@ -16142,7 +16156,7 @@ void skill_identify (struct map_session_data *sd, int idx) /*========================================== * Weapon Refine [Celest] *------------------------------------------*/ -void skill_weaponrefine (struct map_session_data *sd, int idx) +static void skill_weaponrefine(struct map_session_data *sd, int idx) { nullpo_retv(sd); @@ -16231,7 +16245,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) /*========================================== * *------------------------------------------*/ -int skill_autospell (struct map_session_data *sd, uint16 skill_id) +static int skill_autospell(struct map_session_data *sd, uint16 skill_id) { uint16 skill_lv; int maxlv=1,lv; @@ -16274,7 +16288,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id) /*========================================== * Sitting skills functions. *------------------------------------------*/ -int skill_sit_count(struct block_list *bl, va_list ap) +static int skill_sit_count(struct block_list *bl, va_list ap) { int type = va_arg(ap, int); struct map_session_data *sd = NULL; @@ -16295,7 +16309,7 @@ int skill_sit_count(struct block_list *bl, va_list ap) return 0; } -int skill_sit_in(struct block_list *bl, va_list ap) +static int skill_sit_in(struct block_list *bl, va_list ap) { int type = va_arg(ap, int); struct map_session_data *sd = NULL; @@ -16319,7 +16333,7 @@ int skill_sit_in(struct block_list *bl, va_list ap) return 0; } -int skill_sit_out(struct block_list *bl, va_list ap) +static int skill_sit_out(struct block_list *bl, va_list ap) { int type = va_arg(ap, int); struct map_session_data *sd = NULL; @@ -16338,7 +16352,7 @@ int skill_sit_out(struct block_list *bl, va_list ap) return 0; } -int skill_sit (struct map_session_data *sd, int type) +static int skill_sit(struct map_session_data *sd, int type) { int flag = 0; int range = 0, lv; @@ -16378,7 +16392,7 @@ int skill_sit (struct map_session_data *sd, int type) /*========================================== * *------------------------------------------*/ -int skill_frostjoke_scream(struct block_list *bl, va_list ap) +static int skill_frostjoke_scream(struct block_list *bl, va_list ap) { struct block_list *src; uint16 skill_id,skill_lv; @@ -16411,7 +16425,7 @@ int skill_frostjoke_scream(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag) +static void skill_unitsetmapcell(struct skill_unit *src, uint16 skill_id, uint16 skill_lv, cell_t cell, bool flag) { int range = skill->get_unit_range(skill_id,skill_lv); int x,y; @@ -16425,7 +16439,7 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill /*========================================== * *------------------------------------------*/ -int skill_attack_area(struct block_list *bl, va_list ap) +static int skill_attack_area(struct block_list *bl, va_list ap) { struct block_list *src,*dsrc; int atk_type,skill_id,skill_lv,flag,type; @@ -16468,7 +16482,7 @@ int skill_attack_area(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_clear_group (struct block_list *bl, int flag) +static int skill_clear_group(struct block_list *bl, int flag) { struct unit_data *ud = unit->bl2ud(bl); struct skill_unit_group *group[MAX_SKILLUNITGROUP]; @@ -16512,7 +16526,7 @@ int skill_clear_group (struct block_list *bl, int flag) /*========================================== * Returns the first element field found [Skotlex] *------------------------------------------*/ -struct skill_unit_group *skill_locate_element_field(struct block_list *bl) +static struct skill_unit_group *skill_locate_element_field(struct block_list *bl) { struct unit_data *ud = unit->bl2ud(bl); int i; @@ -16535,7 +16549,7 @@ struct skill_unit_group *skill_locate_element_field(struct block_list *bl) } // for graffiti cleaner [Valaris] -int skill_graffitiremover(struct block_list *bl, va_list ap) +static int skill_graffitiremover(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; @@ -16551,7 +16565,7 @@ int skill_graffitiremover(struct block_list *bl, va_list ap) return 0; } -int skill_greed(struct block_list *bl, va_list ap) +static int skill_greed(struct block_list *bl, va_list ap) { struct block_list *src = va_arg(ap, struct block_list *); @@ -16568,7 +16582,7 @@ int skill_greed(struct block_list *bl, va_list ap) } //For Ranger's Detonator [Jobbie/3CeAM] -int skill_detonator(struct block_list *bl, va_list ap) +static int skill_detonator(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; struct block_list *src = va_arg(ap,struct block_list *); @@ -16619,7 +16633,7 @@ int skill_detonator(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_cell_overlap(struct block_list *bl, va_list ap) +static int skill_cell_overlap(struct block_list *bl, va_list ap) { uint16 skill_id; int *alive; @@ -16717,7 +16731,7 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_chastle_mob_changetarget(struct block_list *bl, va_list ap) +static int skill_chastle_mob_changetarget(struct block_list *bl, va_list ap) { struct unit_data *ud = unit->bl2ud(bl); struct block_list *from_bl = va_arg(ap, struct block_list *); @@ -16741,7 +16755,7 @@ int skill_chastle_mob_changetarget(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_trap_splash(struct block_list *bl, va_list ap) +static int skill_trap_splash(struct block_list *bl, va_list ap) { struct block_list *src = va_arg(ap, struct block_list *); int64 tick = va_arg(ap, int64); @@ -16851,7 +16865,7 @@ int skill_trap_splash(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_enchant_elemental_end(struct block_list *bl, int type) +static int skill_enchant_elemental_end(struct block_list *bl, int type) { struct status_change *sc; const enum sc_type scs[] = { SC_ENCHANTPOISON, SC_ASPERSIO, SC_PROPERTYFIRE, SC_PROPERTYWATER, SC_PROPERTYWIND, SC_PROPERTYGROUND, SC_PROPERTYDARK, SC_PROPERTYTELEKINESIS, SC_ENCHANTARMS }; @@ -16868,7 +16882,7 @@ int skill_enchant_elemental_end(struct block_list *bl, int type) return 0; } -bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce) +static bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce) { bool wall = true; @@ -16907,7 +16921,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce /** * Verifies if an user can use SC_CLOAKING **/ -bool skill_can_cloak(struct map_session_data *sd) +static bool skill_can_cloak(struct map_session_data *sd) { nullpo_retr(false, sd); @@ -16925,7 +16939,7 @@ bool skill_can_cloak(struct map_session_data *sd) * Verifies if an user can still be cloaked (AS_CLOAKING) * Is called via map->foreachinrange when any kind of wall disapears **/ -int skill_check_cloaking_end(struct block_list *bl, va_list ap) +static int skill_check_cloaking_end(struct block_list *bl, va_list ap) { struct map_session_data *sd = BL_CAST(BL_PC, bl); @@ -16935,7 +16949,7 @@ int skill_check_cloaking_end(struct block_list *bl, va_list ap) return 0; } -bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *sce) +static bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *sce) { bool wall = true; @@ -16963,7 +16977,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s return wall; } -bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit) +static bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit) { struct status_change *sc; @@ -17002,7 +17016,7 @@ bool skill_check_shadowform(struct block_list *bl, int64 damage, int hit) /*========================================== * *------------------------------------------*/ -struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2) +static struct skill_unit *skill_initunit(struct skill_unit_group *group, int idx, int x, int y, int val1, int val2) { struct skill_unit *su; @@ -17055,7 +17069,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int /*========================================== * *------------------------------------------*/ -int skill_delunit (struct skill_unit* su) +static int skill_delunit(struct skill_unit *su) { struct skill_unit_group *group; @@ -17131,14 +17145,14 @@ int skill_delunit (struct skill_unit* su) * *------------------------------------------*/ /// Returns the target skill_unit_group or NULL if not found. -struct skill_unit_group* skill_id2group(int group_id) +static struct skill_unit_group *skill_id2group(int group_id) { return (struct skill_unit_group*)idb_get(skill->group_db, group_id); } /// Returns a new group_id that isn't being used in skill->group_db. /// Fatal error if nothing is available. -int skill_get_new_group_id(void) +static int skill_get_new_group_id(void) { if (skill->unit_group_newid > MAX_SKILL_ID && skill->id2group(skill->unit_group_newid) == NULL) return skill->unit_group_newid++;// available @@ -17158,7 +17172,7 @@ int skill_get_new_group_id(void) } } -struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval) +static struct skill_unit_group *skill_initunitgroup(struct block_list *src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, int limit, int interval) { struct unit_data* ud = unit->bl2ud( src ); struct skill_unit_group* group; @@ -17221,7 +17235,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, /*========================================== * *------------------------------------------*/ -int skill_delunitgroup(struct skill_unit_group *group, const char *file, int line, const char *func) +static int skill_delunitgroup(struct skill_unit_group *group, const char *file, int line, const char *func) { struct block_list* src; struct unit_data *ud; @@ -17357,7 +17371,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char *file, int lin /*========================================== * *------------------------------------------*/ -int skill_clear_unitgroup (struct block_list *src) +static int skill_clear_unitgroup(struct block_list *src) { struct unit_data *ud = unit->bl2ud(src); @@ -17372,7 +17386,7 @@ int skill_clear_unitgroup (struct block_list *src) /*========================================== * *------------------------------------------*/ -struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl, struct skill_unit_group *group, int64 tick) +static struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl, struct skill_unit_group *group, int64 tick) { int i,j=-1,s,id; struct unit_data *ud; @@ -17414,7 +17428,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list /*========================================== * *------------------------------------------*/ -int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) +static int skill_unit_timer_sub_onplace(struct block_list *bl, va_list ap) { struct skill_unit* su; struct skill_unit_group* group; @@ -17444,7 +17458,7 @@ int skill_unit_timer_sub_onplace(struct block_list* bl, va_list ap) /** * @see DBApply */ -int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) +static int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) { struct skill_unit* su; struct skill_unit_group* group; @@ -17664,7 +17678,7 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) /*========================================== * Executes on all skill units every SKILLUNITTIMER_INTERVAL milliseconds. *------------------------------------------*/ -int skill_unit_timer(int tid, int64 tick, int id, intptr_t data) +static int skill_unit_timer(int tid, int64 tick, int id, intptr_t data) { map->freeblock_lock(); @@ -17678,7 +17692,7 @@ int skill_unit_timer(int tid, int64 tick, int id, intptr_t data) /*========================================== * *------------------------------------------*/ -int skill_unit_move_sub(struct block_list* bl, va_list ap) +static int skill_unit_move_sub(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; struct skill_unit_group *group = NULL; @@ -17778,7 +17792,7 @@ int skill_unit_move_sub(struct block_list* bl, va_list ap) * units to figure out when they have left a group. * flag&4: Force a onleft event (triggered when the bl is killed, for example) *------------------------------------------*/ -int skill_unit_move(struct block_list *bl, int64 tick, int flag) +static int skill_unit_move(struct block_list *bl, int64 tick, int flag) { nullpo_ret(bl); @@ -17804,7 +17818,7 @@ int skill_unit_move(struct block_list *bl, int64 tick, int flag) /*========================================== * *------------------------------------------*/ -int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy) +static int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx, int16 dy) { int i,j; int64 tick = timer->gettick(); @@ -17894,7 +17908,7 @@ int skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 dx /*========================================== * *------------------------------------------*/ -int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, int qty) +static int skill_can_produce_mix(struct map_session_data *sd, int nameid, int trigger, int qty) { int i,j; @@ -17957,7 +17971,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, /*========================================== * *------------------------------------------*/ -int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) +static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty) { int slot[3]; int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0; @@ -18576,7 +18590,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, return 0; } -int skill_arrow_create (struct map_session_data *sd, int nameid) +static int skill_arrow_create(struct map_session_data *sd, int nameid) { int i,j,flag,index=-1; struct item tmp_item; @@ -18618,7 +18632,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) return 0; } -int skill_poisoningweapon(struct map_session_data *sd, int nameid) +static int skill_poisoningweapon(struct map_session_data *sd, int nameid) { sc_type type; int chance, i; @@ -18650,7 +18664,7 @@ int skill_poisoningweapon(struct map_session_data *sd, int nameid) return 0; } -void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) +static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) { struct status_change *sc = status->get_sc(bl); @@ -18675,7 +18689,7 @@ void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id) } } -int skill_magicdecoy(struct map_session_data *sd, int nameid) +static int skill_magicdecoy(struct map_session_data *sd, int nameid) { int x, y, i, class_ = 0, skill_id; struct mob_data *md; @@ -18727,7 +18741,7 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) } // Warlock Spellbooks. [LimitLine/3CeAM] -int skill_spellbook(struct map_session_data *sd, int nameid) +static int skill_spellbook(struct map_session_data *sd, int nameid) { int i, max_preserve, skill_id, point; struct status_change *sc; @@ -18777,7 +18791,7 @@ int skill_spellbook(struct map_session_data *sd, int nameid) return 1; } -int skill_select_menu(struct map_session_data *sd,uint16 skill_id) +static int skill_select_menu(struct map_session_data *sd, uint16 skill_id) { int id, lv, prob, aslvl = 0, idx = 0; nullpo_ret(sd); @@ -18802,7 +18816,7 @@ int skill_select_menu(struct map_session_data *sd,uint16 skill_id) return 0; } -int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv, const struct itemlist *item_list) +static int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv, const struct itemlist *item_list) { int i; @@ -18875,7 +18889,7 @@ int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv, const return 0; } -int skill_changematerial(struct map_session_data *sd, const struct itemlist *item_list) +static int skill_changematerial(struct map_session_data *sd, const struct itemlist *item_list) { int i, j, k, c, p = 0, nameid, amount; @@ -18930,7 +18944,7 @@ int skill_changematerial(struct map_session_data *sd, const struct itemlist *ite /** * for Royal Guard's LG_TRAMPLE **/ -int skill_destroy_trap(struct block_list *bl, va_list ap) +static int skill_destroy_trap(struct block_list *bl, va_list ap) { struct skill_unit *su = NULL; struct skill_unit_group *sg; @@ -18966,7 +18980,7 @@ int skill_destroy_trap(struct block_list *bl, va_list ap) /*========================================== * *------------------------------------------*/ -int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) +static int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd = map->id2sd(id); struct skill_cd * cd = NULL; @@ -19019,7 +19033,7 @@ int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) * @param tick the length of time the delay should last * @return 0 if successful, -1 otherwise */ -int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) +static int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) { struct skill_cd* cd = NULL; uint16 idx = skill->get_index(skill_id); @@ -19100,7 +19114,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) } // [orn] -int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) +static int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) { struct homun_data *hd = map->id2hd(id); if (data <= 0 || data >= MAX_SKILL_DB) @@ -19112,7 +19126,7 @@ int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) } // [orn] -int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) +static int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { uint16 idx = skill->get_index(skill_id); nullpo_retr (-1, hd); @@ -19129,7 +19143,7 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) } // [orn] -int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) +static int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) { struct mercenary_data *md = map->id2mc(id); if (data <= 0 || data >= MAX_SKILL_DB) @@ -19140,7 +19154,7 @@ int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) return 1; } -int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) +static int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) { uint16 idx = skill->get_index(skill_id); nullpo_retr (-1, md); @@ -19159,7 +19173,7 @@ int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick) /** * Adds a new skill unit entry for this player to recast after map load **/ -void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill_lv) +static void skill_usave_add(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) { struct skill_unit_save * sus = NULL; @@ -19177,7 +19191,7 @@ void skill_usave_add(struct map_session_data * sd, uint16 skill_id, uint16 skill return; } -void skill_usave_trigger(struct map_session_data *sd) +static void skill_usave_trigger(struct map_session_data *sd) { struct skill_unit_save * sus = NULL; @@ -19195,7 +19209,7 @@ void skill_usave_trigger(struct map_session_data *sd) /* * */ -int skill_split_atoi(char *str, int *val) +static int skill_split_atoi(char *str, int *val) { int i, j, step = 1; @@ -19242,7 +19256,7 @@ int skill_split_atoi(char *str, int *val) /* * */ -void skill_init_unit_layout (void) +static void skill_init_unit_layout(void) { int i,j,pos = 0; @@ -19514,13 +19528,13 @@ void skill_init_unit_layout (void) } -void skill_init_unit_layout_unknown(int skill_idx) +static void skill_init_unit_layout_unknown(int skill_idx) { Assert_retv(skill_idx >= 0 && skill_idx < MAX_SKILL_DB); ShowError("unknown unit layout at skill %d\n", skill->dbs->db[skill_idx].nameid); } -int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) +static int skill_block_check(struct block_list *bl, sc_type type, uint16 skill_id) { int inf = 0; struct status_change *sc = status->get_sc(bl); @@ -19668,7 +19682,7 @@ int skill_block_check(struct block_list *bl, sc_type type , uint16 skill_id) return 0; } -int skill_get_elemental_type(uint16 skill_id , uint16 skill_lv) +static int skill_get_elemental_type(uint16 skill_id, uint16 skill_lv) { int type = 0; @@ -19688,7 +19702,7 @@ int skill_get_elemental_type(uint16 skill_id , uint16 skill_lv) * update stored skill cooldowns for player logout * @param sd the affected player structure */ -void skill_cooldown_save(struct map_session_data * sd) +static void skill_cooldown_save(struct map_session_data *sd) { int i; struct skill_cd* cd = NULL; @@ -19717,7 +19731,7 @@ void skill_cooldown_save(struct map_session_data * sd) * reload stored skill cooldowns when a player logs in. * @param sd the affected player structure */ -void skill_cooldown_load(struct map_session_data * sd) +static void skill_cooldown_load(struct map_session_data *sd) { int i; struct skill_cd* cd = NULL; @@ -19750,7 +19764,7 @@ void skill_cooldown_load(struct map_session_data * sd) } } -bool skill_parse_row_producedb(char* split[], int columns, int current) +static bool skill_parse_row_producedb(char *split[], int columns, int current) { // ProduceItemID,ItemLV,RequireSkill,Requireskill_lv,MaterialID1,MaterialAmount1,...... int x,y; @@ -19774,7 +19788,7 @@ bool skill_parse_row_producedb(char* split[], int columns, int current) return true; } -bool skill_parse_row_createarrowdb(char* split[], int columns, int current) +static bool skill_parse_row_createarrowdb(char *split[], int columns, int current) { // SourceID,MakeID1,MakeAmount1,...,MakeID5,MakeAmount5 int x,y; @@ -19795,7 +19809,7 @@ bool skill_parse_row_createarrowdb(char* split[], int columns, int current) return true; } -bool skill_parse_row_spellbookdb(char* split[], int columns, int current) +static bool skill_parse_row_spellbookdb(char *split[], int columns, int current) { // skill_id,PreservePoints @@ -19825,7 +19839,7 @@ bool skill_parse_row_spellbookdb(char* split[], int columns, int current) return false; } -bool skill_parse_row_improvisedb(char* split[], int columns, int current) +static bool skill_parse_row_improvisedb(char *split[], int columns, int current) { // SkillID,Rate uint16 skill_id; @@ -19857,7 +19871,7 @@ bool skill_parse_row_improvisedb(char* split[], int columns, int current) return true; } -bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) +static bool skill_parse_row_magicmushroomdb(char *split[], int column, int current) { // SkillID uint16 skill_id; @@ -19878,7 +19892,7 @@ bool skill_parse_row_magicmushroomdb(char* split[], int column, int current) return true; } -bool skill_parse_row_abradb(char* split[], int columns, int current) +static bool skill_parse_row_abradb(char *split[], int columns, int current) { // skill_id,DummyName,RequiredHocusPocusLevel,Rate uint16 skill_id; @@ -19900,7 +19914,7 @@ bool skill_parse_row_abradb(char* split[], int columns, int current) return true; } -bool skill_parse_row_changematerialdb(char* split[], int columns, int current) +static bool skill_parse_row_changematerialdb(char *split[], int columns, int current) { // ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5 uint16 skill_id; @@ -19945,7 +19959,7 @@ bool skill_parse_row_changematerialdb(char* split[], int columns, int current) * @param *conf pointer to config setting. * @param *arr pointer to array to be set. */ -void skill_config_set_level(struct config_setting_t *conf, int *arr) +static void skill_config_set_level(struct config_setting_t *conf, int *arr) { int i=0; @@ -19974,7 +19988,7 @@ void skill_config_set_level(struct config_setting_t *conf, int *arr) * @param value value being set for the array. * @return (void) */ -void skill_level_set_value(int *arr, int value) +static void skill_level_set_value(int *arr, int value) { int i=0; @@ -19984,7 +19998,7 @@ void skill_level_set_value(int *arr, int value) } } -void skill_validate_hittype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_hittype(struct config_setting_t *conf, struct s_skill_db *sk) { const char *type = NULL; @@ -20009,7 +20023,7 @@ void skill_validate_hittype(struct config_setting_t *conf, struct s_skill_db *sk * @param sk struct, pointer to s_skill_db * @return (void) */ -void skill_validate_skilltype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_skilltype(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *t = NULL, *tt = NULL; @@ -20063,7 +20077,7 @@ void skill_validate_skilltype(struct config_setting_t *conf, struct s_skill_db * * @param sk struct, pointer to s_skill_db * @return (void) */ -void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *t = NULL, *tt = NULL; @@ -20201,7 +20215,7 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db * * @param sk struct, pointer to s_skill_db * @return (void) */ -void skill_validate_attacktype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_attacktype(struct config_setting_t *conf, struct s_skill_db *sk) { const char *type = NULL; @@ -20226,7 +20240,7 @@ void skill_validate_attacktype(struct config_setting_t *conf, struct s_skill_db * @param sk struct, pointer to s_skill_db * @return (void) */ -void skill_validate_element(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_element(struct config_setting_t *conf, struct s_skill_db *sk) { const char *type = NULL; struct config_setting_t *t = NULL; @@ -20274,7 +20288,7 @@ void skill_validate_element(struct config_setting_t *conf, struct s_skill_db *sk * @param sk struct, pointer to s_skill_db * @return (void) */ -void skill_validate_damagetype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_damagetype(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *t = NULL, *tt = NULL; @@ -20347,7 +20361,7 @@ void skill_validate_damagetype(struct config_setting_t *conf, struct s_skill_db * @param delay boolean, switch for cast/delay setting * @return (void) */ -void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db *sk, bool delay) +static void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db *sk, bool delay) { struct config_setting_t *t = NULL, *tt = NULL; @@ -20394,7 +20408,7 @@ void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db * * @param *sk struct, pointer to s_skill_db * @return void */ -int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk) +static int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk) { nullpo_ret(sk); if (strcmpi(type, "NoWeapon") == 0) { @@ -20597,7 +20611,7 @@ int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db * * @param sk struct, struct, pointer to s_skill_db * @return (void) */ -void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *tt = NULL; const char *type = NULL; @@ -20624,7 +20638,7 @@ void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db * @param sk struct, pointer to s_skill_db * @return void */ -int skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk) +static int skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk) { nullpo_ret(sk); if (strcmpi(type, "A_ARROW") == 0) { @@ -20701,7 +20715,7 @@ int skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk * @param sk struct, pointer to s_skill_db * @return void */ -void skill_validate_ammotype(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_ammotype(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *tt = NULL; const char *tstr = NULL; @@ -20727,7 +20741,7 @@ void skill_validate_ammotype(struct config_setting_t *conf, struct s_skill_db *s * @param sk struct, pointer to s_skill_db * @return void */ -void skill_validate_state(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_state(struct config_setting_t *conf, struct s_skill_db *sk) { const char *type = NULL; @@ -20768,7 +20782,7 @@ void skill_validate_state(struct config_setting_t *conf, struct s_skill_db *sk) * @param sk struct, pointer to s_skill_db * @return void */ -void skill_validate_item_requirements(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_item_requirements(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *tt = NULL; @@ -20805,7 +20819,7 @@ void skill_validate_item_requirements(struct config_setting_t *conf, struct s_sk * @param sk struct, pointer to s_skill_db * @return void */ -void skill_validate_unit_target(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_unit_target(struct config_setting_t *conf, struct s_skill_db *sk) { const char *type = NULL; @@ -20847,7 +20861,7 @@ void skill_validate_unit_target(struct config_setting_t *conf, struct s_skill_db * @param sk struct, pointer to s_skill_db. * @return (void) */ -int skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *sk) +static int skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *sk) { nullpo_ret(type); nullpo_ret(sk); @@ -20943,7 +20957,7 @@ int skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *s * @param sk struct, struct, pointer to s_skill_db * @return (void) */ -void skill_validate_unit_flag(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_unit_flag(struct config_setting_t *conf, struct s_skill_db *sk) { struct config_setting_t *t = NULL; @@ -20966,7 +20980,7 @@ void skill_validate_unit_flag(struct config_setting_t *conf, struct s_skill_db * * @param sk struct, struct, pointer to s_skill_db * @return (void) */ -void skill_validate_additional_fields(struct config_setting_t *conf, struct s_skill_db *sk) +static void skill_validate_additional_fields(struct config_setting_t *conf, struct s_skill_db *sk) { // Does nothing like a boss. *cough* plugins *cough* } @@ -20977,7 +20991,7 @@ void skill_validate_additional_fields(struct config_setting_t *conf, struct s_sk * @param *source filepath constant. * @return boolean true on success. */ -bool skill_validate_skilldb(struct s_skill_db *sk, const char *source) +static bool skill_validate_skilldb(struct s_skill_db *sk, const char *source) { int idx; @@ -21008,7 +21022,7 @@ bool skill_validate_skilldb(struct s_skill_db *sk, const char *source) * @param filename contains the file path and name. * @return boolean true on success */ -bool skill_read_skilldb(const char *filename) +static bool skill_read_skilldb(const char *filename) { struct config_t skilldb; struct config_setting_t *sk, *conf; @@ -21265,7 +21279,7 @@ bool skill_read_skilldb(const char *filename) * create_arrow_db.txt * abra_db.txt *------------------------------*/ -void skill_readdb(bool minimal) +static void skill_readdb(bool minimal) { // init skill db structures db_clear(skill->name2id_db); @@ -21304,7 +21318,7 @@ void skill_readdb(bool minimal) sv->readdb(map->db_path, "skill_changematerial_db.txt", ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb); } -void skill_reload(void) +static void skill_reload(void) { struct s_mapiterator *iter; struct map_session_data *sd; @@ -21337,7 +21351,7 @@ void skill_reload(void) /*========================================== * *------------------------------------------*/ -int do_init_skill(bool minimal) +static int do_init_skill(bool minimal) { skill->name2id_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAX_SKILL_NAME_LENGTH); skill->read_db(minimal); @@ -21371,7 +21385,7 @@ int do_init_skill(bool minimal) return 0; } -int do_final_skill(void) +static int do_final_skill(void) { db_destroy(skill->name2id_db); db_destroy(skill->group_db); diff --git a/src/map/status.c b/src/map/status.c index f2275e47b..2bd3700b3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -61,17 +61,17 @@ #include <string.h> #include <time.h> -struct status_interface status_s; -struct s_status_dbs statusdbs; +static struct status_interface status_s; +static struct s_status_dbs statusdbs; struct status_interface *status; /** -* Returns the status change associated with a skill. -* @param skill The skill to look up -* @return The status registered for this skill -**/ -sc_type status_skill2sc(int skill_id) + * Returns the status change associated with a skill. + * @param skill The skill to look up + * @return The status registered for this skill + */ +static sc_type status_skill2sc(int skill_id) { int idx; if( (idx = skill->get_index(skill_id)) == 0 ) { @@ -82,12 +82,12 @@ sc_type status_skill2sc(int skill_id) } /** -* Returns the FIRST skill (in order of definition in initChangeTables) to use a given status change. -* Utilized for various duration lookups. Use with caution! -* @param sc The status to look up -* @return A skill associated with the status -**/ -int status_sc2skill(sc_type sc) + * Returns the FIRST skill (in order of definition in initChangeTables) to use a given status change. + * Utilized for various duration lookups. Use with caution! + * @param sc The status to look up + * @return A skill associated with the status + */ +static int status_sc2skill(sc_type sc) { if( sc < 0 || sc >= SC_MAX ) { ShowError("status_sc2skill: Unsupported status change id %d\n", sc); @@ -98,11 +98,11 @@ int status_sc2skill(sc_type sc) } /** -* Returns the status calculation flag associated with a given status change. -* @param sc The status to look up -* @return The scb_flag registered for this status (see enum scb_flag) -**/ -unsigned int status_sc2scb_flag(sc_type sc) + * Returns the status calculation flag associated with a given status change. + * @param sc The status to look up + * @return The scb_flag registered for this status (see enum scb_flag) + */ +static unsigned int status_sc2scb_flag(sc_type sc) { if( sc < 0 || sc >= SC_MAX ) { ShowError("status_sc2scb_flag: Unsupported status change id %d\n", sc); @@ -113,11 +113,11 @@ unsigned int status_sc2scb_flag(sc_type sc) } /** -* Returns the bl types which require a status change packet to be sent for a given client status identifier. -* @param type The client-side status identifier to look up (see enum si_type) -* @return The bl types relevant to the type (see enum bl_type) -**/ -int status_type2relevant_bl_types(int type) + * Returns the bl types which require a status change packet to be sent for a given client status identifier. + * @param type The client-side status identifier to look up (see enum si_type) + * @return The bl types relevant to the type (see enum bl_type) + */ +static int status_type2relevant_bl_types(int type) { if( type < 0 || type >= SI_MAX ) { ShowError("status_type2relevant_bl_types: Unsupported type %d\n", type); @@ -127,7 +127,7 @@ int status_type2relevant_bl_types(int type) return status->dbs->RelevantBLTypes[type]; } -void status_set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) +static void status_set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) { uint16 idx; if( (idx = skill->get_index(skill_id)) == 0 ) { @@ -149,7 +149,7 @@ void status_set_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag) status->dbs->Skill2SCTable[idx] = sc; } -void initChangeTables(void) +static void initChangeTables(void) { #define add_sc(skill,sc) status->set_sc((skill),(sc),SI_BLANK,SCB_NONE) // indicates that the status displays a visual effect for the affected unit, and should be sent to the client for all supported units @@ -1211,7 +1211,7 @@ void initChangeTables(void) #undef set_sc_with_vfx } -void initDummyData(void) +static void initDummyData(void) { memset(&status->dummy, 0, sizeof(status->dummy)); status->dummy.hp = @@ -1233,7 +1233,7 @@ void initDummyData(void) } //For copying a status_data structure from b to a, without overwriting current Hp and Sp -void status_copy(struct status_data *a, const struct status_data *b) +static void status_copy(struct status_data *a, const struct status_data *b) { nullpo_retv(a); nullpo_retv(b); @@ -1243,7 +1243,7 @@ void status_copy(struct status_data *a, const struct status_data *b) //Sets HP to given value. Flag is the flag passed to status->heal in case //final value is higher than current (use 2 to make a healing effect display //on players) It will always succeed (overrides Berserk block), but it can't kill. -int status_set_hp(struct block_list *bl, unsigned int hp, int flag) +static int status_set_hp(struct block_list *bl, unsigned int hp, int flag) { struct status_data *st; if (hp < 1) return 0; @@ -1261,7 +1261,7 @@ int status_set_hp(struct block_list *bl, unsigned int hp, int flag) //Sets SP to given value. Flag is the flag passed to status->heal in case //final value is higher than current (use 2 to make a healing effect display //on players) -int status_set_sp(struct block_list *bl, unsigned int sp, int flag) +static int status_set_sp(struct block_list *bl, unsigned int sp, int flag) { struct status_data *st; @@ -1276,7 +1276,7 @@ int status_set_sp(struct block_list *bl, unsigned int sp, int flag) return status_zap(bl, 0, st->sp - sp); } -int status_charge(struct block_list* bl, int64 hp, int64 sp) +static int status_charge(struct block_list *bl, int64 hp, int64 sp) { nullpo_retr((int)(hp + sp), bl); if(!(bl->type&BL_CONSUME)) @@ -1289,7 +1289,7 @@ int status_charge(struct block_list* bl, int64 hp, int64 sp) //If flag&2, fail if target does not has enough to subtract. //If flag&4, if killed, mob must not give exp/loot. //flag will be set to &8 when damaging sp of a dead character -int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, int64 in_sp, int walkdelay, int flag) +static int status_damage(struct block_list *src, struct block_list *target, int64 in_hp, int64 in_sp, int walkdelay, int flag) { struct status_data *st; struct status_change *sc; @@ -1529,7 +1529,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, //Heals a character. If flag&1, this is forced healing (otherwise stuff like Berserk can block it) //If flag&2, when the player is healed, show the HP/SP heal effect. -int status_heal(struct block_list *bl, int64 in_hp, int64 in_sp, int flag) +static int status_heal(struct block_list *bl, int64 in_hp, int64 in_sp, int flag) { struct status_data *st; struct status_change *sc; @@ -1609,7 +1609,7 @@ int status_heal(struct block_list *bl, int64 in_hp, int64 in_sp, int flag) //If rates are < 0, percent is of max HP/SP //If !flag, this is heal, otherwise it is damage. //Furthermore, if flag==2, then the target must not die from the subtraction. -int status_percent_change(struct block_list *src, struct block_list *target, signed char hp_rate, signed char sp_rate, int flag) +static int status_percent_change(struct block_list *src, struct block_list *target, signed char hp_rate, signed char sp_rate, int flag) { struct status_data *st; unsigned int hp = 0, sp = 0; @@ -1662,7 +1662,7 @@ int status_percent_change(struct block_list *src, struct block_list *target, sig return status->heal(target, hp, sp, 0); } -int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp) +static int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp) { struct status_data *st; unsigned int hp, sp; @@ -1701,7 +1701,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per return 1; } -int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int per_sp) +static int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int per_sp) { struct status_data *st; unsigned int hp, sp; @@ -1739,17 +1739,17 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int } /*========================================== -* Checks whether the src can use the skill on the target, -* taking into account status/option of both source/target. [Skotlex] -* flag: -* 0 - Trying to use skill on target. -* 1 - Cast bar is done. -* 2 - Skill already pulled off, check is due to ground-based skills or splash-damage ones. -* src MAY be null to indicate we shouldn't check it, this is a ground-based skill attack. -* target MAY Be null, in which case the checks are only to see -* whether the source can cast or not the skill on the ground. -*------------------------------------------*/ -int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) + * Checks whether the src can use the skill on the target, + * taking into account status/option of both source/target. [Skotlex] + * flag: + * 0 - Trying to use skill on target. + * 1 - Cast bar is done. + * 2 - Skill already pulled off, check is due to ground-based skills or splash-damage ones. + * src MAY be null to indicate we shouldn't check it, this is a ground-based skill attack. + * target MAY Be null, in which case the checks are only to see + * whether the source can cast or not the skill on the ground. + *------------------------------------------*/ +static int status_check_skilluse(struct block_list *src, struct block_list *target, uint16 skill_id, int flag) { struct status_data *st; struct status_change *sc=NULL, *tsc; @@ -2049,7 +2049,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin //Skotlex: Calculates the initial status for the given mob //first will only be false when the mob leveled up or got a GuardUp level. -int status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt) +static int status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt) { struct status_data *mstatus; struct block_list *mbl = NULL; @@ -2220,7 +2220,7 @@ int status_calc_mob_(struct mob_data *md, enum e_status_calc_opt opt) } //Skotlex: Calculates the stats of the given pet. -int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) +static int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) { nullpo_ret(pd); @@ -2282,7 +2282,7 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) return 1; } -unsigned int status_get_base_maxsp(const struct map_session_data *sd, const struct status_data *st) +static unsigned int status_get_base_maxsp(const struct map_session_data *sd, const struct status_data *st) { uint64 val; @@ -2303,7 +2303,7 @@ unsigned int status_get_base_maxsp(const struct map_session_data *sd, const stru return (unsigned int)cap_value(val, 0, UINT_MAX); } -unsigned int status_get_base_maxhp(const struct map_session_data *sd, const struct status_data *st) +static unsigned int status_get_base_maxhp(const struct map_session_data *sd, const struct status_data *st) { uint64 val; @@ -2330,13 +2330,13 @@ unsigned int status_get_base_maxhp(const struct map_session_data *sd, const stru return (unsigned int)cap_value(val,0,UINT_MAX); } -void status_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_opt opt) +static void status_calc_pc_additional(struct map_session_data *sd, enum e_status_calc_opt opt) { /* Just used for Plugin to give bonuses. */ return; } -void status_calc_pc_recover_hp(struct map_session_data* sd, struct status_data *bstatus) +static void status_calc_pc_recover_hp(struct map_session_data *sd, struct status_data *bstatus) { nullpo_retv(sd); nullpo_retv(bstatus); @@ -2350,7 +2350,7 @@ void status_calc_pc_recover_hp(struct map_session_data* sd, struct status_data * //Calculates player data from scratch without counting SC adjustments. //Should be invoked whenever players raise stats, learn passive skills or change equipment. -int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) +static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt opt) { static int calculating = 0; //Check for recursive call preemption. [Skotlex] struct status_data *bstatus; // pointer to the player's base status @@ -3286,7 +3286,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) return 0; } -int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt) +static int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt) { struct status_data *mstatus; struct s_mercenary *merc; @@ -3309,7 +3309,7 @@ int status_calc_mercenary_(struct mercenary_data *md, enum e_status_calc_opt opt return 0; } -int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt) +static int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt) { struct status_data *estatus; struct s_elemental *ele; @@ -3353,7 +3353,7 @@ int status_calc_elemental_(struct elemental_data *ed, enum e_status_calc_opt opt return 0; } -int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) +static int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) { struct status_data *nstatus; @@ -3390,7 +3390,7 @@ int status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) return 0; } -int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) +static int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) { struct status_data *hstatus; struct s_homunculus *hom; @@ -3480,7 +3480,7 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) } //Calculates base regen values. -void status_calc_regen(struct block_list *bl, struct status_data *st, struct regen_data *regen) +static void status_calc_regen(struct block_list *bl, struct status_data *st, struct regen_data *regen) { struct map_session_data *sd; int val, skill_lv, reg_flag; @@ -3581,7 +3581,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *st, struct reg } //Calculates SC related regen rates. -void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc) +static void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc) { nullpo_retv(bl); if (!(bl->type&BL_REGEN) || !regen) @@ -3705,7 +3705,7 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str /// Recalculates parts of an object's battle status according to the specified flags. /// @param flag bitfield of values from enum scb_flag -void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) +static void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { const struct status_data *bst = status->get_base_status(bl); struct status_data *st = status->get_status_data(bl); @@ -4104,7 +4104,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) /// Also sends updates to the client wherever applicable. /// @param flag bitfield of values from enum scb_flag /// @param first if true, will cause status_calc_* functions to run their base status initialization code -void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_calc_opt opt) +static void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_calc_opt opt) { struct status_data bst; // previous battle status struct status_data *st; // pointer to current battle status @@ -4289,7 +4289,7 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca } //Checks whether the source can see and chase target. -int status_check_visibility(struct block_list *src, struct block_list *target) +static int status_check_visibility(struct block_list *src, struct block_list *target) { int view_range; struct status_change *tsc = NULL; @@ -4341,7 +4341,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target) } // Basic ASPD value -int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) +static int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) { int amotion; #ifdef RENEWAL_ASPD /* [malufett/Hercules] */ @@ -4396,7 +4396,7 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) return amotion; } -unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st) +static unsigned short status_base_atk(const struct block_list *bl, const struct status_data *st) { int flag = 0, str, dex, dstr; @@ -4456,19 +4456,24 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_ return cap_value(str, 0, USHRT_MAX); } -unsigned short status_base_matk_min(const struct status_data *st) +static unsigned short status_base_matk_min(const struct status_data *st) { nullpo_ret(st); +#ifdef RENEWAL + Assert_ret(0); + return 0; +#else // not RENEWAL return st->int_ + (st->int_ / 7) * (st->int_ / 7); +#endif // RENEWAL } -unsigned short status_base_matk_max(const struct status_data *st) +static unsigned short status_base_matk_max(const struct status_data *st) { nullpo_ret(st); return st->int_ + (st->int_ / 5)*(st->int_ / 5); } -unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level) +static unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level) { #ifdef RENEWAL nullpo_ret(bl); @@ -4485,12 +4490,13 @@ unsigned short status_base_matk(struct block_list *bl, const struct status_data return st->int_ + (st->int_ / 2) + (st->dex / 5) + (st->luk / 3) + (level / 4); } #else + Assert_ret(0); return 0; #endif } //Fills in the misc data that can be calculated from the other status info (except for level) -void status_calc_misc(struct block_list *bl, struct status_data *st, int level) +static void status_calc_misc(struct block_list *bl, struct status_data *st, int level) { nullpo_retv(bl); nullpo_retv(st); @@ -4572,9 +4578,9 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level) } /*========================================== -* Apply shared stat mods from status changes [DracoRPG] -*------------------------------------------*/ -unsigned short status_calc_str(struct block_list *bl, struct status_change *sc, int str) + * Apply shared stat mods from status changes [DracoRPG] + *------------------------------------------*/ +static unsigned short status_calc_str(struct block_list *bl, struct status_change *sc, int str) { if(!sc || !sc->count) return cap_value(str,0,USHRT_MAX); @@ -4637,7 +4643,7 @@ unsigned short status_calc_str(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(str,0,USHRT_MAX); } -unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, int agi) +static unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, int agi) { if(!sc || !sc->count) return cap_value(agi,0,USHRT_MAX); @@ -4700,7 +4706,7 @@ unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(agi,0,USHRT_MAX); } -unsigned short status_calc_vit(struct block_list *bl, struct status_change *sc, int vit) +static unsigned short status_calc_vit(struct block_list *bl, struct status_change *sc, int vit) { if(!sc || !sc->count) return cap_value(vit,0,USHRT_MAX); @@ -4751,7 +4757,7 @@ unsigned short status_calc_vit(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(vit,0,USHRT_MAX); } -unsigned short status_calc_int(struct block_list *bl, struct status_change *sc, int int_) +static unsigned short status_calc_int(struct block_list *bl, struct status_change *sc, int int_) { nullpo_ret(bl); if(!sc || !sc->count) @@ -4818,7 +4824,7 @@ unsigned short status_calc_int(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(int_,0,USHRT_MAX); } -unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, int dex) +static unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, int dex) { nullpo_ret(bl); if(!sc || !sc->count) @@ -4881,7 +4887,7 @@ unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(dex,0,USHRT_MAX); } -unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, int luk) +static unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, int luk) { nullpo_ret(bl); @@ -4936,7 +4942,7 @@ unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(luk, 0, USHRT_MAX); } -unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) +static unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) { nullpo_ret(bl); if(!sc || !sc->count) @@ -5032,7 +5038,7 @@ unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(batk,0,USHRT_MAX); } -unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) +static unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, int watk, bool viewable) { nullpo_ret(bl); if(!sc || !sc->count) @@ -5125,7 +5131,7 @@ unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(watk,0,USHRT_MAX); } -unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) +static unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc, int matk) { #ifdef RENEWAL if (!sc || !sc->count) @@ -5156,7 +5162,7 @@ unsigned short status_calc_ematk(struct block_list *bl, struct status_change *sc #endif } -unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) +static unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk, bool viewable) { if (!sc || !sc->count) return cap_value(matk,0,USHRT_MAX); @@ -5226,7 +5232,7 @@ unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, return (unsigned short)cap_value(matk, 0, USHRT_MAX); } -signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) +static signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical, bool viewable) { if (!sc || !sc->count) return cap_value(critical, 10, SHRT_MAX); @@ -5267,7 +5273,7 @@ signed short status_calc_critical(struct block_list *bl, struct status_change *s return (short)cap_value(critical, 10, SHRT_MAX); } -signed short status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) +static signed short status_calc_hit(struct block_list *bl, struct status_change *sc, int hit, bool viewable) { if (!sc || !sc->count) @@ -5322,7 +5328,7 @@ signed short status_calc_hit(struct block_list *bl, struct status_change *sc, in return (short)cap_value(hit, 1, SHRT_MAX); } -signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) +static signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee, bool viewable) { nullpo_retr(1, bl); @@ -5419,7 +5425,7 @@ signed short status_calc_flee(struct block_list *bl, struct status_change *sc, i return (short)cap_value(flee, 1, SHRT_MAX); } -signed short status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) +static signed short status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2, bool viewable) { if(!sc || !sc->count) return cap_value(flee2,10,SHRT_MAX); @@ -5441,7 +5447,7 @@ signed short status_calc_flee2(struct block_list *bl, struct status_change *sc, return (short)cap_value(flee2,10,SHRT_MAX); } -defType status_calc_def(struct block_list *bl, struct status_change *sc, int def, bool viewable) +static defType status_calc_def(struct block_list *bl, struct status_change *sc, int def, bool viewable) { nullpo_retr(DEFTYPE_MIN, bl); @@ -5546,7 +5552,7 @@ defType status_calc_def(struct block_list *bl, struct status_change *sc, int def return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX); } -signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2, bool viewable) +static signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2, bool viewable) { nullpo_retr(1, bl); if(!sc || !sc->count) @@ -5623,7 +5629,7 @@ signed short status_calc_def2(struct block_list *bl, struct status_change *sc, i #endif } -defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef, bool viewable) +static defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef, bool viewable) { if(!sc || !sc->count) @@ -5680,7 +5686,7 @@ defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int md return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX); } -signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2, bool viewable) +static signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2, bool viewable) { if(!sc || !sc->count) #ifdef RENEWAL @@ -5719,7 +5725,7 @@ signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, #endif } -unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc, int speed) +static unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc, int speed) { struct map_session_data *sd = BL_CAST(BL_PC, bl); int speed_rate = -1; @@ -5922,7 +5928,7 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc // flag&1 - fixed value [malufett] // flag&2 - percentage value -short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag) +static short status_calc_aspd(struct block_list *bl, struct status_change *sc, short flag) { #ifdef RENEWAL_ASPD int pots = 0, bonus = 0; @@ -6054,7 +6060,7 @@ short status_calc_aspd(struct block_list *bl, struct status_change *sc, short fl #endif } -short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int aspd) +static short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int aspd) { nullpo_ret(bl); if (!sc || !sc->count) @@ -6074,7 +6080,7 @@ short status_calc_fix_aspd(struct block_list *bl, struct status_change *sc, int /// Calculates an object's ASPD modifier (alters the base amotion value). /// Note that the scale of aspd_rate is 1000 = 100%. -short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int aspd_rate) +static short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int aspd_rate) { int i; @@ -6217,7 +6223,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int return (short)cap_value(aspd_rate,0,SHRT_MAX); } -unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *sc, int dmotion) +static unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *sc, int dmotion) { nullpo_ret(bl); // It has been confirmed on official servers that MvP mobs have no dmotion even without endure @@ -6235,7 +6241,7 @@ unsigned short status_calc_dmotion(struct block_list *bl, struct status_change * return (unsigned short)cap_value(dmotion,0,USHRT_MAX); } -unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, uint64 maxhp) +static unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, uint64 maxhp) { if (!sc || !sc->count) @@ -6315,7 +6321,7 @@ unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, return (unsigned int)cap_value(maxhp, 1, UINT_MAX); } -unsigned int status_calc_maxsp(struct block_list *bl, struct status_change *sc, unsigned int maxsp) +static unsigned int status_calc_maxsp(struct block_list *bl, struct status_change *sc, unsigned int maxsp) { if (!sc || !sc->count) return cap_value(maxsp, 1, UINT_MAX); @@ -6354,7 +6360,7 @@ unsigned int status_calc_maxsp(struct block_list *bl, struct status_change *sc, return cap_value(maxsp, 1, UINT_MAX); } -unsigned char status_calc_element(struct block_list *bl, struct status_change *sc, int element) +static unsigned char status_calc_element(struct block_list *bl, struct status_change *sc, int element) { if(!sc || !sc->count) return element; @@ -6375,7 +6381,7 @@ unsigned char status_calc_element(struct block_list *bl, struct status_change *s return (unsigned char)cap_value(element,0,UCHAR_MAX); } -unsigned char status_calc_element_lv(struct block_list *bl, struct status_change *sc, int lv) +static unsigned char status_calc_element_lv(struct block_list *bl, struct status_change *sc, int lv) { if(!sc || !sc->count) return lv; @@ -6398,7 +6404,7 @@ unsigned char status_calc_element_lv(struct block_list *bl, struct status_change return (unsigned char)cap_value(lv,1,4); } -unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element) +static unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element) { if(!sc || !sc->count) return element; @@ -6439,7 +6445,7 @@ unsigned char status_calc_attack_element(struct block_list *bl, struct status_ch * @param mode The starting mode. * @return The calculated mode. */ -uint32 status_calc_mode(const struct block_list *bl, const struct status_change *sc, uint32 mode) +static uint32 status_calc_mode(const struct block_list *bl, const struct status_change *sc, uint32 mode) { if (sc == NULL || sc->count == 0) return mode & MD_MASK; @@ -6460,7 +6466,7 @@ uint32 status_calc_mode(const struct block_list *bl, const struct status_change * @param bl The requested bl. * @return The bl's name or NULL if not available. */ -const char *status_get_name(const struct block_list *bl) +static const char *status_get_name(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6480,12 +6486,12 @@ const char *status_get_name(const struct block_list *bl) } /*========================================== -* Get the class of the current bl -* return -* 0 = fail -* class_id = success -*------------------------------------------*/ -int status_get_class(const struct block_list *bl) + * Get the class of the current bl + * return + * 0 = fail + * class_id = success + *------------------------------------------*/ +static int status_get_class(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6500,12 +6506,12 @@ int status_get_class(const struct block_list *bl) return 0; } /*========================================== -* Get the base level of the current bl -* return -* 1 = fail -* level = success -*------------------------------------------*/ -int status_get_lv(const struct block_list *bl) + * Get the base level of the current bl + * return + * 1 = fail + * level = success + *------------------------------------------*/ +static int status_get_lv(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6520,7 +6526,7 @@ int status_get_lv(const struct block_list *bl) return 1; } -struct regen_data *status_get_regen_data(struct block_list *bl) +static struct regen_data *status_get_regen_data(struct block_list *bl) { nullpo_retr(NULL, bl); switch (bl->type) { @@ -6533,7 +6539,7 @@ struct regen_data *status_get_regen_data(struct block_list *bl) } } -struct status_data *status_get_status_data(struct block_list *bl) +static struct status_data *status_get_status_data(struct block_list *bl) { nullpo_retr(&status->dummy, bl); @@ -6554,7 +6560,7 @@ struct status_data *status_get_status_data(struct block_list *bl) } } -struct status_data *status_get_base_status(struct block_list *bl) +static struct status_data *status_get_base_status(struct block_list *bl) { nullpo_retr(NULL, bl); switch (bl->type) { @@ -6578,7 +6584,7 @@ struct status_data *status_get_base_status(struct block_list *bl) } } -defType status_get_def(struct block_list *bl) +static defType status_get_def(struct block_list *bl) { struct unit_data *ud; struct status_data *st = status->get_status_data(bl); @@ -6590,7 +6596,7 @@ defType status_get_def(struct block_list *bl) return cap_value(def, DEFTYPE_MIN, DEFTYPE_MAX); } -unsigned short status_get_speed(struct block_list *bl) +static unsigned short status_get_speed(struct block_list *bl) { nullpo_ret(bl); if (bl->type == BL_NPC) //Only BL with speed data but no status_data [Skotlex] @@ -6598,7 +6604,7 @@ unsigned short status_get_speed(struct block_list *bl) return status->get_status_data(bl)->speed; } -int status_get_party_id(const struct block_list *bl) +static int status_get_party_id(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6654,7 +6660,7 @@ int status_get_party_id(const struct block_list *bl) return 0; } -int status_get_guild_id(const struct block_list *bl) +static int status_get_guild_id(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6720,7 +6726,7 @@ int status_get_guild_id(const struct block_list *bl) return 0; } -int status_get_emblem_id(const struct block_list *bl) +static int status_get_emblem_id(const struct block_list *bl) { nullpo_ret(bl); switch (bl->type) { @@ -6782,7 +6788,7 @@ int status_get_emblem_id(const struct block_list *bl) return 0; } -int status_get_mexp(const struct block_list *bl) +static int status_get_mexp(const struct block_list *bl) { nullpo_ret(bl); if (bl->type == BL_MOB) @@ -6792,7 +6798,7 @@ int status_get_mexp(const struct block_list *bl) return 0; } -int status_get_race2(const struct block_list *bl) +static int status_get_race2(const struct block_list *bl) { nullpo_ret(bl); if (bl->type == BL_MOB) @@ -6802,13 +6808,13 @@ int status_get_race2(const struct block_list *bl) return 0; } -int status_isdead(struct block_list *bl) +static int status_isdead(struct block_list *bl) { nullpo_ret(bl); return status->get_status_data(bl)->hp == 0; } -int status_isimmune(struct block_list *bl) +static int status_isimmune(struct block_list *bl) { struct status_change *sc = NULL; nullpo_ret(bl); @@ -6825,7 +6831,7 @@ int status_isimmune(struct block_list *bl) return 0; } -struct view_data *status_get_viewdata(struct block_list *bl) +static struct view_data *status_get_viewdata(struct block_list *bl) { nullpo_retr(NULL, bl); switch (bl->type) { @@ -6840,7 +6846,7 @@ struct view_data *status_get_viewdata(struct block_list *bl) return NULL; } -void status_set_viewdata(struct block_list *bl, int class_) +static void status_set_viewdata(struct block_list *bl, int class_) { struct view_data* vd; nullpo_retv(bl); @@ -6991,7 +6997,7 @@ void status_set_viewdata(struct block_list *bl, int class_) } /// Returns the status_change data of bl or NULL if it doesn't exist. -struct status_change *status_get_sc(struct block_list *bl) +static struct status_change *status_get_sc(struct block_list *bl) { if (bl != NULL) { switch (bl->type) { @@ -7006,7 +7012,7 @@ struct status_change *status_get_sc(struct block_list *bl) return NULL; } -void status_change_init(struct block_list *bl) +static void status_change_init(struct block_list *bl) { struct status_change *sc = status->get_sc(bl); nullpo_retv(sc); @@ -7019,7 +7025,7 @@ void status_change_init(struct block_list *bl) * @see status_change_start for the expected parameters. * @return the adjusted duration based on flag values. */ -int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) +static int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) { //Percentual resistance: 10000 = 100% Resist //Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms @@ -7380,7 +7386,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ } /* [Ind/Hercules] fast-checkin sc-display array */ -void status_display_add(struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3) +static void status_display_add(struct map_session_data *sd, enum sc_type type, int dval1, int dval2, int dval3) { struct sc_display_entry *entry; int i; @@ -7409,7 +7415,7 @@ void status_display_add(struct map_session_data *sd, enum sc_type type, int dval sd->sc_display[ sd->sc_display_count - 1 ] = entry; } -void status_display_remove(struct map_session_data *sd, enum sc_type type) +static void status_display_remove(struct map_session_data *sd, enum sc_type type) { int i; @@ -7461,7 +7467,7 @@ void status_display_remove(struct map_session_data *sd, enum sc_type type) * @retval 0 if no status change happened. * @retval 1 if the status change was successfully applied. */ -int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag) +static int status_change_start(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int val1, int val2, int val3, int val4, int tick, int flag) { struct map_session_data *sd = NULL; struct status_change* sc; @@ -9728,7 +9734,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t return 1; } -bool status_change_start_unknown_sc(struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int tick, int flag) +static bool status_change_start_unknown_sc(struct block_list *src, struct block_list *bl, enum sc_type type, int calc_flag, int rate, int val1, int val2, int val3, int val4, int tick, int flag) { Assert_retr(false, type >= SC_NONE && type < SC_MAX); if (calc_flag == SCB_NONE && status->dbs->SkillChangeTable[type] == 0 && status->dbs->IconChangeTable[type] == 0) { @@ -9739,7 +9745,7 @@ bool status_change_start_unknown_sc(struct block_list *src, struct block_list *b return false; } -void status_change_start_display(struct map_session_data *sd, enum sc_type type, int val1, int val2, int val3, int val4) +static void status_change_start_display(struct map_session_data *sd, enum sc_type type, int val1, int val2, int val3, int val4) { Assert_retv(type >= SC_NONE && type < SC_MAX); @@ -9769,7 +9775,7 @@ void status_change_start_display(struct map_session_data *sd, enum sc_type type, * * @retval val_flag. */ -int status_get_val_flag(enum sc_type type) +static int status_get_val_flag(enum sc_type type) { int val_flag = 0; switch (type) { @@ -9921,7 +9927,7 @@ int status_get_val_flag(enum sc_type type) * * @retval option flag. */ -int status_change_start_set_option(struct block_list *bl, struct status_change* sc, enum sc_type type, int val1, int val2, int val3, int val4) +static int status_change_start_set_option(struct block_list *bl, struct status_change *sc, enum sc_type type, int val1, int val2, int val3, int val4) { int opt_flag = 1; @@ -10111,7 +10117,7 @@ int status_change_start_set_option(struct block_list *bl, struct status_change* * @param bl Status change target bl. * @param type Status change type. */ -void status_change_start_stop_action(struct block_list *bl, enum sc_type type) +static void status_change_start_stop_action(struct block_list *bl, enum sc_type type) { nullpo_retv(bl); switch (type) { @@ -10198,7 +10204,7 @@ void status_change_start_stop_action(struct block_list *bl, enum sc_type type) * @retval false if no status change happened, or the other sc can be started regardless. * @retval true if the status change was successfully applied and the other sc shouldn't be started. */ -bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, struct status_change* sc, enum sc_type type, int undead_flag, int val1, int val2, int val3, int val4) +static bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, struct status_change *sc, enum sc_type type, int undead_flag, int val1, int val2, int val3, int val4) { nullpo_retr(true, bl); nullpo_retr(true, st); @@ -10479,7 +10485,7 @@ bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, s * @retval true if boss resist. * @retval false if boss not resist. */ -bool status_is_boss_resist_sc(enum sc_type type) +static bool status_is_boss_resist_sc(enum sc_type type) { if (type >= SC_COMMON_MIN && type <= SC_COMMON_MAX) return true; @@ -10544,7 +10550,7 @@ bool status_is_boss_resist_sc(enum sc_type type) * @retval true if immune resist. * @retval false if not immune resist. */ -bool status_is_immune_to_status(struct status_change* sc, enum sc_type type) +static bool status_is_immune_to_status(struct status_change *sc, enum sc_type type) { nullpo_retr(true, sc); if (sc->data[SC_REFRESH]) { @@ -10618,15 +10624,15 @@ bool status_is_immune_to_status(struct status_change* sc, enum sc_type type) } /*========================================== -* Ending all status except those listed. -* @TODO maybe usefull for dispel instead reseting a liste there. -* type: -* 0 - PC killed -> Place here statuses that do not dispel on death. -* 1 - If for some reason status_change_end decides to still keep the status when quitting. -* 2 - Do clif -* 3 - Do not remove some permanent/time-independent effects -*------------------------------------------*/ -int status_change_clear(struct block_list* bl, int type) + * Ending all status except those listed. + * @TODO maybe usefull for dispel instead reseting a liste there. + * type: + * 0 - PC killed -> Place here statuses that do not dispel on death. + * 1 - If for some reason status_change_end decides to still keep the status when quitting. + * 2 - Do clif + * 3 - Do not remove some permanent/time-independent effects + *------------------------------------------*/ +static int status_change_clear(struct block_list *bl, int type) { struct status_change* sc; int i; @@ -10683,9 +10689,9 @@ int status_change_clear(struct block_list* bl, int type) } /*========================================== -* Special condition we want to effectuate, check before ending a status. -*------------------------------------------*/ -int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const char* file, int line) + * Special condition we want to effectuate, check before ending a status. + *------------------------------------------*/ +static int status_change_end_(struct block_list *bl, enum sc_type type, int tid, const char *file, int line) { struct map_session_data *sd; struct status_change *sc; @@ -11428,7 +11434,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const return 1; } -int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) { +static int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) +{ struct block_list *bl; struct status_change *sc; struct status_change_entry *sce; @@ -11460,10 +11467,10 @@ int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) { } /*========================================== -* For recusive status, like for each 5s we drop sp etc. -* Reseting the end timer. -*------------------------------------------*/ -int status_change_timer(int tid, int64 tick, int id, intptr_t data) + * For recusive status, like for each 5s we drop sp etc. + * Reseting the end timer. + *------------------------------------------*/ +static int status_change_timer(int tid, int64 tick, int id, intptr_t data) { enum sc_type type = (sc_type)data; struct block_list *bl; @@ -12339,9 +12346,9 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) } /*========================================== -* Foreach iteration of repetitive status -*------------------------------------------*/ -int status_change_timer_sub(struct block_list* bl, va_list ap) + * Foreach iteration of repetitive status + *------------------------------------------*/ +static int status_change_timer_sub(struct block_list *bl, va_list ap) { struct status_change* tsc; @@ -12417,10 +12424,17 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) return 0; } -int status_get_total_def(struct block_list *src) { return status->get_status_data(src)->def2 + (short)status->get_def(src); } -int status_get_total_mdef(struct block_list *src) { return status->get_status_data(src)->mdef2 + (short)status_get_mdef(src); } +static int status_get_total_def(struct block_list *src) +{ + return status->get_status_data(src)->def2 + (short)status->get_def(src); +} -int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag) +static int status_get_total_mdef(struct block_list *src) +{ + return status->get_status_data(src)->mdef2 + (short)status_get_mdef(src); +} + +static int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int flag) { #ifdef RENEWAL int min = 0, max = 0; @@ -12483,13 +12497,13 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl } /** -* Get bl's matk_max and matk_min values depending on flag -* @param flag -* 0 - Get MATK -* 1 - Get MATK w/o SC bonuses -* 3 - Get MATK w/o EATK & SC bonuses -**/ -void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_max, unsigned short *matk_min) + * Get bl's matk_max and matk_min values depending on flag + * @param flag + * 0 - Get MATK + * 1 - Get MATK w/o SC bonuses + * 3 - Get MATK w/o EATK & SC bonuses + */ +static void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_max, unsigned short *matk_min) { struct status_data *st; struct status_change *sc; @@ -12601,9 +12615,9 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m #undef status_get_homluk /** -* Gets a random matk value depending on min matk and max matk -**/ -unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk_min) + * Gets a random matk value depending on min matk and max matk + */ +static unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk_min) { if ( matk_max > matk_min ) return matk_min + rnd() % (matk_max - matk_min); @@ -12612,17 +12626,17 @@ unsigned short status_get_rand_matk(unsigned short matk_max, unsigned short matk } /** -* Get bl's matk value depending on flag -* @param flag [malufett] -* 1 - Get MATK w/o SC bonuses -* 2 - Get modified MATK -* 3 - Get MATK w/o eATK & SC bonuses -* @retval 1 failure -* @retval MATK success -* -* Shouldn't change _any_ value! [Panikon] -**/ -int status_get_matk(struct block_list *bl, int flag) + * Get bl's matk value depending on flag + * @param flag [malufett] + * 1 - Get MATK w/o SC bonuses + * 2 - Get modified MATK + * 3 - Get MATK w/o eATK & SC bonuses + * @retval 1 failure + * @retval MATK success + * + * Shouldn't change _any_ value! [Panikon] + */ +static int status_get_matk(struct block_list *bl, int flag) { struct status_data *st; unsigned short matk_max, matk_min; @@ -12649,9 +12663,9 @@ int status_get_matk(struct block_list *bl, int flag) } /** -* Updates bl's MATK values -**/ -void status_update_matk(struct block_list *bl) + * Updates bl's MATK values + */ +static void status_update_matk(struct block_list *bl) { struct status_data *st; struct status_change *sc; @@ -12676,11 +12690,11 @@ void status_update_matk(struct block_list *bl) } /*========================================== -* Clears buffs/debuffs of a character. -* type&1 -> buffs, type&2 -> debuffs -* type&4 -> especific debuffs(implemented with refresh) -*------------------------------------------*/ -int status_change_clear_buffs (struct block_list* bl, int type) + * Clears buffs/debuffs of a character. + * type&1 -> buffs, type&2 -> debuffs + * type&4 -> especific debuffs(implemented with refresh) + *------------------------------------------*/ +static int status_change_clear_buffs(struct block_list *bl, int type) { int i; struct status_change *sc= status->get_sc(bl); @@ -12742,7 +12756,7 @@ int status_change_clear_buffs (struct block_list* bl, int type) return 0; } -int status_change_spread(struct block_list *src, struct block_list *bl) +static int status_change_spread(struct block_list *src, struct block_list *bl) { int i, flag = 0; struct status_change *sc = status->get_sc(src); @@ -12833,7 +12847,7 @@ int status_change_spread(struct block_list *src, struct block_list *bl) } //Natural regen related stuff. -int status_natural_heal(struct block_list* bl, va_list args) +static int status_natural_heal(struct block_list *bl, va_list args) { struct regen_data *regen; struct status_data *st; @@ -13021,7 +13035,7 @@ int status_natural_heal(struct block_list* bl, va_list args) } //Natural heal main timer. -int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) +static int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) { // This difference is always positive and lower than UINT_MAX (~24 days) status->natural_heal_diff_tick = (unsigned int)cap_value(DIFF_TICK(tick,status->natural_heal_prev_tick), 0, UINT_MAX); @@ -13031,12 +13045,12 @@ int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) } /** -* Get the chance to upgrade a piece of equipment. -* @param wlv The weapon type of the item to refine (see see enum refine_type) -* @param refine The target refine level -* @return The chance to refine the item, in percent (0~100) -**/ -int status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chance_type type) + * Get the chance to upgrade a piece of equipment. + * @param wlv The weapon type of the item to refine (see see enum refine_type) + * @param refine The target refine level + * @return The chance to refine the item, in percent (0~100) + */ +static int status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chance_type type) { Assert_ret((int)wlv >= REFINE_TYPE_ARMOR && wlv < REFINE_TYPE_MAX); @@ -13049,7 +13063,7 @@ int status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chanc return status->dbs->refine_info[wlv].chance[type][refine]; } -int status_get_sc_type(sc_type type) +static int status_get_sc_type(sc_type type) { if( type <= SC_NONE || type >= SC_MAX ) @@ -13058,7 +13072,7 @@ int status_get_sc_type(sc_type type) return status->dbs->sc_conf[type]; } -void status_read_job_db_sub(int idx, const char *name, struct config_setting_t *jdb) +static void status_read_job_db_sub(int idx, const char *name, struct config_setting_t *jdb) { struct config_setting_t *temp = NULL; int i32 = 0; @@ -13288,14 +13302,15 @@ void status_read_job_db_sub(int idx, const char *name, struct config_setting_t * } } +/* [malufett/Hercules] */ /*------------------------------------------ -* DB reading. -* job_db.conf - weight, hp, sp, aspd -* job_db2.txt - job level stat bonuses -* size_fix.txt - size adjustment table for weapons -* refine_db.txt - refining data table -*------------------------------------------*/ -void status_read_job_db(void) /* [malufett/Hercules] */ + * DB reading. + * job_db.conf - weight, hp, sp, aspd + * job_db2.txt - job level stat bonuses + * size_fix.txt - size adjustment table for weapons + * refine_db.txt - refining data table + *------------------------------------------*/ +static void status_read_job_db(void) { int i = 0; struct config_t job_db_conf; @@ -13326,7 +13341,7 @@ void status_read_job_db(void) /* [malufett/Hercules] */ libconfig->destroy(&job_db_conf); } -bool status_readdb_job2(char* fields[], int columns, int current) +static bool status_readdb_job2(char *fields[], int columns, int current) { int idx, class, i; @@ -13346,7 +13361,7 @@ bool status_readdb_job2(char* fields[], int columns, int current) return true; } -bool status_readdb_sizefix(char* fields[], int columns, int current) +static bool status_readdb_sizefix(char *fields[], int columns, int current) { unsigned int i; @@ -13370,7 +13385,7 @@ bool status_readdb_sizefix(char* fields[], int columns, int current) * validation errors. * @return # of the validated entry, or 0 in case of failure. */ -int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source) +static int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source) { struct config_setting_t *rate = NULL; int type = REFINE_TYPE_ARMOR, bonus_per_level = 0, rnd_bonus_v = 0, rnd_bonus_lv = 0; @@ -13491,7 +13506,7 @@ int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *n * @param *filename File name, relative to the database path. * @return The number of found entries. */ -int status_readdb_refine_libconfig(const char *filename) +static int status_readdb_refine_libconfig(const char *filename) { bool duplicate[REFINE_TYPE_MAX]; struct config_t refine_db_conf; @@ -13523,7 +13538,7 @@ int status_readdb_refine_libconfig(const char *filename) return count; } -bool status_readdb_scconfig(char* fields[], int columns, int current) +static bool status_readdb_scconfig(char *fields[], int columns, int current) { int val = 0; char* type = fields[0]; @@ -13549,7 +13564,7 @@ bool status_readdb_scconfig(char* fields[], int columns, int current) * size_fixe.txt * refine_db.txt **/ -int status_readdb(void) +static int status_readdb(void) { int i, j; @@ -13590,9 +13605,9 @@ int status_readdb(void) } /*========================================== -* Status db init and destroy. -*------------------------------------------*/ -int do_init_status(bool minimal) + * Status db init and destroy. + *------------------------------------------*/ +static int do_init_status(bool minimal) { if (minimal) return 0; @@ -13609,16 +13624,16 @@ int do_init_status(bool minimal) return 0; } -void do_final_status(void) +static void do_final_status(void) { ers_destroy(status->data_ers); } /*===================================== -* Default Functions : status.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ + * Default Functions : status.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ void status_defaults(void) { status = &status_s; @@ -13777,8 +13792,6 @@ void status_defaults(void) status->read_job_db_sub = status_read_job_db_sub; status->set_sc = status_set_sc; status->copy = status_copy; -#ifndef RENEWAL status->base_matk_min = status_base_matk_min; -#endif // RENEWAL status->base_matk_max = status_base_matk_max; } diff --git a/src/map/storage.c b/src/map/storage.c index 0465765e3..4123ddc7c 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -41,8 +41,8 @@ #include <stdlib.h> #include <string.h> -struct storage_interface storage_s; -struct guild_storage_interface gstorage_s; +static struct storage_interface storage_s; +static struct guild_storage_interface gstorage_s; struct storage_interface *storage; struct guild_storage_interface *gstorage; @@ -50,7 +50,7 @@ struct guild_storage_interface *gstorage; /*========================================== * Sort items in the warehouse *------------------------------------------*/ -int storage_comp_item(const void *i1_, const void *i2_) +static int storage_comp_item(const void *i1_, const void *i2_) { const struct item *i1 = i1_; const struct item *i2 = i2_; @@ -65,7 +65,7 @@ int storage_comp_item(const void *i1_, const void *i2_) } //Sort item by storage_comp_item (nameid) -void storage_sortitem(struct item* items, unsigned int size) +static void storage_sortitem(struct item *items, unsigned int size) { nullpo_retv(items); @@ -79,7 +79,7 @@ void storage_sortitem(struct item* items, unsigned int size) * Parses storage and saves 'dirty' ones upon reconnect. [Skotlex] * @see DBApply */ -int storage_reconnect_sub(union DBKey key, struct DBData *data, va_list ap) +static int storage_reconnect_sub(union DBKey key, struct DBData *data, va_list ap) { struct guild_storage *stor = DB->data2ptr(data); nullpo_ret(stor); @@ -90,7 +90,7 @@ int storage_reconnect_sub(union DBKey key, struct DBData *data, va_list ap) } //Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex] -void do_reconnect_storage(void) +static void do_reconnect_storage(void) { gstorage->db->foreach(gstorage->db, storage->reconnect_sub); } @@ -100,7 +100,7 @@ void do_reconnect_storage(void) * 0 - success * 1 - fail *------------------------------------------*/ -int storage_storageopen(struct map_session_data *sd) +static int storage_storageopen(struct map_session_data *sd) { nullpo_ret(sd); @@ -132,7 +132,7 @@ int storage_storageopen(struct map_session_data *sd) /* helper function * checking if 2 item structure are identique */ -int compare_item(struct item *a, struct item *b) +static int compare_item(struct item *a, struct item *b) { if( a->nameid == b->nameid && a->identify == b->identify && @@ -155,7 +155,7 @@ int compare_item(struct item *a, struct item *b) /*========================================== * Internal add-item function. *------------------------------------------*/ -int storage_additem(struct map_session_data* sd, struct item* item_data, int amount) +static int storage_additem(struct map_session_data *sd, struct item *item_data, int amount) { struct item_data *data = NULL; struct item *it = NULL; @@ -238,7 +238,7 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo /*========================================== * Internal del-item function *------------------------------------------*/ -int storage_delitem(struct map_session_data* sd, int n, int amount) +static int storage_delitem(struct map_session_data *sd, int n, int amount) { struct item *it = NULL; @@ -276,7 +276,7 @@ int storage_delitem(struct map_session_data* sd, int n, int amount) * 0 : fail * 1 : success *------------------------------------------*/ -int storage_add_from_inventory(struct map_session_data* sd, int index, int amount) +static int storage_add_from_inventory(struct map_session_data *sd, int index, int amount) { nullpo_ret(sd); @@ -309,7 +309,7 @@ int storage_add_from_inventory(struct map_session_data* sd, int index, int amoun * 0 : fail * 1 : success *------------------------------------------*/ -int storage_add_to_inventory(struct map_session_data* sd, int index, int amount) +static int storage_add_to_inventory(struct map_session_data *sd, int index, int amount) { int flag; struct item *it = NULL; @@ -344,7 +344,7 @@ int storage_add_to_inventory(struct map_session_data* sd, int index, int amount) * 0 : fail * 1 : success *------------------------------------------*/ -int storage_storageaddfromcart(struct map_session_data* sd, int index, int amount) +static int storage_storageaddfromcart(struct map_session_data *sd, int index, int amount) { nullpo_ret(sd); @@ -375,7 +375,7 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun * 0 : fail * 1 : success *------------------------------------------*/ -int storage_storagegettocart(struct map_session_data* sd, int index, int amount) +static int storage_storagegettocart(struct map_session_data *sd, int index, int amount) { int flag = 0; struct item *it = NULL; @@ -409,7 +409,7 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount) /*========================================== * Modified By Valaris to save upon closing [massdriller] *------------------------------------------*/ -void storage_storageclose(struct map_session_data* sd) +static void storage_storageclose(struct map_session_data *sd) { int i = 0; @@ -438,7 +438,7 @@ void storage_storageclose(struct map_session_data* sd) /*========================================== * When quitting the game. *------------------------------------------*/ -void storage_storage_quit(struct map_session_data* sd, int flag) +static void storage_storage_quit(struct map_session_data *sd, int flag) { nullpo_retv(sd); @@ -451,7 +451,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag) /** * @see DBCreateData */ -struct DBData create_guildstorage(union DBKey key, va_list args) +static struct DBData create_guildstorage(union DBKey key, va_list args) { struct guild_storage *gs = NULL; gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1); @@ -459,7 +459,7 @@ struct DBData create_guildstorage(union DBKey key, va_list args) return DB->ptr2data(gs); } -struct guild_storage *guild2storage_ensure(int guild_id) +static struct guild_storage *guild2storage_ensure(int guild_id) { struct guild_storage *gs = NULL; if(guild->search(guild_id) != NULL) @@ -467,20 +467,20 @@ struct guild_storage *guild2storage_ensure(int guild_id) return gs; } -int guild_storage_delete(int guild_id) +static int guild_storage_delete(int guild_id) { idb_remove(gstorage->db,guild_id); return 0; } /*========================================== -* Attempt to open guild storage for sd -* return -* 0 : success (open or req to create a new one) -* 1 : fail -* 2 : no guild for sd + * Attempt to open guild storage for sd + * return + * 0 : success (open or req to create a new one) + * 1 : fail + * 2 : no guild for sd *------------------------------------------*/ -int storage_guild_storageopen(struct map_session_data* sd) +static int storage_guild_storageopen(struct map_session_data *sd) { struct guild_storage *gstor; @@ -516,12 +516,12 @@ int storage_guild_storageopen(struct map_session_data* sd) } /*========================================== -* Attempt to add an item in guild storage, then refresh it -* return -* 0 : success -* 1 : fail + * Attempt to add an item in guild storage, then refresh it + * return + * 0 : success + * 1 : fail *------------------------------------------*/ -int guild_storage_additem(struct map_session_data* sd, struct guild_storage* stor, struct item* item_data, int amount) +static int guild_storage_additem(struct map_session_data *sd, struct guild_storage *stor, struct item *item_data, int amount) { struct item_data *data; int i; @@ -579,12 +579,12 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto } /*========================================== -* Attempt to delete an item in guild storage, then refresh it -* return -* 0 : success -* 1 : fail + * Attempt to delete an item in guild storage, then refresh it + * return + * 0 : success + * 1 : fail *------------------------------------------*/ -int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* stor, int n, int amount) +static int guild_storage_delitem(struct map_session_data *sd, struct guild_storage *stor, int n, int amount) { nullpo_retr(1, sd); nullpo_retr(1, stor); @@ -605,13 +605,13 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto } /*========================================== -* Attempt to add an item in guild storage from inventory, then refresh it -* @index : inventory idx -* return -* 0 : fail -* 1 : succes + * Attempt to add an item in guild storage from inventory, then refresh it + * @index : inventory idx + * return + * 0 : fail + * 1 : succes *------------------------------------------*/ -int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) +static int storage_guild_storageadd(struct map_session_data *sd, int index, int amount) { struct guild_storage *stor; @@ -644,13 +644,13 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) } /*========================================== -* Attempt to retrieve an item from guild storage to inventory, then refresh it -* @index : storage idx -* return -* 0 : fail -* 1 : success + * Attempt to retrieve an item from guild storage to inventory, then refresh it + * @index : storage idx + * return + * 0 : fail + * 1 : success *------------------------------------------*/ -int storage_guild_storageget(struct map_session_data* sd, int index, int amount) +static int storage_guild_storageget(struct map_session_data *sd, int index, int amount) { struct guild_storage *stor; int flag; @@ -685,13 +685,13 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) } /*========================================== -* Attempt to add an item in guild storage from cart, then refresh it -* @index : cart inventory idx -* return -* 0 : fail -* 1 : success + * Attempt to add an item in guild storage from cart, then refresh it + * @index : cart inventory idx + * return + * 0 : fail + * 1 : success *------------------------------------------*/ -int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int amount) +static int storage_guild_storageaddfromcart(struct map_session_data *sd, int index, int amount) { struct guild_storage *stor; @@ -717,13 +717,13 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int } /*========================================== -* Attempt to retrieve an item from guild storage to cart, then refresh it -* @index : storage idx -* return -* 0 : fail -* 1 : success + * Attempt to retrieve an item from guild storage to cart, then refresh it + * @index : storage idx + * return + * 0 : fail + * 1 : success *------------------------------------------*/ -int storage_guild_storagegettocart(struct map_session_data* sd, int index, int amount) +static int storage_guild_storagegettocart(struct map_session_data *sd, int index, int amount) { struct guild_storage *stor; @@ -749,12 +749,12 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a } /*========================================== -* Request to save guild storage -* return -* 0 : fail (no storage) -* 1 : success + * Request to save guild storage + * return + * 0 : fail (no storage) + * 1 : success *------------------------------------------*/ -int storage_guild_storagesave(int account_id, int guild_id, int flag) +static int storage_guild_storagesave(int account_id, int guild_id, int flag) { struct guild_storage *stor = idb_get(gstorage->db,guild_id); @@ -770,12 +770,12 @@ int storage_guild_storagesave(int account_id, int guild_id, int flag) } /*========================================== -* ACK save of guild storage -* return -* 0 : fail (no storage) -* 1 : success + * ACK save of guild storage + * return + * 0 : fail (no storage) + * 1 : success *------------------------------------------*/ -int storage_guild_storagesaved(int guild_id) +static int storage_guild_storagesaved(int guild_id) { struct guild_storage *stor; @@ -790,7 +790,7 @@ int storage_guild_storagesaved(int guild_id) } //Close storage for sd and save it -int storage_guild_storageclose(struct map_session_data* sd) +static int storage_guild_storageclose(struct map_session_data *sd) { struct guild_storage *stor; @@ -810,7 +810,7 @@ int storage_guild_storageclose(struct map_session_data* sd) return 0; } -int storage_guild_storage_quit(struct map_session_data* sd, int flag) +static int storage_guild_storage_quit(struct map_session_data *sd, int flag) { struct guild_storage *stor; @@ -839,14 +839,14 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) return 0; } -void do_init_gstorage(bool minimal) +static void do_init_gstorage(bool minimal) { if (minimal) return; gstorage->db = idb_alloc(DB_OPT_RELEASE_DATA); } -void do_final_gstorage(void) +static void do_final_gstorage(void) { db_destroy(gstorage->db); } diff --git a/src/map/trade.c b/src/map/trade.c index 316ed14d9..d4f846d19 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -40,13 +40,13 @@ #include <stdio.h> #include <string.h> -struct trade_interface trade_s; +static struct trade_interface trade_s; struct trade_interface *trade; /*========================================== * Initiates a trade request. *------------------------------------------*/ -void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd) +static void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd) { nullpo_retv(sd); @@ -118,7 +118,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta * Weird enough, the client should only send 3/4 * and the server is the one that can reply 0~2 *------------------------------------------*/ -void trade_tradeack(struct map_session_data *sd, int type) +static void trade_tradeack(struct map_session_data *sd, int type) { struct map_session_data *tsd; nullpo_retv(sd); @@ -192,7 +192,7 @@ void trade_tradeack(struct map_session_data *sd, int type) * @retval 0 The trade can continue * @retval 1 Hack attempt **/ -int impossible_trade_check(struct map_session_data *sd) +static int impossible_trade_check(struct map_session_data *sd) { struct item inventory[MAX_INVENTORY]; char message_to_gm[200]; @@ -253,7 +253,7 @@ int impossible_trade_check(struct map_session_data *sd) /*========================================== * Checks if trade is possible (against zeny limits, inventory limits, etc) *------------------------------------------*/ -int trade_check(struct map_session_data *sd, struct map_session_data *tsd) +static int trade_check(struct map_session_data *sd, struct map_session_data *tsd) { struct item inventory[MAX_INVENTORY]; struct item inventory2[MAX_INVENTORY]; @@ -343,7 +343,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) /*========================================== * Adds an item/qty to the trade window *------------------------------------------*/ -void trade_tradeadditem(struct map_session_data *sd, short index, short amount) +static void trade_tradeadditem(struct map_session_data *sd, short index, short amount) { struct map_session_data *target_sd; struct item *item; @@ -438,7 +438,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) /*========================================== * Adds the specified amount of zeny to the trade window *------------------------------------------*/ -void trade_tradeaddzeny(struct map_session_data* sd, int amount) +static void trade_tradeaddzeny(struct map_session_data *sd, int amount) { struct map_session_data* target_sd; nullpo_retv(sd); @@ -464,7 +464,7 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount) /*========================================== * 'Ok' button on the trade window is pressed. *------------------------------------------*/ -void trade_tradeok(struct map_session_data *sd) +static void trade_tradeok(struct map_session_data *sd) { struct map_session_data *target_sd; @@ -485,7 +485,7 @@ void trade_tradeok(struct map_session_data *sd) /*========================================== * 'Cancel' is pressed. (or trade was force-canceled by the code) *------------------------------------------*/ -void trade_tradecancel(struct map_session_data *sd) +static void trade_tradecancel(struct map_session_data *sd) { struct map_session_data *target_sd; int trade_i; @@ -545,7 +545,7 @@ void trade_tradecancel(struct map_session_data *sd) /*========================================== * lock sd and tsd trade data, execute the trade, clear, then save players *------------------------------------------*/ -void trade_tradecommit(struct map_session_data *sd) +static void trade_tradecommit(struct map_session_data *sd) { struct map_session_data *tsd; int trade_i; diff --git a/src/map/unit.c b/src/map/unit.c index 36e095b4b..4f9aa0bf8 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -62,10 +62,10 @@ #include <stdlib.h> #include <string.h> -const short dirx[8]={0,-1,-1,-1,0,1,1,1}; -const short diry[8]={1,1,0,-1,-1,-1,0,1}; +const short dirx[8] = { 0, -1, -1, -1, 0, 1, 1, 1 }; +const short diry[8] = { 1, 1, 0, -1, -1, -1, 0, 1 }; -struct unit_interface unit_s; +static struct unit_interface unit_s; struct unit_interface *unit; /** @@ -74,7 +74,7 @@ struct unit_interface *unit; * @param bl block_list to process * @return a pointer to the given object's unit_data **/ -struct unit_data* unit_bl2ud(struct block_list *bl) +static struct unit_data *unit_bl2ud(struct block_list *bl) { if (bl == NULL) return NULL; if (bl->type == BL_PC) return &BL_UCAST(BL_PC, bl)->ud; @@ -94,7 +94,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl) * @param bl block_list to process * @return a pointer to the given object's unit_data */ -struct unit_data *unit_bl2ud2(struct block_list *bl) +static struct unit_data *unit_bl2ud2(struct block_list *bl) { struct npc_data *nd = BL_CAST(BL_NPC, bl); if (nd != NULL && nd->ud == &npc->base_ud) { @@ -105,7 +105,7 @@ struct unit_data *unit_bl2ud2(struct block_list *bl) return unit->bl2ud(bl); } -int unit_walktoxy_sub(struct block_list *bl) +static int unit_walktoxy_sub(struct block_list *bl) { int i; struct walkpath_data wpd; @@ -176,7 +176,7 @@ int unit_walktoxy_sub(struct block_list *bl) * @param data: Not used * @return 1: Success 0: Fail (No valid bl) */ -int unit_step_timer(int tid, int64 tick, int id, intptr_t data) +static int unit_step_timer(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl; struct unit_data *ud; @@ -236,7 +236,7 @@ int unit_step_timer(int tid, int64 tick, int id, intptr_t data) return 1; } -int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) +static int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { int i; int x,y,dx,dy; @@ -488,7 +488,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) +static int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = map->id2bl(id); @@ -503,7 +503,7 @@ int unit_delay_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) //&2 -> force walking //&4 -> Delay walking if the reason you can't walk is the canwalk delay //&8 -> Search for an unoccupied cell and cancel if none available -int unit_walktoxy( struct block_list *bl, short x, short y, int flag) +static int unit_walktoxy(struct block_list *bl, short x, short y, int flag) { struct unit_data* ud = NULL; struct status_change* sc = NULL; @@ -564,7 +564,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag) } //To set Mob's CHASE/FOLLOW states (shouldn't be done if there's no path to reach) -static inline void set_mobstate(struct block_list* bl, int flag) +static inline void set_mobstate(struct block_list *bl, int flag) { struct mob_data* md = BL_CAST(BL_MOB,bl); @@ -572,7 +572,7 @@ static inline void set_mobstate(struct block_list* bl, int flag) md->state.skillstate = md->state.aggressive ? MSS_FOLLOW : MSS_RUSH; } -int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) +static int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = map->id2bl(id); struct unit_data *ud = bl?unit->bl2ud(bl):NULL; @@ -590,7 +590,7 @@ int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) // Chases a tbl. If the flag&1, use hard-path seek, // if flag&2, start attacking upon arrival within range, otherwise just walk to that character. -int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int flag) +static int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int flag) { struct unit_data *ud = NULL; struct status_change *sc = NULL; @@ -652,7 +652,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int * Called by unit_run when an object was hit * @param sd Required only when using SC_WUGDASH **/ -void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type) +static void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type) { int lv; struct unit_data *ud; @@ -687,7 +687,7 @@ void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_se * @retval true Finished running * @retval false Hit an object/Couldn't run **/ -bool unit_run(struct block_list *bl, struct map_session_data *sd, enum sc_type type) +static bool unit_run(struct block_list *bl, struct map_session_data *sd, enum sc_type type) { struct status_change *sc; short to_x,to_y,dir_x,dir_y; @@ -748,7 +748,7 @@ bool unit_run(struct block_list *bl, struct map_session_data *sd, enum sc_type t } //Makes bl attempt to run dist cells away from target. Uses hard-paths. -int unit_escape(struct block_list *bl, struct block_list *target, short dist) +static int unit_escape(struct block_list *bl, struct block_list *target, short dist) { uint8 dir; nullpo_ret(bl); @@ -759,7 +759,7 @@ int unit_escape(struct block_list *bl, struct block_list *target, short dist) } //Instant warp function. -int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) +static int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) { short dx,dy; uint8 dir; @@ -823,7 +823,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool return 1; } -int unit_setdir(struct block_list *bl,unsigned char dir) +static int unit_setdir(struct block_list *bl, unsigned char dir) { struct unit_data *ud; nullpo_ret(bl ); @@ -836,7 +836,7 @@ int unit_setdir(struct block_list *bl,unsigned char dir) return 0; } -uint8 unit_getdir(struct block_list *bl) +static uint8 unit_getdir(struct block_list *bl) { struct unit_data *ud; nullpo_ret(bl); @@ -852,7 +852,7 @@ uint8 unit_getdir(struct block_list *bl) // map cell restrictions are respected. // flag: // &1 Do not send position update packets. -int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) +static int unit_blown(struct block_list *bl, int dx, int dy, int count, int flag) { if(count) { struct map_session_data* sd; @@ -918,7 +918,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) //Warps a unit/ud to a given map/position. //In the case of players, pc->setpos is used. //it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks. -int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) +static int unit_warp(struct block_list *bl, short m, short x, short y, clr_type type) { struct unit_data *ud; nullpo_ret(bl); @@ -994,7 +994,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type) * Flag values: @see unit_stopwalking_flag. * Upper bytes may be used for other purposes depending on the unit type. *------------------------------------------*/ -int unit_stop_walking(struct block_list *bl, int flag) +static int unit_stop_walking(struct block_list *bl, int flag) { struct unit_data *ud; const struct TimerData* td; @@ -1037,7 +1037,7 @@ int unit_stop_walking(struct block_list *bl, int flag) return 1; } -int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv) +static int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv) { return unit->skilluse_id2( src, target_id, skill_id, skill_lv, @@ -1046,7 +1046,7 @@ int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uin ); } -int unit_is_walking(struct block_list *bl) +static int unit_is_walking(struct block_list *bl) { struct unit_data *ud = unit->bl2ud(bl); nullpo_ret(bl); @@ -1057,7 +1057,7 @@ int unit_is_walking(struct block_list *bl) /*========================================== * Determines if the bl can move based on status changes. [Skotlex] *------------------------------------------*/ -int unit_can_move(struct block_list *bl) +static int unit_can_move(struct block_list *bl) { struct map_session_data *sd; struct unit_data *ud; @@ -1169,7 +1169,7 @@ int unit_can_move(struct block_list *bl) * Resume running after a walk delay *------------------------------------------*/ -int unit_resume_running(int tid, int64 tick, int id, intptr_t data) +static int unit_resume_running(int tid, int64 tick, int id, intptr_t data) { struct unit_data *ud = (struct unit_data *)data; struct map_session_data *sd = map->id2sd(id); @@ -1194,7 +1194,7 @@ int unit_resume_running(int tid, int64 tick, int id, intptr_t data) * if type is 0, this is a damage induced delay: if previous delay is active, do not change it. * if type is 1, this is a skill induced delay: walk-delay may only be increased, not decreased. *------------------------------------------*/ -int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) +static int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) { struct unit_data *ud = unit->bl2ud(bl); if (delay <= 0 || !ud) return 0; @@ -1236,7 +1236,7 @@ int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) } //-------------- stop here -int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) +static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) { struct unit_data *ud; struct status_data *tstatus; @@ -1674,7 +1674,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui return 1; } -int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv) +static int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv) { return unit->skilluse_pos2( src, skill_x, skill_y, skill_id, skill_lv, @@ -1683,7 +1683,7 @@ int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint ); } -int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) +static int unit_skilluse_pos2(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel) { struct map_session_data *sd = NULL; struct unit_data *ud = NULL; @@ -1827,7 +1827,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui /*======================================== * update a block's attack target *----------------------------------------*/ -int unit_set_target(struct unit_data* ud, int target_id) +static int unit_set_target(struct unit_data *ud, int target_id) { nullpo_ret(ud); @@ -1848,7 +1848,7 @@ int unit_set_target(struct unit_data* ud, int target_id) * Stop a unit's attacks * @param bl: Object to stop */ -void unit_stop_attack(struct block_list *bl) +static void unit_stop_attack(struct block_list *bl) { struct unit_data *ud; nullpo_retv(bl); @@ -1870,7 +1870,7 @@ void unit_stop_attack(struct block_list *bl) * Stop a unit's step action * @param bl: Object to stop */ -void unit_stop_stepaction(struct block_list *bl) +static void unit_stop_stepaction(struct block_list *bl) { struct unit_data *ud; nullpo_retv(bl); @@ -1892,7 +1892,7 @@ void unit_stop_stepaction(struct block_list *bl) } //Means current target is unattackable. For now only unlocks mobs. -int unit_unattackable(struct block_list *bl) +static int unit_unattackable(struct block_list *bl) { struct unit_data *ud = unit->bl2ud(bl); nullpo_ret(bl); @@ -1913,7 +1913,7 @@ int unit_unattackable(struct block_list *bl) * Attack request * If type is an ongoing attack *------------------------------------------*/ -int unit_attack(struct block_list *src, int target_id, int continuous) +static int unit_attack(struct block_list *src, int target_id, int continuous) { struct block_list *target; struct unit_data *ud; @@ -1983,7 +1983,7 @@ int unit_attack(struct block_list *src, int target_id, int continuous) //Cancels an ongoing combo, resets attackable time and restarts the //attack timer to resume attacking after amotion time. [Skotlex] -int unit_cancel_combo(struct block_list *bl) +static int unit_cancel_combo(struct block_list *bl) { struct unit_data *ud; @@ -2006,7 +2006,7 @@ int unit_cancel_combo(struct block_list *bl) /*========================================== * *------------------------------------------*/ -bool unit_can_reach_pos(struct block_list *bl,int x,int y, int easy) +static bool unit_can_reach_pos(struct block_list *bl, int x, int y, int easy) { nullpo_retr(false, bl); @@ -2019,7 +2019,7 @@ bool unit_can_reach_pos(struct block_list *bl,int x,int y, int easy) /*========================================== * *------------------------------------------*/ -bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y) +static bool unit_can_reach_bl(struct block_list *bl, struct block_list *tbl, int range, int easy, short *x, short *y) { short dx,dy; struct walkpath_data wpd; @@ -2070,7 +2070,7 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, /*========================================== * Calculates position of Pet/Mercenary/Homunculus/Elemental *------------------------------------------*/ -int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) +static int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) { int dx, dy, x, y; struct unit_data *ud = unit->bl2ud(bl); @@ -2124,7 +2124,7 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir) /*========================================== * Continuous Attack (function timer) *------------------------------------------*/ -int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) +static int unit_attack_timer_sub(struct block_list *src, int tid, int64 tick) { struct block_list *target; struct unit_data *ud; @@ -2273,7 +2273,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) return 1; } -int unit_attack_timer(int tid, int64 tick, int id, intptr_t data) +static int unit_attack_timer(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl; bl = map->id2bl(id); @@ -2287,7 +2287,7 @@ int unit_attack_timer(int tid, int64 tick, int id, intptr_t data) * flag&1: Cast-Cancel invoked. * flag&2: Cancel only if skill is can be cancel. *------------------------------------------*/ -int unit_skillcastcancel(struct block_list *bl,int type) +static int unit_skillcastcancel(struct block_list *bl, int type) { struct map_session_data *sd = NULL; struct unit_data *ud = unit->bl2ud( bl); @@ -2345,7 +2345,7 @@ int unit_skillcastcancel(struct block_list *bl,int type) } // unit_data initialization process -void unit_dataset(struct block_list *bl) +static void unit_dataset(struct block_list *bl) { struct unit_data *ud = unit->bl2ud(bl); nullpo_retv(ud); @@ -2354,7 +2354,7 @@ void unit_dataset(struct block_list *bl) ud->bl = bl; } -void unit_init_ud(struct unit_data *ud) +static void unit_init_ud(struct unit_data *ud) { nullpo_retv(ud); @@ -2371,7 +2371,7 @@ void unit_init_ud(struct unit_data *ud) /*========================================== * Counts the number of units attacking 'bl' *------------------------------------------*/ -int unit_counttargeted(struct block_list* bl) +static int unit_counttargeted(struct block_list *bl) { struct unit_data* ud; if (bl && (ud = unit->bl2ud(bl)) != NULL) @@ -2382,7 +2382,7 @@ int unit_counttargeted(struct block_list* bl) /*========================================== * *------------------------------------------*/ -int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2) +static int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2) { nullpo_ret(target); @@ -2395,7 +2395,7 @@ int unit_fixdamage(struct block_list *src, struct block_list *target, int sdelay /*========================================== * To change the size of the char (player or mob only) *------------------------------------------*/ -int unit_changeviewsize(struct block_list *bl,short size) +static int unit_changeviewsize(struct block_list *bl, short size) { nullpo_ret(bl); @@ -2419,7 +2419,7 @@ int unit_changeviewsize(struct block_list *bl,short size) * Otherwise it is assumed bl is being warped. * On-Kill specific stuff is not performed here, look at status->damage for that. *------------------------------------------*/ -int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func) +static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func) { struct unit_data *ud = unit->bl2ud(bl); struct status_change *sc = status->get_sc(bl); @@ -2665,7 +2665,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i return 1; } -void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) +static void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) { nullpo_retv(sd); unit->remove_map(&sd->bl,clrtype,ALC_MARK); @@ -2683,7 +2683,7 @@ void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) unit->remove_map(&sd->ed->bl, clrtype, ALC_MARK); } -void unit_free_pc(struct map_session_data *sd) +static void unit_free_pc(struct map_session_data *sd) { nullpo_retv(sd); if (sd->pd) unit->free(&sd->pd->bl,CLR_OUTSIGHT); @@ -2697,7 +2697,7 @@ void unit_free_pc(struct map_session_data *sd) * Function to free all related resources to the bl * if unit is on map, it is removed using the clrtype specified *------------------------------------------*/ -int unit_free(struct block_list *bl, clr_type clrtype) +static int unit_free(struct block_list *bl, clr_type clrtype) { struct unit_data *ud = unit->bl2ud( bl ); nullpo_ret(bl); @@ -2948,7 +2948,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) return 0; } -int do_init_unit(bool minimal) +static int do_init_unit(bool minimal) { if (minimal) return 0; @@ -2961,7 +2961,7 @@ int do_init_unit(bool minimal) return 0; } -int do_final_unit(void) +static int do_final_unit(void) { // nothing to do return 0; diff --git a/src/map/vending.c b/src/map/vending.c index 9a35bdccb..fb8b22729 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -40,7 +40,7 @@ #include <stdio.h> #include <string.h> -struct vending_interface vending_s; +static struct vending_interface vending_s; struct vending_interface *vending; /// Returns an unique vending shop id. @@ -52,7 +52,7 @@ static inline unsigned int getid(void) /*========================================== * Close shop *------------------------------------------*/ -void vending_closevending(struct map_session_data* sd) +static void vending_closevending(struct map_session_data *sd) { nullpo_retv(sd); @@ -66,7 +66,7 @@ void vending_closevending(struct map_session_data* sd) /*========================================== * Request a shop's item list *------------------------------------------*/ -void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) +static void vending_vendinglistreq(struct map_session_data *sd, unsigned int id) { struct map_session_data* vsd; nullpo_retv(sd); @@ -89,7 +89,7 @@ void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) /*========================================== * Purchase item(s) from a shop *------------------------------------------*/ -void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count) +static void vending_purchasereq(struct map_session_data *sd, int aid, unsigned int uid, const uint8 *data, int count) { int i, j, cursor, w, new_ = 0, blank, vend_list[MAX_VENDING]; int64 z; @@ -245,7 +245,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, * Open shop * data := {<index>.w <amount>.w <value>.l}[count] *------------------------------------------*/ -void vending_openvending(struct map_session_data* sd, const char* message, const uint8* data, int count) +static void vending_openvending(struct map_session_data *sd, const char *message, const uint8 *data, int count) { int i, j; int vending_skill_lvl; @@ -315,7 +315,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const /// Checks if an item is being sold in given player's vending. -bool vending_search(struct map_session_data* sd, unsigned short nameid) +static bool vending_search(struct map_session_data *sd, unsigned short nameid) { int i; @@ -335,7 +335,7 @@ bool vending_search(struct map_session_data* sd, unsigned short nameid) /// Searches for all items in a vending, that match given ids, price and possible cards. /// @return Whether or not the search should be continued. -bool vending_searchall(struct map_session_data* sd, const struct s_search_store_search* s) +static bool vending_searchall(struct map_session_data *sd, const struct s_search_store_search *s) { int i, c, slot; unsigned int idx, cidx; @@ -389,12 +389,12 @@ bool vending_searchall(struct map_session_data* sd, const struct s_search_store_ return true; } -void final(void) +static void final(void) { db_destroy(vending->db); } -void init(bool minimal) +static void init(bool minimal) { vending->db = idb_alloc(DB_OPT_BASE); vending->next_id = 0; diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index f6c799934..fa7d5be93 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -49,10 +49,10 @@ function run_server { echo "Running: $1 --run-once $2" $1 --run-once $2 2>runlog.txt export errcode=$? - export teststr=$(cat runlog.txt) + export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then echo "Errors found in running server $1." - cat runlog.txt + head -c 10000 runlog.txt aborterror "Errors found in running server $1." else echo "No errors found for server $1." @@ -67,10 +67,10 @@ function run_test { echo "Running: test_$1" ./test_$1 2>runlog.txt export errcode=$? - export teststr=$(cat runlog.txt) + export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then echo "Errors found in running test $1." - cat runlog.txt + head -c 10000 runlog.txt aborterror "Errors found in running test $1." else echo "No errors found for test $1." |