summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-15 12:31:16 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-15 12:31:16 +0000
commit0bd634fd221fc351c14bcb4138034eff641f92f3 (patch)
treec6b3158719c9c65b58352113d8234a51be7516ec /src/char_sql
parent07bde8db7bd90940be387e9337088d4640b9cb91 (diff)
downloadhercules-0bd634fd221fc351c14bcb4138034eff641f92f3.tar.gz
hercules-0bd634fd221fc351c14bcb4138034eff641f92f3.tar.bz2
hercules-0bd634fd221fc351c14bcb4138034eff641f92f3.tar.xz
hercules-0bd634fd221fc351c14bcb4138034eff641f92f3.zip
- Added the required changes to support the 2008-09-10+ clients
- Cleaned around the char set offline function to properly avoid setting offline a character that had relogged faster than the map server's packet arrival to the char-server (I presume this was the bugfix that Kevin attempted a long time ago, but the current code for that causes a dangling pointer problem). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13293 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index bc934216a..9cba965dc 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -309,14 +309,17 @@ void set_char_offline(int char_id, int account_id)
character->waiting_disconnect = -1;
}
- //If user is NOT at char screen, delete entry [Kevin]
- if(character->char_id != -1)
+ if(character->char_id == char_id)
{
- idb_remove(online_char_db, account_id);
+ character->char_id = -1;
+ character->server = -1;
}
+
+ //FIXME? Why Kevin free'd the online information when the char was effectively in the map-server?
}
-
- if (login_fd > 0 && !session[login_fd]->flag.eof && (char_id == -1 || character == NULL || character->char_id != -1))
+
+ //Remove char if 1- Set all offline, or 2- character is no longer connected to char-server.
+ if (login_fd > 0 && !session[login_fd]->flag.eof && (char_id == -1 || character == NULL || character->fd == -1))
{
WFIFOHEAD(login_fd,6);
WFIFOW(login_fd,0) = 0x272c;
@@ -2870,10 +2873,10 @@ int parse_char(int fd)
if( sd != NULL && sd->auth )
{ // already authed client
struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
- if( data == NULL || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
- set_char_offline(-1,sd->account_id);
if( data != NULL && data->fd == fd)
data->fd = -1;
+ if( data == NULL || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
+ set_char_offline(-1,sd->account_id);
}
do_close(fd);
return 0;