summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-15 18:37:00 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-15 18:37:00 +0300
commit65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635 (patch)
tree493d6441dd152419908d28178c26112a4639e89f /src/gui
parente1e411459e9c9aae819eee474d48d0cc20f6ca07 (diff)
downloadplus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.gz
plus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.bz2
plus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.xz
plus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.zip
Fix code style.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp4
-rw-r--r--src/gui/chatwindow.cpp4
-rw-r--r--src/gui/inventorywindow.cpp6
-rw-r--r--src/gui/killstats.cpp45
-rw-r--r--src/gui/ministatuswindow.cpp81
-rw-r--r--src/gui/shopwindow.cpp12
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/statuswindow.cpp121
-rw-r--r--src/gui/tradewindow.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp1
-rw-r--r--src/gui/widgets/slider.cpp3
-rw-r--r--src/gui/widgets/slider.h2
12 files changed, 155 insertions, 128 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 38a58c03c..9004c52f9 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -616,9 +616,9 @@ void CharacterDisplay::update()
mButton->setActionEventId("use");
mName->setCaption(strprintf("%s", character->getName().c_str()));
mLevel->setCaption(strprintf(_("Level %d"),
- mCharacter->data.mAttributes[LEVEL]));
+ mCharacter->data.mAttributes[PlayerInfo::LEVEL]));
mMoney->setCaption(Units::formatCurrency(
- mCharacter->data.mAttributes[MONEY]));
+ mCharacter->data.mAttributes[PlayerInfo::MONEY]));
mDelete->setVisible(true);
}
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 966223685..1ea40a207 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -932,7 +932,7 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
{
switch (event.getInt("id"))
{
- case EXP:
+ case PlayerInfo::EXP:
{
if (event.getInt("oldValue") > event.getInt("newValue"))
break;
@@ -944,7 +944,7 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
battleChatLog("+" + toString(change) + " xp");
break;
}
- case LEVEL:
+ case PlayerInfo::LEVEL:
battleChatLog("Level: " + toString(
event.getInt("newValue")));
break;
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index de2e0e1a4..b2c92a32c 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -620,7 +620,7 @@ void InventoryWindow::processEvent(Channels channel A_UNUSED,
if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
int id = event.getInt("id");
- if (id == TOTAL_WEIGHT || id == MAX_WEIGHT)
+ if (id == PlayerInfo::TOTAL_WEIGHT || id == PlayerInfo::MAX_WEIGHT)
updateWeight();
}
}
@@ -630,8 +630,8 @@ void InventoryWindow::updateWeight()
if (!isMainInventory())
return;
- int total = PlayerInfo::getAttribute(TOTAL_WEIGHT);
- int max = PlayerInfo::getAttribute(MAX_WEIGHT);
+ int total = PlayerInfo::getAttribute(PlayerInfo::TOTAL_WEIGHT);
+ int max = PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT);
if (max <= 0)
return;
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index f46d17bdf..37fd70340 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -60,8 +60,8 @@ KillStats::KillStats():
setDefaultSize(250, 250, 350, 300);
listen(CHANNEL_ATTRIBUTES);
- int xp(PlayerInfo::getAttribute(EXP));
- int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED));
+ int xp(PlayerInfo::getAttribute(PlayerInfo::EXP));
+ int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED));
mResetButton = new Button(_("Reset stats"), "reset", this);
mTimerButton = new Button(_("Reset timer"), "timer", this);
@@ -138,7 +138,7 @@ void KillStats::action(const gcn::ActionEvent &event)
mKillCounter = 0;
mExpCounter = 0;
mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s",
- PlayerInfo::getAttribute(EXP_NEEDED) / 100, "?"));
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED) / 100, "?"));
mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"), "?", "?"));
mLine5->setCaption(strprintf(_("Avg Exp: %s"), "?"));
mLine6->setCaption(strprintf(
@@ -173,7 +173,7 @@ void KillStats::resetTimes()
void KillStats::gainXp(int xp)
{
- if (xp == PlayerInfo::getAttribute(EXP_NEEDED))
+ if (xp == PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED))
xp = 0;
else if (!xp)
return;
@@ -187,7 +187,7 @@ void KillStats::gainXp(int xp)
mKillCounter = 1;
float AvgExp = static_cast<float>(mExpCounter / mKillCounter);
- int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED));
+ int xpNextLevel(PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED));
if (mKillTimer == 0)
mKillTimer = cur_time;
@@ -202,12 +202,12 @@ void KillStats::gainXp(int xp)
mLine1->setCaption(strprintf(_("Level: %d at %f%%"),
player_node->getLevel(), static_cast<double>(
- PlayerInfo::getAttribute(EXP)) / static_cast<double>(
+ PlayerInfo::getAttribute(PlayerInfo::EXP)) / static_cast<double>(
xpNextLevel) * 100.0));
mLine2->setCaption(strprintf(_("Exp: %d/%d Left: %d"),
- PlayerInfo::getAttribute(EXP), xpNextLevel,
- xpNextLevel - PlayerInfo::getAttribute(EXP)));
+ PlayerInfo::getAttribute(PlayerInfo::EXP), xpNextLevel,
+ xpNextLevel - PlayerInfo::getAttribute(PlayerInfo::EXP)));
if (AvgExp >= 0.001f && AvgExp <= 0.001f)
{
@@ -231,7 +231,7 @@ void KillStats::gainXp(int xp)
mLine6->setCaption(strprintf(_("No. of avg mob to next level: %s"),
toString(static_cast<float>(xpNextLevel
- - PlayerInfo::getAttribute(EXP)) / AvgExp).c_str()));
+ - PlayerInfo::getAttribute(PlayerInfo::EXP)) / AvgExp).c_str()));
}
mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"),
toString(mKillCounter).c_str(), toString(mExpCounter).c_str()));
@@ -253,7 +253,7 @@ void KillStats::recalcStats()
// Need Update Exp Counter
if (curTime - m1minExpTime > 60)
{
- int newExp = PlayerInfo::getAttribute(EXP);
+ int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
if (m1minExpTime != 0)
m1minSpeed = newExp - m1minExpNum;
else
@@ -264,7 +264,7 @@ void KillStats::recalcStats()
if (curTime - m5minExpTime > 60*5)
{
- int newExp = PlayerInfo::getAttribute(EXP);
+ int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
if (m5minExpTime != 0)
m5minSpeed = newExp - m5minExpNum;
else
@@ -275,7 +275,7 @@ void KillStats::recalcStats()
if (curTime - m15minExpTime > 60*15)
{
- int newExp = PlayerInfo::getAttribute(EXP);
+ int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
if (m15minExpTime != 0)
m15minSpeed = newExp - m15minExpNum;
else
@@ -294,8 +294,9 @@ void KillStats::update()
if (m1minSpeed != 0)
{
mExpTime1Label->setCaption(strprintf(_(" Time for next level: %s"),
- toString(static_cast<float>((PlayerInfo::getAttribute(EXP_NEEDED)
- - PlayerInfo::getAttribute(EXP)) / m1minSpeed)).c_str()));
+ toString(static_cast<float>((PlayerInfo::getAttribute(
+ PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
+ PlayerInfo::EXP)) / m1minSpeed)).c_str()));
}
else
{
@@ -311,8 +312,9 @@ void KillStats::update()
if (m5minSpeed != 0)
{
mExpTime5Label->setCaption(strprintf(_(" Time for next level: %s"),
- toString(static_cast<float>((PlayerInfo::getAttribute(EXP_NEEDED)
- - PlayerInfo::getAttribute(EXP)) / m5minSpeed * 5)).c_str()));
+ toString(static_cast<float>((PlayerInfo::getAttribute(
+ PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
+ PlayerInfo::EXP)) / m5minSpeed * 5)).c_str()));
}
else
{
@@ -330,8 +332,9 @@ void KillStats::update()
if (m15minSpeed != 0)
{
mExpTime15Label->setCaption(strprintf(_(" Time for next level: %s"),
- toString(static_cast<float>((PlayerInfo::getAttribute(EXP_NEEDED)
- - PlayerInfo::getAttribute(EXP)) / m15minSpeed * 15)).c_str()));
+ toString(static_cast<float>((PlayerInfo::getAttribute(
+ PlayerInfo::EXP_NEEDED) - PlayerInfo::getAttribute(
+ PlayerInfo::EXP)) / m15minSpeed * 15)).c_str()));
}
else
{
@@ -443,19 +446,19 @@ void KillStats::processEvent(Channels channel A_UNUSED,
if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
int id = event.getInt("id");
- if (id == EXP || id == EXP_NEEDED)
+ if (id == PlayerInfo::EXP || id == PlayerInfo::EXP_NEEDED)
{
gainXp(event.getInt("newValue") - event.getInt("oldValue"));
// update();
}
- else if (id == LEVEL)
+ else if (id == PlayerInfo::LEVEL)
{
mKillCounter = 0;
mKillTCounter = 0;
mExpCounter = 0;
mExpTCounter = 0;
mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s",
- PlayerInfo::getAttribute(EXP_NEEDED) / 100, "?"));
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED) / 100, "?"));
mLine4->setCaption(strprintf(_(
"Kills: %s, total exp: %s"), "?", "?"));
mLine5->setCaption(strprintf(_("Avg Exp: %s"), "?"));
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 9ac37a413..54ededd41 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -227,16 +227,27 @@ void MiniStatusWindow::processEvent(Channels channel A_UNUSED,
if (event.getName() == EVENT_UPDATEATTRIBUTE)
{
int id = event.getInt("id");
- if (id == HP || id == MAX_HP)
+ if (id == PlayerInfo::HP || id == PlayerInfo::MAX_HP)
+ {
StatusWindow::updateHPBar(mHpBar);
- else if (id == MP || id == MAX_MP)
+ }
+ else if (id == PlayerInfo::MP || id == PlayerInfo::MAX_MP)
+ {
StatusWindow::updateMPBar(mMpBar);
- else if (id == EXP || id == EXP_NEEDED)
+ }
+ else if (id == PlayerInfo::EXP || id == PlayerInfo::EXP_NEEDED)
+ {
StatusWindow::updateXPBar(mXpBar);
- else if (id == TOTAL_WEIGHT || id == MAX_WEIGHT)
+ }
+ else if (id == PlayerInfo::TOTAL_WEIGHT
+ || id == PlayerInfo::MAX_WEIGHT)
+ {
StatusWindow::updateWeightBar(mWeightBar);
- else if (id == MONEY)
+ }
+ else if (id == PlayerInfo::MONEY)
+ {
StatusWindow::updateMoneyBar(mMoneyBar);
+ }
}
else if (event.getName() == EVENT_UPDATESTAT)
{
@@ -282,40 +293,38 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
}
else if (event.getSource() == mXpBar)
{
- if (PlayerInfo::getAttribute(EXP)
- > PlayerInfo::getAttribute(EXP_NEEDED))
+ if (PlayerInfo::getAttribute(PlayerInfo::EXP)
+ > PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED))
{
mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", PlayerInfo::getAttribute(EXP),
- PlayerInfo::getAttribute(EXP_NEEDED)));
+ event.getSource()->getId(), strprintf("%u/%u",
+ PlayerInfo::getAttribute(PlayerInfo::EXP),
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)));
}
else
{
mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", PlayerInfo::getAttribute(EXP),
- PlayerInfo::getAttribute(EXP_NEEDED)),
- strprintf("%s: %u", _("Need"),
- PlayerInfo::getAttribute(EXP_NEEDED)
- - PlayerInfo::getAttribute(EXP)));
+ event.getSource()->getId(), strprintf("%u/%u",
+ PlayerInfo::getAttribute(PlayerInfo::EXP),
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)),
+ strprintf("%s: %u", _("Need"),
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED)
+ - PlayerInfo::getAttribute(PlayerInfo::EXP)));
}
mStatusPopup->hide();
}
else if (event.getSource() == mHpBar)
{
- mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", PlayerInfo::getAttribute(HP),
- PlayerInfo::getAttribute(MAX_HP)));
+ mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(),
+ strprintf("%u/%u", PlayerInfo::getAttribute(PlayerInfo::HP),
+ PlayerInfo::getAttribute(PlayerInfo::MAX_HP)));
mStatusPopup->hide();
}
else if (event.getSource() == mMpBar)
{
- mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", PlayerInfo::getAttribute(MP),
- PlayerInfo::getAttribute(MAX_MP)));
+ mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(),
+ strprintf("%u/%u", PlayerInfo::getAttribute(PlayerInfo::MP),
+ PlayerInfo::getAttribute(PlayerInfo::MAX_MP)));
mStatusPopup->hide();
}
else if (event.getSource() == mJobBar)
@@ -326,28 +335,24 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
if (exp.first > exp.second)
{
mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", exp.first,
- exp.second));
+ event.getSource()->getId(),
+ strprintf("%u/%u", exp.first, exp.second));
}
else
{
mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", exp.first,
- exp.second),
- strprintf("%s: %u", _("Need"),
- exp.second
- - exp.first));
+ event.getSource()->getId(),
+ strprintf("%u/%u", exp.first, exp.second),
+ strprintf("%s: %u", _("Need"), exp.second - exp.first));
}
mStatusPopup->hide();
}
else if (event.getSource() == mWeightBar)
{
- mTextPopup->show(x + getX(), y + getY(),
- event.getSource()->getId(),
- strprintf("%u/%u", PlayerInfo::getAttribute(TOTAL_WEIGHT),
- PlayerInfo::getAttribute(MAX_WEIGHT)));
+ mTextPopup->show(x + getX(), y + getY(), event.getSource()->getId(),
+ strprintf("%u/%u", PlayerInfo::getAttribute(
+ PlayerInfo::TOTAL_WEIGHT),
+ PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT)));
mStatusPopup->hide();
}
else if (event.getSource() == mInvSlotsBar)
@@ -368,7 +373,7 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event)
{
mTextPopup->show(x + getX(), y + getY(),
event.getSource()->getId(),
- toString(PlayerInfo::getAttribute(MONEY)));
+ toString(PlayerInfo::getAttribute(PlayerInfo::MONEY)));
}
else
{
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 615bbc18b..4daa1c2bb 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -577,8 +577,12 @@ void ShopWindow::giveList(const std::string &nick, int mode)
else
{
int amount = item->getQuantity();
- if (item->getPrice() * amount > PlayerInfo::getAttribute(MONEY))
- amount = PlayerInfo::getAttribute(MONEY) / item->getPrice();
+ if (item->getPrice() * amount > PlayerInfo::getAttribute(
+ PlayerInfo::MONEY))
+ {
+ amount = PlayerInfo::getAttribute(PlayerInfo::MONEY)
+ / item->getPrice();
+ }
if (amount > 0)
{
@@ -637,9 +641,9 @@ void ShopWindow::showList(const std::string &nick, std::string data)
return;
if (buyDialog)
- buyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ buyDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
if (sellDialog)
- sellDialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ sellDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
for (unsigned f = 0; f < data.length(); f += 9)
{
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 09c6a58fb..47de3b381 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -335,7 +335,7 @@ std::string SkillDialog::update(int id)
void SkillDialog::update()
{
mPointsLabel->setCaption(strprintf(_("Skill points available: %d"),
- PlayerInfo::getAttribute(SKILL_POINTS)));
+ PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS)));
mPointsLabel->adjustSize();
for (SkillMap::const_iterator it = mSkills.begin(), it_end = mSkills.end();
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 4798cbd84..267bd9cfc 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -150,20 +150,20 @@ StatusWindow::StatusWindow():
mLvlLabel = new Label(strprintf(_("Level: %d"), 0));
mMoneyLabel = new Label(strprintf(_("Money: %s"), ""));
- int max = PlayerInfo::getAttribute(MAX_HP);
+ int max = PlayerInfo::getAttribute(PlayerInfo::MAX_HP);
if (!max)
max = 1;
mHpLabel = new Label(_("HP:"));
mHpBar = new ProgressBar(max ?
- static_cast<float>(PlayerInfo::getAttribute(HP))
+ static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::HP))
/ static_cast<float>(max):
static_cast<float>(0), 80, 15, Theme::PROG_HP);
- max = PlayerInfo::getAttribute(EXP_NEEDED);
+ max = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
mXpLabel = new Label(_("Exp:"));
mXpBar = new ProgressBar(max ?
- static_cast<float>(PlayerInfo::getAttribute(EXP))
+ static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::EXP))
/ static_cast<float>(max):
static_cast<float>(0), 80, 15, Theme::PROG_EXP);
@@ -174,13 +174,13 @@ StatusWindow::StatusWindow():
if (magicBar)
{
- max = PlayerInfo::getAttribute(MAX_MP);
+ max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
mMpLabel = new Label(_("MP:"));
- mMpBar = new ProgressBar(max ?
- static_cast<float>(PlayerInfo::getAttribute(MAX_MP))
- / static_cast<float>(max) : static_cast<float>(0),
- 80, 15, Net::getPlayerHandler()->canUseMagic() ?
- Theme::PROG_MP : Theme::PROG_NO_MP);
+ mMpBar = new ProgressBar(max ? static_cast<float>(
+ PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
+ / static_cast<float>(max) : static_cast<float>(0),
+ 80, 15, Net::getPlayerHandler()->canUseMagic() ?
+ Theme::PROG_MP : Theme::PROG_NO_MP);
}
else
{
@@ -263,22 +263,23 @@ StatusWindow::StatusWindow():
updateMPBar(mMpBar, true);
updateXPBar(mXpBar, false);
- mMoneyLabel->setCaption(strprintf(_("Money: %s"),
- Units::formatCurrency(PlayerInfo::getAttribute(MONEY)).c_str()));
+ mMoneyLabel->setCaption(strprintf(_("Money: %s"), Units::formatCurrency(
+ PlayerInfo::getAttribute(PlayerInfo::MONEY)).c_str()));
mMoneyLabel->adjustSize();
mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"),
- PlayerInfo::getAttribute(CHAR_POINTS)));
+ PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS)));
mCharacterPointsLabel->adjustSize();
if (player_node && player_node->isGM())
{
mLvlLabel->setCaption(strprintf(_("Level: %d (GM %d)"),
- PlayerInfo::getAttribute(LEVEL), player_node->getGMLevel()));
+ PlayerInfo::getAttribute(PlayerInfo::LEVEL),
+ player_node->getGMLevel()));
}
else
{
mLvlLabel->setCaption(strprintf(_("Level: %d"),
- PlayerInfo::getAttribute(LEVEL)));
+ PlayerInfo::getAttribute(PlayerInfo::LEVEL)));
}
mLvlLabel->adjustSize();
}
@@ -294,25 +295,28 @@ void StatusWindow::processEvent(Channels channel A_UNUSED,
{
switch (event.getInt("id"))
{
- case HP: case MAX_HP:
+ case PlayerInfo::HP:
+ case PlayerInfo::MAX_HP:
updateHPBar(mHpBar, true);
break;
- case MP: case MAX_MP:
+ case PlayerInfo::MP:
+ case PlayerInfo::MAX_MP:
updateMPBar(mMpBar, true);
break;
- case EXP: case EXP_NEEDED:
+ case PlayerInfo::EXP:
+ case PlayerInfo::EXP_NEEDED:
updateXPBar(mXpBar, false);
break;
- case MONEY:
+ case PlayerInfo::MONEY:
mMoneyLabel->setCaption(strprintf(_("Money: %s"),
Units::formatCurrency(event.getInt("newValue")).c_str()));
mMoneyLabel->adjustSize();
break;
- case CHAR_POINTS:
+ case PlayerInfo::CHAR_POINTS:
mCharacterPointsLabel->setCaption(strprintf(
_("Character points: %d"), event.getInt("newValue")));
@@ -326,7 +330,7 @@ void StatusWindow::processEvent(Channels channel A_UNUSED,
}
break;
- case CORR_POINTS:
+ case PlayerInfo::CORR_POINTS:
mCorrectionPointsLabel->setCaption(strprintf(
_("Correction points: %d"), event.getInt("newValue")));
mCorrectionPointsLabel->adjustSize();
@@ -339,7 +343,7 @@ void StatusWindow::processEvent(Channels channel A_UNUSED,
}
break;
- case LEVEL:
+ case PlayerInfo::LEVEL:
mLvlLabel->setCaption(strprintf(_("Level: %d"),
event.getInt("newValue")));
mLvlLabel->adjustSize();
@@ -458,17 +462,21 @@ void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax)
return;
if (showMax)
- bar->setText(toString(PlayerInfo::getAttribute(HP)) +
- "/" + toString(PlayerInfo::getAttribute(MAX_HP)));
+ {
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::HP)) +
+ "/" + toString(PlayerInfo::getAttribute(PlayerInfo::MAX_HP)));
+ }
else
- bar->setText(toString(PlayerInfo::getAttribute(HP)));
+ {
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::HP)));
+ }
float prog = 1.0;
- if (PlayerInfo::getAttribute(MAX_HP) > 0)
+ if (PlayerInfo::getAttribute(PlayerInfo::MAX_HP) > 0)
{
- prog = static_cast<float>(PlayerInfo::getAttribute(HP))
- / static_cast<float>(PlayerInfo::getAttribute(MAX_HP));
+ prog = static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::HP))
+ / static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::MAX_HP));
}
bar->setProgress(prog);
}
@@ -480,26 +488,28 @@ void StatusWindow::updateMPBar(ProgressBar *bar, bool showMax)
if (showMax)
{
- bar->setText(toString(PlayerInfo::getAttribute(MP)) +
- "/" + toString(PlayerInfo::getAttribute(MAX_MP)));
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::MP)) +
+ "/" + toString(PlayerInfo::getAttribute(PlayerInfo::MAX_MP)));
}
else
{
- bar->setText(toString(PlayerInfo::getAttribute(MP)));
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::MP)));
}
float prog = 1.0f;
- if (PlayerInfo::getAttribute(MAX_MP) > 0)
+ if (PlayerInfo::getAttribute(PlayerInfo::MAX_MP) > 0)
{
- if (PlayerInfo::getAttribute(MAX_MP))
+ if (PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
{
- prog = static_cast<float>(PlayerInfo::getAttribute(MP))
- / static_cast<float>(PlayerInfo::getAttribute(MAX_MP));
+ prog = static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::MP))
+ / static_cast<float>(PlayerInfo::getAttribute(
+ PlayerInfo::MAX_MP));
}
else
{
- prog = static_cast<float>(PlayerInfo::getAttribute(MP));
+ prog = static_cast<float>(PlayerInfo::getAttribute(
+ PlayerInfo::MP));
}
}
@@ -547,8 +557,8 @@ void StatusWindow::updateXPBar(ProgressBar *bar, bool percent)
if (!bar)
return;
- updateProgressBar(bar, PlayerInfo::getAttribute(EXP),
- PlayerInfo::getAttribute(EXP_NEEDED), percent);
+ updateProgressBar(bar, PlayerInfo::getAttribute(PlayerInfo::EXP),
+ PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED), percent);
}
void StatusWindow::updateJobBar(ProgressBar *bar, bool percent)
@@ -572,21 +582,21 @@ void StatusWindow::updateWeightBar(ProgressBar *bar)
if (!bar)
return;
- if (PlayerInfo::getAttribute(MAX_WEIGHT) == 0)
+ if (PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT) == 0)
{
bar->setText(_("Max"));
bar->setProgress(1.0);
}
else
{
- float progress = static_cast<float>(
- PlayerInfo::getAttribute(TOTAL_WEIGHT))
- / static_cast<float>(PlayerInfo::getAttribute(MAX_WEIGHT));
+ float progress = static_cast<float>(PlayerInfo::getAttribute(
+ PlayerInfo::TOTAL_WEIGHT)) / static_cast<float>(
+ PlayerInfo::getAttribute(PlayerInfo::MAX_WEIGHT));
bar->setText(strprintf("%s/%s", Units::formatWeight(
- PlayerInfo::getAttribute(TOTAL_WEIGHT)).c_str(),
+ PlayerInfo::getAttribute(PlayerInfo::TOTAL_WEIGHT)).c_str(),
Units::formatWeight(PlayerInfo::getAttribute(
- MAX_WEIGHT)).c_str()));
+ PlayerInfo::MAX_WEIGHT)).c_str()));
bar->setProgress(progress);
}
@@ -597,7 +607,7 @@ void StatusWindow::updateMoneyBar(ProgressBar *bar)
if (!bar)
return;
- int money = PlayerInfo::getAttribute(MONEY);
+ int money = PlayerInfo::getAttribute(PlayerInfo::MONEY);
bar->setText(Units::formatCurrency(money).c_str());
if (money > 0)
{
@@ -807,10 +817,10 @@ std::string ChangeDisplay::update()
mPoints->setCaption(_("Max"));
if (mDec)
- mDec->setEnabled(PlayerInfo::getAttribute(CORR_POINTS));
+ mDec->setEnabled(PlayerInfo::getAttribute(PlayerInfo::CORR_POINTS));
- mInc->setEnabled(PlayerInfo::getAttribute(CHAR_POINTS) >= mNeeded &&
- mNeeded > 0);
+ mInc->setEnabled(PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS)
+ >= mNeeded && mNeeded > 0);
return AttrDisplay::update();
}
@@ -827,11 +837,13 @@ void ChangeDisplay::action(const gcn::ActionEvent &event)
if (Net::getPlayerHandler()->canCorrectAttributes() &&
event.getSource() == mDec)
{
- int newcorpoints = PlayerInfo::getAttribute(CORR_POINTS) - 1;
- PlayerInfo::setAttribute(CORR_POINTS, newcorpoints);
+ int newcorpoints = PlayerInfo::getAttribute(
+ PlayerInfo::CORR_POINTS) - 1;
+ PlayerInfo::setAttribute(PlayerInfo::CORR_POINTS, newcorpoints);
- int newpoints = PlayerInfo::getAttribute(CHAR_POINTS) + 1;
- PlayerInfo::setAttribute(CHAR_POINTS, newpoints);
+ int newpoints = PlayerInfo::getAttribute(
+ PlayerInfo::CHAR_POINTS) + 1;
+ PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints);
int newbase = PlayerInfo::getStatBase(mId) - 1;
PlayerInfo::setStatBase(mId, newbase);
@@ -848,8 +860,9 @@ void ChangeDisplay::action(const gcn::ActionEvent &event)
cnt = 10;
}
- int newpoints = PlayerInfo::getAttribute(CHAR_POINTS) - cnt;
- PlayerInfo::setAttribute(CHAR_POINTS, newpoints);
+ int newpoints = PlayerInfo::getAttribute(
+ PlayerInfo::CHAR_POINTS) - cnt;
+ PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, newpoints);
int newbase = PlayerInfo::getStatBase(mId) + cnt;
PlayerInfo::setStatBase(mId, newbase);
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 5ad8e33f6..f37f1d49d 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -369,7 +369,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
return;
int v = atoi(mMoneyField->getText().c_str());
- int curMoney = PlayerInfo::getAttribute(MONEY);
+ int curMoney = PlayerInfo::getAttribute(PlayerInfo::MONEY);
if (v > curMoney)
{
if (localChatTab)
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 4cc4cad41..3635e5f4f 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -347,6 +347,7 @@ void ScrollArea::drawButton(gcn::Graphics *graphics, BUTTON_DIR dir)
state = mRightButtonPressed ? 1 : 0;
dim = getRightButtonDimension();
break;
+ case BUTTONS_DIR:
default:
logger->log("ScrollArea::drawButton unknown dir: "
+ toString(static_cast<unsigned>(dir)));
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 6b5ad28a4..d97e3e57d 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -142,7 +142,8 @@ void Slider::draw(gcn::Graphics *graphics)
}
x += w;
- static_cast<Graphics*>(graphics)->drawImage(buttons[0].grid[HEND], x, y);
+ static_cast<Graphics*>(graphics)->drawImage(
+ buttons[0].grid[HEND], x, y);
}
else
{
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index 94eef42a0..9afc05fcf 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -80,7 +80,7 @@ class Slider : public gcn::Slider
enum SLIDER_ENUM
{
- HSTART,
+ HSTART = 0,
HMID,
HEND,
HGRIP,