diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-24 20:15:19 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-24 20:15:19 +0000 |
commit | 1c4742e530271e10ae949cf7e85402bee867e298 (patch) | |
tree | f95927614c4f9a84a507c9425b882f945be6d09f /src/net | |
parent | 05a12d5568111fa13759026442ed358605bf9a28 (diff) | |
download | mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.gz mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.bz2 mana-client-1c4742e530271e10ae949cf7e85402bee867e298.tar.xz mana-client-1c4742e530271e10ae949cf7e85402bee867e298.zip |
Another bunch of cosmetic cleanups, ie mostly typedefs...
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/network.cpp | 17 | ||||
-rw-r--r-- | src/net/network.h | 4 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp index 9e6f6621..366d07d9 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -182,17 +182,9 @@ void Network::registerHandler(MessageHandler *handler) void Network::unregisterHandler(MessageHandler *handler) { - const Uint16 *i = handler->handledMessages; - - while(*i) + for (const Uint16 *i = handler->handledMessages; *i; i++) { - std::map<Uint16, MessageHandler*>::iterator iter; - iter = mMessageHandlers.find(*i); - if (iter != mMessageHandlers.end()) - { - mMessageHandlers.erase(iter); - } - i++; + mMessageHandlers.erase(*i); } handler->setNetwork(0); @@ -200,7 +192,7 @@ void Network::unregisterHandler(MessageHandler *handler) void Network::clearHandlers() { - std::map<Uint16, MessageHandler*>::iterator i; + MessageHandlerIterator i; for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); i++) { i->second->setNetwork(0); @@ -214,8 +206,7 @@ void Network::dispatchMessages() { MessageIn msg = getNextMessage(); - std::map<Uint16, MessageHandler*>::iterator iter; - iter = mMessageHandlers.find(msg.getId()); + MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); if (iter != mMessageHandlers.end()) iter->second->handleMessage(&msg); diff --git a/src/net/network.h b/src/net/network.h index 06abc445..f4637f73 100644 --- a/src/net/network.h +++ b/src/net/network.h @@ -89,7 +89,9 @@ class Network SDL_Thread *mWorkerThread; SDL_mutex *mMutex; - std::map<Uint16, MessageHandler*> mMessageHandlers; + typedef std::map<Uint16, MessageHandler*> MessageHandlers; + typedef MessageHandlers::iterator MessageHandlerIterator; + MessageHandlers mMessageHandlers; bool realConnect(); void receive(); |