diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-21 20:09:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-21 20:09:28 +0300 |
commit | 8e832312082e0f260d559c321ee081aa3b806361 (patch) | |
tree | ff2171d5f1a7e265dc2d16414f75278f708a72a8 /src | |
parent | 4aabd8991aac14641b9cdf14f1a944a026123254 (diff) | |
download | plus-8e832312082e0f260d559c321ee081aa3b806361.tar.gz plus-8e832312082e0f260d559c321ee081aa3b806361.tar.bz2 plus-8e832312082e0f260d559c321ee081aa3b806361.tar.xz plus-8e832312082e0f260d559c321ee081aa3b806361.zip |
Add support for status effects without id.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/db/statuseffectdb.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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<int, StatusEffect *> 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]); |