Sfoglia il codice sorgente

Merged two similar conditions on mapchange

Lemongrass3110 7 anni fa
parent
commit
6f01321b27
1 ha cambiato i file con 18 aggiunte e 16 eliminazioni
  1. 18 16
      src/map/pc.cpp

+ 18 - 16
src/map/pc.cpp

@@ -5459,24 +5459,26 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
 	sd->state.warping = 1;
 	sd->state.workinprogress = WIP_DISABLE_NONE;
 
-	if(map[sd->bl.m].instance_id && sd->state.changemap && !map[m].instance_id) {
-		bool instance_found = false;
-		struct party_data *p = NULL;
-		struct guild *g = NULL;
-
-		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) {
-			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)
-			instance_delusers(g->instance_id);
-	}
 	if( sd->state.changemap ) { // Misc map-changing settings
 		int i;
+
+		if(map[sd->bl.m].instance_id && !map[m].instance_id) {
+			bool instance_found = false;
+			struct party_data *p = NULL;
+			struct guild *g = NULL;
+
+			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) {
+				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)
+				instance_delusers(g->instance_id);
+		}
+
 		sd->state.pmap = sd->bl.m;
 		if (sd->sc.count) { // Cancel some map related stuff.
 			if (sd->sc.data[SC_JAILED])