summaryrefslogtreecommitdiff
path: root/src/gui
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
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')
-rw-r--r--src/gui/chatwindow.cpp2
-rw-r--r--src/gui/killstats.cpp17
-rw-r--r--src/gui/serverdialog.cpp19
-rw-r--r--src/gui/skilldialog.cpp9
-rw-r--r--src/gui/statuswindow.cpp5
-rw-r--r--src/gui/widgets/avatarlistbox.cpp2
-rw-r--r--src/gui/widgets/browserbox.h8
7 files changed, 29 insertions, 33 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 0bc3b9edc..88c9936fe 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -883,7 +883,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
ChatTab *const tab = getFocused();
if (tab && tab->hasRows())
{
- const size_t tabSize = tab->getRows().size();
+ const size_t &tabSize = tab->getRows().size();
if (mChatHistoryIndex + 1 < tabSize)
{
mChatHistoryIndex ++;
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()));
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 6bb09d8e9..4a9960beb 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -288,16 +288,15 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
mServersList->addSelectionListener(this);
usedScroll->setVerticalScrollAmount(0);
- const int n = 0;
- place(0, 0 + n, usedScroll, 7, 5).setPadding(3);
- place(0, 5 + n, mDescription, 7);
- place(0, 6 + n, mPersistentIPCheckBox, 7);
- place(0, 7 + n, mAddEntryButton);
- place(1, 7 + n, mEditEntryButton);
- place(2, 7 + n, mLoadButton);
- place(3, 7 + n, mDeleteButton);
- place(5, 7 + n, mQuitButton);
- place(6, 7 + n, mConnectButton);
+ place(0, 0, usedScroll, 7, 5).setPadding(3);
+ place(0, 5, mDescription, 7);
+ place(0, 6, mPersistentIPCheckBox, 7);
+ place(0, 7, mAddEntryButton);
+ place(1, 7, mEditEntryButton);
+ place(2, 7, mLoadButton);
+ place(3, 7, mDeleteButton);
+ place(5, 7, mQuitButton);
+ place(6, 7, mConnectButton);
// Make sure the list has enough height
getLayout().setRowHeight(0, 80);
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index c89bf5697..2a673a277 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -579,10 +579,11 @@ void SkillDialog::addSkill(const int id, const int level, const int range,
{
SkillInfo *const skill = new SkillInfo;
skill->id = static_cast<unsigned int>(id);
- skill->data->name = "Unknown skill Id: " + toString(id);
- skill->data->dispName = "Unknown skill Id: " + toString(id);
- skill->data->description.clear();
- skill->data->setIcon("");
+ SkillData *const data = skill->data;
+ data->name = "Unknown skill Id: " + toString(id);
+ data->dispName = "Unknown skill Id: " + toString(id);
+ data->description.clear();
+ data->setIcon("");
skill->modifiable = modifiable;
skill->visible = false;
skill->model = mDefaultModel;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index ddd16fa12..ef91582f8 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -415,10 +415,7 @@ void StatusWindow::processEvent(Channels channel A_UNUSED,
updateMPBar(mMpBar, true);
const Attrs::const_iterator it = mAttrs.find(id);
if (it != mAttrs.end() && it->second)
- {
- if (it->second)
- it->second->update();
- }
+ it->second->update();
}
}
}
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index f2907aaf3..372218fe6 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -399,7 +399,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
{
const WhisperTab *const tab = chatWindow->addWhisperTab(
model->getAvatarAt(selected)->getName(), true);
- if (chatWindow && tab)
+ if (tab)
chatWindow->saveState();
}
}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 0b8c99c8a..045e0d5d5 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -48,8 +48,8 @@ struct BROWSER_LINK final
class LinePart final
{
public:
- LinePart(const int x, const int y, const gcn::Color color,
- const gcn::Color color2, const std::string &text,
+ LinePart(const int x, const int y, const gcn::Color &color,
+ const gcn::Color &color2, const std::string &text,
const bool bold) :
mX(x),
mY(y),
@@ -62,8 +62,8 @@ class LinePart final
{
}
- LinePart(const int x, const int y, const gcn::Color color,
- const gcn::Color color2, Image *const image) :
+ LinePart(const int x, const int y, const gcn::Color &color,
+ const gcn::Color &color2, Image *const image) :
mX(x),
mY(y),
mColor(color),