Explorar el Código

Resolved a potential map crash on instance destruction (fixes #1333)
* Adjusted the instance destruction checks on party and guild breaks.

aleos89 hace 9 años
padre
commit
5ef2000bd9
Se han modificado 3 ficheros con 6 adiciones y 10 borrados
  1. 1 3
      src/map/guild.c
  2. 4 4
      src/map/instance.c
  3. 1 3
      src/map/party.c

+ 1 - 3
src/map/guild.c

@@ -1852,10 +1852,8 @@ int guild_break(struct map_session_data *sd,char *name) {
 		return 0;
 	}
 
-	if (g->instance_id) {
-		instance_data[g->instance_id].owner_id = 0;
+	if (g->instance_id)
 		instance_destroy(g->instance_id);
-	}
 
 	/* Regardless of char server allowing it, we clear the guild master's auras */
 	if ((ud = unit_bl2ud(&sd->bl))) {

+ 4 - 4
src/map/instance.c

@@ -579,7 +579,7 @@ int instance_destroy(unsigned short instance_id)
 
 				for(i = 0; i < instance_wait.count; i++)
 					if(instance_data[instance_wait.id[i]].state == INSTANCE_IDLE)
-						if ((mode == IM_CHAR && sd != NULL) || (mode == IM_PARTY && p != NULL) || (mode == IM_GUILD && g != NULL))
+						if ((mode == IM_CHAR && sd) || (mode == IM_PARTY && p) || (mode == IM_GUILD && g))
 							clif_instance_changewait(instance_id, i + 1);
 
 				if(instance_wait.count)
@@ -613,11 +613,11 @@ int instance_destroy(unsigned short instance_id)
 		im->idle_timer = INVALID_TIMER;
 	}
 
-	if (mode == IM_CHAR)
+	if (mode == IM_CHAR && sd)
 		sd->instance_id = 0;
-	else if (mode == IM_PARTY)
+	else if (mode == IM_PARTY && p)
 		p->instance_id = 0;
-	else if (mode == IM_GUILD)
+	else if (mode == IM_GUILD && g)
 		g->instance_id = 0;
 
 	if (mode != IM_NONE) {

+ 1 - 3
src/map/party.c

@@ -659,10 +659,8 @@ int party_broken(int party_id)
 	if( p == NULL )
 		return 0;
 
-	if( p->instance_id ) {
-		instance_data[p->instance_id].owner_id = 0;
+	if( p->instance_id )
 		instance_destroy( p->instance_id );
-	}
 
 	for( i = 0; i < MAX_PARTY; i++ ) {
 		if( p->data[i].sd != NULL ) {