summaryrefslogtreecommitdiff
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
parente1e411459e9c9aae819eee474d48d0cc20f6ca07 (diff)
downloadmanaplus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.gz
manaplus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.bz2
manaplus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.tar.xz
manaplus-65f11a2d85f26932b0e2f0679ddbfc6b6fc4b635.zip
Fix code style.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/actorspritemanager.cpp20
-rw-r--r--src/being.cpp4
-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
-rw-r--r--src/localplayer.cpp15
-rw-r--r--src/net/ea/buysellhandler.cpp4
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/ea/playerhandler.cpp78
-rw-r--r--src/net/eathena/buysellhandler.cpp2
-rw-r--r--src/net/eathena/charserverhandler.cpp14
-rw-r--r--src/net/eathena/generalhandler.cpp16
-rw-r--r--src/net/eathena/playerhandler.cpp2
-rw-r--r--src/net/tmwa/buysellhandler.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp14
-rw-r--r--src/net/tmwa/generalhandler.cpp16
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/playerinfo.h46
-rw-r--r--src/spellmanager.cpp2
29 files changed, 277 insertions, 249 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 6a5c6900f..fa3c03526 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -385,7 +385,7 @@ impHandler0(itenplz)
if (actorSpriteManager)
{
if (Net::getPlayerHandler()->canUseMagic()
- && PlayerInfo::getAttribute(MP) >= 3)
+ && PlayerInfo::getAttribute(PlayerInfo::MP) >= 3)
{
actorSpriteManager->itenplz();
}
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index a85d2cd49..8cdede262 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -1126,9 +1126,9 @@ void ActorSpriteManager::heal(Being* target)
// self
if (target && player_node->getName() == target->getName())
{
- if (PlayerInfo::getAttribute(MP) >= 6
- && PlayerInfo::getAttribute(HP)
- != PlayerInfo::getAttribute(MAX_HP))
+ if (PlayerInfo::getAttribute(PlayerInfo::MP) >= 6
+ && PlayerInfo::getAttribute(PlayerInfo::HP)
+ != PlayerInfo::getAttribute(PlayerInfo::MAX_HP))
{
if (!Client::limitPackets(PACKET_CHAT))
return;
@@ -1139,7 +1139,7 @@ void ActorSpriteManager::heal(Being* target)
else if (PlayerInfo::getStatEffective(340) < 2
|| PlayerInfo::getStatEffective(341) < 2)
{
- if (PlayerInfo::getAttribute(MP) >= 6)
+ if (PlayerInfo::getAttribute(PlayerInfo::MP) >= 6)
{
if (target && target->getType() != Being::MONSTER)
{
@@ -1148,8 +1148,8 @@ void ActorSpriteManager::heal(Being* target)
chatWindow->localChatInput(mSpellHeal1 + " "
+ target->getName());
}
- else if (PlayerInfo::getAttribute(HP)
- != PlayerInfo::getAttribute(MAX_HP))
+ else if (PlayerInfo::getAttribute(PlayerInfo::HP)
+ != PlayerInfo::getAttribute(PlayerInfo::MAX_HP))
{
if (!Client::limitPackets(PACKET_CHAT))
return;
@@ -1161,7 +1161,7 @@ void ActorSpriteManager::heal(Being* target)
else
{
// mp > 10 and target not monster
- if (PlayerInfo::getAttribute(MP) >= 10 && target
+ if (PlayerInfo::getAttribute(PlayerInfo::MP) >= 10 && target
&& target->getType() != Being::MONSTER)
{
// target not enemy
@@ -1183,9 +1183,9 @@ void ActorSpriteManager::heal(Being* target)
}
// heal self if selected monster or selection empty
else if ((!target || target->getType() == Being::MONSTER)
- && PlayerInfo::getAttribute(MP) >= 6
- && PlayerInfo::getAttribute(HP)
- != PlayerInfo::getAttribute(MAX_HP))
+ && PlayerInfo::getAttribute(PlayerInfo::MP) >= 6
+ && PlayerInfo::getAttribute(PlayerInfo::HP)
+ != PlayerInfo::getAttribute(PlayerInfo::MAX_HP))
{
if (!Client::limitPackets(PACKET_CHAT))
return;
diff --git a/src/being.cpp b/src/being.cpp
index 740989993..2d276a72c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2120,8 +2120,8 @@ bool Being::drawSpriteAt(Graphics *graphics, int x, int y) const
}
if (mShowOwnHP && player_node == this && mAction != DEAD)
{
- drawHpBar(graphics, PlayerInfo::getAttribute(MAX_HP),
- PlayerInfo::getAttribute(HP), 0,
+ drawHpBar(graphics, PlayerInfo::getAttribute(PlayerInfo::MAX_HP),
+ PlayerInfo::getAttribute(PlayerInfo::HP), 0,
UserPalette::PLAYER_HP, UserPalette::PLAYER_HP2,
x - 50 + 16, y + 32 - 6, 2 * 50, 4);
}
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,
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index f204164ee..e4de6ad1e 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -184,8 +184,9 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mWaitPing = false;
mPingTime = 0;
- PlayerInfo::setStatBase(WALK_SPEED, static_cast<int>(getWalkSpeed().x));
- PlayerInfo::setStatMod(WALK_SPEED, 0);
+ PlayerInfo::setStatBase(PlayerInfo::WALK_SPEED,
+ static_cast<int>(getWalkSpeed().x));
+ PlayerInfo::setStatMod(PlayerInfo::WALK_SPEED, 0);
loadHomes();
@@ -1672,19 +1673,19 @@ void LocalPlayer::processEvent(Channels channel,
{
switch (event.getInt("id"))
{
- case EXP:
+ case PlayerInfo::EXP:
{
if (event.getInt("oldValue") > event.getInt("newValue"))
break;
int change = event.getInt("newValue")
- - event.getInt("oldValue");
+ - event.getInt("oldValue");
if (change != 0)
addMessageToQueue(strprintf("%d %s", change, _("xp")));
break;
}
- case LEVEL:
+ case PlayerInfo::LEVEL:
mLevel = event.getInt("newValue");
break;
default:
@@ -3257,7 +3258,7 @@ void LocalPlayer::tryMagic(std::string spell, int baseMagic,
if (PlayerInfo::getStatEffective(340) >= baseMagic
&& PlayerInfo::getStatEffective(342) >= schoolMagic)
{
- if (PlayerInfo::getAttribute(MP) >= mana)
+ if (PlayerInfo::getAttribute(PlayerInfo::MP) >= mana)
{
if (!Client::limitPackets(PACKET_CHAT))
return;
@@ -4098,7 +4099,7 @@ int LocalPlayer::getTargetTime()
int LocalPlayer::getLevel() const
{
- return PlayerInfo::getAttribute(LEVEL);
+ return PlayerInfo::getAttribute(PlayerInfo::LEVEL);
}
void LocalPlayer::updateNavigateList()
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 5208f34fc..46292bae5 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -144,7 +144,7 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset)
if (n_items > 0)
{
SellDialog *dialog = new SellDialog(mNpcId);
- dialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ dialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
for (int k = 0; k < n_items; k++)
{
@@ -175,7 +175,7 @@ void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg)
// Reset player money since buy dialog already assumed purchase
// would go fine
if (mBuyDialog)
- mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ mBuyDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
SERVER_NOTICE(_("Unable to buy."))
}
}
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index a03ea45af..b194afd0d 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -590,8 +590,8 @@ void InventoryHandler::processPlayerAttackRange(Net::MessageIn &msg)
int range = msg.readInt16();
if (player_node)
player_node->setAttackRange(range);
- PlayerInfo::setStatBase(ATTACK_RANGE, range);
- PlayerInfo::setStatMod(ATTACK_RANGE, 0);
+ PlayerInfo::setStatBase(PlayerInfo::ATTACK_RANGE, range);
+ PlayerInfo::setStatMod(PlayerInfo::ATTACK_RANGE, 0);
}
void InventoryHandler::processPlayerArrowEquip(Net::MessageIn &msg)
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index b31f9aa2f..4c6e894c9 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -274,12 +274,12 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
case 0x0000:
player_node->setWalkSpeed(Vector(static_cast<float>(
value), static_cast<float>(value), 0));
- PlayerInfo::setStatBase(WALK_SPEED, value);
- PlayerInfo::setStatMod(WALK_SPEED, 0);
+ PlayerInfo::setStatBase(PlayerInfo::WALK_SPEED, value);
+ PlayerInfo::setStatMod(PlayerInfo::WALK_SPEED, 0);
break;
case 0x0004: break; // manner
case 0x0005:
- PlayerInfo::setAttribute(HP, value);
+ PlayerInfo::setAttribute(PlayerInfo::HP, value);
if (player_node->isInParty() && Party::getParty(1))
{
PartyMember *m = Party::getParty(1)
@@ -287,12 +287,12 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
if (m)
{
m->setHp(value);
- m->setMaxHp(PlayerInfo::getAttribute(MAX_HP));
+ m->setMaxHp(PlayerInfo::getAttribute(PlayerInfo::MAX_HP));
}
}
break;
case 0x0006:
- PlayerInfo::setAttribute(MAX_HP, value);
+ PlayerInfo::setAttribute(PlayerInfo::MAX_HP, value);
if (player_node->isInParty() && Party::getParty(1))
{
@@ -300,22 +300,22 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
player_node->getId());
if (m)
{
- m->setHp(PlayerInfo::getAttribute(HP));
+ m->setHp(PlayerInfo::getAttribute(PlayerInfo::HP));
m->setMaxHp(value);
}
}
break;
case 0x0007:
- PlayerInfo::setAttribute(MP, value);
+ PlayerInfo::setAttribute(PlayerInfo::MP, value);
break;
case 0x0008:
- PlayerInfo::setAttribute(MAX_MP, value);
+ PlayerInfo::setAttribute(PlayerInfo::MAX_MP, value);
break;
case 0x0009:
- PlayerInfo::setAttribute(CHAR_POINTS, value);
+ PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, value);
break;
case 0x000b:
- PlayerInfo::setAttribute(LEVEL, value);
+ PlayerInfo::setAttribute(PlayerInfo::LEVEL, value);
if (player_node)
{
player_node->setLevel(value);
@@ -323,15 +323,17 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
}
break;
case 0x000c:
- PlayerInfo::setAttribute(SKILL_POINTS, value);
+ PlayerInfo::setAttribute(PlayerInfo::SKILL_POINTS, value);
if (skillDialog)
skillDialog->update();
break;
case 0x0018:
if (!weightNotice)
{
- const int max = PlayerInfo::getAttribute(MAX_WEIGHT) / 2;
- const int total = PlayerInfo::getAttribute(TOTAL_WEIGHT);
+ const int max = PlayerInfo::getAttribute(
+ PlayerInfo::MAX_WEIGHT) / 2;
+ const int total = PlayerInfo::getAttribute(
+ PlayerInfo::TOTAL_WEIGHT);
if (value >= max && total < max)
{
weightNoticeTime = cur_time + 5;
@@ -353,10 +355,10 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
&weightListener);
}
}
- PlayerInfo::setAttribute(TOTAL_WEIGHT, value);
+ PlayerInfo::setAttribute(PlayerInfo::TOTAL_WEIGHT, value);
break;
case 0x0019:
- PlayerInfo::setAttribute(MAX_WEIGHT, value);
+ PlayerInfo::setAttribute(PlayerInfo::MAX_WEIGHT, value);
break;
case 0x0029:
@@ -406,8 +408,8 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
case 0x0035:
player_node->setAttackSpeed(value);
- PlayerInfo::setStatBase(ATTACK_DELAY, value);
- PlayerInfo::setStatMod(ATTACK_DELAY, 0);
+ PlayerInfo::setStatBase(PlayerInfo::ATTACK_DELAY, value);
+ PlayerInfo::setStatMod(PlayerInfo::ATTACK_DELAY, 0);
PlayerInfo::updateAttrs();
break;
@@ -425,7 +427,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
break;
}
- if (PlayerInfo::getAttribute(HP) == 0 && !deathNotice)
+ if (PlayerInfo::getAttribute(PlayerInfo::HP) == 0 && !deathNotice)
{
deathNotice = new OkDialog(_("Message"),
randomDeathMessage(), DIALOG_OK, false);
@@ -440,7 +442,7 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg)
switch (type)
{
case 0x0001:
- PlayerInfo::setAttribute(EXP, msg.readInt32());
+ PlayerInfo::setAttribute(PlayerInfo::EXP, msg.readInt32());
break;
case 0x0002:
PlayerInfo::setStatExperience(EA_JOB, msg.readInt32(),
@@ -448,26 +450,24 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg)
break;
case 0x0014:
{
- int oldMoney = PlayerInfo::getAttribute(MONEY);
- int newMoney = msg.readInt32();
- if (newMoney > oldMoney)
- {
- SERVER_NOTICE(strprintf(_("You picked up %s."),
- Units::formatCurrency(newMoney -
- oldMoney).c_str()))
- }
- else if (newMoney < oldMoney)
- {
- SERVER_NOTICE(strprintf(_("You spent %s."),
- Units::formatCurrency(oldMoney -
- newMoney).c_str()))
- }
+ int oldMoney = PlayerInfo::getAttribute(PlayerInfo::MONEY);
+ int newMoney = msg.readInt32();
+ if (newMoney > oldMoney)
+ {
+ SERVER_NOTICE(strprintf(_("You picked up %s."),
+ Units::formatCurrency(newMoney - oldMoney).c_str()))
+ }
+ else if (newMoney < oldMoney)
+ {
+ SERVER_NOTICE(strprintf(_("You spent %s."),
+ Units::formatCurrency(oldMoney - newMoney).c_str()))
+ }
- PlayerInfo::setAttribute(MONEY, newMoney);
+ PlayerInfo::setAttribute(PlayerInfo::MONEY, newMoney);
break;
}
case 0x0016:
- PlayerInfo::setAttribute(EXP_NEEDED, msg.readInt32());
+ PlayerInfo::setAttribute(PlayerInfo::EXP_NEEDED, msg.readInt32());
break;
case 0x0017:
PlayerInfo::setStatExperience(EA_JOB,
@@ -488,7 +488,7 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg)
PlayerInfo::setStatBase(type, base, false);
PlayerInfo::setStatMod(type, bonus);
- if (type == EA_ATK || type == ATTACK_DELAY)
+ if (type == EA_ATK || type == PlayerInfo::ATTACK_DELAY)
PlayerInfo::updateAttrs();
}
@@ -501,9 +501,9 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg)
if (ok != 1)
{
int oldValue = PlayerInfo::getStatBase(type);
- int points = PlayerInfo::getAttribute(CHAR_POINTS);
+ int points = PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS);
points += oldValue - value;
- PlayerInfo::setAttribute(CHAR_POINTS, points);
+ PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, points);
SERVER_NOTICE(_("Cannot raise skill!"))
}
@@ -512,7 +512,7 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg)
void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg)
{
- PlayerInfo::setAttribute(CHAR_POINTS, msg.readInt16());
+ PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, msg.readInt16());
int val = msg.readInt8();
PlayerInfo::setStatBase(EA_STR, val);
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index bc53daeff..785338373 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -108,7 +108,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
int sz = 11;
int n_items = (msg.getLength() - 4) / sz;
mBuyDialog = new BuyDialog(mNpcId);
- mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ mBuyDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
for (int k = 0; k < n_items; k++)
{
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index c2c5f1ebf..2348e0a67 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -176,8 +176,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
tempPlayer->setGender(token.sex);
PlayerInfoBackend &data = character->data;
- data.mAttributes[EXP] = msg.readInt32();
- data.mAttributes[MONEY] = msg.readInt32();
+ data.mAttributes[PlayerInfo::EXP] = msg.readInt32();
+ data.mAttributes[PlayerInfo::MONEY] = msg.readInt32();
data.mStats[JOB].exp = msg.readInt32();
int temp = msg.readInt32();
@@ -194,10 +194,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt32(); // manner
msg.readInt16(); // character points left
- data.mAttributes[HP] = msg.readInt16();
- data.mAttributes[MAX_HP] = msg.readInt16();
- data.mAttributes[MP] = msg.readInt16();
- data.mAttributes[MAX_MP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::HP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MAX_HP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16();
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
@@ -205,7 +205,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
- data.mAttributes[LEVEL] = msg.readInt16();
+ data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
int bottomClothes = msg.readInt16();
diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp
index 3fce80ad2..76bb2cb36 100644
--- a/src/net/eathena/generalhandler.cpp
+++ b/src/net/eathena/generalhandler.cpp
@@ -278,14 +278,14 @@ void GeneralHandler::processEvent(Channels channel,
statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
// xgettext:no-c-format
statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
- statusWindow->addAttribute(ATTACK_DELAY, _("Attack Delay"),
- false, "");
- statusWindow->addAttribute(WALK_SPEED, _("Walk Delay"),
- false, "");
- statusWindow->addAttribute(ATTACK_RANGE, _("Attack Range"),
- false, "");
- statusWindow->addAttribute(ATTACK_SPEED, _("Damage per sec."),
- false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_DELAY,
+ _("Attack Delay"), false, "");
+ statusWindow->addAttribute(PlayerInfo::WALK_SPEED,
+ _("Walk Delay"), false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_RANGE,
+ _("Attack Range"), false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_SPEED,
+ _("Damage per sec."), false, "");
}
else if (event.getName() == EVENT_GUIWINDOWSUNLOADING)
{
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index dfce8812c..13a6ec018 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -149,7 +149,7 @@ void PlayerHandler::increaseAttribute(int attr)
void PlayerHandler::increaseSkill(unsigned short skillId)
{
- if (PlayerInfo::getAttribute(SKILL_POINTS) <= 0)
+ if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0)
return;
MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST);
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 664953e4e..aa0a07d9d 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -110,7 +110,7 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg)
sz += 1;
int n_items = (msg.getLength() - 4) / sz;
mBuyDialog = new BuyDialog(mNpcId);
- mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
+ mBuyDialog->setMoney(PlayerInfo::getAttribute(PlayerInfo::MONEY));
for (int k = 0; k < n_items; k++)
{
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 85ee3ce44..b851a5093 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -177,8 +177,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
tempPlayer->setGender(token.sex);
PlayerInfoBackend &data = character->data;
- data.mAttributes[EXP] = msg.readInt32();
- data.mAttributes[MONEY] = msg.readInt32();
+ data.mAttributes[PlayerInfo::EXP] = msg.readInt32();
+ data.mAttributes[PlayerInfo::MONEY] = msg.readInt32();
data.mStats[JOB].exp = msg.readInt32();
int temp = msg.readInt32();
@@ -195,10 +195,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt32(); // manner
msg.readInt16(); // character points left
- data.mAttributes[HP] = msg.readInt16();
- data.mAttributes[MAX_HP] = msg.readInt16();
- data.mAttributes[MP] = msg.readInt16();
- data.mAttributes[MAX_MP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::HP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MAX_HP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MP] = msg.readInt16();
+ data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16();
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
@@ -206,7 +206,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
- data.mAttributes[LEVEL] = msg.readInt16();
+ data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
int bottomClothes = msg.readInt16();
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 9839dfe10..0006d724d 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -278,14 +278,14 @@ void GeneralHandler::processEvent(Channels channel,
statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
// xgettext:no-c-format
statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
- statusWindow->addAttribute(ATTACK_DELAY, _("Attack Delay"),
- false, "");
- statusWindow->addAttribute(WALK_SPEED, _("Walk Delay"),
- false, "");
- statusWindow->addAttribute(ATTACK_RANGE, _("Attack Range"),
- false, "");
- statusWindow->addAttribute(ATTACK_SPEED, _("Damage per sec."),
- false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_DELAY,
+ _("Attack Delay"), false, "");
+ statusWindow->addAttribute(PlayerInfo::WALK_SPEED,
+ _("Walk Delay"), false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_RANGE,
+ _("Attack Range"), false, "");
+ statusWindow->addAttribute(PlayerInfo::ATTACK_SPEED,
+ _("Damage per sec."), false, "");
}
else if (event.getName() == EVENT_GUIWINDOWSUNLOADING)
{
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 5c0b8d950..92bfaef74 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -143,7 +143,7 @@ void PlayerHandler::increaseAttribute(int attr)
void PlayerHandler::increaseSkill(unsigned short skillId)
{
- if (PlayerInfo::getAttribute(SKILL_POINTS) <= 0)
+ if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0)
return;
MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST);
diff --git a/src/playerinfo.h b/src/playerinfo.h
index cff145d2d..4298a45b5 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -27,29 +27,6 @@
#include <map>
#include <string>
-/**
- * Standard attributes for players.
- */
-enum Attribute
-{
- LEVEL = 0,
- HP,
- MAX_HP,
- MP,
- MAX_MP,
- EXP,
- EXP_NEEDED,
- MONEY,
- TOTAL_WEIGHT,
- MAX_WEIGHT,
- SKILL_POINTS,
- CHAR_POINTS,
- CORR_POINTS,
- ATTACK_DELAY = 100,
- ATTACK_RANGE = 101,
- WALK_SPEED = 102,
- ATTACK_SPEED = 103
-};
/**
* Stat information storage structure.
@@ -97,6 +74,29 @@ typedef std::map<int, Special> SpecialsMap;
*/
namespace PlayerInfo
{
+ /**
+ * Standard attributes for players.
+ */
+ enum Attribute
+ {
+ LEVEL = 0,
+ HP,
+ MAX_HP,
+ MP,
+ MAX_MP,
+ EXP,
+ EXP_NEEDED,
+ MONEY,
+ TOTAL_WEIGHT,
+ MAX_WEIGHT,
+ SKILL_POINTS,
+ CHAR_POINTS,
+ CORR_POINTS,
+ ATTACK_DELAY = 100,
+ ATTACK_RANGE = 101,
+ WALK_SPEED = 102,
+ ATTACK_SPEED = 103
+ };
// --- Attributes -------------------------------------------------------------
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index ed6989280..222004347 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -141,7 +141,7 @@ void SpellManager::invoke(int spellId)
&& PlayerInfo::getStatEffective(SKILL_MAGIC) >= spell->getBaseLvl()
&& PlayerInfo::getStatEffective(
spell->getSchool()) >= spell->getSchoolLvl()
- && PlayerInfo::getAttribute(MP) >= spell->getMana()))
+ && PlayerInfo::getAttribute(PlayerInfo::MP) >= spell->getMana()))
{
Being* target = player_node->getTarget();
if (spell->getTargetType() == NOTARGET)