From 26a56d6a024bbb75f22b85b8d723f2f9e881f37e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 1 Apr 2018 14:58:04 +0300 Subject: [PATCH] [Client] Include NPC/creature containers when adding all cell containers --- apps/openmw/mwmp/WorldEvent.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index f0a86aab5..cae3bcceb 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -717,23 +717,22 @@ void WorldEvent::playVideo() void WorldEvent::addAllContainers(MWWorld::CellStore* cellStore) { - MWWorld::CellRefList *containerList = cellStore->getContainers(); - - for (auto &container : containerList->mList) + for (auto &ref : cellStore->getContainers()->mList) { - mwmp::WorldObject worldObject; - worldObject.refId = container.mRef.getRefId(); - worldObject.refNumIndex = container.mRef.getRefNum().mIndex; - worldObject.mpNum = container.mRef.getMpNum(); - - MWWorld::ContainerStore& containerStore = container.mClass->getContainerStore(MWWorld::Ptr(&container, 0)); + MWWorld::Ptr ptr(&ref, 0); + addEntireContainer(ptr); + } - for (const auto itemPtr : containerStore) - { - addContainerItem(worldObject, itemPtr, 0); - } + for (auto &ref : cellStore->getNpcs()->mList) + { + MWWorld::Ptr ptr(&ref, 0); + addEntireContainer(ptr); + } - addObject(worldObject); + for (auto &ref : cellStore->getCreatures()->mList) + { + MWWorld::Ptr ptr(&ref, 0); + addEntireContainer(ptr); } }