From 450c0004c32acb37247a1cc4dd046703cf65e5f9 Mon Sep 17 00:00:00 2001 From: Paradox924X Date: Thu, 3 Dec 2009 07:51:55 +0000 Subject: Prevented online user count from going negative. (bugreport:3913) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14186 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/char/char.c | 6 ++++-- src/char_sql/char.c | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index afd9329c9..3d9e73d91 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,8 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2009/12/03 + * Prevented online user count from going negative. (bugreport:3913) [Paradox924X] 2009/12/02 * Rev. 14183 Semi-revert of 14182, moved ALL_WEWISH up under SA_GRAVITY instead, as I hadn't noticed it does exactly what the new case did. [L0ne_W0lf] * Rev. 14182 Added skill ALL_WEWISH. This skill in older clients plays a song, however in current clients it does not. The effect (AL_ANGELUS) still shows. [L0ne_W0lf] diff --git a/src/char/char.c b/src/char/char.c index f2910751f..4c4379074 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -198,7 +198,8 @@ void set_char_charselect(int account_id) character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data); if( character->server > -1 ) - server[character->server].users--; + if( server[character->server].users > 0 ) // Prevent this value from going negative. + server[character->server].users--; character->char_id = -1; character->server = -1; @@ -258,7 +259,8 @@ void set_char_offline(int char_id, int account_id) if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL) { //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex] if( character->server > -1 ) - server[character->server].users--; + if( server[character->server].users > 0 ) // Prevent this value from going negative. + server[character->server].users--; if(character->waiting_disconnect != -1){ delete_timer(character->waiting_disconnect, chardb_waiting_disconnect); diff --git a/src/char_sql/char.c b/src/char_sql/char.c index ee1e08bdb..9fc4aea99 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -212,7 +212,8 @@ void set_char_charselect(int account_id) character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data); if( character->server > -1 ) - server[character->server].users--; + if( server[character->server].users > 0 ) // Prevent this value from going negative. + server[character->server].users--; character->char_id = -1; character->server = -1; @@ -300,7 +301,8 @@ void set_char_offline(int char_id, int account_id) if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL) { //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex] if( character->server > -1 ) - server[character->server].users--; + if( server[character->server].users > 0 ) // Prevent this value from going negative. + server[character->server].users--; if(character->waiting_disconnect != -1){ delete_timer(character->waiting_disconnect, chardb_waiting_disconnect); -- cgit v1.2.3-60-g2f50