Skip to content

Commit

Permalink
Incremented player count gating to fix population display issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretsOTheP committed Feb 21, 2024
1 parent 126a3c5 commit ad29348
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 13 additions & 4 deletions world/cliententry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ClientListEntry::ClientListEntry(uint32 in_id, uint32 iLSID, const char* iLoginN
: id(in_id)
{
ClearVars(true);

incremented_player_count = false;
pIP = ip;
pLSID = iLSID;
if(iLSID > 0)
Expand All @@ -56,7 +56,7 @@ ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList
: id(in_id)
{
ClearVars(true);

incremented_player_count = false;
pIP = 0;
pForumName[0] = 0;
pLSID = scl->LSAccountID;
Expand All @@ -83,6 +83,13 @@ ClientListEntry::~ClientListEntry() {
Camp(); // updates zoneserver's numplayers
client_list.RemoveCLEReferances(this);
}

if (incremented_player_count)
{
numplayers--;
incremented_player_count = false;
}

SetOnline(CLE_Status_Offline);
SetAccountID(0);
for (auto &elem : tell_queue)
Expand All @@ -105,12 +112,14 @@ void ClientListEntry::SetOnline(int8 iOnline) {

// this counting method, counts players connected to world.
if (iOnline >= CLE_Status_Online && pOnline < CLE_Status_Online) {
if (!mule() || RuleB(Quarm, IncludeMulesInServerCount)) {
if (!mule() && !incremented_player_count || RuleB(Quarm, IncludeMulesInServerCount)) {
incremented_player_count = true;
numplayers++;
}
}
else if (iOnline < CLE_Status_Online && pOnline >= CLE_Status_Online) {
if (!mule() || RuleB(Quarm, IncludeMulesInServerCount)) {
if (incremented_player_count || RuleB(Quarm, IncludeMulesInServerCount)) {
incremented_player_count = false;
numplayers--;
}
}
Expand Down
2 changes: 2 additions & 0 deletions world/cliententry.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class ClientListEntry {
MD5 pMD5Pass;
int16 padmin;

bool incremented_player_count;

// Character info
ZoneServer* pzoneserver;
uint32 pzone;
Expand Down

0 comments on commit ad29348

Please sign in to comment.