[Client] Delete new LocalEvents after sending them

pull/163/head
David Cernat 8 years ago
parent 239c1aaebf
commit 703f253712

@ -93,6 +93,9 @@ namespace MWGui
worldObject.refNumIndex, worldObject.refNumIndex,
worldObject.count); worldObject.count);
delete event;
event = nullptr;
return dropped; return dropped;
} }

@ -644,6 +644,8 @@ namespace MWGui
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
delete event;
event = nullptr;
// remove from world // remove from world
MWBase::Environment::get().getWorld()->deleteObject (object); MWBase::Environment::get().getWorld()->deleteObject (object);

@ -68,6 +68,8 @@ namespace MWMechanics
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
delete event;
event = nullptr;
lock.getClass().unlock(lock); lock.getClass().unlock(lock);
resultMessage = "#{sLockSuccess}"; resultMessage = "#{sLockSuccess}";

@ -77,6 +77,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(event);
delete event;
event = nullptr;
} }
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max(), true); MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max(), true);

@ -207,6 +207,9 @@ namespace MWScript
event->cell.getDescription().c_str(), event->cell.getDescription().c_str(),
worldObject.index, worldObject.index,
worldObject.shortVal); worldObject.shortVal);
delete event;
event = nullptr;
} }
} }
@ -248,6 +251,9 @@ namespace MWScript
event->cell.getDescription().c_str(), event->cell.getDescription().c_str(),
worldObject.index, worldObject.index,
worldObject.floatVal); worldObject.floatVal);
delete event;
event = nullptr;
} }
} }
@ -307,6 +313,9 @@ namespace MWScript
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i", LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i",
worldObject.varName.c_str(), worldObject.varName.c_str(),
worldObject.shortVal); worldObject.shortVal);
delete event;
event = nullptr;
} }
MWBase::Environment::get().getWorld()->setGlobalInt (name, value); MWBase::Environment::get().getWorld()->setGlobalInt (name, value);
@ -646,6 +655,9 @@ namespace MWScript
worldObject.refId.c_str(), worldObject.refId.c_str(),
worldObject.index, worldObject.index,
worldObject.shortVal); worldObject.shortVal);
delete event;
event = nullptr;
} }
} }

@ -98,6 +98,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send(event);
delete event;
event = nullptr;
MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping); MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping);
} }
@ -208,6 +210,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send(event);
delete event;
event = nullptr;
ptr.getClass().lock (ptr, lockLevel); ptr.getClass().lock (ptr, lockLevel);
@ -245,6 +249,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
delete event;
event = nullptr;
ptr.getClass().unlock (ptr); ptr.getClass().unlock (ptr);
} }
@ -716,6 +722,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
delete event;
event = nullptr;
MWBase::Environment::get().getWorld()->deleteObject(ptr); MWBase::Environment::get().getWorld()->deleteObject(ptr);
} }

@ -78,6 +78,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send(event);
delete event;
event = nullptr;
MWBase::Environment::get().getSoundManager()->streamMusic (sound); MWBase::Environment::get().getSoundManager()->streamMusic (sound);
} }

@ -57,6 +57,8 @@ namespace MWScript
event->addObject(worldObject); event->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send(event); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send(event);
delete event;
event = nullptr;
MWBase::Environment::get().getWorld()->scaleObject(ptr,scale); MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
} }
@ -570,6 +572,9 @@ namespace MWScript
worldObject.refId.c_str(), worldObject.refId.c_str(),
worldObject.refNumIndex, worldObject.refNumIndex,
worldObject.count); worldObject.count);
delete event;
event = nullptr;
} }
} }
}; };

@ -41,6 +41,9 @@ namespace MWWorld
getTarget().getCellRef().getRefNum().mIndex, getTarget().getCellRef().getRefNum().mIndex,
event->cell.getDescription().c_str()); event->cell.getDescription().c_str());
delete event;
event = nullptr;
// LocalPlayer's inventory has changed, so send a packet with it // LocalPlayer's inventory has changed, so send a packet with it
mwmp::Main::get().getLocalPlayer()->sendInventory(); mwmp::Main::get().getLocalPlayer()->sendInventory();

@ -2283,6 +2283,9 @@ namespace MWWorld
event->cell.getDescription().c_str(), event->cell.getDescription().c_str(),
worldObject.state ? "true" : "false"); worldObject.state ? "true" : "false");
delete event;
event = nullptr;
door.getClass().setDoorState(door, state); door.getClass().setDoorState(door, state);
mDoorStates[door] = state; mDoorStates[door] = state;
} }
@ -2307,6 +2310,9 @@ namespace MWWorld
event->cell.getDescription().c_str(), event->cell.getDescription().c_str(),
worldObject.state ? "true" : "false"); worldObject.state ? "true" : "false");
delete event;
event = nullptr;
door.getClass().setDoorState(door, state); door.getClass().setDoorState(door, state);
mDoorStates[door] = state; mDoorStates[door] = state;
if (state == 0) if (state == 0)

Loading…
Cancel
Save