From c027862609d46a586a17cd96177dbbf10eb1ca6b Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 12 Oct 2021 00:34:15 +0200 Subject: [PATCH] [Client] Track actor IDs in ActiveSpells --- apps/openmw/mwmechanics/activespells.cpp | 18 ++++++++++++++++++ apps/openmw/mwmechanics/activespells.hpp | 21 +++++++++++++++++++++ apps/openmw/mwmechanics/creaturestats.cpp | 9 +++++++++ 3 files changed, 48 insertions(+) diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index cc6cce290..813f61899 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -517,4 +517,22 @@ namespace MWMechanics mSpellsChanged = true; } } + + /* + Start of tes3mp addition + + Make it possible to set and get the actorId for these ActiveSpells + */ + int ActiveSpells::getActorId() const + { + return mActorId; + } + + void ActiveSpells::setActorId(int actorId) + { + mActorId = actorId; + } + /* + End of tes3mp addition + */ } diff --git a/apps/openmw/mwmechanics/activespells.hpp b/apps/openmw/mwmechanics/activespells.hpp index 0d4fd78e7..aae4c032c 100644 --- a/apps/openmw/mwmechanics/activespells.hpp +++ b/apps/openmw/mwmechanics/activespells.hpp @@ -51,6 +51,16 @@ namespace MWMechanics mutable MagicEffects mEffects; mutable bool mSpellsChanged; + /* + Start of tes3mp addition + + Track the actorId corresponding to these ActiveSpells + */ + int mActorId; + /* + End of tes3mp addition + */ + void rebuildEffects() const; /// Add any effects that are in "from" and not in "addTo" to "addTo" @@ -146,6 +156,17 @@ namespace MWMechanics void visitEffectSources (MWMechanics::EffectSourceVisitor& visitor) const; + /* + Start of tes3mp addition + + Make it possible to set and get the actorId for these ActiveSpells + */ + int getActorId() const; + void setActorId(int actorId); + /* + End of tes3mp addition + */ + }; } diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 84e3510ce..d06689c54 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -128,6 +128,15 @@ namespace MWMechanics ActiveSpells &CreatureStats::getActiveSpells() { + /* + Start of tes3mp addition + + Set the actorId associated with these ActiveSpells so it can be used inside them + */ + mActiveSpells.setActorId(getActorId()); + /* + End of tes3mp addition + */ return mActiveSpells; }