Переглянути джерело

Fix for issue #3540 "IM_NONE idle timer" (#3550)

* Fix for issue #3540 "IM_NONE idle timer"

* Cleaned redundant map_getmapdata

Thanks to @aleos89 !
Atemo 6 роки тому
батько
коміт
7d8530e3b1
1 змінених файлів з 10 додано та 9 видалено
  1. 10 9
      src/map/pc.cpp

+ 10 - 9
src/map/pc.cpp

@@ -5493,22 +5493,23 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
 
 	if( sd->state.changemap ) { // Misc map-changing settings
 		int i;
+		unsigned short instance_id = map_getmapdata(sd->bl.m)->instance_id;
 
-		if(map_getmapdata(sd->bl.m)->instance_id && !mapdata->instance_id) {
-			bool instance_found = false;
+		if (instance_id && instance_id != mapdata->instance_id) {
 			struct party_data *p = NULL;
 			struct guild *g = NULL;
+			struct clan *cd = NULL;
 
-			if (sd->instance_id) {
+			if (sd->instance_id)
 				instance_delusers(sd->instance_id);
-				instance_found = true;
-			}
-			if (!instance_found && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id) {
+			else if (sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id)
 				instance_delusers(p->instance_id);
-				instance_found = true;
-			}
-			if (!instance_found && sd->status.guild_id && (g = guild_search(sd->status.guild_id)) != NULL && g->instance_id)
+			else if (sd->status.guild_id && (g = guild_search(sd->status.guild_id)) != NULL && g->instance_id)
 				instance_delusers(g->instance_id);
+			else if (sd->status.clan_id && (cd = clan_search(sd->status.clan_id)) != NULL && cd->instance_id)
+				instance_delusers(cd->instance_id);
+			else
+				instance_delusers(instance_id);
 		}
 
 		sd->state.pmap = sd->bl.m;