From d5586e6b6d5c7b1b83b3ec681e9da62840b5adaf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Apr 2014 15:12:01 +0300 Subject: Simplify triggerStat function. --- src/being/playerinfo.cpp | 14 ++++---------- 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); -- cgit v1.2.3-70-g09d2