From 569c7674349ba86822b648060ac01de129c31d37 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Sun, 28 Jun 2009 12:43:57 +0200 Subject: Really fix crash on adding offline partner. Derived from ea stable. --- src/map/party.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/map/party.c b/src/map/party.c index 73f85c4..7f5605c 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -251,10 +251,12 @@ int party_reply_invite(struct map_session_data *sd,int account_id,int flag) int party_member_added(int party_id,int account_id,int flag) { struct map_session_data *sd= map_id2sd(account_id),*sd2; - if(sd==NULL || flag==0){ - if(battle_config.error_log) - printf("party: member added error %d is not online\n",account_id); - intif_party_leave(party_id,account_id); // キャラ側に登録できなかったため脱退要求を出す + if(sd == NULL){ + if (flag == 0) { + if(battle_config.error_log) + printf("party: member added error %d is not online\n",account_id); + intif_party_leave(party_id,account_id); // キャラ側に登録できなかったため脱退要求を出す + } return 0; } sd2=map_id2sd(sd->party_invite_account); -- cgit v1.2.3-70-g09d2 From 381151eb83dbfb753b6cbb031546fd2d4a828f69 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Sun, 28 Jun 2009 14:34:18 +0200 Subject: Check party exists on add, reset party info so it shows on adding member. Inspired by ea stable. --- src/map/party.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/map/party.c b/src/map/party.c index 7f5605c..feacc25 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -251,6 +251,8 @@ int party_reply_invite(struct map_session_data *sd,int account_id,int flag) int party_member_added(int party_id,int account_id,int flag) { struct map_session_data *sd= map_id2sd(account_id),*sd2; + struct party *p=party_search(party_id); + if(sd == NULL){ if (flag == 0) { if(battle_config.error_log) @@ -262,23 +264,31 @@ int party_member_added(int party_id,int account_id,int flag) sd2=map_id2sd(sd->party_invite_account); sd->party_invite=0; sd->party_invite_account=0; - + + if (p==NULL) { + printf("party_member_added: party %d not found.\n",party_id); + intif_party_leave(party_id,account_id); + return 0; + } + if(flag==1){ // 失敗 if( sd2!=NULL ) clif_party_inviteack(sd2,sd->status.name,0); return 0; } - - // 成功 + + // 成功 sd->party_sended=0; sd->status.party_id=party_id; - + if( sd2!=NULL) clif_party_inviteack(sd2,sd->status.name,2); // いちおう競合確認 party_check_conflict(sd); + party_send_xy_clear(p); + return 0; } // パーティ除名要求 -- cgit v1.2.3-70-g09d2