summaryrefslogtreecommitdiff
path: root/src/net/tmwa/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/network.cpp')
-rw-r--r--src/net/tmwa/network.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index e26f48324..3181ec898 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -104,16 +104,17 @@ int networkThread(void *data)
return 0;
}
-Network *Network::mInstance = 0;
+Network *Network::mInstance = nullptr;
Network::Network() :
- mSocket(0),
+ mSocket(nullptr),
mInBuffer(new char[BUFFER_SIZE]),
mOutBuffer(new char[BUFFER_SIZE]),
- mInSize(0), mOutSize(0),
+ mInSize(0),
+ mOutSize(0),
mToSkip(0),
mState(IDLE),
- mWorkerThread(0)
+ mWorkerThread(nullptr)
{
SDLNet_Init();
@@ -129,8 +130,8 @@ Network::~Network()
disconnect();
SDL_DestroyMutex(mMutex);
- mMutex = 0;
- mInstance = 0;
+ mMutex = nullptr;
+ mInstance = nullptr;
delete[] mInBuffer;
delete[] mOutBuffer;
@@ -181,15 +182,15 @@ void Network::disconnect()
if (mWorkerThread && SDL_GetThreadID(mWorkerThread))
{
- SDL_WaitThread(mWorkerThread, NULL);
- mWorkerThread = NULL;
+ SDL_WaitThread(mWorkerThread, nullptr);
+ mWorkerThread = nullptr;
}
if (mSocket)
{
// need call SDLNet_TCP_DelSocket?
SDLNet_TCP_Close(mSocket);
- mSocket = 0;
+ mSocket = nullptr;
}
}
@@ -212,7 +213,7 @@ void Network::unregisterHandler(MessageHandler *handler)
for (const Uint16 *i = handler->handledMessages; *i; ++i)
mMessageHandlers.erase(*i);
- handler->setNetwork(0);
+ handler->setNetwork(nullptr);
}
void Network::clearHandlers()
@@ -221,7 +222,7 @@ void Network::clearHandlers()
for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); ++i)
{
if (i->second)
- i->second->setNetwork(0);
+ i->second->setNetwork(nullptr);
}
mMessageHandlers.clear();
}