diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-26 20:08:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-28 21:17:59 +0300 |
commit | c430b75e370a21a17f80d4ba3acd84111828a462 (patch) | |
tree | 6d4ea8421de26c623c4196a7dd2aa3d86c5add01 /src/gui/skilldialog.cpp | |
parent | 1dcb42c708c92216c7c9cacd3d3c9301e71e6006 (diff) | |
download | plus-c430b75e370a21a17f80d4ba3acd84111828a462.tar.gz plus-c430b75e370a21a17f80d4ba3acd84111828a462.tar.bz2 plus-c430b75e370a21a17f80d4ba3acd84111828a462.tar.xz plus-c430b75e370a21a17f80d4ba3acd84111828a462.zip |
add const for methods return values.
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 1f36d6de9..672928551 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -629,14 +629,20 @@ void SkillDialog::addSkill(const int id, const int level, const int range, } } -SkillInfo* SkillDialog::getSkill(const int id) +SkillInfo* SkillDialog::getSkill(const int id) const { - return mSkills[id]; + SkillMap::const_iterator it = mSkills.find(id); + if (it != mSkills.end()) + return (*it).second; + return nullptr; } -SkillInfo* SkillDialog::getSkillByItem(const int itemId) +SkillInfo* SkillDialog::getSkillByItem(const int itemId) const { - return mSkills[itemId - SKILL_MIN_ID]; + SkillMap::const_iterator it = mSkills.find(itemId - SKILL_MIN_ID); + if (it != mSkills.end()) + return (*it).second; + return nullptr; } void SkillDialog::widgetResized(const gcn::Event &event) |