From 937bf978834ce1e3d4c624b0a711c51debfcf124 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 29 Oct 2016 00:34:46 +0300 Subject: [PATCH] Send gold values correctly with ID_OBJECT_PLACE --- apps/openmw/mwgui/hud.cpp | 9 ++++++++- apps/openmw/mwmp/Networking.cpp | 1 + components/openmw-mp/Packets/World/PacketObjectPlace.cpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 068238b48..da8ec6bc4 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -61,7 +61,14 @@ namespace MWGui event->cellRef.mRefID = dropped.getCellRef().getRefId(); event->cellRef.mRefNum = dropped.getCellRef().getRefNum(); event->cellRef.mPos = dropped.getCellRef().getPosition(); - event->count = count; + + // We have to get the count from the dropped object because it gets changed + // automatically for stacks of gold + event->count = dropped.getRefData().getCount(); + + // For the real count of gold in a stack + event->cellRef.mGoldValue = dropped.getCellRef().getGoldValue(); + mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event); printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n", diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 3f152bec8..450d9c0c0 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -713,6 +713,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), event->cellRef.mRefID, 1); MWWorld::Ptr newPtr = ref.getPtr(); + newPtr.getCellRef().setGoldValue(event->cellRef.mGoldValue); if (event->count > 1) newPtr.getRefData().setCount(event->count); diff --git a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp index dfed23a3e..8a94c9f1e 100644 --- a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp @@ -15,6 +15,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se RW(event->cellRef.mRefID, send); RW(event->cellRef.mRefNum.mIndex, send); RW(event->cellRef.mPos, send); + RW(event->cellRef.mGoldValue, send); RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mX, send);