From 1950748daeef31fe5e3863dbfa7f1443dee52c68 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 6 Dec 2019 12:21:30 +0200 Subject: [PATCH] [Client] Always use autoEquip on newly initialized LocalActors Previously, it was possible for a Container packet to clear all equipment slots for an actor without the actor's authority then sending an equipment packet to correct that, due to packet loss or sudden disconnection, leading to actors not wearing any equipment as soon as they acquired a new authority. This ensures that newly initialized LocalActors will now autoEquip. --- apps/openmw/mwmp/LocalActor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmp/LocalActor.cpp b/apps/openmw/mwmp/LocalActor.cpp index 2212ed8ea..3c9103255 100644 --- a/apps/openmw/mwmp/LocalActor.cpp +++ b/apps/openmw/mwmp/LocalActor.cpp @@ -201,11 +201,16 @@ void LocalActor::updateEquipment(bool forceUpdate, bool sendImmediately) if (!ptr.getClass().hasInventoryStore(ptr)) return; + MWWorld::InventoryStore &invStore = ptr.getClass().getInventoryStore(ptr); + + // If we've never sent any data, autoEquip the actor just in case its inventory + // slots have been cleared by a previous Container packet + if (!hasSentData) + invStore.autoEquip(ptr); + if (forceUpdate) equipmentChanged = true; - MWWorld::InventoryStore &invStore = ptr.getClass().getInventoryStore(ptr); - for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++) { auto &item = equipmentItems[slot];