diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-06 01:09:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-06 01:09:47 +0300 |
commit | 7fa78a35307227453ab55c7452e348a40cd41d65 (patch) | |
tree | 1d3e16a94bed043877306f1c47b3992add85b3be /src/gui | |
parent | a87db81b6b7551a248e31e2850577aefda092538 (diff) | |
download | manaplus-7fa78a35307227453ab55c7452e348a40cd41d65.tar.gz manaplus-7fa78a35307227453ab55c7452e348a40cd41d65.tar.bz2 manaplus-7fa78a35307227453ab55c7452e348a40cd41d65.tar.xz manaplus-7fa78a35307227453ab55c7452e348a40cd41d65.zip |
Add strong typed bool type Modifiable.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/skillinfo.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/skillinfo.h | 4 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 4 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.h | 2 |
6 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp index 864d973ea..80783a4b2 100644 --- a/src/gui/widgets/skillinfo.cpp +++ b/src/gui/widgets/skillinfo.cpp @@ -58,7 +58,7 @@ SkillInfo::SkillInfo() : castingDstEffectId(-1), type(SkillType::Unknown), owner(SkillOwner::Player), - modifiable(false), + modifiable(Modifiable_false), visible(false), alwaysVisible(false) { @@ -78,7 +78,7 @@ void SkillInfo::update() const int baseLevel = PlayerInfo::getSkillLevel(id); const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); - if (!modifiable && baseLevel == 0 && exp.second == 0) + if (modifiable == Modifiable_false && baseLevel == 0 && exp.second == 0) { if (visible) { diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index 3e4d99820..9cec3aa49 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -23,6 +23,8 @@ #ifndef GUI_WIDGETS_SKILLINFO_H #define GUI_WIDGETS_SKILLINFO_H +#include "enums/simpletypes.h" + #include "gui/color.h" #include "resources/skillowner.h" @@ -66,7 +68,7 @@ struct SkillInfo final int castingDstEffectId; SkillType::SkillType type; SkillOwner::Type owner; - bool modifiable; + Modifiable modifiable; bool visible; bool alwaysVisible; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index b9af88a06..a11ba562b 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -195,7 +195,7 @@ void SkillDialog::update() FOR_EACH (SkillMap::const_iterator, it, mSkills) { SkillInfo *const info = (*it).second; - if (info && info->modifiable) + if (info && info->modifiable == Modifiable_true) info->update(); } } @@ -314,7 +314,7 @@ void SkillDialog::loadXmlFile(const std::string &fileName) { skill = new SkillInfo; skill->id = static_cast<unsigned int>(id); - skill->modifiable = false; + skill->modifiable = Modifiable_false; skill->model = model; skill->update(); skill->useButton = XML::getProperty( @@ -421,7 +421,7 @@ void SkillDialog::removeSkill(const int id) bool SkillDialog::updateSkill(const int id, const int range, - const bool modifiable, + const Modifiable modifiable, const SkillType::SkillType type, const int sp) { @@ -448,7 +448,7 @@ void SkillDialog::addSkill(const SkillOwner::Type owner, const std::string &name, const int level, const int range, - const bool modifiable, + const Modifiable modifiable, const SkillType::SkillType type, const int sp) { @@ -515,7 +515,7 @@ void SkillDialog::setSkillDuration(const SkillOwner::Type owner, SkillInfo *info = nullptr; if (it == mSkills.end()) { - addSkill(owner, id, "", 0, 0, false, SkillType::Unknown, 0); + addSkill(owner, id, "", 0, 0, Modifiable_false, SkillType::Unknown, 0); it = mSkills.find(id); } if (it != mSkills.end()) diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 7a55c691b..d067643f4 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -84,7 +84,7 @@ class SkillDialog final : public Window, bool updateSkill(const int id, const int range, - const bool modifiable, + const Modifiable modifiable, const SkillType::SkillType type, const int sp); @@ -93,7 +93,7 @@ class SkillDialog final : public Window, const std::string &name, const int level, const int range, - const bool modifiable, + const Modifiable modifiable, const SkillType::SkillType type, const int sp); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index aa62aae4c..198df1508 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -401,11 +401,11 @@ void StatusWindow::setPointsNeeded(const int id, const int needed) void StatusWindow::addAttribute(const int id, const std::string &restrict name, const std::string &restrict shortName, - const bool modifiable) + const Modifiable modifiable) { AttrDisplay *disp; - if (modifiable) + if (modifiable == Modifiable_true) { disp = new ChangeDisplay(this, id, name, shortName); disp->update(); diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h index bde444fe5..eea7f936e 100644 --- a/src/gui/windows/statuswindow.h +++ b/src/gui/windows/statuswindow.h @@ -58,7 +58,7 @@ class StatusWindow final : public Window, void addAttribute(const int id, const std::string &restrict name, const std::string &restrict shortName = "", - const bool modifiable = false); + const Modifiable modifiable = Modifiable_false); static void updateHPBar(ProgressBar *const bar, const bool showMax = false); |