From cbc132612a7a80a212a7f3f4ff6bd02b981ac03f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 23 Oct 2016 16:33:53 +0300 Subject: [PATCH] Use mRefNum.mIndex instead of just mRefNum and add extra debug --- apps/openmw-mp/Networking.cpp | 9 +++++++-- apps/openmw/mwgui/hud.cpp | 2 +- apps/openmw/mwmp/Networking.cpp | 14 ++++++++++---- apps/openmw/mwworld/actiontake.cpp | 8 ++++++-- .../openmw-mp/Packets/World/PacketObjectDelete.cpp | 2 +- .../openmw-mp/Packets/World/PacketObjectPlace.cpp | 2 +- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index adfc7c992..de3ca9f0e 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -393,8 +393,13 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) myPacket->Read(event); - LOG_APPEND(Log::LOG_WARN, "- %s", event->cellRef.mRefID.c_str()); - LOG_APPEND(Log::LOG_WARN, "- %i", event->cellRef.mRefNum); + LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %i, %i, %i, %s", + event->cellRef.mRefID.c_str(), + event->cellRef.mRefNum.mIndex, + event->cell.mData.mFlags, + event->cell.mCellId.mIndex.mX, + event->cell.mCellId.mIndex.mY, + event->cell.mName.c_str()); myPacket->Send(event, true); diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 917fdb02b..09f610d98 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -65,7 +65,7 @@ namespace MWGui printf("Sending ID_WORLD_OBJECT_PLACE about %s\n%i\n", event->cellRef.mRefID.c_str(), - event->cellRef.mRefNum); + event->cellRef.mRefNum.mIndex); return dropped; } diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 7ee853ff2..752499b54 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -637,9 +637,13 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) MWWorld::CellStore *ptrCellStore; if (event->cell.isExterior()) + { ptrCellStore = MWBase::Environment::get().getWorld()->getExterior(event->cell.mData.mX, event->cell.mData.mY); + } else + { ptrCellStore = MWBase::Environment::get().getWorld()->getInterior(event->cell.mName); + } switch (packet->data[0]) { @@ -654,11 +658,13 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet) case ID_WORLD_OBJECT_DELETE: { LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_DELETE"); - LOG_APPEND(Log::LOG_WARN, "- cellRefId: %s, %i", + LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %i, %i, %i, %s", event->cellRef.mRefID.c_str(), - event->cellRef.mRefNum); - LOG_APPEND(Log::LOG_WARN, "- cell: %s", - event->cell.getDescription().c_str()); + event->cellRef.mRefNum.mIndex, + event->cell.mData.mFlags, + event->cell.mCellId.mIndex.mX, + event->cell.mCellId.mIndex.mY, + event->cell.mName.c_str()); MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum); diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index 5778fa308..9f86a9063 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -29,9 +29,13 @@ namespace MWWorld event->cellRef.mRefNum = getTarget().getCellRef().getRefNum(); mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_DELETE)->Send(event); - printf("Sending ID_WORLD_OBJECT_DELETE about %s\n%i\n", + printf("Sending ID_WORLD_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %i, %i, %i, %s", event->cellRef.mRefID.c_str(), - event->cellRef.mRefNum); + event->cellRef.mRefNum.mIndex, + event->cell.mData.mFlags, + event->cell.mCellId.mIndex.mX, + event->cell.mCellId.mIndex.mY, + event->cell.mName.c_str()); MWBase::Environment::get().getWorld()->deleteObject (getTarget()); } diff --git a/components/openmw-mp/Packets/World/PacketObjectDelete.cpp b/components/openmw-mp/Packets/World/PacketObjectDelete.cpp index 4b28cc46a..aaac1e4bc 100644 --- a/components/openmw-mp/Packets/World/PacketObjectDelete.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectDelete.cpp @@ -13,7 +13,7 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, WorldEvent *event, bool s WorldPacket::Packet(bs, event, send); RW(event->cellRef.mRefID, send); - RW(event->cellRef.mRefNum, send); + RW(event->cellRef.mRefNum.mIndex, send); RW(event->cell.mData.mFlags, send); RW(event->cell.mCellId.mIndex.mX, send); diff --git a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp index b9f50e168..52c96e177 100644 --- a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp @@ -13,7 +13,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se WorldPacket::Packet(bs, event, send); RW(event->cellRef.mRefID, send); - RW(event->cellRef.mRefNum, send); + RW(event->cellRef.mRefNum.mIndex, send); RW(event->cellRef.mPos, send); RW(event->cell.mData.mFlags, send);