diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-08 00:07:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-08 00:07:56 +0300 |
commit | b3f70d8d46199524edc590269a73c262899763c7 (patch) | |
tree | af8e20371f2cc825c0b2dbe0c0e5c392a926c46d /src/net | |
parent | 3f84fc198131ff706e18c56f612e38ff147b0005 (diff) | |
download | manaverse-b3f70d8d46199524edc590269a73c262899763c7.tar.gz manaverse-b3f70d8d46199524edc590269a73c262899763c7.tar.bz2 manaverse-b3f70d8d46199524edc590269a73c262899763c7.tar.xz manaverse-b3f70d8d46199524edc590269a73c262899763c7.zip |
Replace most iterator to const_iterator.
Some other minor changes.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/manaserv/network.cpp | 6 | ||||
-rw-r--r-- | src/net/manaserv/npchandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 2 |
4 files changed, 5 insertions, 11 deletions
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 01000f8f1..1de681007 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -434,8 +434,8 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) if (!mStorage) mStorage = new Inventory(Inventory::STORAGE, size); - Ea::InventoryItems::iterator it = mInventoryItems.begin(); - Ea::InventoryItems::iterator it_end = mInventoryItems.end(); + Ea::InventoryItems::const_iterator it = mInventoryItems.begin(); + Ea::InventoryItems::const_iterator it_end = mInventoryItems.end(); for (; it != it_end; ++it) { mStorage->setItem((*it).slot, (*it).id, (*it).quantity, diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index 53e83e4ec..b83bc5748 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -45,7 +45,7 @@ namespace ManaServ { typedef std::map<unsigned short, MessageHandler*> MessageHandlers; -typedef MessageHandlers::iterator MessageHandlerIterator; +typedef MessageHandlers::const_iterator MessageHandlerIterator; static MessageHandlers mMessageHandlers; void initialize() @@ -96,17 +96,13 @@ Connection *getConnection() void registerHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) - { mMessageHandlers[*i] = handler; - } } void unregisterHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) - { mMessageHandlers.erase(*i); - } } void clearNetworkHandlers() diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index efd2ab2bc..8c14f3dfc 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -60,12 +60,10 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) { Being *being = actorSpriteManager->findBeing(msg.readInt16()); if (!being || being->getType() != ActorSprite::NPC) - { return; - } int npcId = being->getId(); - NpcDialogs::iterator diag = mNpcDialogs.find(npcId); + NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId); NpcDialog *dialog; if (diag == mNpcDialogs.end()) diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 43271671e..f80dd6e69 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -194,7 +194,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength) const int npcId = msg.readInt32(); - NpcDialogs::iterator diag = mNpcDialogs.find(npcId); + NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId); mDialog = 0; if (diag == mNpcDialogs.end()) |