summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/chrif.c3
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/unit.c9
3 files changed, 7 insertions, 8 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 239880f88..615755fd0 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -400,9 +400,6 @@ int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int c
} else
clif_changemapserver(node->sd, map_index, x, y, ntohl(ip), ntohs(port));
- //Free session data from this map server [Kevin]
- unit_free_pc(node->sd);
-
//Player has been saved already, remove him from memory. [Skotlex]
chrif_auth_delete(account_id, char_id, ST_MAPCHANGE);
diff --git a/src/map/pc.c b/src/map/pc.c
index e55ae2014..efdacae53 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3595,6 +3595,9 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
chrif_save(sd,2);
chrif_changemapserver(sd, ip, (short)port);
+ //Free session data from this map server [Kevin]
+ unit_free_pc(node->sd);
+
return 0;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index ea4cda9f5..252b65188 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1838,12 +1838,11 @@ int unit_free(struct block_list *bl, int clrtype)
sd->regstr = NULL;
sd->regstr_num = 0;
}
+
+ //Tell the script to end, not delete it, it will free itself when necessary [Kevin]
if (sd->st) {
- if (sd->st->stack)
- script_free_stack (sd->st->stack);
- aFree(sd->st);
- sd->st = NULL;
- sd->npc_id = 0;
+ sd->st->rid = 0;
+ sd->st->state = 2;
}
} else if( bl->type == BL_PET ) {
struct pet_data *pd = (struct pet_data*)bl;