summaryrefslogtreecommitdiff
path: root/src/game-server/gamehandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/gamehandler.cpp')
-rw-r--r--src/game-server/gamehandler.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index 7886ac18..fe5b7df1 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -45,7 +45,9 @@
const unsigned int TILES_TO_BE_NEAR = 7;
GameHandler::GameHandler():
- mTokenCollector(this)
+ mTokenCollector(this),
+ mTotalBandwidthOut(0),
+ mTotalBandwidthIn(0)
{
}
@@ -608,3 +610,26 @@ void GameHandler::handleSendPost(GameClient *client, MessageIn &message)
postMan->addCharacter(client->character);
accountHandler->sendPost(client->character, message);
}
+
+int GameHandler::calculateTotalOut()
+{
+ for (NetComputers::const_iterator i = clients.begin(),
+ i_end = clients.end(); i != i_end; ++i)
+ {
+ mTotalBandwidthOut += (*i)->totalOut();
+ }
+
+ return mTotalBandwidthOut;
+}
+
+int GameHandler::calculateTotalIn()
+{
+ for (NetComputers::const_iterator i = clients.begin(),
+ i_end = clients.end(); i != i_end; ++i)
+ {
+ mTotalBandwidthIn += (*i)->totalIn();
+ (*i)->reset();
+ }
+
+ return mTotalBandwidthIn;
+}