diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-01 16:33:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-01 19:20:50 +0300 |
commit | 30586d87976c755a6a3922ff275d2cc36faa3255 (patch) | |
tree | 4528134e9ecd414aab4679db4d5b1a00797f0087 /src/gui/windows/skilldialog.cpp | |
parent | 547fb04145d2ab1e5c68a47b1e673aa352d41da6 (diff) | |
download | manaverse-30586d87976c755a6a3922ff275d2cc36faa3255.tar.gz manaverse-30586d87976c755a6a3922ff275d2cc36faa3255.tar.bz2 manaverse-30586d87976c755a6a3922ff275d2cc36faa3255.tar.xz manaverse-30586d87976c755a6a3922ff275d2cc36faa3255.zip |
Add default icons for unknown skills by types.
Diffstat (limited to 'src/gui/windows/skilldialog.cpp')
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index ae6b72a35..a0401012d 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -508,7 +508,10 @@ void SkillDialog::loadSkillData(XmlNodeConstPtr node, strprintf(_("Skill %u"), skill->id)); data->name = name; const std::string icon = XML::getProperty(node, "icon", ""); - data->setIcon(icon); + if (icon.empty()) + data->setIcon(paths.getStringValue("missingSkillIcon")); + else + data->setIcon(icon); if (skill->id < SKILL_VAR_MIN_ID) { data->dispName = strprintf("%s, %u", @@ -614,6 +617,40 @@ bool SkillDialog::updateSkill(const int id, return false; } +std::string SkillDialog::getDefaultSkillIcon(const SkillType::SkillType type) +{ + std::string icon; + switch (type) + { + case SkillType::Attack: + icon = paths.getStringValue("attackSkillIcon"); + break; + case SkillType::Ground: + icon = paths.getStringValue("groundSkillIcon"); + break; + case SkillType::Self: + icon = paths.getStringValue("selfSkillIcon"); + break; + case SkillType::Unused: + icon = paths.getStringValue("unusedSkillIcon"); + break; + case SkillType::Support: + icon = paths.getStringValue("supportSkillIcon"); + break; + case SkillType::TargetTrap: + icon = paths.getStringValue("trapSkillIcon"); + break; + case SkillType::Unknown: + icon = paths.getStringValue("unknownSkillIcon"); + break; + default: + break; + } + if (icon.empty()) + return paths.getStringValue("missingSkillIcon"); + return icon; +} + void SkillDialog::addSkill(const SkillOwner::Type owner, const int id, const std::string &name, @@ -641,7 +678,7 @@ void SkillDialog::addSkill(const SkillOwner::Type owner, data->dispName = strprintf("%s, %u", name.c_str(), skill->id); } data->description.clear(); - data->setIcon(""); + data->setIcon(getDefaultSkillIcon(type)); data->shortName = toString(skill->id); skill->modifiable = modifiable; skill->visible = Visible_false; |