From 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 May 2015 14:30:20 +0300 Subject: Add strong typed int type BeingId. --- src/resources/db/petdb.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/resources/db/petdb.cpp') 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 -- cgit v1.2.3-60-g2f50