summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/petdb.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index aef1b2bda..0529ee874 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -80,15 +80,19 @@ void PETDB::loadXmlFile(const std::string &fileName)
continue;
}
- const int id = XML::getProperty(petNode, "id", 0);
- if (id == 0)
+ const int id = XML::getProperty(petNode, "id", -1);
+ if (id == -1)
{
logger->log("PET Database: PET with missing ID in %s!",
paths.getStringValue("petsFile").c_str());
continue;
}
- BeingInfo *const currentInfo = new BeingInfo;
+ BeingInfo *currentInfo = nullptr;
+ if (mPETInfos.find(id) != mPETInfos.end())
+ currentInfo = mPETInfos[id];
+ if (!currentInfo)
+ currentInfo = new BeingInfo;
currentInfo->setName(XML::langProperty(petNode,
// TRANSLATORS: unknown info name