summaryrefslogtreecommitdiff
path: root/src/resources/db/homunculusdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 14:30:20 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 14:30:20 +0300
commit0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (patch)
tree6259593b8436178ad8d981a96a8fd71eab9e04cc /src/resources/db/homunculusdb.cpp
parent01773c71a4698c6f01fe70d864f922bda65506cb (diff)
downloadplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz
plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2
plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz
plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip
Add strong typed int type BeingId.
Diffstat (limited to 'src/resources/db/homunculusdb.cpp')
-rw-r--r--src/resources/db/homunculusdb.cpp11
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