diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-09 19:49:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-09 19:49:14 +0300 |
commit | 7e3bd20e9675202e30fac741f3d3acb4f19b109d (patch) | |
tree | 9e12ab198b68e8f6ed0dd2121a72066c7b7053ba /src/playerinfo.cpp | |
parent | b9d66c41246fef56e41f600b5523a5ff1a29a1c8 (diff) | |
download | plus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.gz plus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.bz2 plus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.tar.xz plus-7e3bd20e9675202e30fac741f3d3acb4f19b109d.zip |
Small refactoring based on idea from mana commit 30d4b0adf4f17f05d1d62fc3428c896ef1079b6b
Diffstat (limited to 'src/playerinfo.cpp')
-rw-r--r-- | src/playerinfo.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 61c34d54a..ab2596f32 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -54,17 +54,17 @@ int mLevelProgress = 0; void triggerAttr(int id, int old) { - Mana::Event event(EVENT_UPDATEATTRIBUTE); + Mana::Event event(Mana::EVENT_UPDATEATTRIBUTE); event.setInt("id", id); event.setInt("oldValue", old); event.setInt("newValue", mData.mAttributes.find(id)->second); - Mana::Event::trigger(CHANNEL_ATTRIBUTES, event); + Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); } void triggerStat(int id, const std::string &changed, int old1, int old2) { StatMap::iterator it = mData.mStats.find(id); - Mana::Event event(EVENT_UPDATESTAT); + Mana::Event event(Mana::EVENT_UPDATESTAT); event.setInt("id", id); event.setInt("base", it->second.base); event.setInt("mod", it->second.mod); @@ -73,7 +73,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) event.setString("changed", changed); event.setInt("oldValue1", old1); event.setInt("oldValue2", old2); - Mana::Event::trigger(CHANNEL_ATTRIBUTES, event); + Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); } // --- Attributes ------------------------------------------------------------- @@ -272,9 +272,9 @@ void setTrading(bool trading) if (notify) { - Mana::Event event(EVENT_TRADING); + Mana::Event event(Mana::EVENT_TRADING); event.setInt("trading", trading); - Mana::Event::trigger(CHANNEL_STATUS, event); + Mana::Event::trigger(Mana::CHANNEL_STATUS, event); } } @@ -283,15 +283,15 @@ class PlayerInfoListener : Mana::Listener public: PlayerInfoListener() { - listen(CHANNEL_CLIENT); - listen(CHANNEL_GAME); + listen(Mana::CHANNEL_CLIENT); + listen(Mana::CHANNEL_GAME); } - void event(Channels channel, const Mana::Event &event) + void event(Mana::Channels channel, const Mana::Event &event) { - if (channel == CHANNEL_CLIENT) + if (channel == Mana::CHANNEL_CLIENT) { - if (event.getName() == EVENT_STATECHANGE) + if (event.getName() == Mana::EVENT_STATECHANGE) { int newState = event.getInt("newState"); @@ -305,9 +305,9 @@ public: } } } - else if (channel == CHANNEL_GAME) + else if (channel == Mana::CHANNEL_GAME) { - if (event.getName() == EVENT_DESTRUCTED) + if (event.getName() == Mana::EVENT_DESTRUCTED) { delete mInventory; delete mEquipment; |