From e00ee1425a616df12f62b2581e18b550ca7a5ef7 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 7 May 2021 18:15:39 +0200 Subject: [PATCH] [Client] Reload DedicatedActor ptrs when setting their active spells This makes the spells' visual effects appear correctly. --- apps/openmw/mwmp/DedicatedActor.cpp | 11 +++++++++++ apps/openmw/mwmp/DedicatedActor.hpp | 1 + 2 files changed, 12 insertions(+) diff --git a/apps/openmw/mwmp/DedicatedActor.cpp b/apps/openmw/mwmp/DedicatedActor.cpp index 98d90227b..34e07738d 100644 --- a/apps/openmw/mwmp/DedicatedActor.cpp +++ b/apps/openmw/mwmp/DedicatedActor.cpp @@ -371,8 +371,12 @@ void DedicatedActor::addSpellsActive() activeSpells.addSpell(activeSpell.id, false, activeSpell.params.mEffects, activeSpell.params.mDisplayName, 1); } else + { LOG_APPEND(TimedLog::LOG_INFO, "- Ignored addition of invalid spell %s", activeSpell.id.c_str()); + } } + + reloadPtr(); } void DedicatedActor::removeSpellsActive() @@ -410,3 +414,10 @@ void DedicatedActor::setPtr(const MWWorld::Ptr& newPtr) position = ptr.getRefData().getPosition(); drawState = ptr.getClass().getCreatureStats(ptr).getDrawState(); } + +void DedicatedActor::reloadPtr() +{ + MWBase::World* world = MWBase::Environment::get().getWorld(); + world->disable(ptr); + world->enable(ptr); +} diff --git a/apps/openmw/mwmp/DedicatedActor.hpp b/apps/openmw/mwmp/DedicatedActor.hpp index a7b51b3a9..227de0c25 100644 --- a/apps/openmw/mwmp/DedicatedActor.hpp +++ b/apps/openmw/mwmp/DedicatedActor.hpp @@ -35,6 +35,7 @@ namespace mwmp MWWorld::Ptr getPtr(); void setPtr(const MWWorld::Ptr& newPtr); + void reloadPtr(); private: MWWorld::Ptr ptr;