diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
commit | 5afe88df2538274859a162ffd63ed52118e80c19 (patch) | |
tree | b610dfd58dc748fd63f49565b2a43eea2316714f /src/net/tmwa/network.cpp | |
parent | 73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff) | |
download | mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2 mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz mana-5afe88df2538274859a162ffd63ed52118e80c19.zip |
Apply C++11 fixits
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
Diffstat (limited to 'src/net/tmwa/network.cpp')
-rw-r--r-- | src/net/tmwa/network.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 5ff4f7e5..c1ba615f 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -91,7 +91,7 @@ namespace TmwAthena { int networkThread(void *data) { - Network *network = static_cast<Network*>(data); + auto *network = static_cast<Network*>(data); if (!network->realConnect()) return -1; @@ -101,16 +101,16 @@ 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), mToSkip(0), mState(IDLE), - mWorkerThread(0) + mWorkerThread(nullptr) { SDLNet_Init(); @@ -124,7 +124,7 @@ Network::~Network() if (mState != IDLE && mState != NET_ERROR) disconnect(); - mInstance = 0; + mInstance = nullptr; delete[] mInBuffer; delete[] mOutBuffer; @@ -175,14 +175,14 @@ void Network::disconnect() if (mWorkerThread) { - SDL_WaitThread(mWorkerThread, NULL); - mWorkerThread = NULL; + SDL_WaitThread(mWorkerThread, nullptr); + mWorkerThread = nullptr; } if (mSocket) { SDLNet_TCP_Close(mSocket); - mSocket = 0; + mSocket = nullptr; } } @@ -203,7 +203,7 @@ void Network::unregisterHandler(MessageHandler *handler) mMessageHandlers.erase(*i); } - handler->setNetwork(0); + handler->setNetwork(nullptr); } void Network::clearHandlers() @@ -211,7 +211,7 @@ void Network::clearHandlers() MessageHandlerIterator i; for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); ++i) { - i->second->setNetwork(0); + i->second->setNetwork(nullptr); } mMessageHandlers.clear(); } @@ -222,7 +222,7 @@ void Network::dispatchMessages() { MessageIn msg = getNextMessage(); - MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); + auto iter = mMessageHandlers.find(msg.getId()); if (msg.getLength() == 0) logger->error("Zero length packet received. Exiting."); |