diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
commit | 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (patch) | |
tree | 6259593b8436178ad8d981a96a8fd71eab9e04cc /src/resources/db/homunculusdb.cpp | |
parent | 01773c71a4698c6f01fe70d864f922bda65506cb (diff) | |
download | manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2 manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz manaverse-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip |
Add strong typed int type BeingId.
Diffstat (limited to 'src/resources/db/homunculusdb.cpp')
-rw-r--r-- | src/resources/db/homunculusdb.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index 173b37e65..41c863a6f 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -85,10 +85,11 @@ void HomunculusDB::loadXmlFile(const std::string &fileName) const int id = XML::getProperty(homunculusNode, "id", 0); BeingInfo *currentInfo = nullptr; - if (mHomunculusInfos.find(id + offset) != mHomunculusInfos.end()) + if (mHomunculusInfos.find(fromInt(id + offset, BeingId)) + != mHomunculusInfos.end()) { logger->log("HomunculusDB: Redefinition of homunculus ID %d", id); - currentInfo = mHomunculusInfos[id + offset]; + currentInfo = mHomunculusInfos[fromInt(id + offset, BeingId)]; } if (!currentInfo) currentInfo = new BeingInfo; @@ -133,7 +134,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName) } currentInfo->setDisplay(display); - mHomunculusInfos[id + offset] = currentInfo; + mHomunculusInfos[fromInt(id + offset, BeingId)] = currentInfo; } } @@ -146,7 +147,7 @@ void HomunculusDB::unload() } -BeingInfo *HomunculusDB::get(const int id) +BeingInfo *HomunculusDB::get(const BeingId id) { BeingInfoIterator i = mHomunculusInfos.find(id); @@ -157,7 +158,7 @@ BeingInfo *HomunculusDB::get(const int id) { logger->log("HomunculusDB: Warning, unknown homunculus ID " "%d requested", - id); + toInt(id, int)); return BeingInfo::unknown; } else |