summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/party.c3
-rw-r--r--src/map/skill.c9
-rw-r--r--src/map/unit.c1
4 files changed, 11 insertions, 8 deletions
diff --git a/src/map/map.c b/src/map/map.c
index bbff98410..8a74bcca1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1518,8 +1518,6 @@ int map_quit(struct map_session_data *sd)
if (sd->npc_timer_id != -1) //Cancel the event timer.
npc_timerevent_quit(sd);
- if( sd->state.bg_id )
- bg_team_leave(sd,1);
npc_script_event(sd, NPCE_LOGOUT);
//Unit_free handles clearing the player related data,
@@ -3275,6 +3273,7 @@ int map_instance_destroy_timer(int tid, unsigned int tick, int id, intptr data)
void map_instance_destroy(int instance_id)
{
int last = 0, type;
+ struct party_data *p;
time_t now = time(NULL);
if( !instance_id || !instance[instance_id].name_id )
@@ -3312,6 +3311,9 @@ void map_instance_destroy(int instance_id)
instance[instance_id].ivar = NULL;
instance[instance_id].svar = NULL;
+ if( instance[instance_id].party_id && (p = party_search(instance[instance_id].party_id)) != NULL )
+ p->instance_id = 0;
+
ShowInfo("[Instance] Destroyed %s.\n", instance[instance_id].name);
memset( &instance[instance_id], 0x00, sizeof(instance[0]) );
}
diff --git a/src/map/party.c b/src/map/party.c
index a71344ed7..ae9685075 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -557,7 +557,10 @@ int party_broken(int party_id)
return 0;
if( p->instance_id )
+ {
+ instance[p->instance_id].party_id = 0;
map_instance_destroy( p->instance_id );
+ }
for(i=0;i<MAX_PARTY;i++){
if(p->data[i].sd!=NULL){
diff --git a/src/map/skill.c b/src/map/skill.c
index 4e4cf1734..4629e9f6e 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1112,13 +1112,10 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, int s
continue; // No target
if( rand()%1000 > sd->autospell3[i].rate )
continue;
- if( !battle_check_range(&sd->bl, bl, skill_get_range2(&sd->bl, skill,skilllv) + (skill == RG_CLOSECONFINE?0:1)) )
- continue;
+ tbl = (sd->autospell3[i].id < 0) ? &sd->bl : bl;
- if( sd->autospell3[i].id < 0 )
- tbl = &sd->bl;
- else
- tbl = bl;
+ if( !battle_check_range(&sd->bl, tbl, skill_get_range2(&sd->bl, skill,skilllv) + (skill == RG_CLOSECONFINE?0:1)) )
+ continue;
sd->state.autocast = 1;
skill_consume_requirement(sd,skill,skilllv,1);
diff --git a/src/map/unit.c b/src/map/unit.c
index 4fce9b2d7..f19eb4d4a 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1976,6 +1976,7 @@ int unit_free(struct block_list *bl, int clrtype)
guild_send_memberinfoshort(sd,0);
pc_cleareventtimer(sd);
pc_inventory_rental_clear(sd);
+ if( sd->state.bg_id ) bg_team_leave(sd,1);
pc_delspiritball(sd,sd->spiritball,1);
if( sd->reg )