diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-21 20:49:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-21 20:49:47 +0300 |
commit | d65b19913092fa0ebe8848c0c902e6ee487d55c9 (patch) | |
tree | aca426a47726fc92b031f55a57d37ed63c682864 | |
parent | 8e832312082e0f260d559c321ee081aa3b806361 (diff) | |
download | manaplus-d65b19913092fa0ebe8848c0c902e6ee487d55c9.tar.gz manaplus-d65b19913092fa0ebe8848c0c902e6ee487d55c9.tar.bz2 manaplus-d65b19913092fa0ebe8848c0c902e6ee487d55c9.tar.xz manaplus-d65b19913092fa0ebe8848c0c902e6ee487d55c9.zip |
Fix reading opt1 field. This is not bit field.
-rw-r--r-- | src/being/actorsprite.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index aab26690a..5334bcb6a 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -241,6 +241,37 @@ static void applyEffectByOption(ActorSprite *const actor, } } +static void applyEffectByOption1(ActorSprite *const actor, + uint32_t option, + const char *const name, + const OptionsMap& options) +{ + FOR_EACH (OptionsMapCIter, it, options) + { + const int opt = (*it).first; + const int id = (*it).second; + if (opt == option) + { + actor->setStatusEffect(id, Enable_true); + option = 0U; + } + else + { + actor->setStatusEffect(id, Enable_false); + } + } + if (option && config.getBoolValue("unimplimentedLog")) + { + const std::string str = strprintf( + "Error: unknown effect by %s. " + "Left value: %u", + name, + option); + logger->log(str); + DebugMessageListener::distributeEvent(str); + } +} + void ActorSprite::setStatusEffectOpitons(const uint32_t option, const uint32_t opt1, const uint32_t opt2, @@ -250,7 +281,7 @@ void ActorSprite::setStatusEffectOpitons(const uint32_t option, { applyEffectByOption(this, option, "option", StatusEffectDB::getOptionMap()); - applyEffectByOption(this, opt1, "opt1", + applyEffectByOption1(this, opt1, "opt1", StatusEffectDB::getOpt1Map()); applyEffectByOption(this, opt2, "opt2", StatusEffectDB::getOpt2Map()); @@ -279,7 +310,7 @@ void ActorSprite::setStatusEffectOpitons(const uint32_t option, { applyEffectByOption(this, option, "option", StatusEffectDB::getOptionMap()); - applyEffectByOption(this, opt1, "opt1", + applyEffectByOption1(this, opt1, "opt1", StatusEffectDB::getOpt1Map()); applyEffectByOption(this, opt2, "opt2", StatusEffectDB::getOpt2Map()); |