summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 21:42:33 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 22:43:38 +0300
commit3411edb5d3ae07d247421e4b8f7936a22b7b4027 (patch)
tree63685d0979938a42a62b3f0a880663bb06f4e8ca /src/gui/windows
parent390e5da0f9ecc4407aa7d4bcba1af5730db56271 (diff)
downloadmanaplus-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.gz
manaplus-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.bz2
manaplus-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.xz
manaplus-3411edb5d3ae07d247421e4b8f7936a22b7b4027.zip
Convert Attributes enum into strong typed enum.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/chatwindow.h4
-rw-r--r--src/gui/windows/inventorywindow.cpp2
-rw-r--r--src/gui/windows/inventorywindow.h2
-rw-r--r--src/gui/windows/killstats.cpp2
-rw-r--r--src/gui/windows/killstats.h2
-rw-r--r--src/gui/windows/ministatuswindow.cpp4
-rw-r--r--src/gui/windows/ministatuswindow.h4
-rw-r--r--src/gui/windows/statuswindow.cpp30
-rw-r--r--src/gui/windows/statuswindow.h20
10 files changed, 43 insertions, 31 deletions
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;
};