1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-07-21 05:14:10 +00:00

[Client] Require InventoryStore for autoequipping actors

This commit is contained in:
David Cernat 2018-04-01 09:02:26 +03:00
parent afe8c97cb9
commit 258e319acb

View file

@ -84,6 +84,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
// ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); // ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
bool isCurrentContainer = false; bool isCurrentContainer = false;
bool hasActorEquipment = ptrFound.getClass().isActor() && ptrFound.getClass().hasInventoryStore(ptrFound);
// If we are in a container, and it happens to be this container, keep track of that // If we are in a container, and it happens to be this container, keep track of that
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container)) if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Container))
@ -151,7 +152,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
takeAllSound = itemPtr.getClass().getUpSoundId(itemPtr); takeAllSound = itemPtr.getClass().getUpSoundId(itemPtr);
// Is this an actor's container? If so, unequip this item if it was equipped // Is this an actor's container? If so, unequip this item if it was equipped
if (ptrFound.getClass().isActor() && ptrFound.getClass().hasInventoryStore(ptrFound)) if (hasActorEquipment)
{ {
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound); MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);
@ -190,7 +191,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
// Was this a SET or ADD action on an actor's container, and are we the authority // Was this a SET or ADD action on an actor's container, and are we the authority
// over the actor? If so, autoequip the actor // over the actor? If so, autoequip the actor
if ((action == BaseEvent::ADD || action == BaseEvent::SET) && ptrFound.getClass().isActor() && if ((action == BaseEvent::ADD || action == BaseEvent::SET) && hasActorEquipment &&
mwmp::Main::get().getCellController()->isLocalActor(ptrFound)) mwmp::Main::get().getCellController()->isLocalActor(ptrFound))
{ {
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound); MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);