From 1ba36076f308103fdfe2800a5518f25471abb357 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 1 Oct 2021 03:09:14 +0200 Subject: [PATCH] [Client] Update 3rd person model of local player when unequipping This had apparently been broken by the fact that I had made inventory listeners get run only for actors in active cells in 385ef5584881358c3ccd97dcbf7380d8e7124662. Strangely, the player Ptr passed to fireEquipmentChangedEvent() when unequipping items has as its cell the player's original spawn cell instead of the current cell, causing the active cell check to return false in most locations for the player. --- apps/openmw/mwworld/inventorystore.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index cd9cf55ab..b7f4e2f74 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -919,10 +919,15 @@ void MWWorld::InventoryStore::fireEquipmentChangedEvent(const Ptr& actor) /* Start of tes3mp change (major) - Only fire inventory events for actors in loaded cells to avoid crashes + Only fire inventory events for local players or for other actors in loaded cells to avoid crashes */ - if (mInventoryListener && MWBase::Environment::get().getWorld()->isCellActive(*actor.getCell()->getCell())) - mInventoryListener->equipmentChanged(); + if (mInventoryListener) + { + if (actor == MWMechanics::getPlayer() || MWBase::Environment::get().getWorld()->isCellActive(*actor.getCell()->getCell())) + { + mInventoryListener->equipmentChanged(); + } + } /* End of tes3mp change (major) */