1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 22:06:42 +00:00

[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.
This commit is contained in:
David Cernat 2019-12-06 12:21:30 +02:00
parent cd444f8707
commit 1950748dae

View file

@ -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];