From 8e832312082e0f260d559c321ee081aa3b806361 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 21 Mar 2016 20:09:28 +0300 Subject: Add support for status effects without id. --- src/resources/db/statuseffectdb.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/resources/db/statuseffectdb.cpp') diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp index cd7267fe2..fb670f694 100644 --- a/src/resources/db/statuseffectdb.cpp +++ b/src/resources/db/statuseffectdb.cpp @@ -45,6 +45,7 @@ namespace { typedef std::map IdToEffectMap[2]; bool mLoaded = false; + int fakeId = 10000; IdToEffectMap statusEffects; OptionsMap optionToIdMap; OptionsMap opt1ToIdMap; @@ -115,13 +116,18 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName) continue; } - const int id = XML::getProperty(node, "id", -1); + int id = XML::getProperty(node, "id", -1); // legacy field. Only for clients 1.6.3.12 and older const int blockId = XML::getProperty(node, "block-id", -1); if (id >= 0 && blockId >= 0) blockIdToIdMap[blockId] = id; + if (id == -1) + { + id = fakeId; + fakeId ++; + } const int option = XML::getProperty(node, "option", 0); const int opt1 = XML::getProperty(node, "opt1", 0); const int opt2 = XML::getProperty(node, "opt2", 0); @@ -210,6 +216,7 @@ void StatusEffectDB::unload() if (!mLoaded) return; + fakeId = 10000; unloadMap(statusEffects[0]); unloadMap(statusEffects[1]); -- cgit v1.2.3-70-g09d2