[Client] Avoid sending repeated ObjectDelete packets about an object

pull/526/head
David Cernat 6 years ago
parent 7523a73346
commit f6db7d4fc5

@ -778,10 +778,14 @@ namespace MWScript
Start of tes3mp addition Start of tes3mp addition
Send an ID_OBJECT_DELETE packet every time an object is deleted Send an ID_OBJECT_DELETE packet every time an object is deleted
through a script through a script, as long as we haven't already communicated
a deletion for it
*/ */
if (mwmp::Main::get().getLocalPlayer()->isLoggedIn()) if (mwmp::Main::get().getLocalPlayer()->isLoggedIn() &&
ptr.getRefData().getLastCommunicatedState() != MWWorld::RefData::StateCommunication::Deleted)
{ {
ptr.getRefData().setLastCommunicatedState(MWWorld::RefData::StateCommunication::Deleted);
mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
objectList->reset(); objectList->reset();
objectList->packetOrigin = ScriptController::getPacketOriginFromContextType(runtime.getContext().getContextType()); objectList->packetOrigin = ScriptController::getPacketOriginFromContextType(runtime.getContext().getContextType());

@ -150,7 +150,8 @@ namespace MWWorld
{ {
None = 0, None = 0,
Enabled = 1, Enabled = 1,
Disabled = 2 Disabled = 2,
Deleted = 3
}; };
private: private:

Loading…
Cancel
Save