summaryrefslogtreecommitdiff
path: root/src/gui/killstats.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-07 14:57:08 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-07 21:38:21 +0300
commitae550d179c25e149f7e8a8d70011b364fb0d85d6 (patch)
treec4dabe3e38afc8b343e3946202eb6fa5f30a18a9 /src/gui/killstats.cpp
parent2566e68d2502d39c9f7c9d83ce4b281e2834fe29 (diff)
downloadplus-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.gz
plus-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.bz2
plus-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.xz
plus-ae550d179c25e149f7e8a8d70011b364fb0d85d6.zip
some fixes after auto check.
Diffstat (limited to 'src/gui/killstats.cpp')
-rw-r--r--src/gui/killstats.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index c1d8fa8b1..61d8acfcb 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -185,7 +185,8 @@ void KillStats::resetTimes()
void KillStats::gainXp(int xp)
{
- if (xp == PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED))
+ const int expNeed = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ if (xp == expNeed)
xp = 0;
else if (!xp)
return;
@@ -199,7 +200,7 @@ void KillStats::gainXp(int xp)
mKillCounter = 1;
const float AvgExp = static_cast<float>(mExpCounter / mKillCounter);
- int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED));
+ int xpNextLevel(expNeed);
if (mKillTimer == 0)
mKillTimer = cur_time;
@@ -212,14 +213,13 @@ void KillStats::gainXp(int xp)
if (timeDiff <= 0.001)
timeDiff = 1;
+ const int exp = PlayerInfo::getAttribute(PlayerInfo::EXP);
mLine1->setCaption(strprintf(_("Level: %d at %f%%"),
- player_node->getLevel(), static_cast<double>(
- PlayerInfo::getAttribute(PlayerInfo::EXP)) / static_cast<double>(
+ player_node->getLevel(), static_cast<double>(exp) / static_cast<double>(
xpNextLevel) * 100.0));
- mLine2->setCaption(strprintf(_("Exp: %d/%d Left: %d"),
- PlayerInfo::getAttribute(PlayerInfo::EXP), xpNextLevel,
- xpNextLevel - PlayerInfo::getAttribute(PlayerInfo::EXP)));
+ mLine2->setCaption(strprintf(_("Exp: %d/%d Left: %d"), exp,
+ xpNextLevel, xpNextLevel - exp));
if (AvgExp >= 0.001f && AvgExp <= 0.001f)
{
@@ -242,8 +242,7 @@ void KillStats::gainXp(int xp)
toString(AvgExp).c_str()));
mLine6->setCaption(strprintf(_("No. of avg mob to next level: %s"),
- toString(static_cast<float>(xpNextLevel
- - PlayerInfo::getAttribute(PlayerInfo::EXP)) / AvgExp).c_str()));
+ toString(static_cast<float>(xpNextLevel - exp) / AvgExp).c_str()));
}
mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"),
toString(mKillCounter).c_str(), toString(mExpCounter).c_str()));