summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-18 19:02:01 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-18 19:02:01 +0300
commit627c9a7a762ebaf2ae65c5938986f24a5400d52b (patch)
treeee7183998c7214a62bf0bac0d50d542564ba3fda
parentcbd1e245325bc83c35a84508f75a9ed3f0e74c2d (diff)
downloadmanaplus-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.gz
manaplus-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.bz2
manaplus-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.xz
manaplus-627c9a7a762ebaf2ae65c5938986f24a5400d52b.zip
Add empty skill if need add skill duration/cooldown and skin not created/loaded.
-rw-r--r--src/gui/windows/skilldialog.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index ee82445f7..7176c4103 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -430,15 +430,21 @@ SkillInfo* SkillDialog::getSkillByItem(const int itemId) const
void SkillDialog::setSkillDuration(const int id, const int duration)
{
SkillMap::const_iterator it = mSkills.find(id);
+ SkillInfo *info = nullptr;
+ if (it == mSkills.end())
+ {
+ addSkill(id, "", 0, 0, false, SkillType::Unknown, 0);
+ it = mSkills.find(id);
+ }
if (it != mSkills.end())
{
- SkillInfo *const info = (*it).second;
- if (info)
- {
- info->duration = duration;
- info->durationTime = tick_time;
- addSkillDuration(info);
- }
+ info = (*it).second;
+ }
+ if (info)
+ {
+ info->duration = duration;
+ info->durationTime = tick_time;
+ addSkillDuration(info);
}
}