diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogsmanager.cpp | 2 | ||||
-rw-r--r-- | src/gui/dialogsmanager.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/skillinfo.cpp | 21 | ||||
-rw-r--r-- | src/gui/widgets/skillinfo.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/statuswindowattrs.h | 12 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 4 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.h | 2 | ||||
-rw-r--r-- | src/gui/windows/killstats.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/killstats.h | 2 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.h | 4 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 30 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.h | 20 |
15 files changed, 54 insertions, 60 deletions
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index eab8c7387..91fb96103 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -143,7 +143,7 @@ void DialogsManager::playerDeath() } } -void DialogsManager::attributeChanged(const int id, +void DialogsManager::attributeChanged(const AttributesT id, const int oldVal, const int newVal) { diff --git a/src/gui/dialogsmanager.h b/src/gui/dialogsmanager.h index 34f8c8e40..11a4545ad 100644 --- a/src/gui/dialogsmanager.h +++ b/src/gui/dialogsmanager.h @@ -51,7 +51,7 @@ class DialogsManager final : public AttributeListener, void playerDeath() override final; - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; }; diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index d16994bae..0778b6c12 100644 --- a/src/gui/widgets/skillinfo.cpp +++ b/src/gui/widgets/skillinfo.cpp @@ -37,12 +37,9 @@ SkillInfo::SkillInfo() : skillLevel(), - skillExp(), skillEffect(), useButton(), errorText(), - progress(0.0F), - color(), dataMap(), model(nullptr), data(nullptr), @@ -76,9 +73,7 @@ SkillInfo::~SkillInfo() void SkillInfo::update() { const int baseLevel = PlayerInfo::getSkillLevel(id); - const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); - - if (modifiable == Modifiable_false && baseLevel == 0 && exp.second == 0) + if (modifiable == Modifiable_false && baseLevel == 0) { if (visible == Visible_true) { @@ -160,20 +155,6 @@ void SkillInfo::update() level = baseLevel; skillLevelWidth = -1; - if (exp.second) - { - skillExp = strprintf("%d / %d", exp.first, exp.second); - progress = static_cast<float>(exp.first) - / static_cast<float>(exp.second); - } - else - { - skillExp.clear(); - progress = 0.0F; - } - - color = Theme::getProgressColor(Theme::PROG_EXP, progress); - if (updateVisibility && model) model->updateVisibilities(); diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index e2679713d..038fc2a01 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -48,12 +48,9 @@ typedef SkillDataMap::const_iterator SkillDataMapCIter; struct SkillInfo final { std::string skillLevel; - std::string skillExp; std::string skillEffect; std::string useButton; std::string errorText; - float progress; - Color color; SkillDataMap dataMap; SkillModel *model; SkillData *data; diff --git a/src/gui/widgets/statuswindowattrs.h b/src/gui/widgets/statuswindowattrs.h index ee336c616..7359a1a86 100644 --- a/src/gui/widgets/statuswindowattrs.h +++ b/src/gui/widgets/statuswindowattrs.h @@ -23,6 +23,8 @@ #ifndef GUI_WIDGETS_STATUSWINDOWATTRS_H #define GUI_WIDGETS_STATUSWINDOWATTRS_H +#include "enums/being/attributes.h" + #include "gui/widgets/container.h" #include "gui/widgets/label.h" @@ -66,11 +68,11 @@ class AttrDisplay notfinal : public Container protected: AttrDisplay(const Widget2 *const widget, - const int id, + const AttributesT id, const std::string &restrict name, const std::string &restrict shortName); - const int mId; + const AttributesT mId; const std::string mName; const std::string mShortName; @@ -83,7 +85,8 @@ class DerDisplay final : public AttrDisplay { public: DerDisplay(const Widget2 *const widget, - const int id, const std::string &restrict name, + const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName); A_DELETE_COPY(DerDisplay) @@ -97,7 +100,8 @@ class ChangeDisplay final : public AttrDisplay, { public: ChangeDisplay(const Widget2 *const widget, - const int id, const std::string &restrict name, + const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName); A_DELETE_COPY(ChangeDisplay) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 713ad5e53..31b874032 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -947,7 +947,7 @@ bool ChatWindow::addCurrentToHistory() return true; } -void ChatWindow::statChanged(const int id, +void ChatWindow::statChanged(const AttributesT id, const int oldVal1, const int oldVal2) { @@ -970,7 +970,7 @@ void ChatWindow::statChanged(const int id, } } -void ChatWindow::attributeChanged(const int id, +void ChatWindow::attributeChanged(const AttributesT id, const int oldVal, const int newVal) { diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index a91178a97..76e932525 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -299,11 +299,11 @@ class ChatWindow final : public Window, void selectTabByType(const ChatTabType::Type &type); - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; - void statChanged(const int id, + void statChanged(const AttributesT id, const int oldVal1, const int oldVal2) override final; diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index ce954e7f3..63cde64f7 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -988,7 +988,7 @@ void InventoryWindow::unsetInventory() mInventory = nullptr; } -void InventoryWindow::attributeChanged(const int id, +void InventoryWindow::attributeChanged(const AttributesT id, const int oldVal A_UNUSED, const int newVal A_UNUSED) { diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index cb08a8fa2..c220b75aa 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -154,7 +154,7 @@ class InventoryWindow final : public Window, void unsetInventory(); - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 919b11e9a..c765c5b5a 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -403,7 +403,7 @@ void KillStats::update() BLOCK_END("KillStats::update") } -void KillStats::attributeChanged(const int id, +void KillStats::attributeChanged(const AttributesT id, const int oldVal, const int newVal) { diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h index a3e047553..ef784acf5 100644 --- a/src/gui/windows/killstats.h +++ b/src/gui/windows/killstats.h @@ -68,7 +68,7 @@ class KillStats final : public Window, void resetTimes(); - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 80adb129c..250258ca7 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -252,7 +252,7 @@ void MiniStatusWindow::drawIcons(Graphics *const graphics) } } -void MiniStatusWindow::statChanged(const int id A_UNUSED, +void MiniStatusWindow::statChanged(const AttributesT id A_UNUSED, const int oldVal1 A_UNUSED, const int oldVal2 A_UNUSED) { @@ -261,7 +261,7 @@ void MiniStatusWindow::statChanged(const int id A_UNUSED, StatusWindow::updateJobBar(mJobBar); } -void MiniStatusWindow::attributeChanged(const int id, +void MiniStatusWindow::attributeChanged(const AttributesT id, const int oldVal A_UNUSED, const int newVal A_UNUSED) { diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index d31783b63..bd1e6a393 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -92,11 +92,11 @@ class MiniStatusWindow final : public Window, Rect getChildrenArea() override final A_WARN_UNUSED; - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; - void statChanged(const int id, + void statChanged(const AttributesT id, const int oldVal1, const int oldVal2) override final; diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 7a1c798ec..fb28aacb7 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -257,7 +257,7 @@ void StatusWindow::updateLevelLabel() mLvlLabel->adjustSize(); } -void StatusWindow::statChanged(const int id, +void StatusWindow::statChanged(const AttributesT id, const int oldVal1, const int oldVal2 A_UNUSED) { @@ -305,7 +305,7 @@ void StatusWindow::statChanged(const int id, mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl)); mJobLvlLabel->adjustSize(); - updateProgressBar(mJobBar, id, false); + updateJobBar(mJobBar, false); } } else @@ -317,7 +317,7 @@ void StatusWindow::statChanged(const int id, } } -void StatusWindow::attributeChanged(const int id, +void StatusWindow::attributeChanged(const AttributesT id, const int oldVal A_UNUSED, const int newVal) { @@ -385,7 +385,8 @@ void StatusWindow::attributeChanged(const int id, } } -void StatusWindow::setPointsNeeded(const int id, const int needed) +void StatusWindow::setPointsNeeded(const AttributesT id, + const int needed) { const Attrs::const_iterator it = mAttrs.find(id); @@ -397,7 +398,8 @@ void StatusWindow::setPointsNeeded(const int id, const int needed) } } -void StatusWindow::addAttribute(const int id, const std::string &restrict name, +void StatusWindow::addAttribute(const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName, const Modifiable modifiable) { @@ -478,8 +480,10 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, bar->setProgress(prog); } -void StatusWindow::updateProgressBar(ProgressBar *const bar, const int value, - const int max, const bool percent) +void StatusWindow::updateProgressBar(ProgressBar *const bar, + const int value, + const int max, + const bool percent) { if (!bar) return; @@ -527,7 +531,8 @@ void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent) updateProgressBar(bar, exp.first, exp.second, percent); } -void StatusWindow::updateProgressBar(ProgressBar *const bar, const int id, +void StatusWindow::updateProgressBar(ProgressBar *const bar, + const AttributesT id, const bool percent) { const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); @@ -691,7 +696,8 @@ void StatusWindow::action(const ActionEvent &event) } AttrDisplay::AttrDisplay(const Widget2 *const widget, - const int id, const std::string &restrict name, + const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName) : Container(widget), mId(id), @@ -724,7 +730,8 @@ std::string AttrDisplay::update() } DerDisplay::DerDisplay(const Widget2 *const widget, - const int id, const std::string &restrict name, + const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName) : AttrDisplay(widget, id, name, shortName) { @@ -735,7 +742,8 @@ DerDisplay::DerDisplay(const Widget2 *const widget, } ChangeDisplay::ChangeDisplay(const Widget2 *const widget, - const int id, const std::string &restrict name, + const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName) : AttrDisplay(widget, id, name, shortName), ActionListener(), diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h index 44328e1df..2ec0a778b 100644 --- a/src/gui/windows/statuswindow.h +++ b/src/gui/windows/statuswindow.h @@ -56,9 +56,11 @@ class StatusWindow final : public Window, A_DELETE_COPY(StatusWindow) - void setPointsNeeded(const int id, const int needed); + void setPointsNeeded(const AttributesT id, + const int needed); - void addAttribute(const int id, const std::string &restrict name, + void addAttribute(const AttributesT id, + const std::string &restrict name, const std::string &restrict shortName = "", const Modifiable modifiable = Modifiable_false); @@ -75,21 +77,23 @@ class StatusWindow final : public Window, static void updateArrowsBar(ProgressBar *const bar); void updateStatusBar(ProgressBar *const bar, const bool percent = true) const; - static void updateProgressBar(ProgressBar *const bar, const int value, - const int max, const bool percent); static void updateProgressBar(ProgressBar *const bar, - const int id, + const int value, + const int max, + const bool percent); + static void updateProgressBar(ProgressBar *const bar, + const AttributesT id, const bool percent = true); void action(const ActionEvent &event) override; void clearAttributes(); - void attributeChanged(const int id, + void attributeChanged(const AttributesT id, const int oldVal, const int newVal) override final; - void statChanged(const int id, + void statChanged(const AttributesT id, const int oldVal1, const int oldVal2) override final; @@ -124,7 +128,7 @@ class StatusWindow final : public Window, Label *mCorrectionPointsLabel; Button *mCopyButton; - typedef std::map<int, AttrDisplay*> Attrs; + typedef std::map<Attributes, AttrDisplay*> Attrs; Attrs mAttrs; }; |