mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
Do not initialize map every call
This commit is contained in:
parent
c280a71b33
commit
b0ac0b0b22
2 changed files with 73 additions and 67 deletions
|
@ -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,43 +274,46 @@ 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;
|
||||
effects[DisintegrateArmor] = Sanctuary;
|
||||
effects[DisintegrateWeapon] = Sanctuary;
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = ResistMagicka;
|
||||
|
||||
effects[Burden] = ResistMagicka;
|
||||
effects[Charm] = ResistMagicka;
|
||||
effects[Silence] = ResistMagicka;
|
||||
effects[Blind] = ResistMagicka;
|
||||
effects[Sound] = ResistMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
static std::map<short, short> effects;
|
||||
if (effects.empty())
|
||||
{
|
||||
effects[CalmHumanoid+i] = ResistMagicka;
|
||||
effects[FrenzyHumanoid+i] = ResistMagicka;
|
||||
effects[DemoralizeHumanoid+i] = ResistMagicka;
|
||||
effects[RallyHumanoid+i] = ResistMagicka;
|
||||
effects[DisintegrateArmor] = Sanctuary;
|
||||
effects[DisintegrateWeapon] = Sanctuary;
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = ResistMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = ResistMagicka;
|
||||
|
||||
effects[Burden] = ResistMagicka;
|
||||
effects[Charm] = ResistMagicka;
|
||||
effects[Silence] = ResistMagicka;
|
||||
effects[Blind] = ResistMagicka;
|
||||
effects[Sound] = ResistMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
effects[CalmHumanoid+i] = ResistMagicka;
|
||||
effects[FrenzyHumanoid+i] = ResistMagicka;
|
||||
effects[DemoralizeHumanoid+i] = ResistMagicka;
|
||||
effects[RallyHumanoid+i] = ResistMagicka;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = ResistMagicka;
|
||||
|
||||
effects[FireDamage] = ResistFire;
|
||||
effects[FrostDamage] = ResistFrost;
|
||||
effects[ShockDamage] = ResistShock;
|
||||
effects[Vampirism] = ResistCommonDisease;
|
||||
effects[Corprus] = ResistCorprusDisease;
|
||||
effects[Poison] = ResistPoison;
|
||||
effects[Paralyze] = ResistParalysis;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = ResistMagicka;
|
||||
|
||||
effects[FireDamage] = ResistFire;
|
||||
effects[FrostDamage] = ResistFrost;
|
||||
effects[ShockDamage] = ResistShock;
|
||||
effects[Vampirism] = ResistCommonDisease;
|
||||
effects[Corprus] = ResistCorprusDisease;
|
||||
effects[Poison] = ResistPoison;
|
||||
effects[Paralyze] = ResistParalysis;
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
else
|
||||
|
@ -319,42 +322,44 @@ short MagicEffect::getResistanceEffect(short effect)
|
|||
|
||||
short MagicEffect::getWeaknessEffect(short effect)
|
||||
{
|
||||
std::map<short, short> effects;
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = WeaknessToMagicka;
|
||||
|
||||
effects[Burden] = WeaknessToMagicka;
|
||||
effects[Charm] = WeaknessToMagicka;
|
||||
effects[Silence] = WeaknessToMagicka;
|
||||
effects[Blind] = WeaknessToMagicka;
|
||||
effects[Sound] = WeaknessToMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
static std::map<short, short> effects;
|
||||
if (effects.empty())
|
||||
{
|
||||
effects[CalmHumanoid+i] = WeaknessToMagicka;
|
||||
effects[FrenzyHumanoid+i] = WeaknessToMagicka;
|
||||
effects[DemoralizeHumanoid+i] = WeaknessToMagicka;
|
||||
effects[RallyHumanoid+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DrainAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[DamageAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<5; ++i)
|
||||
effects[AbsorbAttribute+i] = WeaknessToMagicka;
|
||||
for (int i=0; i<10; ++i)
|
||||
effects[WeaknessToFire+i] = WeaknessToMagicka;
|
||||
|
||||
effects[Burden] = WeaknessToMagicka;
|
||||
effects[Charm] = WeaknessToMagicka;
|
||||
effects[Silence] = WeaknessToMagicka;
|
||||
effects[Blind] = WeaknessToMagicka;
|
||||
effects[Sound] = WeaknessToMagicka;
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
effects[CalmHumanoid+i] = WeaknessToMagicka;
|
||||
effects[FrenzyHumanoid+i] = WeaknessToMagicka;
|
||||
effects[DemoralizeHumanoid+i] = WeaknessToMagicka;
|
||||
effects[RallyHumanoid+i] = WeaknessToMagicka;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = WeaknessToMagicka;
|
||||
|
||||
effects[FireDamage] = WeaknessToFire;
|
||||
effects[FrostDamage] = WeaknessToFrost;
|
||||
effects[ShockDamage] = WeaknessToShock;
|
||||
effects[Vampirism] = WeaknessToCommonDisease;
|
||||
effects[Corprus] = WeaknessToCorprusDisease;
|
||||
effects[Poison] = WeaknessToPoison;
|
||||
|
||||
effects[Paralyze] = -1;
|
||||
}
|
||||
|
||||
effects[TurnUndead] = WeaknessToMagicka;
|
||||
|
||||
effects[FireDamage] = WeaknessToFire;
|
||||
effects[FrostDamage] = WeaknessToFrost;
|
||||
effects[ShockDamage] = WeaknessToShock;
|
||||
effects[Vampirism] = WeaknessToCommonDisease;
|
||||
effects[Corprus] = WeaknessToCorprusDisease;
|
||||
effects[Poison] = WeaknessToPoison;
|
||||
|
||||
effects[Paralyze] = -1;
|
||||
|
||||
if (effects.find(effect) != effects.end())
|
||||
return effects[effect];
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue