diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-17 20:20:10 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-17 23:40:30 +0100 |
commit | 61ac3cbf1e507f103e5fc240958971f512cd8c73 (patch) | |
tree | 28fc78e2047a91f9b6131d2f3e62d83c4db23711 /src/game-server | |
parent | a6c3eed2b9a91e9768ec6ce137879cac13703dea (diff) | |
download | manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.tar.gz manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.tar.xz manaserv-61ac3cbf1e507f103e5fc240958971f512cd8c73.zip |
Made skill related function capable of taking the skill name as parameter
Reviewed-by: bjorn.
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/skillmanager.cpp | 11 | ||||
-rw-r--r-- | src/game-server/skillmanager.h | 9 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/game-server/skillmanager.cpp b/src/game-server/skillmanager.cpp index 0ed327b..b5a94cb 100644 --- a/src/game-server/skillmanager.cpp +++ b/src/game-server/skillmanager.cpp @@ -167,11 +167,16 @@ void SkillManager::printDebugSkillTable() } } -unsigned int SkillManager::getId(const std::string& set, - const std::string &name) const +unsigned int SkillManager::getId(const std::string &set, + const std::string &name) const { std::string key = utils::toLower(set) + "_" + utils::toLower(name); - SkillInfo *skillInfo = mNamedSkillsInfo.value(key); + return getId(key); +} + +unsigned int SkillManager::getId(const std::string &skillName) const +{ + SkillInfo *skillInfo = mNamedSkillsInfo.value(skillName); return skillInfo ? skillInfo->id : 0; } diff --git a/src/game-server/skillmanager.h b/src/game-server/skillmanager.h index e789c89..36e2485 100644 --- a/src/game-server/skillmanager.h +++ b/src/game-server/skillmanager.h @@ -49,7 +49,14 @@ class SkillManager /** * Gets the skill Id from a set and a skill string. */ - unsigned int getId(const std::string& set, const std::string &name) const; + unsigned int getId(const std::string &set, const std::string &name) const; + + /** + * Gets the skill Id from a string formatted in this way: + * "setname_skillname" + */ + unsigned int getId(const std::string &skillName) const; + const std::string getSkillName(unsigned int id) const; const std::string getSetName(unsigned int id) const; |