From 8b8c01f389f79ffa5f240480f81f4d4c2bf84d13 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 4 Apr 2017 11:43:33 +0300 Subject: [PATCH] [General] Make ID_OBJECT_PLACE take effect only when sent back by server --- .../processors/world/ProcessorObjectPlace.hpp | 3 +++ apps/openmw/mwgui/hud.cpp | 11 +++++++++++ apps/openmw/mwscript/transformationextensions.cpp | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp index 51271e9fd..d214b2e9b 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp @@ -25,6 +25,9 @@ namespace mwmp event.objectChanges.objects.at(i).mpNum = mwmp::Networking::getPtr()->getNextMpNum(); } + // Send this packet back to the original sender with the mpNum generation from above, + // then send it to the other players + packet.Send(false); packet.Send(true); Script::Call(player.getId(), event.cell.getDescription().c_str()); diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 31033b946..3e28b66a0 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -95,6 +95,17 @@ namespace MWGui End of tes3mp addition */ + /* + Start of tes3mp change (major) + + Instead of actually keeping this object as is, delete it after sending the packet + and wait for the server to send it back with the correct mpNum + */ + MWBase::Environment::get().getWorld()->deleteObject(dropped); + /* + End of tes3mp change (major) + */ + return dropped; } diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 1c173dbfe..f54bbeaef 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -581,6 +581,17 @@ namespace MWScript /* End of tes3mp addition */ + + /* + Start of tes3mp change (major) + + Instead of actually keeping this object as is, delete it after sending the packet + and wait for the server to send it back with the correct mpNum + */ + MWBase::Environment::get().getWorld()->deleteObject(ptr); + /* + End of tes3mp change (major) + */ } } };