diff --git a/src/map/guild.c b/src/map/guild.c index 243c1c69cf..411ad47317 100644 --- a/src/map/guild.c +++ b/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))) { diff --git a/src/map/instance.c b/src/map/instance.c index 333c8ec871..63bc8f2198 100644 --- a/src/map/instance.c +++ b/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) { diff --git a/src/map/party.c b/src/map/party.c index 65e68a9baa..daefcf5b52 100644 --- a/src/map/party.c +++ b/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 ) {