From a4526605a6ce46775e986ac0a3620702ebcd6ba9 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 20 Feb 2017 12:31:11 +0200 Subject: [PATCH] [General] Remove goldValue from ContainerItem because it is never useful --- apps/openmw-mp/Script/Functions/World.cpp | 6 ------ apps/openmw-mp/Script/Functions/World.hpp | 2 -- apps/openmw/mwgui/container.cpp | 4 +--- apps/openmw/mwmp/WorldEvent.cpp | 4 ---- components/openmw-mp/Base/BaseEvent.hpp | 3 +-- components/openmw-mp/Packets/World/PacketContainer.cpp | 1 - 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/World.cpp b/apps/openmw-mp/Script/Functions/World.cpp index 7bda0190d..713a56b43 100644 --- a/apps/openmw-mp/Script/Functions/World.cpp +++ b/apps/openmw-mp/Script/Functions/World.cpp @@ -132,12 +132,6 @@ int WorldFunctions::GetContainerItemCharge(unsigned int objectIndex, unsigned in .containerChanges.items.at(itemIndex).charge; } -int WorldFunctions::GetContainerItemGoldValue(unsigned int objectIndex, unsigned int itemIndex) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex) - .containerChanges.items.at(itemIndex).goldValue; -} - int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept { return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(objectIndex) diff --git a/apps/openmw-mp/Script/Functions/World.hpp b/apps/openmw-mp/Script/Functions/World.hpp index 1dcb8365e..21b5607da 100644 --- a/apps/openmw-mp/Script/Functions/World.hpp +++ b/apps/openmw-mp/Script/Functions/World.hpp @@ -26,7 +26,6 @@ {"GetContainerItemRefId", WorldFunctions::GetContainerItemRefId},\ {"GetContainerItemCount", WorldFunctions::GetContainerItemCount},\ {"GetContainerItemCharge", WorldFunctions::GetContainerItemCharge},\ - {"GetContainerItemGoldValue", WorldFunctions::GetContainerItemGoldValue},\ {"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\ \ {"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\ @@ -90,7 +89,6 @@ public: static const char *GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex) noexcept; static int GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept; static int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept; - static int GetContainerItemGoldValue(unsigned int objectIndex, unsigned int itemIndex) noexcept; static int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept; static void SetBaseEventCell(const char* cellDescription) noexcept; diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index edfca1131..65a60d622 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -116,7 +116,6 @@ namespace MWGui containerItem.refId =itemPtr.getCellRef().getRefId(); containerItem.count = itemPtr.getRefData().getCount(); containerItem.charge = itemPtr.getCellRef().getCharge(); - containerItem.goldValue = itemPtr.getCellRef().getGoldValue(); containerItem.actionCount = count; worldObject.containerChanges.items.push_back(containerItem); @@ -176,9 +175,8 @@ namespace MWGui // Make sure we get the drag and drop count, not the count of the original item containerItem.count = mDragAndDrop->mDraggedCount; - + containerItem.charge = itemPtr.getCellRef().getCharge(); - containerItem.goldValue = itemPtr.getCellRef().getGoldValue(); worldObject.containerChanges.items.push_back(containerItem); event->addObject(worldObject); diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index a21398ae2..690798fef 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -67,7 +67,6 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore) containerItem.refId = itemPtr.getCellRef().getRefId(); containerItem.count = itemPtr.getRefData().getCount(); containerItem.charge = itemPtr.getCellRef().getCharge(); - containerItem.goldValue = itemPtr.getCellRef().getGoldValue(); worldObject.containerChanges.items.push_back(containerItem); } @@ -122,8 +121,6 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) if (containerItem.charge > -1) newPtr.getCellRef().setCharge(containerItem.charge); - newPtr.getCellRef().setGoldValue(containerItem.goldValue); - containerStore.add(newPtr, containerItem.count, ownerPtr, true); } else if (action == BaseEvent::REMOVE) @@ -135,7 +132,6 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) if (Misc::StringUtils::ciEqual(iter->getCellRef().getRefId(), containerItem.refId)) { if (iter->getCellRef().getCharge() == containerItem.charge && - iter->getCellRef().getGoldValue() == containerItem.goldValue && iter->getRefData().getCount() == containerItem.count) { containerStore.remove(*iter, containerItem.actionCount, ownerPtr); diff --git a/components/openmw-mp/Base/BaseEvent.hpp b/components/openmw-mp/Base/BaseEvent.hpp index 28d4baf16..7ef655d84 100644 --- a/components/openmw-mp/Base/BaseEvent.hpp +++ b/components/openmw-mp/Base/BaseEvent.hpp @@ -12,13 +12,12 @@ namespace mwmp std::string refId; int count; int charge; - int goldValue; int actionCount; inline bool operator==(const ContainerItem& rhs) { - return refId == rhs.refId && count == rhs.count && charge == rhs.charge && goldValue && rhs.goldValue; + return refId == rhs.refId && count == rhs.count && charge == rhs.charge; } }; diff --git a/components/openmw-mp/Packets/World/PacketContainer.cpp b/components/openmw-mp/Packets/World/PacketContainer.cpp index af614a37c..74a273a43 100644 --- a/components/openmw-mp/Packets/World/PacketContainer.cpp +++ b/components/openmw-mp/Packets/World/PacketContainer.cpp @@ -60,7 +60,6 @@ void PacketContainer::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send) RW(containerItem.refId, send); RW(containerItem.count, send); RW(containerItem.charge, send); - RW(containerItem.goldValue, send); RW(containerItem.actionCount, send); if (!send)