1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Issue #256: moved magic effects update from MechanicsManager to Actors

This commit is contained in:
Marc Zinnschlag 2012-05-17 13:21:49 +02:00
parent 1fddbf9a40
commit e56ff9283d
4 changed files with 21 additions and 21 deletions

View file

@ -14,7 +14,10 @@ namespace MWMechanics
{
void Actors::updateActor (const MWWorld::Ptr& ptr, float duration)
{
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
// magic effects
adjustMagicEffects (ptr);
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
// calculate dynamic stats
int strength = creatureStats.mAttributes[0].getBase();
@ -41,6 +44,21 @@ namespace MWMechanics
MWWorld::Class::get (ptr).getNpcStats (ptr));
}
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
{
CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature);
MagicEffects now = creatureStats.mSpells.getMagicEffects();
/// \todo add effects from active spells and equipment
MagicEffects diff = MagicEffects::diff (creatureStats.mMagicEffects, now);
creatureStats.mMagicEffects = now;
// TODO apply diff to other stats
}
Actors::Actors() : mDuration (0) {}
void Actors::addActor (const MWWorld::Ptr& ptr)

View file

@ -23,6 +23,8 @@ namespace MWMechanics
void updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused);
void adjustMagicEffects (const MWWorld::Ptr& creature);
public:
Actors();

View file

@ -138,26 +138,8 @@ namespace MWMechanics
}
}
}
// magic effects
adjustMagicEffects (ptr);
}
void MechanicsManager::adjustMagicEffects (MWWorld::Ptr& creature)
{
MWMechanics::CreatureStats& creatureStats =
MWWorld::Class::get (creature).getCreatureStats (creature);
MagicEffects now = creatureStats.mSpells.getMagicEffects();
/// \todo add effects from active spells and equipment
MagicEffects diff = MagicEffects::diff (creatureStats.mMagicEffects, now);
creatureStats.mMagicEffects = now;
// TODO apply diff to other stats
}
MechanicsManager::MechanicsManager()
: mUpdatePlayer (true), mClassSelected (false),

View file

@ -31,8 +31,6 @@ namespace MWMechanics
///< build player according to stored class/race/birthsign information. Will
/// default to the values of the ESM::NPC object, if no explicit information is given.
void adjustMagicEffects (MWWorld::Ptr& creature);
public:
MechanicsManager ();