summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-02 22:53:35 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-03 01:01:11 +0300
commitdaa922db12d8387fefa0952dc06697614de0175f (patch)
treefc4fe51a5c534a5e8cdc13a56a4b1b5538a3c0c3
parentf886c62eee04a89c01d30322db1a9eb85f699ac3 (diff)
downloadmanaplus-daa922db12d8387fefa0952dc06697614de0175f.tar.gz
manaplus-daa922db12d8387fefa0952dc06697614de0175f.tar.bz2
manaplus-daa922db12d8387fefa0952dc06697614de0175f.tar.xz
manaplus-daa922db12d8387fefa0952dc06697614de0175f.zip
Dont draw name in skill shortcuts if icon already present.
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp32
-rw-r--r--src/gui/windows/skilldialog.cpp20
-rw-r--r--src/resources/skill/skilldata.h1
3 files changed, 36 insertions, 17 deletions
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 915923610..e99230216 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -208,13 +208,15 @@ void ItemShortcutContainer::draw(Graphics *const graphics)
image->setAlpha(1.0F);
graphics->drawImage(image, itemX, itemY);
}
-
- font->drawString(graphics,
- mForegroundColor,
- mForegroundColor,
- skill->data->shortName,
- itemX + 2,
- itemY + mBoxHeight / 2);
+ if (!skill->data->haveIcon)
+ {
+ font->drawString(graphics,
+ mForegroundColor,
+ mForegroundColor,
+ skill->data->shortName,
+ itemX + 2,
+ itemY + mBoxHeight / 2);
+ }
}
}
}
@@ -345,13 +347,15 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics)
image->setAlpha(1.0F);
graphics->drawImage(image, itemX, itemY);
}
-
- font->drawString(graphics,
- mForegroundColor,
- mForegroundColor,
- skill->data->shortName,
- itemX + 2,
- itemY + mBoxHeight / 2);
+ if (!skill->data->haveIcon)
+ {
+ font->drawString(graphics,
+ mForegroundColor,
+ mForegroundColor,
+ skill->data->shortName,
+ itemX + 2,
+ itemY + mBoxHeight / 2);
+ }
}
}
}
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index fdc1b7409..2305cd58b 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -536,9 +536,15 @@ void SkillDialog::loadSkillData(XmlNodeConstPtr node,
data->name = name;
const std::string icon = XML::getProperty(node, "icon", "");
if (icon.empty())
+ {
data->setIcon(paths.getStringValue("missingSkillIcon"));
+ data->haveIcon = false;
+ }
else
+ {
data->setIcon(icon);
+ data->haveIcon = true;
+ }
if (skill->id < SKILL_VAR_MIN_ID)
{
data->dispName = strprintf("%s, %u",
@@ -673,8 +679,6 @@ std::string SkillDialog::getDefaultSkillIcon(const SkillType::SkillType type)
default:
break;
}
- if (icon.empty())
- return paths.getStringValue("missingSkillIcon");
return icon;
}
@@ -705,7 +709,17 @@ void SkillDialog::addSkill(const SkillOwner::Type owner,
data->dispName = strprintf("%s, %u", name.c_str(), skill->id);
}
data->description.clear();
- data->setIcon(getDefaultSkillIcon(type));
+ const std::string icon = getDefaultSkillIcon(type);
+ if (icon.empty())
+ {
+ data->setIcon(paths.getStringValue("missingSkillIcon"));
+ data->haveIcon = false;
+ }
+ else
+ {
+ data->setIcon(icon);
+ data->haveIcon = true;
+ }
data->shortName = toString(skill->id);
skill->modifiable = modifiable;
skill->visible = Visible_false;
diff --git a/src/resources/skill/skilldata.h b/src/resources/skill/skilldata.h
index 920bb91cd..bb52b31cd 100644
--- a/src/resources/skill/skilldata.h
+++ b/src/resources/skill/skilldata.h
@@ -53,6 +53,7 @@ struct SkillData final
int castingGroundEffectId;
int srcEffectId;
int dstEffectId;
+ bool haveIcon;
SkillData();
A_DELETE_COPY(SkillData)