From 962f182fcc989ec587282e44f889188ce241ba31 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Sep 2012 14:05:30 +0300 Subject: Add const to more classes. --- src/net/ea/network.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/net/ea/network.cpp') diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index fc50c0971..679ff450d 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -44,7 +44,7 @@ const unsigned int BUFFER_LIMIT = 930000; int networkThread(void *data) { - Network *network = static_cast(data); + Network *const network = static_cast(data); if (!network || !network->realConnect()) return -1; @@ -62,11 +62,12 @@ Network::Network() : mOutSize(0), mToSkip(0), mState(IDLE), - mWorkerThread(nullptr) + mWorkerThread(nullptr), + mMutex(SDL_CreateMutex()), + mSleep(config.getIntValue("networksleep")) { SDLNet_Init(); - mMutex = SDL_CreateMutex(); } Network::~Network() @@ -135,9 +136,8 @@ void Network::disconnect() // need call SDLNet_TCP_DelSocket? SDLNet_TCP_Close(mSocket); mSocket = nullptr; - int sleep = config.getIntValue("networksleep"); - if (sleep > 0) - SDL_Delay(sleep); + if (mSleep > 0) + SDL_Delay(mSleep); } } @@ -237,7 +237,8 @@ void Network::receive() { // TODO Try to get this to block all the time while still being able // to escape the loop - int numReady = SDLNet_CheckSockets(set, (static_cast(500))); + const int numReady = SDLNet_CheckSockets( + set, (static_cast(500))); int ret; switch (numReady) { -- cgit v1.2.3-60-g2f50