From 76731f5def8148e0219614e26cad372144485779 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 5 Jul 2018 01:11:45 +0300 Subject: [PATCH] [Client] Don't remove SummonKeys with actorIds of -1 This prevents summon duplication caused by a SummonKey sometimes being deleted immediately after being created, before the server can send back an ObjectSpawn packet spawning a creature that can be attached to the SummonKey. --- apps/openmw/mwmechanics/summoning.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index 19e13e63d..094f91a9a 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -183,6 +183,22 @@ namespace MWMechanics for (std::map::iterator it = creatureMap.begin(); it != creatureMap.end(); ) { + /* + Start of tes3mp addition + + If we're iterating over a SummonKey matching an actorId of -1, that means it's a summon + yet to be sent back to us by the server and we should skip over it, because deleting it + here would mean it becomes just a regular creature when the server sends it back to us + */ + if (it->second == -1) + { + ++it; + continue; + } + /* + End of tes3mp addition + */ + MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->searchPtrViaActorId(it->second); if (ptr.isEmpty() || (ptr.getClass().getCreatureStats(ptr).isDead() && ptr.getClass().getCreatureStats(ptr).isDeathAnimationFinished())) {