From 7c79aa2b8e484319e3e511fa21db6d2448347024 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 27 Aug 2012 21:18:46 +0300 Subject: Add const to more classes. --- src/gui/killstats.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src/gui/killstats.cpp') diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 564eba642..8c9fe8757 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -58,7 +58,7 @@ KillStats::KillStats(): setDefaultSize(250, 250, 350, 300); listen(CHANNEL_ATTRIBUTES); - int xp(PlayerInfo::getAttribute(PlayerInfo::EXP)); + const int xp(PlayerInfo::getAttribute(PlayerInfo::EXP)); int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)); mResetButton = new Button(_("Reset stats"), "reset", this); @@ -184,7 +184,7 @@ void KillStats::gainXp(int xp) if (!mKillCounter) mKillCounter = 1; - float AvgExp = static_cast(mExpCounter / mKillCounter); + const float AvgExp = static_cast(mExpCounter / mKillCounter); int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)); if (mKillTimer == 0) @@ -246,12 +246,12 @@ void KillStats::gainXp(int xp) void KillStats::recalcStats() { - int curTime = cur_time; + const int curTime = cur_time; // Need Update Exp Counter if (curTime - m1minExpTime > 60) { - int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); + const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); if (m1minExpTime != 0) m1minSpeed = newExp - m1minExpNum; else @@ -262,7 +262,7 @@ void KillStats::recalcStats() if (curTime - m5minExpTime > 60*5) { - int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); + const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); if (m5minExpTime != 0) m5minSpeed = newExp - m5minExpNum; else @@ -273,7 +273,7 @@ void KillStats::recalcStats() if (curTime - m15minExpTime > 60*15) { - int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); + const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP); if (m15minExpTime != 0) m15minSpeed = newExp - m15minExpNum; else @@ -376,7 +376,7 @@ void KillStats::updateJackoLabel() } } -void KillStats::jackoDead(int id) +void KillStats::jackoDead(const int id) { if (id == mJackoId && mIsJackoAlive) { @@ -387,12 +387,6 @@ void KillStats::jackoDead(int id) } } -void KillStats::addLog(std::string str) -{ - if (debugChatTab) - debugChatTab->chatLog(str, BY_SERVER); -} - void KillStats::jackoAlive(int id) { if (!mIsJackoAlive) @@ -411,7 +405,7 @@ void KillStats::validateJacko() if (!actorSpriteManager || !player_node) return; - Map *currentMap = Game::instance()->getCurrentMap(); + const Map *const currentMap = Game::instance()->getCurrentMap(); if (currentMap) { if (currentMap->getProperty("_realfilename") == "018-1" @@ -422,7 +416,8 @@ void KillStats::validateJacko() && player_node->getTileY() >= 21 && player_node->getTileY() <= 46) { - Being *dstBeing = actorSpriteManager->findBeingByName( + const Being *const dstBeing + = actorSpriteManager->findBeingByName( "Jack O", Being::MONSTER); if (mIsJackoAlive && !dstBeing) { @@ -443,7 +438,7 @@ void KillStats::processEvent(Channels channel A_UNUSED, { if (event.getName() == EVENT_UPDATEATTRIBUTE) { - int id = event.getInt("id"); + const int id = event.getInt("id"); if (id == PlayerInfo::EXP || id == PlayerInfo::EXP_NEEDED) { gainXp(event.getInt("newValue") - event.getInt("oldValue")); -- cgit v1.2.3-60-g2f50