Use more accurate position for ID_OBJECT_PLACE

coverity_scan^2
David Cernat 8 years ago
parent a4647de048
commit 41504bd02a

@ -68,7 +68,10 @@ namespace MWGui
event->cell = *dropped.getCell()->getCell();
event->cellRef.mRefID = dropped.getCellRef().getRefId();
event->cellRef.mRefNum = dropped.getCellRef().getRefNum();
event->cellRef.mPos = dropped.getCellRef().getPosition();
// Make sure we send the RefData position instead of the CellRef one, because that's what
// we actually see on this client
event->pos = dropped.getRefData().getPosition();
// We have to get the count from the dropped object because it gets changed
// automatically for stacks of gold

@ -719,7 +719,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
newPtr.getCellRef().setGoldValue(event->cellRef.mGoldValue);
newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, ptrCellStore, event->cellRef.mPos);
newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, ptrCellStore, event->pos);
// Change RefNum here because the line above unsets it
newPtr.getCellRef().setRefNumIndex(event->cellRef.mRefNum.mIndex);

@ -549,7 +549,11 @@ namespace MWScript
event->cell = *ptr.getCell()->getCell();
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->cellRef.mPos = ptr.getCellRef().getPosition();
// Make sure we send the RefData position instead of the CellRef one, because that's what
// we actually see on this client
event->pos = ptr.getRefData().getPosition();
event->count = 1;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event);

@ -14,7 +14,6 @@ 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);
@ -22,5 +21,6 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
RW(event->cell.mData.mY, send);
RW(event->cell.mName, send);
RW(event->pos, send);
RW(event->count, send);
}

Loading…
Cancel
Save