summaryrefslogtreecommitdiff
path: root/src/resources/db/statuseffectdb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-21 19:37:01 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-21 19:37:01 +0300
commit8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f (patch)
treecac057743c1b48db050dbfdad37809afa728b054 /src/resources/db/statuseffectdb.cpp
parent542d2ba78d84e0fa051e0620ccab5fb3a0c711e3 (diff)
downloadplus-8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f.tar.gz
plus-8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f.tar.bz2
plus-8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f.tar.xz
plus-8800940bb4b94f6dab7dcf80bf0abc3e3b09e35f.zip
Add support for using fields from status effects: option, opt1, opt2, opt3.
Diffstat (limited to 'src/resources/db/statuseffectdb.cpp')
-rw-r--r--src/resources/db/statuseffectdb.cpp43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp
index 4390f79fe..cd7267fe2 100644
--- a/src/resources/db/statuseffectdb.cpp
+++ b/src/resources/db/statuseffectdb.cpp
@@ -23,6 +23,7 @@
#include "resources/db/statuseffectdb.h"
#include "configuration.h"
+#include "settings.h"
#include "soundmanager.h"
#include "statuseffect.h"
@@ -45,12 +46,12 @@ namespace
typedef std::map<int, StatusEffect *> IdToEffectMap[2];
bool mLoaded = false;
IdToEffectMap statusEffects;
- std::map<int, int> optionToIdMap;
- std::map<int, int> opt1ToIdMap;
- std::map<int, int> opt2ToIdMap;
- std::map<int, int> opt3ToIdMap;
+ OptionsMap optionToIdMap;
+ OptionsMap opt1ToIdMap;
+ OptionsMap opt2ToIdMap;
+ OptionsMap opt3ToIdMap;
- std::map<int, int> blockIdToIdMap;
+ OptionsMap blockIdToIdMap;
} // namespace
int StatusEffectDB::blockIdToId(const int blockIndex)
@@ -126,13 +127,25 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName)
const int opt2 = XML::getProperty(node, "opt2", 0);
const int opt3 = XML::getProperty(node, "opt3", 0);
if (option != 0)
+ {
optionToIdMap[option] = id;
+ settings.legacyEffects = false;
+ }
if (opt1 != 0)
+ {
opt1ToIdMap[opt1] = id;
+ settings.legacyEffects = false;
+ }
if (opt2 != 0)
+ {
opt2ToIdMap[opt2] = id;
+ settings.legacyEffects = false;
+ }
if (opt3 != 0)
+ {
opt3ToIdMap[opt3] = id;
+ settings.legacyEffects = false;
+ }
StatusEffect *startEffect = statusEffects[1][id];
StatusEffect *endEffect = statusEffects[0][id];
@@ -208,3 +221,23 @@ void StatusEffectDB::unload()
mLoaded = false;
}
+
+const OptionsMap& StatusEffectDB::getOptionMap()
+{
+ return optionToIdMap;
+}
+
+const OptionsMap& StatusEffectDB::getOpt1Map()
+{
+ return opt1ToIdMap;
+}
+
+const OptionsMap& StatusEffectDB::getOpt2Map()
+{
+ return opt2ToIdMap;
+}
+
+const OptionsMap& StatusEffectDB::getOpt3Map()
+{
+ return opt3ToIdMap;
+}