From 55af5ea9f16c710fd5c1685aeab5203098bd598c Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 18 Apr 2007 14:39:11 +0000 Subject: - Some more cleanups that should prevent the double-login issue even further. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10286 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 16 +++++++++------- src/map/pc.c | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/map/map.c b/src/map/map.c index 37a6f1d91..169d038af 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1672,11 +1672,15 @@ void map_deliddb(struct block_list *bl) { int map_quit(struct map_session_data *sd) { if(!sd->state.auth) { //Removing a player that hasn't even finished loading + TBL_PC *sd2 = map_id2sd(sd->status.account_id); if (sd->pd) unit_free(&sd->pd->bl,-1); if (sd->hd) unit_free(&sd->hd->bl,-1); + //Double login, let original do the cleanups below. + if (sd2 && sd2 != sd) + return 0; + idb_remove(id_db,sd->bl.id); idb_remove(pc_db,sd->status.account_id); idb_remove(charid_db,sd->status.char_id); - idb_remove(id_db,sd->bl.id); return 0; } if(!sd->state.waitingdisconnect) { @@ -1692,13 +1696,11 @@ int map_quit(struct map_session_data *sd) { chrif_save(sd,1); } else { //Try to free some data, without saving anything (this could be invoked on map server change. [Skotlex] if (sd->bl.prev != NULL) - { //Remove from map... unit_remove_map(&sd->bl, 0); - if (sd->pd && sd->pd->bl.prev != NULL) - unit_remove_map(&sd->pd->bl, 0); - if (sd->hd && sd->hd->bl.prev != NULL) - unit_remove_map(&sd->hd->bl, 0); - } + if (sd->pd && sd->pd->bl.prev != NULL) + unit_remove_map(&sd->pd->bl, 0); + if (sd->hd && sd->hd->bl.prev != NULL) + unit_remove_map(&sd->hd->bl, 0); } //Do we really need to remove the name? diff --git a/src/map/pc.c b/src/map/pc.c index 6d0c88b05..cff5069d5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -580,8 +580,9 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t ShowDebug("pc_authok: Received auth ok for already authorized client (account id %d)!\n", sd->bl.id); return 1; } - + sd->login_id2 = login_id2; + memcpy(&sd->status, st, sizeof(*st)); if (st->sex != sd->status.sex) { clif_authfail_fd(sd->fd, 0); @@ -598,7 +599,6 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t clif_authfail_fd(sd->fd, 8); // still recognizes last connection return 1; } - memcpy(&sd->status, st, sizeof(*st)); //Set the map-server used job id. [Skotlex] i = pc_jobid2mapid(sd->status.class_); -- cgit v1.2.3-60-g2f50