summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-31 18:57:07 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-31 18:57:07 +0300
commit5719a23f9b0729f04ed1fa5dc6cc680c58d514d4 (patch)
treed4fc1a73ea263a737e56d740a266bea34a1bbfcd /src/gui
parent31e7a7d05f36495df0176fc31d5894e216c3cdf4 (diff)
downloadmv-5719a23f9b0729f04ed1fa5dc6cc680c58d514d4.tar.gz
mv-5719a23f9b0729f04ed1fa5dc6cc680c58d514d4.tar.bz2
mv-5719a23f9b0729f04ed1fa5dc6cc680c58d514d4.tar.xz
mv-5719a23f9b0729f04ed1fa5dc6cc680c58d514d4.zip
Move units into db directory.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/itempopup.cpp5
-rw-r--r--src/gui/widgets/characterdisplay.cpp6
-rw-r--r--src/gui/widgets/selldialog.cpp8
-rw-r--r--src/gui/windowmanager_unittest.cc5
-rw-r--r--src/gui/windows/bankwindow.cpp6
-rw-r--r--src/gui/windows/buydialog.cpp7
-rw-r--r--src/gui/windows/charselectdialog.cpp5
-rw-r--r--src/gui/windows/inventorywindow.cpp9
-rw-r--r--src/gui/windows/statuswindow.cpp16
-rw-r--r--src/gui/windows/tradewindow.cpp5
10 files changed, 40 insertions, 32 deletions
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index a659a94bd..5cdc1dd20 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -25,7 +25,6 @@
#include "actormanager.h"
#include "configuration.h"
-#include "units.h"
#include "gui/gui.h"
@@ -39,6 +38,8 @@
#include "resources/iteminfo.h"
+#include "resources/db/unitsdb.h"
+
#include "resources/image/image.h"
#include "resources/item/item.h"
@@ -222,7 +223,7 @@ void ItemPopup::setItem(const ItemInfo &item,
mItemEffect->setTextWrapped(item.getEffect(), 196);
// TRANSLATORS: popup label
mItemWeight->setTextWrapped(strprintf(_("Weight: %s"),
- Units::formatWeight(item.getWeight()).c_str()), 196);
+ UnitsDb::formatWeight(item.getWeight()).c_str()), 196);
mItemCards->setTextWrapped(getCardsString(cards), 196);
int minWidth = mItemName->getWidth() + space;
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp
index 8ebc311f7..696b8c2bf 100644
--- a/src/gui/widgets/characterdisplay.cpp
+++ b/src/gui/widgets/characterdisplay.cpp
@@ -22,8 +22,6 @@
#include "gui/widgets/characterdisplay.h"
-#include "units.h"
-
#include "gui/gui.h"
#include "gui/windows/charselectdialog.h"
@@ -37,6 +35,8 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
+#include "resources/db/unitsdb.h"
+
#include "net/character.h"
#include "debug.h"
@@ -139,7 +139,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED)
CAST_U32(
mCharacter->data.mAttributes[Attributes::PLAYER_LEVEL])),
// TRANSLATORS: character money
- strprintf(_("Money: %s"), Units::formatCurrency(
+ strprintf(_("Money: %s"), UnitsDb::formatCurrency(
mCharacter->data.mAttributes[Attributes::MONEY]).c_str()));
}
else
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 39584050d..7f96e14ff 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -22,8 +22,6 @@
#include "gui/widgets/selldialog.h"
-#include "units.h"
-
#include "enums/gui/layouttype.h"
#include "gui/windows/setupwindow.h"
@@ -43,6 +41,8 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
+#include "resources/db/unitsdb.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
@@ -358,8 +358,8 @@ void SellDialog::updateButtonsAndLabels()
{
// TRANSLATORS: sell dialog label
mMoneyLabel->setCaption(strprintf(_("Price: %s / Total: %s"),
- Units::formatCurrency(income).c_str(),
- Units::formatCurrency(mPlayerMoney + income).c_str()));
+ UnitsDb::formatCurrency(income).c_str(),
+ UnitsDb::formatCurrency(mPlayerMoney + income).c_str()));
}
if (item)
item->update();
diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc
index 048d23550..b9c848821 100644
--- a/src/gui/windowmanager_unittest.cc
+++ b/src/gui/windowmanager_unittest.cc
@@ -23,7 +23,6 @@
#include "configuration.h"
#include "graphicsmanager.h"
#include "settings.h"
-#include "units.h"
#include "textcommand.h"
#include "being/being.h"
@@ -105,6 +104,8 @@
#include "resources/sdlimagehelper.h"
+#include "resources/db/unitsdb.h"
+
#include "resources/item/item.h"
#include "resources/map/map.h"
@@ -160,7 +161,7 @@ TEST_CASE("Windows tests", "windowmanager")
gui = new Gui();
gui->postInit(mainGraphics);
touchManager.init();
- Units::loadUnits();
+ UnitsDb::loadUnits();
charServerHandler = new EAthena::CharServerHandler;
serverFeatures = new EAthena::ServerFeatures;
inventoryHandler = new EAthena::InventoryHandler;
diff --git a/src/gui/windows/bankwindow.cpp b/src/gui/windows/bankwindow.cpp
index c55c11250..d6e33148c 100644
--- a/src/gui/windows/bankwindow.cpp
+++ b/src/gui/windows/bankwindow.cpp
@@ -20,8 +20,6 @@
#include "gui/windows/bankwindow.h"
-#include "units.h"
-
#include "net/bankhandler.h"
#include "gui/windows/setupwindow.h"
@@ -34,6 +32,8 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
+#include "resources/db/unitsdb.h"
+
#include "debug.h"
BankWindow *bankWindow = nullptr;
@@ -89,7 +89,7 @@ void BankWindow::bankMoneyChanged(const int money)
{
// TRANSLATORS: bank window money label
mBankMoneyLabel->setCaption(strprintf(_("Money in bank: %s"),
- Units::formatCurrency(money).c_str()));
+ UnitsDb::formatCurrency(money).c_str()));
}
void BankWindow::action(const ActionEvent &event)
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index d2c4e3a6a..c5fdac885 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -24,7 +24,6 @@
#include "actormanager.h"
#include "configuration.h"
-#include "units.h"
#include "being/being.h"
@@ -57,6 +56,8 @@
#include "resources/iteminfo.h"
+#include "resources/db/unitsdb.h"
+
#include "utils/delete2.h"
#include <algorithm>
@@ -738,8 +739,8 @@ void BuyDialog::updateButtonsAndLabels()
mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
// TRANSLATORS: buy dialog label
mMoneyLabel->setCaption(strprintf(_("Price: %s / Total: %s"),
- Units::formatCurrency(price).c_str(),
- Units::formatCurrency(mMoney - price).c_str()));
+ UnitsDb::formatCurrency(price).c_str(),
+ UnitsDb::formatCurrency(mMoney - price).c_str()));
}
void BuyDialog::setVisible(Visible visible)
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 537ae57d4..f7edbfc24 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -24,7 +24,6 @@
#include "client.h"
#include "configuration.h"
-#include "units.h"
#include "listeners/charrenamelistener.h"
#include "listeners/pincodelistener.h"
@@ -48,6 +47,8 @@
#include "net/logindata.h"
#include "net/serverfeatures.h"
+#include "resources/db/unitsdb.h"
+
#include "debug.h"
// Character slots per row in the dialog
@@ -251,7 +252,7 @@ void CharSelectDialog::action(const ActionEvent &event)
character->data.mAttributes[Attributes::PLAYER_LEVEL]),
CAST_U32(
character->data.mAttributes[Attributes::PLAYER_EXP]),
- Units::formatCurrency(
+ UnitsDb::formatCurrency(
character->data.mAttributes[Attributes::MONEY]).c_str());
CREATEWIDGET(OkDialog, data->getName(), msg,
// TRANSLATORS: ok dialog button
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 440d8ab6d..7e303af28 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -23,7 +23,6 @@
#include "gui/windows/inventorywindow.h"
#include "configuration.h"
-#include "units.h"
#include "being/playerinfo.h"
@@ -65,6 +64,8 @@
#include "resources/iteminfo.h"
+#include "resources/db/unitsdb.h"
+
#include "resources/item/item.h"
#include "utils/delete2.h"
@@ -701,7 +702,7 @@ void InventoryWindow::mouseMoved(MouseEvent &event)
{
// TRANSLATORS: money label
textPopup->show(rect.x + x, rect.y + y, strprintf(_("Money: %s"),
- Units::formatCurrency(PlayerInfo::getAttribute(
+ UnitsDb::formatCurrency(PlayerInfo::getAttribute(
Attributes::MONEY)).c_str()));
}
else
@@ -856,8 +857,8 @@ void InventoryWindow::updateWeight()
mWeightBar->setProgress(static_cast<float>(total)
/ static_cast<float>(max));
mWeightBar->setText(strprintf("%s/%s",
- Units::formatWeight(total).c_str(),
- Units::formatWeight(max).c_str()));
+ UnitsDb::formatWeight(total).c_str(),
+ UnitsDb::formatWeight(max).c_str()));
}
void InventoryWindow::slotsChanged(const Inventory *const inventory)
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 933e80dee..9b1fa0770 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -25,7 +25,6 @@
#include "configuration.h"
#include "gamemodifiers.h"
#include "settings.h"
-#include "units.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -49,6 +48,7 @@
#include "net/inventoryhandler.h"
#include "net/playerhandler.h"
+#include "resources/db/unitsdb.h"
#include "resources/db/statdb.h"
#include "resources/item/item.h"
@@ -215,8 +215,9 @@ StatusWindow::StatusWindow() :
updateXPBar(mXpBar, false);
// TRANSLATORS: status window label
- mMoneyLabel->setCaption(strprintf(_("Money: %s"), Units::formatCurrency(
- PlayerInfo::getAttribute(Attributes::MONEY)).c_str()));
+ mMoneyLabel->setCaption(strprintf(_("Money: %s"),
+ UnitsDb::formatCurrency(PlayerInfo::getAttribute(
+ Attributes::MONEY)).c_str()));
mMoneyLabel->adjustSize();
updateLevelLabel();
@@ -356,7 +357,7 @@ void StatusWindow::attributeChanged(const AttributesT id,
case Attributes::MONEY:
// TRANSLATORS: status window label
mMoneyLabel->setCaption(strprintf(_("Money: %s"),
- Units::formatCurrency(newVal).c_str()));
+ UnitsDb::formatCurrency(newVal).c_str()));
mMoneyLabel->adjustSize();
break;
@@ -510,8 +511,9 @@ void StatusWindow::updateWeightBar(ProgressBar *const bar)
progress = static_cast<float>(totalWeight)
/ static_cast<float>(maxWeight);
}
- bar->setText(strprintf("%s/%s", Units::formatWeight(
- totalWeight).c_str(), Units::formatWeight(maxWeight).c_str()));
+ bar->setText(strprintf("%s/%s",
+ UnitsDb::formatWeight(totalWeight).c_str(),
+ UnitsDb::formatWeight(maxWeight).c_str()));
bar->setProgress(progress);
}
}
@@ -522,7 +524,7 @@ void StatusWindow::updateMoneyBar(ProgressBar *const bar)
return;
const int money = PlayerInfo::getAttribute(Attributes::MONEY);
- bar->setText(Units::formatCurrency(money));
+ bar->setText(UnitsDb::formatCurrency(money));
if (money > 0)
{
const float progress = static_cast<float>(money)
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 825615dc7..995db35eb 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -24,7 +24,6 @@
#include "configuration.h"
#include "game.h"
-#include "units.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -50,6 +49,8 @@
#include "gui/widgets/tabs/chat/chattab.h"
+#include "resources/db/unitsdb.h"
+
#include "resources/item/item.h"
#include "net/serverfeatures.h"
@@ -191,7 +192,7 @@ void TradeWindow::setMoney(const int amount)
mGotMoney = amount;
// TRANSLATORS: trade window money label
mMoneyLabel->setCaption(strprintf(_("You get %s"),
- Units::formatCurrency(amount).c_str()));
+ UnitsDb::formatCurrency(amount).c_str()));
mMoneyLabel->adjustSize();
}