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/petdb.cpp | |
parent | 01773c71a4698c6f01fe70d864f922bda65506cb (diff) | |
download | mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2 mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz mv-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip |
Add strong typed int type BeingId.
Diffstat (limited to 'src/resources/db/petdb.cpp')
-rw-r--r-- | src/resources/db/petdb.cpp | 10 |
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 |