mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
Send gold values correctly with ID_OBJECT_PLACE
This commit is contained in:
parent
180aa3f2f3
commit
937bf97883
3 changed files with 10 additions and 1 deletions
|
@ -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…
Reference in a new issue