diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-27 15:12:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-27 15:12:01 +0300 |
commit | d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf (patch) | |
tree | 5f9a70468149907fa15aad5b5b5e1dc6b7e11bc0 /src/being | |
parent | 744b6e62e1252ca50445b21f671ad8d81dd28ea1 (diff) | |
download | mv-d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf.tar.gz mv-d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf.tar.bz2 mv-d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf.tar.xz mv-d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf.zip |
Simplify triggerStat function.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/playerinfo.cpp | 14 | ||||
-rw-r--r-- | src/being/playerinfo.h | 7 |
2 files changed, 5 insertions, 16 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index d7652abe0..09604e971 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -62,8 +62,7 @@ void triggerAttr(const int id, const int old) mData.mAttributes.find(id)->second); } -void triggerStat(const int id, const std::string &changed, - const int old1, const int old2) +void triggerStat(const int id, const int old1, const int old2) { const StatMap::const_iterator it = mData.mStats.find(id); if (it == mData.mStats.end()) @@ -72,11 +71,6 @@ void triggerStat(const int id, const std::string &changed, DepricatedEvent event(EVENT_UPDATESTAT); event.setInt("id", id); const Stat &stat = it->second; - event.setInt("base", stat.base); - event.setInt("mod", stat.mod); - event.setInt("exp", stat.exp); - event.setInt("expNeeded", stat.expNeed); - event.setString("changed", changed); event.setInt("oldValue1", old1); event.setInt("oldValue2", old2); DepricatedEvent::trigger(CHANNEL_ATTRIBUTES, event); @@ -131,7 +125,7 @@ void setStatBase(const int id, const int value, const bool notify) const int old = mData.mStats[id].base; mData.mStats[id].base = value; if (notify) - triggerStat(id, "base", old); + triggerStat(id, old, 0); } int getStatMod(const int id) @@ -148,7 +142,7 @@ void setStatMod(const int id, const int value, const bool notify) const int old = mData.mStats[id].mod; mData.mStats[id].mod = value; if (notify) - triggerStat(id, "mod", old); + triggerStat(id, old, 0); } int getStatEffective(const int id) @@ -187,7 +181,7 @@ void setStatExperience(const int id, const int have, stat.exp = have; stat.expNeed = need; if (notify) - triggerStat(id, "exp", oldExp, oldExpNeed); + triggerStat(id, oldExp, oldExpNeed); } // --- Inventory / Equipment -------------------------------------------------- diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 6437017b5..bb7b89141 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -245,14 +245,9 @@ namespace PlayerInfo void stateChange(const int state); - void triggerAttr(int id); - void triggerAttr(const int id, const int old); - void triggerStat(int id); - - void triggerStat(const int id, const std::string &changed, - const int old1, const int old2 = 0); + void triggerStat(const int id, const int old1, const int old2); void setEquipmentBackend(Equipment::Backend *const backend); |