فهرست منبع

Fixed a case where a dangling pointer was formed when a person was invited to a party immediately after creating their own. (bugreport:1180)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12518 54d463be-8e91-2dee-dedb-b68131a5f0ec
Kevin 17 سال پیش
والد
کامیت
39a6aabcd6
2فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 2 0
      Changelog-Trunk.txt
  2. 7 1
      src/map/party.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/04/06
+	* Fixed a case where a dangling pointer was formed when a person was
+	- invited to a party immediately after creating their own. (r12518) [Kevin]
 	* Sight rasher now affects the wizard's own and other's icewalls. (r12516) [Kevin]
 	* Sight rasher, sight blaster, and arrow shower are now the only
 	- three skills that will affect traps. (r12516) [Kevin]

+ 7 - 1
src/map/party.c

@@ -114,6 +114,9 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
 		return 0; // "already in a party"
 	}
 
+	//Temporarily set to -1 so cannot be spam invited
+	sd->status.party_id = -1;
+
 	party_fill_member(&leader, sd);
 	leader.leader = 1;
 
@@ -129,6 +132,8 @@ void party_created(int account_id,int char_id,int fail,int party_id,char *name)
 
 	if (!sd || sd->status.char_id != char_id)
 	{	//Character logged off before creation ack?
+		if(sd)
+			sd->status.party_id = 0;
 		if (!fail) //break up party since player could not be added to it.
 			intif_party_leave(party_id,account_id,char_id);
 		return;
@@ -139,6 +144,7 @@ void party_created(int account_id,int char_id,int fail,int party_id,char *name)
 		clif_party_created(sd,0); //Success message
 		//We don't do any further work here because the char-server sends a party info packet right after creating the party.
 	} else {
+		sd->status.party_id = 0;
 		clif_party_created(sd,1); // "party name already exists"
 	}
 }
@@ -299,7 +305,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
 		return 0;
 	}
 
-	if( tsd->status.party_id>0 || tsd->party_invite>0 ){
+	if( tsd->status.party_id!=0 || tsd->party_invite>0){
 		clif_party_inviteack(sd,tsd->status.name,0);
 		return 0;
 	}