diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-18 19:02:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-18 19:02:01 +0300 |
commit | 627c9a7a762ebaf2ae65c5938986f24a5400d52b (patch) | |
tree | ee7183998c7214a62bf0bac0d50d542564ba3fda | |
parent | cbd1e245325bc83c35a84508f75a9ed3f0e74c2d (diff) | |
download | mv-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.gz mv-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.bz2 mv-627c9a7a762ebaf2ae65c5938986f24a5400d52b.tar.xz mv-627c9a7a762ebaf2ae65c5938986f24a5400d52b.zip |
Add empty skill if need add skill duration/cooldown and skin not created/loaded.
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 20 |
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); } } |