diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-27 16:15:26 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-27 16:15:26 +0000 |
commit | 1195b69fb88843d6813253fcedda35e416ff2e96 (patch) | |
tree | 853d3a4f50bc3774b685e35d1eeb06e642bb5a19 /src/map | |
parent | 0e5784703b00fe94eb19e24298d3dde5dbc811da (diff) | |
download | hercules-1195b69fb88843d6813253fcedda35e416ff2e96.tar.gz hercules-1195b69fb88843d6813253fcedda35e416ff2e96.tar.bz2 hercules-1195b69fb88843d6813253fcedda35e416ff2e96.tar.xz hercules-1195b69fb88843d6813253fcedda35e416ff2e96.zip |
- Added a cleanup routine on shutdown to remove all characters from memory for whom the save ack has not returned from the char-server yet.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7923 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/map.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/map/map.c b/src/map/map.c index 323ad3681..d217f0b35 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3617,6 +3617,18 @@ static int cleanup_db_sub(DBKey key,void *data,va_list va) { return cleanup_sub((struct block_list*)data, NULL); } +static int cleanup_db_subpc(DBKey key,void *data,va_list va) { + struct map_session_data *sd = (TBL_PC*)data; + if (!sd->state.finalsave) + { //Error? + ShowError("do_final: Player character in DB which was not sent to save! %d:%d\n", sd->status.account_id, sd->status.char_id); + map_quit(sd); //Attempt force-save + } + //Force remove from memory... + map_quit_ack(sd); + return 1; +} + /*========================================== * mapŽII—¹E— *------------------------------------------ @@ -3645,9 +3657,12 @@ void do_final(void) { for (i = 0; i < j; i++) map_quit(pl_allsd[i]); - i = id_db->foreach(id_db,cleanup_db_sub); + id_db->foreach(id_db,cleanup_db_sub); chrif_char_reset_offline(); chrif_flush_fifo(); + //Online players were sent to save, but the ack will not arrive on time! + //They have to be removed from memory, and assume the char-server saved them. + pc_db->foreach(pc_db,cleanup_db_subpc); do_final_atcommand(); do_final_battle(); |