Send gold values correctly with ID_OBJECT_PLACE

coverity_scan^2
David Cernat 8 years ago
parent 180aa3f2f3
commit 937bf97883

@ -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",

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

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

Loading…
Cancel
Save