mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-25 16:43:33 +00:00
Do not initialize map every call
This commit is contained in:
parent
c280a71b33
commit
b0ac0b0b22
@ -138,6 +138,7 @@
|
||||
Task #4605: Optimize skinning
|
||||
Task #4606: Support Rapture3D's OpenAL driver
|
||||
Task #4613: Incomplete type errors when compiling with g++ on OSX 10.9
|
||||
Task #4621: Optimize combat AI
|
||||
|
||||
0.44.0
|
||||
------
|
||||
|
@ -274,7 +274,9 @@ short MagicEffect::getResistanceEffect(short effect)
|
||||
// Source https://wiki.openmw.org/index.php?title=Research:Magic#Effect_attribute
|
||||
|
||||
// <Effect, Effect providing resistance against first effect>
|
||||
std::map<short, short> effects;
|
||||
static std::map<short, short> effects;
|
||||
if (effects.empty())
|
||||
{
|
||||
effects[DisintegrateArmor] = Sanctuary;
|
||||
effects[DisintegrateWeapon] = Sanctuary;
|
||||
|
||||
@ -310,6 +312,7 @@ short MagicEffect::getResistanceEffect(short effect)
|
||||
effects[Corprus] = ResistCorprusDisease;
|
||||
effects[Poison] = ResistPoison;
|
||||
effects[Paralyze] = ResistParalysis;
|
||||
}
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
@ -319,8 +322,9 @@ short MagicEffect::getResistanceEffect(short effect)
|
||||
|
||||
short MagicEffect::getWeaknessEffect(short effect)
|
||||
{
|
||||
std::map<short, short> effects;
|
||||
|
||||
static std::map<short, short> effects;
|
||||
if (effects.empty())
|
||||
{
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
@ -354,6 +358,7 @@ short MagicEffect::getWeaknessEffect(short effect)
|
||||
effects[Poison] = WeaknessToPoison;
|
||||
|
||||
effects[Paralyze] = -1;
|
||||
}
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
|
Loading…
x
Reference in New Issue
Block a user