diff options
author | Haru <haru@dotalux.com> | 2018-06-28 03:17:32 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2018-07-01 21:09:26 +0200 |
commit | a675e06c38ec4e31a2758435a582b58a2199cfc4 (patch) | |
tree | a4bf91c20da434eef97f55f7427ccbf034c5e285 /src/map/party.c | |
parent | b7e6439f0c788ceacc567fbb017d3c7f09913f78 (diff) | |
download | hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.gz hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.bz2 hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.tar.xz hercules-a675e06c38ec4e31a2758435a582b58a2199cfc4.zip |
Change functions to static where possible (Part 4 - map)
This fixes issues with plugins defining symbols with the same names
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/party.c')
-rw-r--r-- | src/map/party.c | 131 |
1 files changed, 75 insertions, 56 deletions
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; /* */ |