From 226d526a49322d1fa755645801254703dfd90476 Mon Sep 17 00:00:00 2001 From: ultramage Date: Wed, 16 Apr 2008 07:48:53 +0000 Subject: Fixed an issue in r12575 where 'not setting char offline when going from mapserver to charserver' also caused a permanent account lockout if the player pressed 'cancel' in the char select screen. Merged some recent changes from SQL to TXT, as someone didn't bother to do it. Ifdefed the quest data request code as SQL-only (this was causing server disconnects whenver someone logged in). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12606 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/char.c | 12 ++++++++---- src/char_sql/char.c | 8 +++----- src/map/clif.c | 2 +- src/map/pc.c | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index 9a1a87bee..76312ac0d 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -241,15 +241,19 @@ void set_char_offline(int char_id, int account_id) if( character->server > -1 ) server[character->server].users--; - character->char_id = -1; - character->server = -1; if(character->waiting_disconnect != -1){ delete_timer(character->waiting_disconnect, chardb_waiting_disconnect); character->waiting_disconnect = -1; } + + //If user is NOT at char screen, delete entry [Kevin] + if(character->char_id != -1) + { + idb_remove(online_char_db, account_id); + } } - if (login_fd > 0 && !session[login_fd]->flag.eof) + if (login_fd > 0 && !session[login_fd]->flag.eof && (char_id == -1 || character == NULL || character->char_id != -1)) { WFIFOHEAD(login_fd,6); WFIFOW(login_fd,0) = 0x272c; @@ -2335,7 +2339,7 @@ int parse_fromlogin(int fd) set_eof(i); } else //Shouldn't happen, but just in case. - set_char_offline(99, aid); + set_char_offline(-1, aid); } } } diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 992e7892a..d3839ca2f 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -263,8 +263,7 @@ void set_char_offline(int char_id, int account_id) { struct online_char_data* character; - //FIXME: usage of 'magic constant'; this needs to go! [ultramage] - if ( char_id == 99 ) + if ( char_id == -1 ) { if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id) ) Sql_ShowDebug(sql_handle); @@ -297,7 +296,7 @@ void set_char_offline(int char_id, int account_id) } } - if (login_fd > 0 && !session[login_fd]->flag.eof && (character == NULL || character->char_id != -1)) + if (login_fd > 0 && !session[login_fd]->flag.eof && (char_id == -1 || character == NULL || character->char_id != -1)) { WFIFOHEAD(login_fd,6); WFIFOW(login_fd,0) = 0x272c; @@ -1930,7 +1929,7 @@ int parse_fromlogin(int fd) set_eof(i); } else //Shouldn't happen, but just in case. - set_char_offline(99, aid); + set_char_offline(-1, aid); } } } @@ -2917,7 +2916,6 @@ int parse_char(int fd) { // 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] - //send -1 as char id (99 means at char select) [Kevin] set_char_offline(-1,sd->account_id); if( data != NULL && data->fd == fd) data->fd = -1; diff --git a/src/map/clif.c b/src/map/clif.c index ea2a10b4c..4c6d0f833 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7952,7 +7952,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } #ifndef TXT_ONLY - mail_clear(sd); + mail_clear(sd); #endif quest_pc_login(sd); diff --git a/src/map/pc.c b/src/map/pc.c index 400799e61..27336c05b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -962,11 +962,11 @@ int pc_reg_received(struct map_session_data *sd) status_calc_pc(sd,1); chrif_scdata_request(sd->status.account_id, sd->status.char_id); + #ifndef TXT_ONLY intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox -#endif - intif_request_questlog(sd); +#endif if (!sd->state.connect_new && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually. -- cgit v1.2.3-70-g09d2