diff options
Diffstat (limited to 'src/map/party.c')
-rw-r--r-- | src/map/party.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/map/party.c b/src/map/party.c index dbb7b6ae2..a1fb5579e 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -58,6 +58,9 @@ struct party_interface *party; * 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) { + nullpo_retv(member); + nullpo_retv(sd); + member->account_id = sd->status.account_id; member->char_id = sd->status.char_id; safestrncpy(member->name, sd->status.name, NAME_LENGTH); @@ -80,6 +83,7 @@ int party_getmemberid(struct party_data *p, struct map_session_data *sd) { int member_id; nullpo_retr(INDEX_NOT_FOUND, p); + nullpo_retr(INDEX_NOT_FOUND, sd); if (sd == NULL) return INDEX_NOT_FOUND; // no player @@ -162,6 +166,9 @@ int party_create(struct map_session_data *sd, const char *name,int item,int item struct party_member leader; char tname[NAME_LENGTH]; + nullpo_retr(0, sd); + nullpo_retr(0, name); + safestrncpy(tname, name, NAME_LENGTH); trim(tname); @@ -228,6 +235,7 @@ int party_recv_noinfo(int party_id, int char_id) { void party_check_state(struct party_data *p) { int i; + nullpo_retv(p); memset(&p->state, 0, sizeof(p->state)); for (i = 0; i < MAX_PARTY; i ++) { if (!p->party.member[i].online) continue; //Those not online shouldn't apart to skill usage and all that. @@ -407,6 +415,8 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag) { struct map_session_data* tsd; struct party_member member; + nullpo_retv(sd); + if( sd->party_invite != party_id ) {// forged sd->party_invite = 0; @@ -436,8 +446,11 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag) { //- Player must be authed/active and belong to a party before calling this method void party_member_joined(struct map_session_data *sd) { - struct party_data* p = party->search(sd->status.party_id); + struct party_data* p; int i; + + nullpo_retv(sd); + p = party->search(sd->status.party_id); if (!p) { party->request_info(sd->status.party_id, sd->status.char_id); return; @@ -536,6 +549,7 @@ int party_removemember(struct map_session_data* sd, int account_id, const char * if( !p->party.member[i].leader ) return 0; // only party leader may remove members + nullpo_retr(0, name); ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && strncmp(p->party.member[i].name,name,NAME_LENGTH) == 0 ); if( i == MAX_PARTY ) return 0; // no such char in party @@ -550,6 +564,7 @@ int party_leave(struct map_session_data *sd) struct party_data *p; int i; + nullpo_ret(sd); p = party->search(sd->status.party_id); if( p == NULL ) return 0; @@ -743,6 +758,8 @@ void party_send_movemap(struct map_session_data *sd) { struct party_data *p; + nullpo_retv(sd); + if( sd->status.party_id==0 ) return; @@ -782,6 +799,8 @@ int party_send_logout(struct map_session_data *sd) struct party_data *p; int i; + nullpo_ret(sd); + if(!sd->status.party_id) return 0; @@ -800,9 +819,12 @@ int party_send_logout(struct map_session_data *sd) int party_send_message(struct map_session_data *sd, const char *mes) { - int len = (int)strlen(mes); + int len; nullpo_ret(sd); + nullpo_ret(mes); + + len = (int)strlen(mes); if (sd->status.party_id == 0) return 0; @@ -847,6 +869,8 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id return 0; //Unknown case? } + nullpo_ret(sd); + for(i=0;i<MAX_PARTY;i++){ if ((p_sd = p->data[i].sd) == NULL) continue; @@ -939,6 +963,7 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b #endif nullpo_ret(p); + nullpo_ret(src); // count the number of players eligible for exp sharing for (i = c = 0; i < MAX_PARTY; i++) { @@ -991,8 +1016,12 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i { struct map_session_data *target = NULL; int i; + + nullpo_ret(item_data); + if (p && p->party.item&2 && (first_charid || !(battle_config.party_share_type&1))) { + nullpo_ret(sd); //item distribution to party members. if (battle_config.party_share_type&2) { //Round Robin @@ -1054,6 +1083,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i int party_send_dot_remove(struct map_session_data *sd) { + nullpo_ret(sd); if (sd->status.party_id) clif->party_xy_remove(sd); return 0; @@ -1069,6 +1099,7 @@ int party_sub_count(struct block_list *bl, va_list ap) nullpo_ret(bl); Assert_ret(bl->type == BL_PC); sd = BL_UCCAST(BL_PC, bl); + nullpo_ret(sd); if (sd->state.autotrade) return 0; @@ -1181,6 +1212,9 @@ void party_recruit_register(struct map_session_data *sd, short level, const char #ifdef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; + nullpo_retv(sd); + nullpo_retv(notice); + pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id); if( pb_ad == NULL ) @@ -1211,6 +1245,9 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi struct party_booking_ad_info *pb_ad; int i; + nullpo_retv(sd); + nullpo_retv(job); + pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id); if( pb_ad == NULL ) { @@ -1244,6 +1281,7 @@ void party_recruit_update(struct map_session_data *sd, const char *notice) { #ifdef PARTY_RECRUIT struct party_booking_ad_info *pb_ad; + nullpo_retv(sd); pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id); if( pb_ad == NULL ) @@ -1265,6 +1303,9 @@ void party_booking_update(struct map_session_data *sd, short* job) { int i; struct party_booking_ad_info *pb_ad; + nullpo_retv(sd); + nullpo_retv(job); + pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id); if( pb_ad == NULL ) @@ -1291,6 +1332,7 @@ void party_recruit_search(struct map_session_data *sd, short level, short mapid, bool more_result = false; struct DBIterator *iter = db_iterator(party->booking_db); + nullpo_retv(sd); memset(result_list, 0, sizeof(result_list)); for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) ) @@ -1322,6 +1364,8 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, bool more_result = false; struct DBIterator *iter = db_iterator(party->booking_db); + nullpo_retv(sd); + memset(result_list, 0, sizeof(result_list)); for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) ) { @@ -1357,6 +1401,8 @@ bool party_booking_delete(struct map_session_data *sd) { struct party_booking_ad_info* pb_ad; + nullpo_retr(false, sd); + if((pb_ad = (struct party_booking_ad_info*)idb_get(party->booking_db, sd->status.char_id))!=NULL) { #ifdef PARTY_RECRUIT |