From d2e442a12d5b918e0970d89be981c98a829005c1 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Tue, 14 Oct 2014 03:24:55 -0400 Subject: [PATCH] Fixed "steam" IRC command --- RenX.Commands/RenX_Commands.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/RenX.Commands/RenX_Commands.cpp b/RenX.Commands/RenX_Commands.cpp index d1e3c80..17f893b 100644 --- a/RenX.Commands/RenX_Commands.cpp +++ b/RenX.Commands/RenX_Commands.cpp @@ -424,13 +424,15 @@ void SteamIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &ch } else { - unsigned int total = 0; - unsigned int realPlayers = 0; + unsigned int total; + unsigned int realPlayers; for (unsigned int i = 0; i != RenX::getCore()->getServerCount(); i++) { RenX::Server *server = RenX::getCore()->getServer(i); if (server->isLogChanType(type) && server->players.size() != 0) { + total = 0; + realPlayers = 0; for (Jupiter::DLList::Node *node = server->players.getNode(0); node != nullptr; node = node->next) { player = node->data; @@ -441,10 +443,10 @@ void SteamIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &ch total++; } } + if (realPlayers != 0) + source->sendMessage(channel, Jupiter::StringS::Format("%.2f%% (%u/%u) of players are using Steam.", ((double)total * 100) / ((double)realPlayers), total, realPlayers)); + else source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("No players are in-game.")); } - if (realPlayers != 0) - source->sendMessage(channel, Jupiter::StringS::Format("%.2f%% (%u/%u) of players are using Steam.", ((double)total * 100) / ((double)realPlayers), total, realPlayers)); - else source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("No players are in-game.")); } } }