summaryrefslogtreecommitdiff
path: root/src/resources/db/petdb.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/petdb.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/petdb.cpp')
-rw-r--r--src/resources/db/petdb.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 31893403f..242313d14 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -79,8 +79,9 @@ void PETDB::loadXmlFile(const std::string &fileName)
continue;
}
- const int id = XML::getProperty(petNode, "id", -1);
- if (id == -1)
+ const BeingId id = fromInt(XML::getProperty(
+ petNode, "id", -1), BeingId);
+ if (id == BeingId_negOne)
{
logger->log("PET Database: PET with missing ID in %s!",
paths.getStringValue("petsFile").c_str());
@@ -185,13 +186,14 @@ void PETDB::unload()
mLoaded = false;
}
-BeingInfo *PETDB::get(const int id)
+BeingInfo *PETDB::get(const BeingId id)
{
const BeingInfoIterator i = mPETInfos.find(id);
if (i == mPETInfos.end())
{
- logger->log("PETDB: Warning, unknown PET ID %d requested", id);
+ logger->log("PETDB: Warning, unknown PET ID %d requested",
+ toInt(id, int));
return BeingInfo::unknown;
}
else