summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-21 20:09:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-21 20:09:28 +0300
commit8e832312082e0f260d559c321ee081aa3b806361 (patch)
treeff2171d5f1a7e265dc2d16414f75278f708a72a8
parent4aabd8991aac14641b9cdf14f1a944a026123254 (diff)
downloadplus-8e832312082e0f260d559c321ee081aa3b806361.tar.gz
plus-8e832312082e0f260d559c321ee081aa3b806361.tar.bz2
plus-8e832312082e0f260d559c321ee081aa3b806361.tar.xz
plus-8e832312082e0f260d559c321ee081aa3b806361.zip
Add support for status effects without id.
-rw-r--r--src/resources/db/statuseffectdb.cpp9
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]);