summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-04 20:04:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-04 20:04:05 +0300
commitc14af75fab3ddb45886a358e5056c2b0baee91e1 (patch)
tree8bc0979e70665db89c49b29d938ad7de376f4115 /src/gui/widgets
parente0514307bfa5d7affb3dba5c8b61bf59b8bc3b81 (diff)
downloadmanaverse-c14af75fab3ddb45886a358e5056c2b0baee91e1.tar.gz
manaverse-c14af75fab3ddb45886a358e5056c2b0baee91e1.tar.bz2
manaverse-c14af75fab3ddb45886a358e5056c2b0baee91e1.tar.xz
manaverse-c14af75fab3ddb45886a358e5056c2b0baee91e1.zip
Use skill type as bit mask with skill types.
It rare but still possible.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/skillinfo.cpp65
1 files changed, 25 insertions, 40 deletions
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp
index 4174146e2..2ce169451 100644
--- a/src/gui/widgets/skillinfo.cpp
+++ b/src/gui/widgets/skillinfo.cpp
@@ -31,6 +31,8 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
+#include "resources/skilltypelist.h"
+
#include "debug.h"
SkillInfo::SkillInfo() :
@@ -113,47 +115,30 @@ void SkillInfo::update()
// TRANSLATORS: skill type
const char *const typeStr = _("Type: %s");
- switch (type)
+
+ if (type == SkillType::Unknown)
+ {
+ // TRANSLATORS: Skill type
+ skillEffect = strprintf(typeStr, _("Unknown"));
+ }
+ else
+ {
+ for (size_t f = 0; f < skillTypeListSize; f ++)
+ {
+ const SkillTypeEntry &item = skillTypeList[f];
+ if ((item.type & type) != 0)
+ {
+ if (!skillEffect.empty())
+ skillEffect.append(", ");
+ skillEffect.append(strprintf(typeStr, item.name));
+ }
+ }
+ }
+ if (skillEffect.empty())
{
- case SkillType::Unknown:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Unknown"));
- break;
-
- case SkillType::Attack:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Attack"));
- break;
-
- case SkillType::Ground:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Ground"));
- break;
-
- case SkillType::Self:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Self"));
- break;
-
- case SkillType::Unused:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Unused"));
- break;
-
- case SkillType::Support:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Support"));
- break;
-
- case SkillType::TargetTrap:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Target trap"));
- break;
- default:
- // TRANSLATORS: Skill type
- skillEffect = strprintf(typeStr, _("Unknown:"));
- skillEffect.append(" ").append(toString(CAST_S32(type)));
- break;
+ // TRANSLATORS: Skill type
+ skillEffect = strprintf(typeStr, _("Unknown:"));
+ skillEffect.append(" ").append(toString(CAST_S32(type)));
}
if (sp)