summaryrefslogtreecommitdiff
path: root/src/playerinfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-31 16:54:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-01 03:56:16 +0300
commit761682b6254a3d43e65ff45e07683c61afa6f1e4 (patch)
tree2ee462840f3aadb1e96bfa5c6784ec2cc0d2861a /src/playerinfo.cpp
parenta39f63cdfa5ce15b22f294a8bb1db3a036ce462d (diff)
downloadmv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.gz
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.bz2
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.tar.xz
mv-761682b6254a3d43e65ff45e07683c61afa6f1e4.zip
Last part of fixes.
Diffstat (limited to 'src/playerinfo.cpp')
-rw-r--r--src/playerinfo.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 533ed8576..2500e298e 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -74,10 +74,11 @@ void triggerStat(int id, const std::string &changed, int old1, int old2)
DepricatedEvent event(EVENT_UPDATESTAT);
event.setInt("id", id);
- event.setInt("base", it->second.base);
- event.setInt("mod", it->second.mod);
- event.setInt("exp", it->second.exp);
- event.setInt("expNeeded", it->second.expNeed);
+ 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);
@@ -167,10 +168,12 @@ std::pair<int, int> getStatExperience(int id)
void setStatExperience(int id, int have, int need, bool notify)
{
- int oldExp = mData.mStats[id].exp;
- int oldExpNeed = mData.mStats[id].expNeed;
- mData.mStats[id].exp = have;
- mData.mStats[id].expNeed = need;
+ Stat &stat = mData.mStats[id];
+
+ int oldExp = stat.exp;
+ int oldExpNeed = stat.expNeed;
+ stat.exp = have;
+ stat.expNeed = need;
if (notify)
triggerStat(id, "exp", oldExp, oldExpNeed);
}