summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-16 18:39:14 -0200
committershennetsind <ind@henn.et>2013-02-16 18:39:14 -0200
commitd7ce0c1ce8c4d9118d1340e48424ad9deae0da09 (patch)
tree0c09cddb581ee4765a6e7fb80f5a62887651ef04
parent3b122c06573fa66cb84417f2f08e78910b685476 (diff)
downloadhercules-d7ce0c1ce8c4d9118d1340e48424ad9deae0da09.tar.gz
hercules-d7ce0c1ce8c4d9118d1340e48424ad9deae0da09.tar.bz2
hercules-d7ce0c1ce8c4d9118d1340e48424ad9deae0da09.tar.xz
hercules-d7ce0c1ce8c4d9118d1340e48424ad9deae0da09.zip
Fixed Bug #7070
Character's online states are now updated as soon as they attempt a char select, instead of at the end of the procedure. This improves reliability with 3rd party software e.g. control panels. Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/char/char.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/char/char.c b/src/char/char.c
index effcd6c31..8b75f6394 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -3768,7 +3768,18 @@ int parse_char(int fd)
char_id = atoi(data);
Sql_FreeResult(sql_handle);
- mmo_char_fromsql(char_id, &char_dat, true);
+
+ /* set char as online prior to loading its data so 3rd party applications will realise the sql data is not reliable */
+ set_char_online(-2,char_id,sd->account_id);
+ if( !mmo_char_fromsql(char_id, &char_dat, true) ) { /* failed? set it back offline */
+ set_char_offline(char_id, sd->account_id);
+ /* failed to load something. REJECT! */
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x6c;
+ WFIFOB(fd,2) = 0;
+ WFIFOSET(fd,3);
+ break;/* jump off this boat */
+ }
//Have to switch over to the DB instance otherwise data won't propagate [Kevin]
cd = (struct mmo_charstatus *)idb_get(char_db_, char_id);
@@ -3867,8 +3878,6 @@ int parse_char(int fd)
node->ip = ipl;
idb_put(auth_db, sd->account_id, node);
- set_char_online(-2,node->char_id,sd->account_id);
-
}
break;