فهرست منبع

- Added an error report and correction when the map server receives a guild from the char-server with more guild members than MAX_GUILD.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7072 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 سال پیش
والد
کامیت
2096550252
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 2 0
      Changelog-Trunk.txt
  2. 8 1
      src/map/guild.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.
 
 2006/06/09
+	* Added an error report and correction when the map server receives a guild
+	  from the char-server with more guild members than MAX_GUILD. [Skotlex]
 	* Changed the interval between waterballs back to 125 [MasterOfMuppets]
 	* Fixed a typo in char_sql/char.c, thanks to Euph [MasterOfMuppets]
 2006/06/08

+ 8 - 1
src/map/guild.c

@@ -566,6 +566,13 @@ int guild_recv_info(struct guild *sg)
 		before=*g;
 	memcpy(g,sg,sizeof(struct guild));
 
+	if(g->max_member > MAX_GUILD)
+	{
+		if (battle_config.error_log)
+			ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD);
+		g->max_member = MAX_GUILD;
+	}
+	
 	for(i=bm=m=0;i<g->max_member;i++){	// sd‚Ì�Ý’è‚Æ�l�”‚ÌŠm”F
 		if(g->member[i].account_id>0){
 			struct map_session_data *sd = map_id2sd(g->member[i].account_id);
@@ -962,7 +969,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
 
 	//Send XY dot updates. [Skotlex]
 	//Moved from guild_send_memberinfoshort [LuzZza]
-	for(i=0; i < MAX_GUILD; i++) {
+	for(i=0; i < g->max_member; i++) {
 		
 		if(!g->member[i].sd || i == idx ||
 			g->member[i].sd->bl.m != g->member[idx].sd->bl.m)