From b3f70d8d46199524edc590269a73c262899763c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Sep 2011 00:07:56 +0300 Subject: Replace most iterator to const_iterator. Some other minor changes. --- src/playerinfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/playerinfo.cpp') diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 769d24a16..562795563 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -68,7 +68,10 @@ void triggerAttr(int id, int old) void triggerStat(int id, const std::string &changed, int old1, int old2) { - StatMap::iterator it = mData.mStats.find(id); + StatMap::const_iterator it = mData.mStats.find(id); + if (it == mData.mStats.end()) + return; + Mana::Event event(Mana::EVENT_UPDATESTAT); event.setInt("id", id); event.setInt("base", it->second.base); -- cgit v1.2.3-70-g09d2 From 3a875a0026936d4bcb3bd1c2b6e8ac547cd5e27e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 9 Sep 2011 19:59:09 +0300 Subject: Rename in listner class method from event to processEvent. --- src/event.cpp | 2 +- src/gui/chatwindow.cpp | 2 +- src/gui/chatwindow.h | 2 +- src/gui/inventorywindow.cpp | 5 ++--- src/gui/inventorywindow.h | 2 +- src/gui/killstats.cpp | 4 ++-- src/gui/killstats.h | 4 ++-- src/gui/ministatuswindow.cpp | 4 ++-- src/gui/ministatuswindow.h | 2 +- src/gui/statuswindow.cpp | 4 ++-- src/gui/statuswindow.h | 2 +- src/listener.h | 2 +- src/localplayer.cpp | 3 ++- src/localplayer.h | 2 +- src/net/ea/gamehandler.cpp | 3 ++- src/net/ea/gamehandler.h | 3 ++- src/net/manaserv/generalhandler.cpp | 4 ++-- src/net/manaserv/generalhandler.h | 2 +- src/net/tmwa/generalhandler.cpp | 4 ++-- src/net/tmwa/generalhandler.h | 2 +- src/playerinfo.cpp | 2 +- 21 files changed, 31 insertions(+), 29 deletions(-) (limited to 'src/playerinfo.cpp') diff --git a/src/event.cpp b/src/event.cpp index 8ac9be189..5a1d673b2 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -118,7 +118,7 @@ void Event::trigger(Channels channel, const Event &event) while (lit != it->second.end()) { if (*lit) - (*lit)->event(channel, event); + (*lit)->processEvent(channel, event); ++lit; } } diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 1b9877363..c52511189 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -822,7 +822,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::event(Mana::Channels channel, const Mana::Event &event) +void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) { if (channel == Mana::CHANNEL_NOTICES) { diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 6e1d548a3..97e366701 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -196,7 +196,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); /** * Scrolls the chat window diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 7a70135fd..da1c45782 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -564,7 +564,6 @@ void InventoryWindow::updateButtons(Item *item) else mSplitButton->setEnabled(false); } - } void InventoryWindow::setSplitAllowed(bool allowed) @@ -585,8 +584,8 @@ void InventoryWindow::close() } } -void InventoryWindow::event(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void InventoryWindow::processEvent(Mana::Channels channel A_UNUSED, + const Mana::Event &event) { if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 14a53a179..c32fd8905 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -127,7 +127,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); void updateButtons(Item *item = 0); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 7d0a9fe11..0cadc765b 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -437,8 +437,8 @@ void KillStats::validateJacko() } } -void KillStats::event(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void KillStats::processEvent(Mana::Channels channel A_UNUSED, + const Mana::Event &event) { if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/killstats.h b/src/gui/killstats.h index ff2a8f010..8562e67a4 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -78,8 +78,8 @@ class KillStats : public Window, gcn::ActionListener, public Mana::Listener void addLog(std::string str); - void event(Mana::Channels channel A_UNUSED, - const Mana::Event &event); + void processEvent(Mana::Channels channel A_UNUSED, + const Mana::Event &event); private: void validateJacko(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index da39eb24c..b325bcef6 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -218,8 +218,8 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } } -void MiniStatusWindow::event(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, + const Mana::Event &event) { if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index 19517326b..91aebcfac 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -66,7 +66,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index a85f60133..97130b103 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -276,8 +276,8 @@ StatusWindow::StatusWindow(): mLvlLabel->adjustSize(); } -void StatusWindow::event(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, + const Mana::Event &event) { static bool blocked = false; if (blocked) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 44d052004..fa957d059 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -58,7 +58,7 @@ class StatusWindow : public Window, */ StatusWindow(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); void setPointsNeeded(int id, int needed); diff --git a/src/listener.h b/src/listener.h index f5efa8a53..8993c31af 100644 --- a/src/listener.h +++ b/src/listener.h @@ -38,7 +38,7 @@ class Listener void ignore(Channels channel); - virtual void event(Channels channel, const Event &event) = 0; + virtual void processEvent(Channels channel, const Event &event) = 0; }; } // namespace Mana diff --git a/src/localplayer.cpp b/src/localplayer.cpp index a68cd5ee8..fdbc4b0b7 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1633,7 +1633,8 @@ void LocalPlayer::optionChanged(const std::string &value) mTradebot = config.getBoolValue("tradebot"); } -void LocalPlayer::event(Mana::Channels channel, const Mana::Event &event) +void LocalPlayer::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_ATTRIBUTES) { diff --git a/src/localplayer.h b/src/localplayer.h index 1f2790e88..cb23d855e 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -386,7 +386,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, */ void optionChanged(const std::string &value); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); /** * set a following player. diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 04c13572f..a202cbc86 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -46,7 +46,8 @@ GameHandler::GameHandler() listen(Mana::CHANNEL_GAME); } -void GameHandler::event(Mana::Channels channel, const Mana::Event &event) +void GameHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_GAME) { diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index abfaaa6b4..6d8b88bd4 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -43,7 +43,8 @@ class GameHandler : public Net::GameHandler, public Mana::Listener public: GameHandler(); - virtual void event(Mana::Channels channel, const Mana::Event &event); + virtual void processEvent(Mana::Channels channel, + const Mana::Event &event); virtual void who(); diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index 7c95033a8..9e32f139d 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -176,8 +176,8 @@ void GeneralHandler::clearHandlers() clearNetworkHandlers(); } -void GeneralHandler::event(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_CLIENT) { diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index 90587eeb3..ccdddbbe6 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -56,7 +56,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener void clearHandlers(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index e1b565399..c6ebc000c 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -240,8 +240,8 @@ void GeneralHandler::clearHandlers() mNetwork->clearHandlers(); } -void GeneralHandler::event(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Mana::Channels channel, + const Mana::Event &event) { if (channel == Mana::CHANNEL_GAME) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 27186fcc8..5e6c9f18f 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -59,7 +59,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void event(Mana::Channels channel, const Mana::Event &event); + void processEvent(Mana::Channels channel, const Mana::Event &event); void reloadPartially(); diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 562795563..e0f8aa494 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -312,7 +312,7 @@ public: listen(Mana::CHANNEL_GAME); } - void event(Mana::Channels channel, const Mana::Event &event) + void processEvent(Mana::Channels channel, const Mana::Event &event) { if (channel == Mana::CHANNEL_CLIENT) { -- cgit v1.2.3-70-g09d2