summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/char/char.c6
-rw-r--r--src/char_sql/char.c6
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);