diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-21 10:36:26 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-21 10:36:26 +0000 |
commit | c6b0361bd56ee72df8b9b3ee7eca824e0619d407 (patch) | |
tree | 8a178d1eff82e4329685dd8130c9b2364412ce4f /src/map/chrif.c | |
parent | 095fe33b1d22e4bc821847b968ac508a983ae50b (diff) | |
download | hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.gz hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.bz2 hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.tar.xz hercules-c6b0361bd56ee72df8b9b3ee7eca824e0619d407.zip |
- Added status_calc_life to properly calculate hp/max_hp as a ratio taking into accounts overflows (and for now also avoids divisions by 0). Applied this function around clif.c, mob.c and pet.c
- Implemented the correct walk-speed bonus from the Bard/Dancer spirit.
- Added a few error messages in case something goes wrong in the new auth db system.
- Fixed logarithmic drops turning 0% drop rates into 100%.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12225 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r-- | src/map/chrif.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 005285da5..969157acd 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -169,8 +169,7 @@ bool chrif_auth_finished(TBL_PC* sd) struct auth_node *node= chrif_search(sd->status.account_id); if (node && node->sd == sd && node->state == ST_LOGIN) { node->sd = NULL; - chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); - return true; + return chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); } return false; } @@ -242,7 +241,8 @@ int chrif_save(struct map_session_data *sd, int flag) { //FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex] if (chrif_isconnected()) chrif_save_scdata(sd); - chrif_auth_logout(sd, flag==1?ST_LOGOUT:ST_MAPCHANGE); + if (!chrif_auth_logout(sd, flag==1?ST_LOGOUT:ST_MAPCHANGE)) + ShowError("chrif_save: Failed to set up player %d:%d for proper quitting!\n", sd->status.account_id, sd->status.char_id); } if(!chrif_isconnected()) @@ -515,11 +515,12 @@ void chrif_authreq(struct map_session_data *sd) if(node->state == ST_LOGIN && node->char_dat && - node->account_id== sd->status.account_id && + node->account_id == sd->status.account_id && + node->char_id == sd->status.char_id && node->login_id1 == sd->login_id1) { //auth ok if (!pc_authok(sd, node->login_id2, node->connect_until_time, node->char_dat)) - chrif_auth_delete(sd->status.account_id, sd->status.char_id, ST_LOGIN); + chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); else { //char_dat no longer needed, but player auth is not completed yet. aFree(node->char_dat); @@ -587,16 +588,18 @@ void chrif_authok(int fd) int auth_db_cleanup_sub(DBKey key,void *data,va_list ap) { struct auth_node *node=(struct auth_node*)data; - + const char* states[] = { "Login", "Logout", "Map change" }; if(DIFF_TICK(gettick(),node->node_created)>60000) { switch (node->state) { case ST_LOGOUT: //Re-save attempt (->sd should never be null here). + node->node_created = gettick(); //Refresh tick (avoid char-server load if connection is really bad) chrif_save(node->sd, 1); break; default: //Clear data. any connected players should have timed out by now. + ShowInfo("auth_db: Node (state %s) timed out for %d:%d\n", states[node->state], node->account_id, node->char_id); chrif_auth_delete(node->account_id, node->char_id, node->state); break; } |