From 78234f90712187f0d339be4e4db829648c4ecb65 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 13 May 2018 00:42:24 +0300 Subject: [PATCH] [General] Rename Event into ObjectList & WorldObject into BaseObject --- apps/openmw-mp/Cell.cpp | 6 +- apps/openmw-mp/Cell.hpp | 4 +- apps/openmw-mp/CellController.hpp | 2 +- apps/openmw-mp/Networking.cpp | 6 +- apps/openmw-mp/Networking.hpp | 4 +- apps/openmw-mp/Script/Functions/World.cpp | 186 ++--- apps/openmw-mp/Script/Functions/World.hpp | 170 ++--- apps/openmw-mp/processors/WorldProcessor.cpp | 20 +- apps/openmw-mp/processors/WorldProcessor.hpp | 4 +- .../processors/world/ProcessorContainer.hpp | 6 +- .../processors/world/ProcessorDoorState.hpp | 4 +- .../world/ProcessorObjectDelete.hpp | 4 +- .../processors/world/ProcessorObjectLock.hpp | 4 +- .../processors/world/ProcessorObjectPlace.hpp | 8 +- .../processors/world/ProcessorObjectScale.hpp | 4 +- .../processors/world/ProcessorObjectSpawn.hpp | 8 +- .../processors/world/ProcessorObjectState.hpp | 4 +- .../processors/world/ProcessorObjectTrap.hpp | 4 +- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwclass/container.cpp | 18 +- apps/openmw/mwclass/door.cpp | 18 +- apps/openmw/mwgui/container.cpp | 66 +- apps/openmw/mwgui/hud.cpp | 10 +- apps/openmw/mwgui/inventorywindow.cpp | 10 +- apps/openmw/mwmechanics/actors.cpp | 10 +- apps/openmw/mwmechanics/security.cpp | 18 +- apps/openmw/mwmechanics/spellcasting.cpp | 18 +- apps/openmw/mwmechanics/summoning.cpp | 18 +- apps/openmw/mwmp/MechanicsHelper.cpp | 10 +- apps/openmw/mwmp/Networking.cpp | 6 +- apps/openmw/mwmp/Networking.hpp | 6 +- .../mwmp/{WorldEvent.cpp => ObjectList.cpp} | 686 +++++++++--------- .../mwmp/{WorldEvent.hpp => ObjectList.hpp} | 16 +- .../openmw/mwmp/processors/ActorProcessor.hpp | 2 +- .../openmw/mwmp/processors/WorldProcessor.cpp | 16 +- .../openmw/mwmp/processors/WorldProcessor.hpp | 6 +- .../processors/world/BaseObjectProcessor.hpp | 6 +- .../world/ProcessorConsoleCommand.hpp | 6 +- .../processors/world/ProcessorContainer.hpp | 42 +- .../world/ProcessorDoorDestination.hpp | 6 +- .../processors/world/ProcessorDoorState.hpp | 6 +- .../processors/world/ProcessorMusicPlay.hpp | 4 +- .../world/ProcessorObjectAnimPlay.hpp | 6 +- .../world/ProcessorObjectAttach.hpp | 6 +- .../world/ProcessorObjectCollision.hpp | 6 +- .../world/ProcessorObjectDelete.hpp | 6 +- .../processors/world/ProcessorObjectLock.hpp | 6 +- .../processors/world/ProcessorObjectMove.hpp | 6 +- .../processors/world/ProcessorObjectPlace.hpp | 6 +- .../processors/world/ProcessorObjectReset.hpp | 6 +- .../world/ProcessorObjectRotate.hpp | 6 +- .../processors/world/ProcessorObjectScale.hpp | 6 +- .../processors/world/ProcessorObjectSpawn.hpp | 6 +- .../processors/world/ProcessorObjectState.hpp | 6 +- .../processors/world/ProcessorObjectTrap.hpp | 6 +- .../world/ProcessorScriptGlobalFloat.hpp | 4 +- .../world/ProcessorScriptGlobalShort.hpp | 4 +- .../world/ProcessorScriptLocalFloat.hpp | 6 +- .../world/ProcessorScriptLocalShort.hpp | 6 +- .../world/ProcessorScriptMemberFloat.hpp | 4 +- .../world/ProcessorScriptMemberShort.hpp | 4 +- .../processors/world/ProcessorVideoPlay.hpp | 4 +- apps/openmw/mwscript/animationextensions.cpp | 10 +- apps/openmw/mwscript/interpretercontext.cpp | 50 +- apps/openmw/mwscript/miscextensions.cpp | 34 +- apps/openmw/mwscript/soundextensions.cpp | 10 +- .../mwscript/transformationextensions.cpp | 22 +- apps/openmw/mwworld/actiontake.cpp | 10 +- apps/openmw/mwworld/actiontrap.cpp | 10 +- apps/openmw/mwworld/worldimp.cpp | 26 +- components/CMakeLists.txt | 2 +- .../Base/{BaseEvent.hpp => BaseObject.hpp} | 14 +- .../openmw-mp/Packets/Object/ObjectPacket.cpp | 38 +- .../openmw-mp/Packets/Object/ObjectPacket.hpp | 8 +- .../Packets/Object/PacketConsoleCommand.cpp | 18 +- .../Packets/Object/PacketContainer.cpp | 30 +- .../Packets/Object/PacketDoorDestination.cpp | 18 +- .../Packets/Object/PacketDoorDestination.hpp | 2 +- .../Packets/Object/PacketDoorState.cpp | 6 +- .../Packets/Object/PacketDoorState.hpp | 2 +- .../Packets/Object/PacketMusicPlay.cpp | 4 +- .../Packets/Object/PacketMusicPlay.hpp | 2 +- .../Packets/Object/PacketObjectAnimPlay.cpp | 8 +- .../Packets/Object/PacketObjectAnimPlay.hpp | 2 +- .../Packets/Object/PacketObjectAttach.cpp | 4 +- .../Packets/Object/PacketObjectAttach.hpp | 2 +- .../Packets/Object/PacketObjectCollision.cpp | 4 +- .../Packets/Object/PacketObjectCollision.hpp | 2 +- .../Packets/Object/PacketObjectLock.cpp | 6 +- .../Packets/Object/PacketObjectLock.hpp | 2 +- .../Packets/Object/PacketObjectMove.cpp | 6 +- .../Packets/Object/PacketObjectMove.hpp | 2 +- .../Packets/Object/PacketObjectPlace.cpp | 16 +- .../Packets/Object/PacketObjectPlace.hpp | 2 +- .../Packets/Object/PacketObjectReset.cpp | 4 +- .../Packets/Object/PacketObjectReset.hpp | 2 +- .../Packets/Object/PacketObjectRotate.cpp | 10 +- .../Packets/Object/PacketObjectRotate.hpp | 2 +- .../Packets/Object/PacketObjectScale.cpp | 6 +- .../Packets/Object/PacketObjectScale.hpp | 2 +- .../Packets/Object/PacketObjectSpawn.cpp | 22 +- .../Packets/Object/PacketObjectSpawn.hpp | 2 +- .../Packets/Object/PacketObjectState.cpp | 6 +- .../Packets/Object/PacketObjectState.hpp | 2 +- .../Packets/Object/PacketObjectTrap.cpp | 10 +- .../Packets/Object/PacketObjectTrap.hpp | 2 +- .../Object/PacketScriptGlobalFloat.cpp | 6 +- .../Object/PacketScriptGlobalFloat.hpp | 2 +- .../Object/PacketScriptGlobalShort.cpp | 6 +- .../Object/PacketScriptGlobalShort.hpp | 2 +- .../Packets/Object/PacketScriptLocalFloat.cpp | 8 +- .../Packets/Object/PacketScriptLocalFloat.hpp | 2 +- .../Packets/Object/PacketScriptLocalShort.cpp | 8 +- .../Packets/Object/PacketScriptLocalShort.hpp | 2 +- .../Object/PacketScriptMemberFloat.cpp | 8 +- .../Object/PacketScriptMemberFloat.hpp | 2 +- .../Object/PacketScriptMemberShort.cpp | 8 +- .../Object/PacketScriptMemberShort.hpp | 2 +- .../Packets/Object/PacketVideoPlay.cpp | 6 +- .../Packets/Object/PacketVideoPlay.hpp | 2 +- 120 files changed, 1033 insertions(+), 1037 deletions(-) rename apps/openmw/mwmp/{WorldEvent.cpp => ObjectList.cpp} (57%) rename apps/openmw/mwmp/{WorldEvent.hpp => ObjectList.hpp} (88%) rename components/openmw-mp/Base/{BaseEvent.hpp => BaseObject.hpp} (87%) diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index 52c431a5e..306999fec 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -211,7 +211,7 @@ void Cell::sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseActorList *bas } } -void Cell::sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseEvent *baseEvent) const +void Cell::sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseObjectList *baseObjectList) const { if (players.empty()) return; @@ -229,9 +229,9 @@ void Cell::sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseEvent *baseE for (auto pl : plList) { - if (pl->guid == baseEvent->guid) continue; + if (pl->guid == baseObjectList->guid) continue; - objectPacket->setEvent(baseEvent); + objectPacket->setObjectList(baseObjectList); // Send the packet to this eligible guid objectPacket->Send(pl->guid); diff --git a/apps/openmw-mp/Cell.hpp b/apps/openmw-mp/Cell.hpp index 50b0537f3..0a21bb89e 100644 --- a/apps/openmw-mp/Cell.hpp +++ b/apps/openmw-mp/Cell.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -41,7 +41,7 @@ public: TPlayers getPlayers() const; void sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseActorList *baseActorList) const; - void sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseEvent *baseEvent) const; + void sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseObjectList *baseObjectList) const; std::string getDescription() const; diff --git a/apps/openmw-mp/CellController.hpp b/apps/openmw-mp/CellController.hpp index 79a7336b5..1206993f8 100644 --- a/apps/openmw-mp/CellController.hpp +++ b/apps/openmw-mp/CellController.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index bd0b1324a..d242c268e 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -188,7 +188,7 @@ void Networking::processObjectPacket(RakNet::Packet *packet) if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED) return; - if (!WorldProcessor::Process(*packet, baseEvent)) + if (!WorldProcessor::Process(*packet, baseObjectList)) LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled ObjectPacket with identifier %i has arrived", packet->data[0]); } @@ -362,9 +362,9 @@ BaseActorList *Networking::getLastActorList() return &baseActorList; } -BaseEvent *Networking::getLastEvent() +BaseObjectList *Networking::getLastObjectList() { - return &baseEvent; + return &baseObjectList; } int Networking::getCurrentMpNum() diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index 36b2b05a5..81cd5cb73 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -46,7 +46,7 @@ namespace mwmp ObjectPacketController *getObjectPacketController() const; BaseActorList *getLastActorList(); - BaseEvent *getLastEvent(); + BaseObjectList *getLastObjectList(); int getCurrentMpNum(); void setCurrentMpNum(int value); @@ -75,7 +75,7 @@ namespace mwmp MasterClient *mclient; BaseActorList baseActorList; - BaseEvent baseEvent; + BaseObjectList baseObjectList; PlayerPacketController *playerPacketController; ActorPacketController *actorPacketController; diff --git a/apps/openmw-mp/Script/Functions/World.cpp b/apps/openmw-mp/Script/Functions/World.cpp index e28fe870f..5ea394633 100644 --- a/apps/openmw-mp/Script/Functions/World.cpp +++ b/apps/openmw-mp/Script/Functions/World.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -10,280 +10,280 @@ using namespace mwmp; -BaseEvent *readEvent; -BaseEvent writeEvent; +BaseObjectList *readObjectList; +BaseObjectList writeObjectList; -WorldObject tempWorldObject; -const WorldObject emptyWorldObject = {}; +BaseObject tempObject; +const BaseObject emptyObject = {}; ContainerItem tempContainerItem; const ContainerItem emptyContainerItem = {}; -void WorldFunctions::ReadLastEvent() noexcept +void WorldFunctions::ReadLastObjectList() noexcept { - readEvent = mwmp::Networking::getPtr()->getLastEvent(); + readObjectList = mwmp::Networking::getPtr()->getLastObjectList(); } -void WorldFunctions::InitializeEvent(unsigned short pid) noexcept +void WorldFunctions::InitializeObjectList(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - writeEvent.cell.blank(); - writeEvent.worldObjects.clear(); - writeEvent.guid = player->guid; + writeObjectList.cell.blank(); + writeObjectList.baseObjects.clear(); + writeObjectList.guid = player->guid; } unsigned int WorldFunctions::GetObjectChangesSize() noexcept { - return readEvent->worldObjectCount; + return readObjectList->baseObjectCount; } -unsigned char WorldFunctions::GetEventAction() noexcept +unsigned char WorldFunctions::GetObjectListAction() noexcept { - return readEvent->action; + return readObjectList->action; } -unsigned char WorldFunctions::GetEventContainerSubAction() noexcept +unsigned char WorldFunctions::GetObjectListContainerSubAction() noexcept { - return readEvent->containerSubAction; + return readObjectList->containerSubAction; } const char *WorldFunctions::GetObjectRefId(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).refId.c_str(); + return readObjectList->baseObjects.at(i).refId.c_str(); } int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).refNumIndex; + return readObjectList->baseObjects.at(i).refNumIndex; } int WorldFunctions::GetObjectMpNum(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).mpNum; + return readObjectList->baseObjects.at(i).mpNum; } int WorldFunctions::GetObjectCount(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).count; + return readObjectList->baseObjects.at(i).count; } int WorldFunctions::GetObjectCharge(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).charge; + return readObjectList->baseObjects.at(i).charge; } double WorldFunctions::GetObjectEnchantmentCharge(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).enchantmentCharge; + return readObjectList->baseObjects.at(i).enchantmentCharge; } int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).goldValue; + return readObjectList->baseObjects.at(i).goldValue; } double WorldFunctions::GetObjectScale(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).scale; + return readObjectList->baseObjects.at(i).scale; } bool WorldFunctions::GetObjectState(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).objectState; + return readObjectList->baseObjects.at(i).objectState; } int WorldFunctions::GetObjectDoorState(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).doorState; + return readObjectList->baseObjects.at(i).doorState; } int WorldFunctions::GetObjectLockLevel(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).lockLevel; + return readObjectList->baseObjects.at(i).lockLevel; } double WorldFunctions::GetObjectPosX(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.pos[0]; + return readObjectList->baseObjects.at(i).position.pos[0]; } double WorldFunctions::GetObjectPosY(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.pos[1]; + return readObjectList->baseObjects.at(i).position.pos[1]; } double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.pos[2]; + return readObjectList->baseObjects.at(i).position.pos[2]; } double WorldFunctions::GetObjectRotX(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.rot[0]; + return readObjectList->baseObjects.at(i).position.rot[0]; } double WorldFunctions::GetObjectRotY(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.rot[1]; + return readObjectList->baseObjects.at(i).position.rot[1]; } double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept { - return readEvent->worldObjects.at(i).position.rot[2]; + return readObjectList->baseObjects.at(i).position.rot[2]; } unsigned int WorldFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept { - return readEvent->worldObjects.at(objectIndex).containerItemCount; + return readObjectList->baseObjects.at(objectIndex).containerItemCount; } const char *WorldFunctions::GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex) noexcept { - return readEvent->worldObjects.at(objectIndex) + return readObjectList->baseObjects.at(objectIndex) .containerItems.at(itemIndex).refId.c_str(); } int WorldFunctions::GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept { - return readEvent->worldObjects.at(objectIndex) + return readObjectList->baseObjects.at(objectIndex) .containerItems.at(itemIndex).count; } int WorldFunctions::GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept { - return readEvent->worldObjects.at(objectIndex) + return readObjectList->baseObjects.at(objectIndex) .containerItems.at(itemIndex).charge; } double WorldFunctions::GetContainerItemEnchantmentCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept { - return readEvent->worldObjects.at(objectIndex) + return readObjectList->baseObjects.at(objectIndex) .containerItems.at(itemIndex).enchantmentCharge; } int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept { - return readEvent->worldObjects.at(objectIndex) + return readObjectList->baseObjects.at(objectIndex) .containerItems.at(itemIndex).actionCount; } -void WorldFunctions::SetEventCell(const char* cellDescription) noexcept +void WorldFunctions::SetObjectListCell(const char* cellDescription) noexcept { - writeEvent.cell = Utils::getCellFromDescription(cellDescription); + writeObjectList.cell = Utils::getCellFromDescription(cellDescription); } -void WorldFunctions::SetEventAction(unsigned char action) noexcept +void WorldFunctions::SetObjectListAction(unsigned char action) noexcept { - writeEvent.action = action; + writeObjectList.action = action; } -void WorldFunctions::SetEventConsoleCommand(const char* consoleCommand) noexcept +void WorldFunctions::SetObjectListConsoleCommand(const char* consoleCommand) noexcept { - writeEvent.consoleCommand = consoleCommand; + writeObjectList.consoleCommand = consoleCommand; } void WorldFunctions::SetObjectRefId(const char* refId) noexcept { - tempWorldObject.refId = refId; + tempObject.refId = refId; } void WorldFunctions::SetObjectRefNumIndex(int refNumIndex) noexcept { - tempWorldObject.refNumIndex = refNumIndex; + tempObject.refNumIndex = refNumIndex; } void WorldFunctions::SetObjectMpNum(int mpNum) noexcept { - tempWorldObject.mpNum = mpNum; + tempObject.mpNum = mpNum; } void WorldFunctions::SetObjectCount(int count) noexcept { - tempWorldObject.count = count; + tempObject.count = count; } void WorldFunctions::SetObjectCharge(int charge) noexcept { - tempWorldObject.charge = charge; + tempObject.charge = charge; } void WorldFunctions::SetObjectEnchantmentCharge(double enchantmentCharge) noexcept { - tempWorldObject.enchantmentCharge = enchantmentCharge; + tempObject.enchantmentCharge = enchantmentCharge; } void WorldFunctions::SetObjectGoldValue(int goldValue) noexcept { - tempWorldObject.goldValue = goldValue; + tempObject.goldValue = goldValue; } void WorldFunctions::SetObjectScale(double scale) noexcept { - tempWorldObject.scale = scale; + tempObject.scale = scale; } void WorldFunctions::SetObjectState(bool objectState) noexcept { - tempWorldObject.objectState = objectState; + tempObject.objectState = objectState; } void WorldFunctions::SetObjectLockLevel(int lockLevel) noexcept { - tempWorldObject.lockLevel = lockLevel; + tempObject.lockLevel = lockLevel; } void WorldFunctions::SetObjectDisarmState(bool disarmState) noexcept { - tempWorldObject.isDisarmed = disarmState; + tempObject.isDisarmed = disarmState; } void WorldFunctions::SetObjectMasterState(bool masterState) noexcept { - tempWorldObject.hasMaster = masterState; + tempObject.hasMaster = masterState; } void WorldFunctions::SetObjectPosition(double x, double y, double z) noexcept { - tempWorldObject.position.pos[0] = x; - tempWorldObject.position.pos[1] = y; - tempWorldObject.position.pos[2] = z; + tempObject.position.pos[0] = x; + tempObject.position.pos[1] = y; + tempObject.position.pos[2] = z; } void WorldFunctions::SetObjectRotation(double x, double y, double z) noexcept { - tempWorldObject.position.rot[0] = x; - tempWorldObject.position.rot[1] = y; - tempWorldObject.position.rot[2] = z; + tempObject.position.rot[0] = x; + tempObject.position.rot[1] = y; + tempObject.position.rot[2] = z; } void WorldFunctions::SetObjectDoorState(int doorState) noexcept { - tempWorldObject.doorState = doorState; + tempObject.doorState = doorState; } void WorldFunctions::SetObjectDoorTeleportState(bool teleportState) noexcept { - tempWorldObject.teleportState = teleportState; + tempObject.teleportState = teleportState; } void WorldFunctions::SetObjectDoorDestinationCell(const char* cellDescription) noexcept { - tempWorldObject.destinationCell = Utils::getCellFromDescription(cellDescription); + tempObject.destinationCell = Utils::getCellFromDescription(cellDescription); } void WorldFunctions::SetObjectDoorDestinationPosition(double x, double y, double z) noexcept { - tempWorldObject.destinationPosition.pos[0] = x; - tempWorldObject.destinationPosition.pos[1] = y; - tempWorldObject.destinationPosition.pos[2] = z; + tempObject.destinationPosition.pos[0] = x; + tempObject.destinationPosition.pos[1] = y; + tempObject.destinationPosition.pos[2] = z; } void WorldFunctions::SetObjectDoorDestinationRotation(double x, double z) noexcept { - tempWorldObject.destinationPosition.rot[0] = x; - tempWorldObject.destinationPosition.rot[2] = z; + tempObject.destinationPosition.rot[0] = x; + tempObject.destinationPosition.rot[2] = z; } void WorldFunctions::SetPlayerAsObject(unsigned short pid) noexcept @@ -291,8 +291,8 @@ void WorldFunctions::SetPlayerAsObject(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - tempWorldObject.guid = player->guid; - tempWorldObject.isPlayer = true; + tempObject.guid = player->guid; + tempObject.isPlayer = true; } void WorldFunctions::SetContainerItemRefId(const char* refId) noexcept @@ -317,20 +317,20 @@ void WorldFunctions::SetContainerItemEnchantmentCharge(double enchantmentCharge) void WorldFunctions::SetReceivedContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept { - readEvent->worldObjects.at(objectIndex).containerItems.at(itemIndex).actionCount = actionCount; + readObjectList->baseObjects.at(objectIndex).containerItems.at(itemIndex).actionCount = actionCount; } -void WorldFunctions::AddWorldObject() noexcept +void WorldFunctions::AddObject() noexcept { - tempWorldObject.droppedByPlayer = false; - writeEvent.worldObjects.push_back(tempWorldObject); + tempObject.droppedByPlayer = false; + writeObjectList.baseObjects.push_back(tempObject); - tempWorldObject = emptyWorldObject; + tempObject = emptyObject; } void WorldFunctions::AddContainerItem() noexcept { - tempWorldObject.containerItems.push_back(tempContainerItem); + tempObject.containerItems.push_back(tempContainerItem); tempContainerItem = emptyContainerItem; } @@ -338,7 +338,7 @@ void WorldFunctions::AddContainerItem() noexcept void WorldFunctions::SendObjectPlace(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_PLACE); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -348,7 +348,7 @@ void WorldFunctions::SendObjectPlace(bool broadcast) noexcept void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SPAWN); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -358,7 +358,7 @@ void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept void WorldFunctions::SendObjectDelete(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_DELETE); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -368,7 +368,7 @@ void WorldFunctions::SendObjectDelete(bool broadcast) noexcept void WorldFunctions::SendObjectLock(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_LOCK); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -378,7 +378,7 @@ void WorldFunctions::SendObjectLock(bool broadcast) noexcept void WorldFunctions::SendObjectTrap(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_TRAP); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -388,7 +388,7 @@ void WorldFunctions::SendObjectTrap(bool broadcast) noexcept void WorldFunctions::SendObjectScale(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SCALE); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -398,7 +398,7 @@ void WorldFunctions::SendObjectScale(bool broadcast) noexcept void WorldFunctions::SendObjectState(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -408,7 +408,7 @@ void WorldFunctions::SendObjectState(bool broadcast) noexcept void WorldFunctions::SendDoorState(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_STATE); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -418,21 +418,21 @@ void WorldFunctions::SendDoorState(bool broadcast) noexcept void WorldFunctions::SendDoorDestination(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_DESTINATION); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) packet->Send(true); } -void WorldFunctions::SendContainer(bool broadcast, bool useLastReadEvent) noexcept +void WorldFunctions::SendContainer(bool broadcast, bool useLastReadObjectList) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONTAINER); - if (useLastReadEvent) - packet->setEvent(readEvent); + if (useLastReadObjectList) + packet->setObjectList(readObjectList); else - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); @@ -443,7 +443,7 @@ void WorldFunctions::SendContainer(bool broadcast, bool useLastReadEvent) noexce void WorldFunctions::SendConsoleCommand(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND); - packet->setEvent(&writeEvent); + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) diff --git a/apps/openmw-mp/Script/Functions/World.hpp b/apps/openmw-mp/Script/Functions/World.hpp index 2ba777dee..8fe2dbace 100644 --- a/apps/openmw-mp/Script/Functions/World.hpp +++ b/apps/openmw-mp/Script/Functions/World.hpp @@ -2,12 +2,12 @@ #define OPENMW_WORLDAPI_HPP #define WORLDAPI \ - {"ReadLastEvent", WorldFunctions::ReadLastEvent},\ - {"InitializeEvent", WorldFunctions::InitializeEvent},\ + {"ReadLastObjectList", WorldFunctions::ReadLastObjectList},\ + {"InitializeObjectList", WorldFunctions::InitializeObjectList},\ \ {"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\ - {"GetEventAction", WorldFunctions::GetEventAction},\ - {"GetEventContainerSubAction", WorldFunctions::GetEventContainerSubAction},\ + {"GetObjectListAction", WorldFunctions::GetObjectListAction},\ + {"GetObjectListContainerSubAction", WorldFunctions::GetObjectListContainerSubAction},\ \ {"GetObjectRefId", WorldFunctions::GetObjectRefId},\ {"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\ @@ -34,9 +34,9 @@ {"GetContainerItemEnchantmentCharge", WorldFunctions::GetContainerItemEnchantmentCharge},\ {"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\ \ - {"SetEventCell", WorldFunctions::SetEventCell},\ - {"SetEventAction", WorldFunctions::SetEventAction},\ - {"SetEventConsoleCommand", WorldFunctions::SetEventConsoleCommand},\ + {"SetObjectListCell", WorldFunctions::SetObjectListCell},\ + {"SetObjectListAction", WorldFunctions::SetObjectListAction},\ + {"SetObjectListConsoleCommand", WorldFunctions::SetObjectListConsoleCommand},\ \ {"SetObjectRefId", WorldFunctions::SetObjectRefId},\ {"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\ @@ -68,7 +68,7 @@ \ {"SetReceivedContainerItemActionCount", WorldFunctions::SetReceivedContainerItemActionCount},\ \ - {"AddWorldObject", WorldFunctions::AddWorldObject},\ + {"AddObject", WorldFunctions::AddObject},\ {"AddContainerItem", WorldFunctions::AddContainerItem},\ \ {"SendObjectPlace", WorldFunctions::SendObjectPlace},\ @@ -92,52 +92,52 @@ class WorldFunctions public: /** - * \brief Use the last event received by the server as the one being read. + * \brief Use the last object list received by the server as the one being read. * * \return void */ - static void ReadLastEvent() noexcept; + static void ReadLastObjectList() noexcept; /** - * \brief Clear the data from the last event sent by the server. + * \brief Clear the data from the last object list sent by the server. * * This is used to initialize the sending of new Object packets. * - * \param pid The player ID to whom the event should be attached. + * \param pid The player ID to whom the object list should be attached. * \return void */ - static void InitializeEvent(unsigned short pid) noexcept; + static void InitializeObjectList(unsigned short pid) noexcept; /** - * \brief Get the number of indexes in the read event's object changes. + * \brief Get the number of indexes in the read object list's object changes. * * \return The number of indexes. */ static unsigned int GetObjectChangesSize() noexcept; /** - * \brief Get the action type used in the read event. + * \brief Get the action type used in the read object list. * * \return The action type (0 for SET, 1 for ADD, 2 for REMOVE, 3 for REQUEST). */ - static unsigned char GetEventAction() noexcept; + static unsigned char GetObjectListAction() noexcept; /** - * \brief Get the container subaction type used in the read event. + * \brief Get the container subaction type used in the read object list. * * \return The action type (0 for NONE, 1 for DRAG, 2 for DROP, 3 for TAKE_ALL). */ - static unsigned char GetEventContainerSubAction() noexcept; + static unsigned char GetObjectListContainerSubAction() noexcept; /** - * \brief Get the refId of the object at a certain index in the read event's object changes. + * \brief Get the refId of the object at a certain index in the read object list's object changes. * * \return The refId. */ static const char *GetObjectRefId(unsigned int i) noexcept; /** - * \brief Get the refNumIndex of the object at a certain index in the read event's object + * \brief Get the refNumIndex of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -146,7 +146,7 @@ public: static int GetObjectRefNumIndex(unsigned int i) noexcept; /** - * \brief Get the mpNum of the object at a certain index in the read event's object changes. + * \brief Get the mpNum of the object at a certain index in the read object list's object changes. * * \param i The index of the object. * \return The mpNum. @@ -154,7 +154,7 @@ public: static int GetObjectMpNum(unsigned int i) noexcept; /** - * \brief Get the count of the object at a certain index in the read event's object changes. + * \brief Get the count of the object at a certain index in the read object list's object changes. * * \param i The index of the object. * \return The object count. @@ -162,7 +162,7 @@ public: static int GetObjectCount(unsigned int i) noexcept; /** - * \brief Get the charge of the object at a certain index in the read event's object changes. + * \brief Get the charge of the object at a certain index in the read object list's object changes. * * \param i The index of the object. * \return The charge. @@ -170,7 +170,7 @@ public: static int GetObjectCharge(unsigned int i) noexcept; /** - * \brief Get the enchantment charge of the object at a certain index in the read event's object changes. + * \brief Get the enchantment charge of the object at a certain index in the read object list's object changes. * * \param i The index of the object. * \return The enchantment charge. @@ -178,7 +178,7 @@ public: static double GetObjectEnchantmentCharge(unsigned int i) noexcept; /** - * \brief Get the gold value of the object at a certain index in the read event's object + * \brief Get the gold value of the object at a certain index in the read object list's object * changes. * * This is used solely to get the gold value of gold. It is not used for other objects. @@ -189,7 +189,7 @@ public: static int GetObjectGoldValue(unsigned int i) noexcept; /** - * \brief Get the object scale of the object at a certain index in the read event's object + * \brief Get the object scale of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -198,7 +198,7 @@ public: static double GetObjectScale(unsigned int i) noexcept; /** - * \brief Get the object state of the object at a certain index in the read event's object + * \brief Get the object state of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -207,7 +207,7 @@ public: static bool GetObjectState(unsigned int i) noexcept; /** - * \brief Get the door state of the object at a certain index in the read event's object + * \brief Get the door state of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -216,7 +216,7 @@ public: static int GetObjectDoorState(unsigned int i) noexcept; /** - * \brief Get the lock level of the object at a certain index in the read event's object + * \brief Get the lock level of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -225,7 +225,7 @@ public: static int GetObjectLockLevel(unsigned int i) noexcept; /** - * \brief Get the X position of the object at a certain index in the read event's object + * \brief Get the X position of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -234,7 +234,7 @@ public: static double GetObjectPosX(unsigned int i) noexcept; /** - * \brief Get the Y position of the object at a certain index in the read event's object + * \brief Get the Y position of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -243,7 +243,7 @@ public: static double GetObjectPosY(unsigned int i) noexcept; /** - * \brief Get the Z position at a certain index in the read event's object changes. + * \brief Get the Z position at a certain index in the read object list's object changes. * * \param i The index of the object. * \return The Z position. @@ -251,7 +251,7 @@ public: static double GetObjectPosZ(unsigned int i) noexcept; /** - * \brief Get the X rotation of the object at a certain index in the read event's object + * \brief Get the X rotation of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -260,7 +260,7 @@ public: static double GetObjectRotX(unsigned int i) noexcept; /** - * \brief Get the Y rotation of the object at a certain index in the read event's object + * \brief Get the Y rotation of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -269,7 +269,7 @@ public: static double GetObjectRotY(unsigned int i) noexcept; /** - * \brief Get the Z rotation of the object at a certain index in the read event's object + * \brief Get the Z rotation of the object at a certain index in the read object list's object * changes. * * \param i The index of the object. @@ -279,7 +279,7 @@ public: /** * \brief Get the number of container item indexes of the object at a certain index in the - * read event's object changes. + * read object list's object changes. * * \param i The index of the object. * \return The number of container item indexes. @@ -288,7 +288,7 @@ public: /** * \brief Get the refId of the container item at a certain itemIndex in the container changes - * of the object at a certain objectIndex in the read event's object changes. + * of the object at a certain objectIndex in the read object list's object changes. * * \param objectIndex The index of the object. * \param itemIndex The index of the container item. @@ -298,7 +298,7 @@ public: /** * \brief Get the item count of the container item at a certain itemIndex in the container - * changes of the object at a certain objectIndex in the read event's object changes. + * changes of the object at a certain objectIndex in the read object list's object changes. * * \param objectIndex The index of the object. * \param itemIndex The index of the container item. @@ -308,7 +308,7 @@ public: /** * \brief Get the charge of the container item at a certain itemIndex in the container changes - * of the object at a certain objectIndex in the read event's object changes. + * of the object at a certain objectIndex in the read object list's object changes. * * \param objectIndex The index of the object. * \param itemIndex The index of the container item. @@ -318,7 +318,7 @@ public: /** * \brief Get the enchantment charge of the container item at a certain itemIndex in the container changes - * of the object at a certain objectIndex in the read event's object changes. + * of the object at a certain objectIndex in the read object list's object changes. * * \param objectIndex The index of the object. * \param itemIndex The index of the container item. @@ -328,7 +328,7 @@ public: /** * \brief Get the action count of the container item at a certain itemIndex in the container - * changes of the object at a certain objectIndex in the read event's object changes. + * changes of the object at a certain objectIndex in the read object list's object changes. * * \param objectIndex The index of the object. * \param itemIndex The index of the container item. @@ -337,7 +337,7 @@ public: static int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept; /** - * \brief Set the cell of the temporary event stored on the server. + * \brief Set the cell of the temporary object list stored on the server. * * The cell is determined to be an exterior cell if it fits the pattern of a number followed * by a comma followed by another number. @@ -345,29 +345,29 @@ public: * \param cellDescription The description of the cell. * \return void */ - static void SetEventCell(const char* cellDescription) noexcept; + static void SetObjectListCell(const char* cellDescription) noexcept; /** - * \brief Set the action type of the temporary event stored on the server. + * \brief Set the action type of the temporary object list stored on the server. * * \param action The action type (0 for SET, 1 for ADD, 2 for REMOVE, 3 for REQUEST). * \return void */ - static void SetEventAction(unsigned char action) noexcept; + static void SetObjectListAction(unsigned char action) noexcept; /** - * \brief Set the console command of the temporary event stored on the server. + * \brief Set the console command of the temporary object list stored on the server. * - * When sent, the command will run once on every object added to the event. If no objects + * When sent, the command will run once on every object added to the object list. If no objects * have been added, it will run once without any object reference. * * \param consoleCommand The console command. * \return void */ - static void SetEventConsoleCommand(const char* consoleCommand) noexcept; + static void SetObjectListConsoleCommand(const char* consoleCommand) noexcept; /** - * \brief Set the refId of the temporary world object stored on the server. + * \brief Set the refId of the temporary object stored on the server. * * \param refId The refId. * \return void @@ -375,7 +375,7 @@ public: static void SetObjectRefId(const char* refId) noexcept; /** - * \brief Set the refNumIndex of the temporary world object stored on the server. + * \brief Set the refNumIndex of the temporary object stored on the server. * * Every object loaded from .ESM and .ESP data files has a unique refNumIndex which needs to be * retained to refer to it in packets. @@ -389,7 +389,7 @@ public: static void SetObjectRefNumIndex(int refNumIndex) noexcept; /** - * \brief Set the mpNum of the temporary world object stored on the server. + * \brief Set the mpNum of the temporary object stored on the server. * * Every object placed or spawned via the server is assigned an mpNum by incrementing the last * mpNum stored on the server. Scripts should take care to ensure that mpNums are kept unique @@ -404,7 +404,7 @@ public: static void SetObjectMpNum(int mpNum) noexcept; /** - * \brief Set the object count of the temporary world object stored on the server. + * \brief Set the object count of the temporary object stored on the server. * * This determines the quantity of an object, with the exception of gold. * @@ -414,7 +414,7 @@ public: static void SetObjectCount(int count) noexcept; /** - * \brief Set the charge of the temporary world object stored on the server. + * \brief Set the charge of the temporary object stored on the server. * * Object durabilities are set through this value. * @@ -424,7 +424,7 @@ public: static void SetObjectCharge(int charge) noexcept; /** - * \brief Set the enchantment charge of the temporary world object stored on the server. + * \brief Set the enchantment charge of the temporary object stored on the server. * * Object durabilities are set through this value. * @@ -434,7 +434,7 @@ public: static void SetObjectEnchantmentCharge(double enchantmentCharge) noexcept; /** - * \brief Set the gold value of the temporary world object stored on the server. + * \brief Set the gold value of the temporary object stored on the server. * * This is used solely to set the gold value for gold. It has no effect on other objects. * @@ -444,7 +444,7 @@ public: static void SetObjectGoldValue(int goldValue) noexcept; /** - * \brief Set the scale of the temporary world object stored on the server. + * \brief Set the scale of the temporary object stored on the server. * * Objects are smaller or larger than their default size based on their scale. * @@ -454,7 +454,7 @@ public: static void SetObjectScale(double scale) noexcept; /** - * \brief Set the object state of the temporary world object stored on the server. + * \brief Set the object state of the temporary object stored on the server. * * Objects are enabled or disabled based on their object state. * @@ -464,7 +464,7 @@ public: static void SetObjectState(bool objectState) noexcept; /** - * \brief Set the lock level of the temporary world object stored on the server. + * \brief Set the lock level of the temporary object stored on the server. * * \param lockLevel The lock level. * \return void @@ -472,7 +472,7 @@ public: static void SetObjectLockLevel(int lockLevel) noexcept; /** - * \brief Set the disarm state of the temporary world object stored on the server. + * \brief Set the disarm state of the temporary object stored on the server. * * \param disarmState The disarmState. * \return void @@ -480,7 +480,7 @@ public: static void SetObjectDisarmState(bool disarmState) noexcept; /** - * \brief Set the master state of the temporary world object stored on the server. + * \brief Set the master state of the temporary object stored on the server. * * This only affects living actors and determines whether they are followers of another * living actor. @@ -491,7 +491,7 @@ public: static void SetObjectMasterState(bool masterState) noexcept; /** - * \brief Set the position of the temporary world object stored on the server. + * \brief Set the position of the temporary object stored on the server. * * \param x The X position. * \param y The Y position. @@ -501,7 +501,7 @@ public: static void SetObjectPosition(double x, double y, double z) noexcept; /** - * \brief Set the rotation of the temporary world object stored on the server. + * \brief Set the rotation of the temporary object stored on the server. * * \param x The X rotation. * \param y The Y rotation. @@ -511,7 +511,7 @@ public: static void SetObjectRotation(double x, double y, double z) noexcept; /** - * \brief Set the door state of the temporary world object stored on the server. + * \brief Set the door state of the temporary object stored on the server. * * Doors are open or closed based on their door state. * @@ -521,7 +521,7 @@ public: static void SetObjectDoorState(int doorState) noexcept; /** - * \brief Set the teleport state of the temporary world object stored on the server. + * \brief Set the teleport state of the temporary object stored on the server. * * If a door's teleport state is true, interacting with the door teleports a player to its * destination. If it's false, it opens and closes like a regular door. @@ -532,7 +532,7 @@ public: static void SetObjectDoorTeleportState(bool teleportState) noexcept; /** - * \brief Set the door destination cell of the temporary world object stored on the server. + * \brief Set the door destination cell of the temporary object stored on the server. * * The cell is determined to be an exterior cell if it fits the pattern of a number followed * by a comma followed by another number. @@ -543,7 +543,7 @@ public: static void SetObjectDoorDestinationCell(const char* cellDescription) noexcept; /** - * \brief Set the door destination position of the temporary world object stored on the server. + * \brief Set the door destination position of the temporary object stored on the server. * * \param x The X position. * \param y The Y position. @@ -553,7 +553,7 @@ public: static void SetObjectDoorDestinationPosition(double x, double y, double z) noexcept; /** - * \brief Set the door destination rotation of the temporary world object stored on the server. + * \brief Set the door destination rotation of the temporary object stored on the server. * * Note: Because this sets the rotation a player will have upon using the door, and rotation * on the Y axis has no effect on players, the Y value has been omitted as an argument. @@ -565,7 +565,7 @@ public: static void SetObjectDoorDestinationRotation(double x, double z) noexcept; /** - * \brief Set a player as the object in the temporary world object stored on the server. + * \brief Set a player as the object in the temporary object stored on the server. * Currently only used for ConsoleCommand packets. * * \param pid The pid of the player. @@ -607,7 +607,7 @@ public: /** * \brief Set the action count of the container item at a certain itemIndex in the container - * changes of the object at a certain objectIndex in the read event's object changes. + * changes of the object at a certain objectIndex in the read object list's object changes. * * When resending a received Container packet, this allows you to correct the amount of items * removed from a container by a player when it conflicts with what other players have already @@ -621,18 +621,18 @@ public: static void SetReceivedContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept; /** - * \brief Add a copy of the server's temporary world object to the server's temporary event. + * \brief Add a copy of the server's temporary object to the server's temporary object list. * - * In the process, the server's temporary world object will automatically be cleared so a new + * In the process, the server's temporary object will automatically be cleared so a new * one can be set up. * * \return void */ - static void AddWorldObject() noexcept; + static void AddObject() noexcept; /** * \brief Add a copy of the server's temporary container item to the container changes of the - * server's temporary world object. + * server's temporary object. * * In the process, the server's temporary container item will automatically be cleared so a new * one can be set up. @@ -645,7 +645,7 @@ public: * \brief Send an ObjectPlace packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -655,7 +655,7 @@ public: * \brief Send an ObjectSpawn packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -665,7 +665,7 @@ public: * \brief Send an ObjectDelete packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -675,7 +675,7 @@ public: * \brief Send an ObjectLock packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -685,7 +685,7 @@ public: * \brief Send an ObjectTrap packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -695,7 +695,7 @@ public: * \brief Send an ObjectScale packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -705,7 +705,7 @@ public: * \brief Send an ObjectState packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -715,7 +715,7 @@ public: * \brief Send a DoorState packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -725,7 +725,7 @@ public: * \brief Send a DoorDestination packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ @@ -735,17 +735,17 @@ public: * \brief Send a Container packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ - static void SendContainer(bool broadcast = false, bool useLastReadEvent = false) noexcept; + static void SendContainer(bool broadcast = false, bool useLastReadObjectList = false) noexcept; /** * \brief Send a ConsoleCommand packet. * * \param broadcast Whether this packet should be sent only to the player for whom the current - * event was initialized or to everyone on the server. + * object list was initialized or to everyone on the server. * * \return void */ diff --git a/apps/openmw-mp/processors/WorldProcessor.cpp b/apps/openmw-mp/processors/WorldProcessor.cpp index ac8a79d2f..34a658d1c 100644 --- a/apps/openmw-mp/processors/WorldProcessor.cpp +++ b/apps/openmw-mp/processors/WorldProcessor.cpp @@ -10,17 +10,17 @@ using namespace mwmp; template typename BasePacketProcessor::processors_t BasePacketProcessor::processors; -void WorldProcessor::Do(ObjectPacket &packet, Player &player, BaseEvent &event) +void WorldProcessor::Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) { packet.Send(true); } -bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept +bool WorldProcessor::Process(RakNet::Packet &packet, BaseObjectList &objectList) noexcept { - // Clear our BaseEvent before loading new data in it - event.cell.blank(); - event.worldObjects.clear(); - event.guid = packet.guid; + // Clear our BaseObjectList before loading new data in it + objectList.cell.blank(); + objectList.baseObjects.clear(); + objectList.guid = packet.guid; for (auto &processor : processors) { @@ -29,14 +29,14 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept Player *player = Players::getPlayer(packet.guid); ObjectPacket *myPacket = Networking::get().getObjectPacketController()->GetPacket(packet.data[0]); - myPacket->setEvent(&event); - event.isValid = true; + myPacket->setObjectList(&objectList); + objectList.isValid = true; if (!processor.second->avoidReading) myPacket->Read(); - if (event.isValid) - processor.second->Do(*myPacket, *player, event); + if (objectList.isValid) + processor.second->Do(*myPacket, *player, objectList); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw-mp/processors/WorldProcessor.hpp b/apps/openmw-mp/processors/WorldProcessor.hpp index 30b2e7a52..752fbd203 100644 --- a/apps/openmw-mp/processors/WorldProcessor.hpp +++ b/apps/openmw-mp/processors/WorldProcessor.hpp @@ -19,9 +19,9 @@ namespace mwmp { public: - virtual void Do(ObjectPacket &packet, Player &player, BaseEvent &event); + virtual void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList); - static bool Process(RakNet::Packet &packet, BaseEvent &event) noexcept; + static bool Process(RakNet::Packet &packet, BaseObjectList &objectList) noexcept; }; } diff --git a/apps/openmw-mp/processors/world/ProcessorContainer.hpp b/apps/openmw-mp/processors/world/ProcessorContainer.hpp index c6ef9ad09..f6bedd98a 100644 --- a/apps/openmw-mp/processors/world/ProcessorContainer.hpp +++ b/apps/openmw-mp/processors/world/ProcessorContainer.hpp @@ -13,16 +13,16 @@ namespace mwmp BPP_INIT(ID_CONTAINER) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); - LOG_APPEND(Log::LOG_INFO, "- action: %i", event.action); + LOG_APPEND(Log::LOG_INFO, "- action: %i", objectList.action); // Don't have any hardcoded sync, and instead expect Lua scripts to forward // container packets to ensure their integrity based on what exists in the // server data - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); LOG_APPEND(Log::LOG_INFO, "- Finished processing ID_CONTAINER"); } diff --git a/apps/openmw-mp/processors/world/ProcessorDoorState.hpp b/apps/openmw-mp/processors/world/ProcessorDoorState.hpp index 221d69949..2b29662c3 100644 --- a/apps/openmw-mp/processors/world/ProcessorDoorState.hpp +++ b/apps/openmw-mp/processors/world/ProcessorDoorState.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_DOOR_STATE) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp b/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp index 524524372..e5d54ae25 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp @@ -13,13 +13,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_DELETE) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp b/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp index 9e9d5a004..3f031734d 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp @@ -13,13 +13,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_LOCK) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp index 5f3cec4ec..59b74ab0f 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp @@ -14,13 +14,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_PLACE) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); - for (unsigned int i = 0; i < event.worldObjectCount; i++) + for (unsigned int i = 0; i < objectList.baseObjectCount; i++) { - event.worldObjects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum(); + objectList.baseObjects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum(); } // Send this packet back to the original sender with the mpNum generation from above, @@ -28,7 +28,7 @@ namespace mwmp packet.Send(false); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp b/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp index 066ebacb1..0d5227b87 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp @@ -13,13 +13,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_SCALE) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp b/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp index 37327d4fa..4973c9cf8 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp @@ -14,13 +14,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_SPAWN) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); - for (unsigned int i = 0; i < event.worldObjectCount; i++) + for (unsigned int i = 0; i < objectList.baseObjectCount; i++) { - event.worldObjects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum(); + objectList.baseObjects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum(); } // Send this packet back to the original sender with the mpNum generation from above, @@ -28,7 +28,7 @@ namespace mwmp packet.Send(false); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectState.hpp b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp index 296541bfd..1d09d7e6f 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectState.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp @@ -13,13 +13,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_STATE) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp b/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp index b4b9638b1..2be1eac5c 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp @@ -13,13 +13,13 @@ namespace mwmp BPP_INIT(ID_OBJECT_TRAP) } - void Do(ObjectPacket &packet, Player &player, BaseEvent &event) override + void Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); packet.Send(true); - Script::Call(player.getId(), event.cell.getDescription().c_str()); + Script::Call(player.getId(), objectList.cell.getDescription().c_str()); } }; } diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index ddd555a77..90b2e1311 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -97,7 +97,7 @@ add_openmw_dir (mwbase inputmanager windowmanager statemanager ) -add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer PlayerList LocalActor DedicatedActor ActorList WorldEvent +add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer PlayerList LocalActor DedicatedActor ActorList ObjectList Cell CellController MechanicsHelper RecordHelper GUIController ) diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index ecae30083..78482b9f3 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -189,10 +189,10 @@ namespace MWClass Send an ID_OBJECT_TRAP packet every time a trap is disarmed */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); - worldEvent->sendObjectTrap(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); + objectList->sendObjectTrap(); /* End of tes3mp addition */ @@ -205,10 +205,10 @@ namespace MWClass */ if (isLocked) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(ptr, 0); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(ptr, 0); + objectList->sendObjectLock(); } /* End of tes3mp addition diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 2b4e47b78..69c06aae9 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -183,10 +183,10 @@ namespace MWClass Send an ID_OBJECT_TRAP packet every time a trap is disarmed */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); - worldEvent->sendObjectTrap(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); + objectList->sendObjectTrap(); /* End of tes3mp addition */ @@ -199,10 +199,10 @@ namespace MWClass */ if (isLocked) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(ptr, 0); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(ptr, 0); + objectList->sendObjectLock(); } /* End of tes3mp addition diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 0d19f9f89..d4614b5ac 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -12,7 +12,7 @@ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/CellController.hpp" /* End of tes3mp addition @@ -112,22 +112,22 @@ namespace MWGui Send an ID_CONTAINER packet every time an item starts being dragged from a container */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->cell = *mPtr.getCell()->getCell(); - worldEvent->action = mwmp::BaseEvent::REMOVE; - worldEvent->containerSubAction = mwmp::BaseEvent::DRAG; + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->cell = *mPtr.getCell()->getCell(); + objectList->action = mwmp::BaseObjectList::REMOVE; + objectList->containerSubAction = mwmp::BaseObjectList::DRAG; - mwmp::WorldObject worldObject = worldEvent->getWorldObject(mPtr); + mwmp::BaseObject baseObject = objectList->getBaseObject(mPtr); MWWorld::Ptr itemPtr = mModel->getItem(mSelectedItem).mBase; - worldEvent->addContainerItem(worldObject, itemPtr, count); - worldEvent->addObject(worldObject); + objectList->addContainerItem(baseObject, itemPtr, count); + objectList->addObject(baseObject); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setEvent(worldEvent); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setObjectList(objectList); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i", - worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(), + baseObject.refId.c_str(), baseObject.refNumIndex, objectList->cell.getDescription().c_str(), itemPtr.getCellRef().getRefId().c_str(), itemPtr.getRefData().getCount()); /* End of tes3mp addition @@ -158,13 +158,13 @@ namespace MWGui */ if (success) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->cell = *mPtr.getCell()->getCell(); - worldEvent->action = mwmp::BaseEvent::ADD; - worldEvent->containerSubAction = mwmp::BaseEvent::DROP; + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->cell = *mPtr.getCell()->getCell(); + objectList->action = mwmp::BaseObjectList::ADD; + objectList->containerSubAction = mwmp::BaseObjectList::DROP; - mwmp::WorldObject worldObject = worldEvent->getWorldObject(mPtr); + mwmp::BaseObject baseObject = objectList->getBaseObject(mPtr); MWWorld::Ptr itemPtr = mDragAndDrop->mItem.mBase; mwmp::ContainerItem containerItem; containerItem.refId = itemPtr.getCellRef().getRefId(); @@ -175,14 +175,14 @@ namespace MWGui containerItem.charge = itemPtr.getCellRef().getCharge(); containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge(); - worldObject.containerItems.push_back(containerItem); - worldEvent->addObject(worldObject); + baseObject.containerItems.push_back(containerItem); + objectList->addObject(baseObject); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setEvent(worldEvent); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setObjectList(objectList); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i, %i", - worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(), + baseObject.refId.c_str(), baseObject.refNumIndex, objectList->cell.getDescription().c_str(), containerItem.refId.c_str(), containerItem.count, containerItem.charge); } /* @@ -298,19 +298,19 @@ namespace MWGui Send an ID_CONTAINER packet every time the Take All button is used on a container */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->cell = *mPtr.getCell()->getCell(); - worldEvent->action = mwmp::BaseEvent::REMOVE; - worldEvent->containerSubAction = mwmp::BaseEvent::TAKE_ALL; - worldEvent->addEntireContainer(mPtr); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->cell = *mPtr.getCell()->getCell(); + objectList->action = mwmp::BaseObjectList::REMOVE; + objectList->containerSubAction = mwmp::BaseObjectList::TAKE_ALL; + objectList->addEntireContainer(mPtr); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setEvent(worldEvent); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setObjectList(objectList); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i-%i\n- cell: %s", mPtr.getCellRef().getRefId().c_str(), mPtr.getCellRef().getRefNum().mIndex, mPtr.getCellRef().getMpNum(), - worldEvent->cell.getDescription().c_str()); + objectList->cell.getDescription().c_str()); /* End of tes3mp addition */ @@ -380,10 +380,10 @@ namespace MWGui */ if (!mPtr.getClass().isPersistent(mPtr)) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(mPtr); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(mPtr); + objectList->sendObjectDelete(); } /* End of tes3mp addition diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 1bf0b7984..d38fe87da 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -14,7 +14,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/LocalPlayer.hpp" #include "../mwworld/cellstore.hpp" /* @@ -72,10 +72,10 @@ namespace MWGui Send an ID_OBJECT_PLACE packet every time an object is dropped into the world from the inventory screen */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectPlace(dropped, true); - worldEvent->sendObjectPlace(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectPlace(dropped, true); + objectList->sendObjectPlace(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index e91cf5a12..0ff317e09 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -24,7 +24,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/LocalPlayer.hpp" #include "../mwworld/cellstore.hpp" /* @@ -697,10 +697,10 @@ namespace MWGui Send an ID_PLAYER_INVENTORY packet as well because of the item thus gained by the player */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(object); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(object); + objectList->sendObjectDelete(); mwmp::Main::get().getLocalPlayer()->sendInventory(); /* End of tes3mp addition diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index e2cdd362f..90f8b0afc 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -23,7 +23,7 @@ #include "../mwmp/PlayerList.hpp" #include "../mwmp/CellController.hpp" #include "../mwmp/MechanicsHelper.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -1726,10 +1726,10 @@ namespace MWMechanics Send an ID_OBJECT_DELETE packet every time a summoned creature despawns */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(ptr); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(ptr); + objectList->sendObjectDelete(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmechanics/security.cpp b/apps/openmw/mwmechanics/security.cpp index d54ffa518..ca40cdd4c 100644 --- a/apps/openmw/mwmechanics/security.cpp +++ b/apps/openmw/mwmechanics/security.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -73,10 +73,10 @@ namespace MWMechanics Send an ID_OBJECT_LOCK packet every time an object is unlocked here */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(lock, 0); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(lock, 0); + objectList->sendObjectLock(); /* End of tes3mp addition */ @@ -132,10 +132,10 @@ namespace MWMechanics Send an ID_OBJECT_TRAP packet every time a trap is disarmed */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectTrap(trap, trap.getRefData().getPosition(), true); - worldEvent->sendObjectTrap(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectTrap(trap, trap.getRefData().getPosition(), true); + objectList->sendObjectTrap(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 190776cb0..202394d8f 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -19,7 +19,7 @@ #include "../mwmp/Networking.hpp" #include "../mwmp/PlayerList.hpp" #include "../mwmp/LocalPlayer.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/MechanicsHelper.hpp" /* End of tes3mp addition @@ -680,10 +680,10 @@ namespace MWMechanics Send an ID_OBJECT_LOCK packet every time an object is locked here */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(target, static_cast(magnitude)); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(target, static_cast(magnitude)); + objectList->sendObjectLock(); /* End of tes3mp addition */ @@ -714,10 +714,10 @@ namespace MWMechanics Send an ID_OBJECT_LOCK packet every time an object is unlocked here */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(target, 0); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(target, 0); + objectList->sendObjectLock(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index 14890f83f..0657b25ce 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -11,7 +11,7 @@ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/CellController.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -105,10 +105,10 @@ namespace MWMechanics if (mwmp::Main::get().getCellController()->hasLocalAuthority(*placed.getCell()->getCell())) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectSpawn(placed, mActor); - worldEvent->sendObjectSpawn(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectSpawn(placed, mActor); + objectList->sendObjectSpawn(); } MWBase::Environment::get().getWorld()->deleteObject(placed); @@ -162,10 +162,10 @@ namespace MWMechanics Send an ID_OBJECT_DELETE packet every time a summoned creature despawns */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(ptr); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(ptr); + objectList->sendObjectDelete(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmp/MechanicsHelper.cpp b/apps/openmw/mwmp/MechanicsHelper.cpp index 9082fea3a..c7dcb7182 100644 --- a/apps/openmw/mwmp/MechanicsHelper.cpp +++ b/apps/openmw/mwmp/MechanicsHelper.cpp @@ -19,7 +19,7 @@ #include "LocalPlayer.hpp" #include "DedicatedPlayer.hpp" #include "PlayerList.hpp" -#include "WorldEvent.hpp" +#include "ObjectList.hpp" #include "CellController.hpp" using namespace mwmp; @@ -35,8 +35,8 @@ osg::Vec3f MechanicsHelper::getLinearInterpolation(osg::Vec3f start, osg::Vec3f void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore) { MWWorld::CellRefList *creatureLevList = cellStore->getCreatureLists(); - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); int spawnCount = 0; @@ -53,7 +53,7 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore) manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition()); MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(manualRef.getPtr(), ptr.getCell(), ptr.getCellRef().getPosition()); - worldEvent->addObjectSpawn(placed); + objectList->addObjectSpawn(placed); MWBase::Environment::get().getWorld()->deleteObject(placed); spawnCount++; @@ -61,7 +61,7 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore) } if (spawnCount > 0) - worldEvent->sendObjectSpawn(); + objectList->sendObjectSpawn(); } Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 2f401b976..b36acb27d 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -430,7 +430,7 @@ void Networking::receiveMessage(RakNet::Packet *packet) } else if (objectPacketController.ContainsPacket(packet->data[0])) { - if (!WorldProcessor::Process(*packet, worldEvent)) + if (!WorldProcessor::Process(*packet, objectList)) LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled ObjectPacket with identifier %i has arrived", packet->data[0]); } } @@ -460,9 +460,9 @@ ActorList *Networking::getActorList() return &actorList; } -WorldEvent *Networking::getWorldEvent() +ObjectList *Networking::getObjectList() { - return &worldEvent; + return &objectList; } bool Networking::isConnected() diff --git a/apps/openmw/mwmp/Networking.hpp b/apps/openmw/mwmp/Networking.hpp index 946dd87a1..c16c2cc28 100644 --- a/apps/openmw/mwmp/Networking.hpp +++ b/apps/openmw/mwmp/Networking.hpp @@ -10,7 +10,7 @@ #include #include "ActorList.hpp" -#include "WorldEvent.hpp" +#include "ObjectList.hpp" #include #include @@ -44,7 +44,7 @@ namespace mwmp LocalPlayer *getLocalPlayer(); ActorList *getActorList(); - WorldEvent *getWorldEvent(); + ObjectList *getObjectList(); private: bool connected; @@ -57,7 +57,7 @@ namespace mwmp ObjectPacketController objectPacketController; ActorList actorList; - WorldEvent worldEvent; + ObjectList objectList; void receiveMessage(RakNet::Packet *packet); diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/ObjectList.cpp similarity index 57% rename from apps/openmw/mwmp/WorldEvent.cpp rename to apps/openmw/mwmp/ObjectList.cpp index db1f32b32..2320fedf6 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/ObjectList.cpp @@ -1,4 +1,4 @@ -#include "WorldEvent.hpp" +#include "ObjectList.hpp" #include "Main.hpp" #include "Networking.hpp" #include "MechanicsHelper.hpp" @@ -32,46 +32,46 @@ using namespace mwmp; using namespace std; -WorldEvent::WorldEvent() +ObjectList::ObjectList() { } -WorldEvent::~WorldEvent() +ObjectList::~ObjectList() { } -Networking *WorldEvent::getNetworking() +Networking *ObjectList::getNetworking() { return mwmp::Main::get().getNetworking(); } -void WorldEvent::reset() +void ObjectList::reset() { cell.blank(); - worldObjects.clear(); + baseObjects.clear(); guid = mwmp::Main::get().getNetworking()->getLocalPlayer()->guid; action = -1; containerSubAction = 0; } -void WorldEvent::addObject(WorldObject worldObject) +void ObjectList::addObject(BaseObject baseObject) { - worldObjects.push_back(worldObject); + baseObjects.push_back(baseObject); } -WorldObject WorldEvent::getWorldObject(const MWWorld::Ptr& ptr) +BaseObject ObjectList::getBaseObject(const MWWorld::Ptr& ptr) { - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - return worldObject; + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + return baseObject; } -void WorldEvent::addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount) +void ObjectList::addContainerItem(mwmp::BaseObject& baseObject, const MWWorld::Ptr& itemPtr, int actionCount) { mwmp::ContainerItem containerItem; containerItem.refId = itemPtr.getCellRef().getRefId(); @@ -82,38 +82,38 @@ void WorldEvent::addContainerItem(mwmp::WorldObject& worldObject, const MWWorld: LOG_APPEND(Log::LOG_INFO, "-- Adding container item %s", containerItem.refId.c_str()); - worldObject.containerItems.push_back(containerItem); + baseObject.containerItems.push_back(containerItem); } -void WorldEvent::addEntireContainer(const MWWorld::Ptr& ptr) +void ObjectList::addEntireContainer(const MWWorld::Ptr& ptr) { MWWorld::ContainerStore& containerStore = ptr.getClass().getContainerStore(ptr); - mwmp::WorldObject worldObject = getWorldObject(ptr); + mwmp::BaseObject baseObject = getBaseObject(ptr); for (const auto itemPtr : containerStore) { - addContainerItem(worldObject, itemPtr, itemPtr.getRefData().getCount()); + addContainerItem(baseObject, itemPtr, itemPtr.getRefData().getCount()); } - addObject(worldObject); + addObject(baseObject); } -void WorldEvent::editContainers(MWWorld::CellStore* cellStore) +void ObjectList::editContainers(MWWorld::CellStore* cellStore) { bool isLocalEvent = guid == Main::get().getLocalPlayer()->guid; LOG_APPEND(Log::LOG_VERBOSE, "- isLocalEvent? %s", isLocalEvent ? "true" : "false"); - WorldObject worldObject; + BaseObject baseObject; - for (unsigned int i = 0; i < worldObjectCount; i++) + for (unsigned int i = 0; i < baseObjectCount; i++) { - worldObject = worldObjects.at(i); + baseObject = baseObjects.at(i); - //LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + //LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -138,16 +138,16 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) MWWorld::ContainerStore& containerStore = ptrFound.getClass().getContainerStore(ptrFound); // If we are setting the entire contents, clear the current ones - if (action == BaseEvent::SET) + if (action == BaseObjectList::SET) containerStore.clear(); - bool isLocalDrop = isLocalEvent && containerSubAction == BaseEvent::DROP; - bool isLocalDrag = isLocalEvent && containerSubAction == BaseEvent::DRAG; - bool isLocalTakeAll = isLocalEvent && containerSubAction == BaseEvent::TAKE_ALL; + bool isLocalDrop = isLocalEvent && containerSubAction == BaseObjectList::DROP; + bool isLocalDrag = isLocalEvent && containerSubAction == BaseObjectList::DRAG; + bool isLocalTakeAll = isLocalEvent && containerSubAction == BaseObjectList::TAKE_ALL; std::string takeAllSound = ""; MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); - for (const auto &containerItem : worldObject.containerItems) + for (const auto &containerItem : baseObject.containerItems) { //LOG_APPEND(Log::LOG_VERBOSE, "-- containerItem cellRef: %s, count: %i, actionCount: %i", // containerItem.refId.c_str(), containerItem.count, containerItem.actionCount); @@ -155,7 +155,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) if (containerItem.refId.find("$dynamic") != string::npos) continue; - if (action == BaseEvent::SET || action == BaseEvent::ADD) + if (action == BaseObjectList::SET || action == BaseObjectList::ADD) { // Create a ManualRef to be able to set item charge MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), containerItem.refId, 1); @@ -173,7 +173,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) containerStore.add(newPtr, containerItem.count, ownerPtr, true); } - else if (action == BaseEvent::REMOVE && containerItem.actionCount > 0) + else if (action == BaseObjectList::REMOVE && containerItem.actionCount > 0) { // We have to find the right item ourselves because ContainerStore has no method // accounting for charge @@ -228,7 +228,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) // Was this a SET or ADD action on an actor's container, and are we the authority // over the actor? If so, autoequip the actor - if ((action == BaseEvent::ADD || action == BaseEvent::SET) && hasActorEquipment && + if ((action == BaseObjectList::ADD || action == BaseObjectList::SET) && hasActorEquipment && mwmp::Main::get().getCellController()->isLocalActor(ptrFound)) { MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound); @@ -258,46 +258,46 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore) } } -void WorldEvent::placeObjects(MWWorld::CellStore* cellStore) +void ObjectList::placeObjects(MWWorld::CellStore* cellStore) { MWBase::World *world = MWBase::Environment::get().getWorld(); - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, count: %i, charge: %i, enchantmentCharge: %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.mpNum, worldObject.count, worldObject.charge, worldObject.enchantmentCharge); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, count: %i, charge: %i, enchantmentCharge: %i", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.mpNum, baseObject.count, baseObject.charge, baseObject.enchantmentCharge); // Ignore generic dynamic refIds because they could be anything on other clients - if (worldObject.refId.find("$dynamic") != string::npos) + if (baseObject.refId.find("$dynamic") != string::npos) continue; - MWWorld::Ptr ptrFound = cellStore->searchExact(0, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(0, baseObject.mpNum); // Only create this object if it doesn't already exist if (!ptrFound) { try { - MWWorld::ManualRef ref(world->getStore(), worldObject.refId, 1); + MWWorld::ManualRef ref(world->getStore(), baseObject.refId, 1); MWWorld::Ptr newPtr = ref.getPtr(); - if (worldObject.count > 1) - newPtr.getRefData().setCount(worldObject.count); + if (baseObject.count > 1) + newPtr.getRefData().setCount(baseObject.count); - if (worldObject.charge > -1) - newPtr.getCellRef().setCharge(worldObject.charge); + if (baseObject.charge > -1) + newPtr.getCellRef().setCharge(baseObject.charge); - if (worldObject.enchantmentCharge > -1) - newPtr.getCellRef().setEnchantmentCharge(worldObject.enchantmentCharge); + if (baseObject.enchantmentCharge > -1) + newPtr.getCellRef().setEnchantmentCharge(baseObject.enchantmentCharge); - newPtr.getCellRef().setGoldValue(worldObject.goldValue); - newPtr = world->placeObject(newPtr, cellStore, worldObject.position); + newPtr.getCellRef().setGoldValue(baseObject.goldValue); + newPtr = world->placeObject(newPtr, cellStore, baseObject.position); // Because gold automatically gets replaced with a new object, make sure we set the mpNum at the end - newPtr.getCellRef().setMpNum(worldObject.mpNum); + newPtr.getCellRef().setMpNum(baseObject.mpNum); - if (guid == Main::get().getLocalPlayer()->guid && worldObject.droppedByPlayer) + if (guid == Main::get().getLocalPlayer()->guid && baseObject.droppedByPlayer) world->PCDropped(newPtr); } @@ -311,37 +311,37 @@ void WorldEvent::placeObjects(MWWorld::CellStore* cellStore) } } -void WorldEvent::spawnObjects(MWWorld::CellStore* cellStore) +void ObjectList::spawnObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.mpNum); // Ignore generic dynamic refIds because they could be anything on other clients - if (worldObject.refId.find("$dynamic") != string::npos) + if (baseObject.refId.find("$dynamic") != string::npos) continue; - MWWorld::Ptr ptrFound = cellStore->searchExact(0, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(0, baseObject.mpNum); // Only create this object if it doesn't already exist if (!ptrFound) { - MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), worldObject.refId, 1); + MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), baseObject.refId, 1); MWWorld::Ptr newPtr = ref.getPtr(); - newPtr.getCellRef().setMpNum(worldObject.mpNum); + newPtr.getCellRef().setMpNum(baseObject.mpNum); - newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, cellStore, worldObject.position); + newPtr = MWBase::Environment::get().getWorld()->placeObject(newPtr, cellStore, baseObject.position); - if (worldObject.hasMaster) + if (baseObject.hasMaster) { MWWorld::Ptr masterPtr; - if (worldObject.master.isPlayer) - masterPtr = MechanicsHelper::getPlayerPtr(worldObject.master); + if (baseObject.master.isPlayer) + masterPtr = MechanicsHelper::getPlayerPtr(baseObject.master); else - masterPtr = cellStore->searchExact(worldObject.master.refNumIndex, worldObject.master.mpNum); + masterPtr = cellStore->searchExact(baseObject.master.refNumIndex, baseObject.master.mpNum); if (masterPtr) { @@ -362,7 +362,7 @@ void WorldEvent::spawnObjects(MWWorld::CellStore* cellStore) int creatureActorId = newPtr.getClass().getCreatureStats(newPtr).getActorId(); MWMechanics::CreatureStats& masterCreatureStats = masterPtr.getClass().getCreatureStats(masterPtr); - masterCreatureStats.setSummonedCreatureActorId(worldObject.refId, creatureActorId); + masterCreatureStats.setSummonedCreatureActorId(baseObject.refId, creatureActorId); } } } @@ -371,13 +371,13 @@ void WorldEvent::spawnObjects(MWWorld::CellStore* cellStore) } } -void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore) +void ObjectList::deleteObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -402,44 +402,44 @@ void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore) } } -void WorldEvent::lockObjects(MWWorld::CellStore* cellStore) +void ObjectList::lockObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - if (worldObject.lockLevel > 0) - ptrFound.getClass().lock(ptrFound, worldObject.lockLevel); + if (baseObject.lockLevel > 0) + ptrFound.getClass().lock(ptrFound, baseObject.lockLevel); else ptrFound.getClass().unlock(ptrFound); } } } -void WorldEvent::triggerTrapObjects(MWWorld::CellStore* cellStore) +void ObjectList::triggerTrapObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - if (!worldObject.isDisarmed) + if (!baseObject.isDisarmed) { MWMechanics::CastSpell cast(ptrFound, ptrFound); - cast.mHitPosition = worldObject.position.asVec3(); + cast.mHitPosition = baseObject.position.asVec3(); cast.cast(ptrFound.getCellRef().getTrap()); } @@ -448,40 +448,40 @@ void WorldEvent::triggerTrapObjects(MWWorld::CellStore* cellStore) } } -void WorldEvent::scaleObjects(MWWorld::CellStore* cellStore) +void ObjectList::scaleObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, scale: %f", worldObject.refId.c_str(), worldObject.refNumIndex, - worldObject.mpNum, worldObject.scale); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, scale: %f", baseObject.refId.c_str(), baseObject.refNumIndex, + baseObject.mpNum, baseObject.scale); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - MWBase::Environment::get().getWorld()->scaleObject(ptrFound, worldObject.scale); + MWBase::Environment::get().getWorld()->scaleObject(ptrFound, baseObject.scale); } } } -void WorldEvent::setObjectStates(MWWorld::CellStore* cellStore) +void ObjectList::setObjectStates(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, state: %s", worldObject.refId.c_str(), worldObject.refNumIndex, - worldObject.mpNum, worldObject.objectState ? "true" : "false"); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, state: %s", baseObject.refId.c_str(), baseObject.refNumIndex, + baseObject.mpNum, baseObject.objectState ? "true" : "false"); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - if (worldObject.objectState) + if (baseObject.objectState) MWBase::Environment::get().getWorld()->enable(ptrFound); else MWBase::Environment::get().getWorld()->disable(ptrFound); @@ -489,32 +489,32 @@ void WorldEvent::setObjectStates(MWWorld::CellStore* cellStore) } } -void WorldEvent::moveObjects(MWWorld::CellStore* cellStore) +void ObjectList::moveObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - MWBase::Environment::get().getWorld()->moveObject(ptrFound, worldObject.position.pos[0], worldObject.position.pos[1], - worldObject.position.pos[2]); + MWBase::Environment::get().getWorld()->moveObject(ptrFound, baseObject.position.pos[0], baseObject.position.pos[1], + baseObject.position.pos[2]); } } } -void WorldEvent::rotateObjects(MWWorld::CellStore* cellStore) +void ObjectList::rotateObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -522,18 +522,18 @@ void WorldEvent::rotateObjects(MWWorld::CellStore* cellStore) ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); MWBase::Environment::get().getWorld()->rotateObject(ptrFound, - worldObject.position.rot[0], worldObject.position.rot[1], worldObject.position.rot[2]); + baseObject.position.rot[0], baseObject.position.rot[1], baseObject.position.rot[2]); } } } -void WorldEvent::animateObjects(MWWorld::CellStore* cellStore) +void ObjectList::animateObjects(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -541,66 +541,66 @@ void WorldEvent::animateObjects(MWWorld::CellStore* cellStore) ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); MWBase::MechanicsManager * mechanicsManager = MWBase::Environment::get().getMechanicsManager(); - mechanicsManager->playAnimationGroup(ptrFound, worldObject.animGroup, worldObject.animMode, + mechanicsManager->playAnimationGroup(ptrFound, baseObject.animGroup, baseObject.animMode, std::numeric_limits::max(), true); } } } -void WorldEvent::activateDoors(MWWorld::CellStore* cellStore) +void ObjectList::activateDoors(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - ptrFound.getClass().setDoorState(ptrFound, worldObject.doorState); - MWBase::Environment::get().getWorld()->saveDoorState(ptrFound, worldObject.doorState); + ptrFound.getClass().setDoorState(ptrFound, baseObject.doorState); + MWBase::Environment::get().getWorld()->saveDoorState(ptrFound, baseObject.doorState); } } } -void WorldEvent::setDoorDestinations(MWWorld::CellStore* cellStore) +void ObjectList::setDoorDestinations(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - ptrFound.getCellRef().setTeleport(worldObject.teleportState); + ptrFound.getCellRef().setTeleport(baseObject.teleportState); - if (worldObject.teleportState) + if (baseObject.teleportState) { - ptrFound.getCellRef().setDoorDest(worldObject.destinationPosition); + ptrFound.getCellRef().setDoorDest(baseObject.destinationPosition); - if (worldObject.destinationCell.isExterior()) + if (baseObject.destinationCell.isExterior()) ptrFound.getCellRef().setDestCell(""); else - ptrFound.getCellRef().setDestCell(worldObject.destinationCell.getDescription()); + ptrFound.getCellRef().setDestCell(baseObject.destinationCell.getDescription()); } } } } -void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) +void ObjectList::runConsoleCommands(MWWorld::CellStore* cellStore) { MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager(); LOG_APPEND(Log::LOG_VERBOSE, "- console command: %s", consoleCommand.c_str()); - if (worldObjects.empty()) + if (baseObjects.empty()) { windowManager->clearConsolePtr(); @@ -609,13 +609,13 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) } else { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { windowManager->clearConsolePtr(); - if (worldObject.isPlayer) + if (baseObject.isPlayer) { - if (worldObject.guid == Main::get().getLocalPlayer()->guid) + if (baseObject.guid == Main::get().getLocalPlayer()->guid) { LOG_APPEND(Log::LOG_VERBOSE, "-- running on local player"); windowManager->setConsolePtr(Main::get().getLocalPlayer()->getPlayerPtr()); @@ -623,7 +623,7 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) } else { - DedicatedPlayer *player = PlayerList::getPlayer(worldObject.guid); + DedicatedPlayer *player = PlayerList::getPlayer(baseObject.guid); if (player != 0) { @@ -635,9 +635,9 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) } else { - LOG_APPEND(Log::LOG_VERBOSE, "-- running on cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "-- running on cellRef: %s, %i, %i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -654,53 +654,53 @@ void WorldEvent::runConsoleCommands(MWWorld::CellStore* cellStore) } } -void WorldEvent::setLocalShorts(MWWorld::CellStore* cellStore) +void ObjectList::setLocalShorts(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, index: %i, shortVal: %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.shortVal); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, index: %i, shortVal: %i", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.mpNum, baseObject.index, baseObject.shortVal); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - ptrFound.getRefData().getLocals().mShorts.at(worldObject.index) = worldObject.shortVal; + ptrFound.getRefData().getLocals().mShorts.at(baseObject.index) = baseObject.shortVal; } } } -void WorldEvent::setLocalFloats(MWWorld::CellStore* cellStore) +void ObjectList::setLocalFloats(MWWorld::CellStore* cellStore) { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, index: %i, floatVal: %f", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.floatVal); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i, index: %i, floatVal: %f", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.mpNum, baseObject.index, baseObject.floatVal); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); - ptrFound.getRefData().getLocals().mFloats.at(worldObject.index) = worldObject.floatVal; + ptrFound.getRefData().getLocals().mFloats.at(baseObject.index) = baseObject.floatVal; } } } -void WorldEvent::setMemberShorts() +void ObjectList::setMemberShorts() { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i", worldObject.refId.c_str(), - worldObject.index, worldObject.shortVal); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i", baseObject.refId.c_str(), + baseObject.index, baseObject.shortVal); // Mimic the way a Ptr is fetched in InterpreterContext for similar situations - MWWorld::Ptr ptrFound = MWBase::Environment::get().getWorld()->searchPtr(worldObject.refId, false); + MWWorld::Ptr ptrFound = MWBase::Environment::get().getWorld()->searchPtr(baseObject.refId, false); if (!ptrFound.isEmpty()) { @@ -712,43 +712,43 @@ void WorldEvent::setMemberShorts() ptrFound.getRefData().setLocals( *MWBase::Environment::get().getWorld()->getStore().get().find(scriptId)); - ptrFound.getRefData().getLocals().mShorts.at(worldObject.index) = worldObject.shortVal;; + ptrFound.getRefData().getLocals().mShorts.at(baseObject.index) = baseObject.shortVal;; } } } -void WorldEvent::setGlobalShorts() +void ObjectList::setGlobalShorts() { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i", worldObject.varName.c_str(), worldObject.shortVal); + LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i", baseObject.varName.c_str(), baseObject.shortVal); - MWBase::Environment::get().getWorld()->setGlobalInt(worldObject.varName, worldObject.shortVal); + MWBase::Environment::get().getWorld()->setGlobalInt(baseObject.varName, baseObject.shortVal); } } -void WorldEvent::playMusic() +void ObjectList::playMusic() { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s", worldObject.filename.c_str()); + LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s", baseObject.filename.c_str()); - MWBase::Environment::get().getSoundManager()->streamMusic(worldObject.filename); + MWBase::Environment::get().getSoundManager()->streamMusic(baseObject.filename); } } -void WorldEvent::playVideo() +void ObjectList::playVideo() { - for (const auto &worldObject : worldObjects) + for (const auto &baseObject : baseObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s, allowSkipping: %s", worldObject.filename.c_str(), - worldObject.allowSkipping ? "true" : "false"); + LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s, allowSkipping: %s", baseObject.filename.c_str(), + baseObject.allowSkipping ? "true" : "false"); - MWBase::Environment::get().getWindowManager()->playVideo(worldObject.filename, worldObject.allowSkipping); + MWBase::Environment::get().getWindowManager()->playVideo(baseObject.filename, baseObject.allowSkipping); } } -void WorldEvent::addAllContainers(MWWorld::CellStore* cellStore) +void ObjectList::addAllContainers(MWWorld::CellStore* cellStore) { for (auto &ref : cellStore->getContainers()->mList) { @@ -769,14 +769,14 @@ void WorldEvent::addAllContainers(MWWorld::CellStore* cellStore) } } -void WorldEvent::addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector& requestObjects) +void ObjectList::addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector& requestObjects) { - for (const auto &worldObject : requestObjects) + for (const auto &baseObject : requestObjects) { - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.mpNum); - MWWorld::Ptr ptrFound = cellStore->searchExact(worldObject.refNumIndex, worldObject.mpNum); + MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { @@ -788,7 +788,7 @@ void WorldEvent::addRequestedContainers(MWWorld::CellStore* cellStore, const std } } -void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer) +void ObjectList::addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer) { if (ptr.getCellRef().getRefId().find("$dynamic") != string::npos) { @@ -798,29 +798,29 @@ void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer) cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = 0; - worldObject.charge = ptr.getCellRef().getCharge(); - worldObject.enchantmentCharge = ptr.getCellRef().getEnchantmentCharge(); - worldObject.droppedByPlayer = droppedByPlayer; + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = 0; + baseObject.charge = ptr.getCellRef().getCharge(); + baseObject.enchantmentCharge = ptr.getCellRef().getEnchantmentCharge(); + baseObject.droppedByPlayer = droppedByPlayer; // Make sure we send the RefData position instead of the CellRef one, because that's what // we actually see on this client - worldObject.position = ptr.getRefData().getPosition(); + baseObject.position = ptr.getRefData().getPosition(); // We have to get the count from the dropped object because it gets changed // automatically for stacks of gold - worldObject.count = ptr.getRefData().getCount(); + baseObject.count = ptr.getRefData().getCount(); // Get the real count of gold in a stack - worldObject.goldValue = ptr.getCellRef().getGoldValue(); + baseObject.goldValue = ptr.getCellRef().getGoldValue(); - addObject(worldObject); + addObject(baseObject); } -void WorldEvent::addObjectSpawn(const MWWorld::Ptr& ptr) +void ObjectList::addObjectSpawn(const MWWorld::Ptr& ptr) { if (ptr.getCellRef().getRefId().find("$dynamic") != string::npos) { @@ -830,339 +830,339 @@ void WorldEvent::addObjectSpawn(const MWWorld::Ptr& ptr) cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = 0; - worldObject.hasMaster = false; + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = 0; + baseObject.hasMaster = false; // Make sure we send the RefData position instead of the CellRef one, because that's what // we actually see on this client - worldObject.position = ptr.getRefData().getPosition(); + baseObject.position = ptr.getRefData().getPosition(); - addObject(worldObject); + addObject(baseObject); } -void WorldEvent::addObjectSpawn(const MWWorld::Ptr& ptr, const MWWorld::Ptr& master) +void ObjectList::addObjectSpawn(const MWWorld::Ptr& ptr, const MWWorld::Ptr& master) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = 0; + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = 0; - worldObject.hasMaster = true; + baseObject.hasMaster = true; if (master == MWBase::Environment::get().getWorld()->getPlayerPtr()) { - worldObject.master.isPlayer = true; - worldObject.master.guid = mwmp::Main::get().getLocalPlayer()->guid; + baseObject.master.isPlayer = true; + baseObject.master.guid = mwmp::Main::get().getLocalPlayer()->guid; } else if (mwmp::PlayerList::isDedicatedPlayer(master)) { - worldObject.master.isPlayer = true; - worldObject.master.guid = mwmp::PlayerList::getPlayer(master)->guid; + baseObject.master.isPlayer = true; + baseObject.master.guid = mwmp::PlayerList::getPlayer(master)->guid; } else { MWWorld::CellRef *masterRef = &master.getCellRef(); - worldObject.master.isPlayer = false; - worldObject.master.refId = masterRef->getRefId(); - worldObject.master.refNumIndex = masterRef->getRefNum().mIndex; - worldObject.master.mpNum = masterRef->getMpNum(); + baseObject.master.isPlayer = false; + baseObject.master.refId = masterRef->getRefId(); + baseObject.master.refNumIndex = masterRef->getRefNum().mIndex; + baseObject.master.mpNum = masterRef->getMpNum(); } // Make sure we send the RefData position instead of the CellRef one, because that's what // we actually see on this client - worldObject.position = ptr.getRefData().getPosition(); + baseObject.position = ptr.getRefData().getPosition(); - addObject(worldObject); + addObject(baseObject); } -void WorldEvent::addObjectDelete(const MWWorld::Ptr& ptr) +void ObjectList::addObjectDelete(const MWWorld::Ptr& ptr) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + addObject(baseObject); } -void WorldEvent::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel) +void ObjectList::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.lockLevel = lockLevel; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.lockLevel = lockLevel; + addObject(baseObject); } -void WorldEvent::addObjectTrap(const MWWorld::Ptr& ptr, const ESM::Position& pos, bool isDisarmed) +void ObjectList::addObjectTrap(const MWWorld::Ptr& ptr, const ESM::Position& pos, bool isDisarmed) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.isDisarmed = isDisarmed; - worldObject.position = pos; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.isDisarmed = isDisarmed; + baseObject.position = pos; + addObject(baseObject); } -void WorldEvent::addObjectScale(const MWWorld::Ptr& ptr, float scale) +void ObjectList::addObjectScale(const MWWorld::Ptr& ptr, float scale) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.scale = scale; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.scale = scale; + addObject(baseObject); } -void WorldEvent::addObjectState(const MWWorld::Ptr& ptr, bool objectState) +void ObjectList::addObjectState(const MWWorld::Ptr& ptr, bool objectState) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.objectState = objectState; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.objectState = objectState; + addObject(baseObject); } -void WorldEvent::addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode) +void ObjectList::addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.animGroup = group; - worldObject.animMode = mode; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.animGroup = group; + baseObject.animMode = mode; + addObject(baseObject); } -void WorldEvent::addDoorState(const MWWorld::Ptr& ptr, int state) +void ObjectList::addDoorState(const MWWorld::Ptr& ptr, int state) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.doorState = state; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.doorState = state; + addObject(baseObject); } -void WorldEvent::addMusicPlay(std::string filename) +void ObjectList::addMusicPlay(std::string filename) { - mwmp::WorldObject worldObject; - worldObject.filename = filename; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.filename = filename; + addObject(baseObject); } -void WorldEvent::addVideoPlay(std::string filename, bool allowSkipping) +void ObjectList::addVideoPlay(std::string filename, bool allowSkipping) { - mwmp::WorldObject worldObject; - worldObject.filename = filename; - worldObject.allowSkipping = allowSkipping; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.filename = filename; + baseObject.allowSkipping = allowSkipping; + addObject(baseObject); } -void WorldEvent::addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal) +void ObjectList::addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.index = index; - worldObject.shortVal = shortVal; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.index = index; + baseObject.shortVal = shortVal; + addObject(baseObject); } -void WorldEvent::addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal) +void ObjectList::addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal) { cell = *ptr.getCell()->getCell(); - mwmp::WorldObject worldObject; - worldObject.refId = ptr.getCellRef().getRefId(); - worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; - worldObject.mpNum = ptr.getCellRef().getMpNum(); - worldObject.index = index; - worldObject.floatVal = floatVal; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = ptr.getCellRef().getRefId(); + baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + baseObject.mpNum = ptr.getCellRef().getMpNum(); + baseObject.index = index; + baseObject.floatVal = floatVal; + addObject(baseObject); } -void WorldEvent::addScriptMemberShort(std::string refId, int index, int shortVal) +void ObjectList::addScriptMemberShort(std::string refId, int index, int shortVal) { - mwmp::WorldObject worldObject; - worldObject.refId = refId; - worldObject.index = index; - worldObject.shortVal = shortVal; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.refId = refId; + baseObject.index = index; + baseObject.shortVal = shortVal; + addObject(baseObject); } -void WorldEvent::addScriptGlobalShort(std::string varName, int shortVal) +void ObjectList::addScriptGlobalShort(std::string varName, int shortVal) { - mwmp::WorldObject worldObject; - worldObject.varName = varName; - worldObject.shortVal = shortVal; - addObject(worldObject); + mwmp::BaseObject baseObject; + baseObject.varName = varName; + baseObject.shortVal = shortVal; + addObject(baseObject); } -void WorldEvent::sendObjectPlace() +void ObjectList::sendObjectPlace() { - if (worldObjects.size() == 0) + if (baseObjects.size() == 0) return; LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE about %s", cell.getDescription().c_str()); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, count: %i", worldObject.refId.c_str(), worldObject.count); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, count: %i", baseObject.refId.c_str(), baseObject.count); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_PLACE)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_PLACE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_PLACE)->Send(); } -void WorldEvent::sendObjectSpawn() +void ObjectList::sendObjectSpawn() { - if (worldObjects.size() == 0) + if (baseObjects.size() == 0) return; LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_SPAWN about %s", cell.getDescription().c_str()); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i", worldObject.refId.c_str(), worldObject.refNumIndex); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i", baseObject.refId.c_str(), baseObject.refNumIndex); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->Send(); } -void WorldEvent::sendObjectDelete() +void ObjectList::sendObjectDelete() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_DELETE)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_DELETE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_DELETE)->Send(); } -void WorldEvent::sendObjectLock() +void ObjectList::sendObjectLock() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_LOCK)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_LOCK)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_LOCK)->Send(); } -void WorldEvent::sendObjectTrap() +void ObjectList::sendObjectTrap() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_TRAP)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_TRAP)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_TRAP)->Send(); } -void WorldEvent::sendObjectScale() +void ObjectList::sendObjectScale() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SCALE)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SCALE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SCALE)->Send(); } -void WorldEvent::sendObjectState() +void ObjectList::sendObjectState() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_STATE)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_STATE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_STATE)->Send(); } -void WorldEvent::sendObjectAnimPlay() +void ObjectList::sendObjectAnimPlay() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_ANIM_PLAY)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_ANIM_PLAY)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_ANIM_PLAY)->Send(); } -void WorldEvent::sendDoorState() +void ObjectList::sendDoorState() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str()); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s", worldObject.refId.c_str(), worldObject.refNumIndex, - worldObject.doorState ? "true" : "false"); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s", baseObject.refId.c_str(), baseObject.refNumIndex, + baseObject.doorState ? "true" : "false"); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_DOOR_STATE)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_DOOR_STATE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_DOOR_STATE)->Send(); } -void WorldEvent::sendMusicPlay() +void ObjectList::sendMusicPlay() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_MUSIC_PLAY)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_MUSIC_PLAY)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_MUSIC_PLAY)->Send(); } -void WorldEvent::sendVideoPlay() +void ObjectList::sendVideoPlay() { - mwmp::Main::get().getNetworking()->getObjectPacket(ID_VIDEO_PLAY)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_VIDEO_PLAY)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_VIDEO_PLAY)->Send(); } -void WorldEvent::sendScriptLocalShort() +void ObjectList::sendScriptLocalShort() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT about %s", cell.getDescription().c_str()); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.index, worldObject.shortVal); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.index, baseObject.shortVal); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->Send(); } -void WorldEvent::sendScriptLocalFloat() +void ObjectList::sendScriptLocalFloat() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT about %s", cell.getDescription().c_str()); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f", worldObject.refId.c_str(), - worldObject.refNumIndex, worldObject.index, worldObject.floatVal); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f", baseObject.refId.c_str(), + baseObject.refNumIndex, baseObject.index, baseObject.floatVal); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(); } -void WorldEvent::sendScriptMemberShort() +void ObjectList::sendScriptMemberShort() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT"); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i", worldObject.refId.c_str(), - worldObject.index, worldObject.shortVal); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i", baseObject.refId.c_str(), + baseObject.index, baseObject.shortVal); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_MEMBER_SHORT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_MEMBER_SHORT)->Send(); } -void WorldEvent::sendScriptGlobalShort() +void ObjectList::sendScriptGlobalShort() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT"); - for (const auto &worldObject : worldObjects) - LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i", worldObject.varName.c_str(), worldObject.shortVal); + for (const auto &baseObject : baseObjects) + LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i", baseObject.varName.c_str(), baseObject.shortVal); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_GLOBAL_SHORT)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_GLOBAL_SHORT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_GLOBAL_SHORT)->Send(); } -void WorldEvent::sendContainer() +void ObjectList::sendContainer() { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_CONTAINER"); - mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setEvent(this); + mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); } diff --git a/apps/openmw/mwmp/WorldEvent.hpp b/apps/openmw/mwmp/ObjectList.hpp similarity index 88% rename from apps/openmw/mwmp/WorldEvent.hpp rename to apps/openmw/mwmp/ObjectList.hpp index a8e15313c..29fcc65b7 100644 --- a/apps/openmw/mwmp/WorldEvent.hpp +++ b/apps/openmw/mwmp/ObjectList.hpp @@ -1,25 +1,25 @@ #ifndef OPENMW_WORLDEVENT_HPP #define OPENMW_WORLDEVENT_HPP -#include +#include #include "../mwworld/cellstore.hpp" #include namespace mwmp { class Networking; - class WorldEvent : public BaseEvent + class ObjectList : public BaseObjectList { public: - WorldEvent(); - virtual ~WorldEvent(); + ObjectList(); + virtual ~ObjectList(); void reset(); - void addObject(WorldObject worldObject); - WorldObject getWorldObject(const MWWorld::Ptr& ptr); - void addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount); + void addObject(BaseObject baseObject); + BaseObject getBaseObject(const MWWorld::Ptr& ptr); + void addContainerItem(mwmp::BaseObject& baseObject, const MWWorld::Ptr& itemPtr, int actionCount); void addEntireContainer(const MWWorld::Ptr& ptr); void editContainers(MWWorld::CellStore* cellStore); @@ -47,7 +47,7 @@ namespace mwmp void playVideo(); void addAllContainers(MWWorld::CellStore* cellStore); - void addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector& requestObjects); + void addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector& requestObjects); void addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer = false); void addObjectSpawn(const MWWorld::Ptr& ptr); diff --git a/apps/openmw/mwmp/processors/ActorProcessor.hpp b/apps/openmw/mwmp/processors/ActorProcessor.hpp index a63e4d9eb..4e94c5128 100644 --- a/apps/openmw/mwmp/processors/ActorProcessor.hpp +++ b/apps/openmw/mwmp/processors/ActorProcessor.hpp @@ -8,7 +8,7 @@ #include #include #include -#include "../WorldEvent.hpp" +#include "../ObjectList.hpp" #include "../ActorList.hpp" #include "BaseClientPacketProcessor.hpp" diff --git a/apps/openmw/mwmp/processors/WorldProcessor.cpp b/apps/openmw/mwmp/processors/WorldProcessor.cpp index b21292649..d951c02d9 100644 --- a/apps/openmw/mwmp/processors/WorldProcessor.cpp +++ b/apps/openmw/mwmp/processors/WorldProcessor.cpp @@ -1,7 +1,3 @@ -// -// Created by koncord on 16.04.17. -// - #include "WorldProcessor.hpp" #include "../Main.hpp" #include "../Networking.hpp" @@ -11,15 +7,15 @@ using namespace mwmp; template typename BasePacketProcessor::processors_t BasePacketProcessor::processors; -bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event) +bool WorldProcessor::Process(RakNet::Packet &packet, ObjectList &objectList) { RakNet::BitStream bsIn(&packet.data[1], packet.length, false); bsIn.Read(guid); - event.guid = guid; + objectList.guid = guid; ObjectPacket *myPacket = Main::get().getNetworking()->getObjectPacket(packet.data[0]); - myPacket->setEvent(&event); + myPacket->setObjectList(&objectList); myPacket->SetReadStream(&bsIn); for (auto &processor: processors) @@ -29,13 +25,13 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event) myGuid = Main::get().getLocalPlayer()->guid; request = packet.length == myPacket->headerSize(); - event.isValid = true; + objectList.isValid = true; if (!request && !processor.second->avoidReading) myPacket->Read(); - if (event.isValid) - processor.second->Do(*myPacket, event); + if (objectList.isValid) + processor.second->Do(*myPacket, objectList); else LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); diff --git a/apps/openmw/mwmp/processors/WorldProcessor.hpp b/apps/openmw/mwmp/processors/WorldProcessor.hpp index 776db3da8..1aa39b2ae 100644 --- a/apps/openmw/mwmp/processors/WorldProcessor.hpp +++ b/apps/openmw/mwmp/processors/WorldProcessor.hpp @@ -8,7 +8,7 @@ #include #include #include -#include "../WorldEvent.hpp" +#include "../ObjectList.hpp" #include "../LocalPlayer.hpp" #include "../DedicatedPlayer.hpp" #include "BaseClientPacketProcessor.hpp" @@ -18,9 +18,9 @@ namespace mwmp class WorldProcessor : public BasePacketProcessor, public BaseClientPacketProcessor { public: - virtual void Do(ObjectPacket &packet, WorldEvent &event) = 0; + virtual void Do(ObjectPacket &packet, ObjectList &objectList) = 0; - static bool Process(RakNet::Packet &packet, WorldEvent &event); + static bool Process(RakNet::Packet &packet, ObjectList &objectList); }; } diff --git a/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp b/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp index 4b016b1a0..4780f0657 100644 --- a/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp +++ b/apps/openmw/mwmp/processors/world/BaseObjectProcessor.hpp @@ -15,13 +15,13 @@ namespace mwmp class BaseObjectProcessor : public WorldProcessor { public: - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - ptrCellStore = Main::get().getCellController()->getCellStore(event.cell); + ptrCellStore = Main::get().getCellController()->getCellStore(objectList.cell); if (!ptrCellStore) return; - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), event.cell.getDescription().c_str()); + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), objectList.cell.getDescription().c_str()); } protected: MWWorld::CellStore *ptrCellStore; diff --git a/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp b/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp index 6c838b9d8..d2162b404 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_CONSOLE_COMMAND) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.runConsoleCommands(ptrCellStore); + objectList.runConsoleCommands(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorContainer.hpp b/apps/openmw/mwmp/processors/world/ProcessorContainer.hpp index 31dc239e5..f5aee6947 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorContainer.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorContainer.hpp @@ -13,43 +13,43 @@ namespace mwmp BPP_INIT(ID_CONTAINER) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - LOG_APPEND(Log::LOG_VERBOSE, "- action: %i, containerSubAction: %i", event.action, event.containerSubAction); + LOG_APPEND(Log::LOG_VERBOSE, "- action: %i, containerSubAction: %i", objectList.action, objectList.containerSubAction); // If we've received a request for information, comply with it - if (event.action == mwmp::BaseEvent::REQUEST) + if (objectList.action == mwmp::BaseObjectList::REQUEST) { - if (event.worldObjectCount == 0) + if (objectList.baseObjectCount == 0) { LOG_APPEND(Log::LOG_VERBOSE, "- Request had no objects attached, so we are sending all containers in the cell %s", - event.cell.getDescription().c_str()); - event.reset(); - event.cell = *ptrCellStore->getCell(); - event.action = mwmp::BaseEvent::SET; - event.addAllContainers(ptrCellStore); - event.sendContainer(); + objectList.cell.getDescription().c_str()); + objectList.reset(); + objectList.cell = *ptrCellStore->getCell(); + objectList.action = mwmp::BaseObjectList::SET; + objectList.addAllContainers(ptrCellStore); + objectList.sendContainer(); } else { - LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", event.worldObjectCount, event.worldObjectCount == 1 ? "object" : "objects"); - std::vector requestObjects = event.worldObjects; - event.reset(); - event.cell = *ptrCellStore->getCell(); - event.action = mwmp::BaseEvent::SET; - event.addRequestedContainers(ptrCellStore, requestObjects); + LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", objectList.baseObjectCount, objectList.baseObjectCount == 1 ? "object" : "objects"); + std::vector requestObjects = objectList.baseObjects; + objectList.reset(); + objectList.cell = *ptrCellStore->getCell(); + objectList.action = mwmp::BaseObjectList::SET; + objectList.addRequestedContainers(ptrCellStore, requestObjects); - if (event.worldObjects.size() > 0) - event.sendContainer(); + if (objectList.baseObjects.size() > 0) + objectList.sendContainer(); } } // Otherwise, edit containers based on the information received else { - LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet", event.worldObjectCount); - event.editContainers(ptrCellStore); + LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet", objectList.baseObjectCount); + objectList.editContainers(ptrCellStore); } } diff --git a/apps/openmw/mwmp/processors/world/ProcessorDoorDestination.hpp b/apps/openmw/mwmp/processors/world/ProcessorDoorDestination.hpp index baf1c3c5a..12953c9d0 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorDoorDestination.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorDoorDestination.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_DOOR_DESTINATION) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.setDoorDestinations(ptrCellStore); + objectList.setDoorDestinations(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorDoorState.hpp b/apps/openmw/mwmp/processors/world/ProcessorDoorState.hpp index 12b4993bd..21422da00 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorDoorState.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorDoorState.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_DOOR_STATE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.activateDoors(ptrCellStore); + objectList.activateDoors(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorMusicPlay.hpp b/apps/openmw/mwmp/processors/world/ProcessorMusicPlay.hpp index 8f237d6c9..5cf6172b0 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorMusicPlay.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorMusicPlay.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_MUSIC_PLAY) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - event.playMusic(); + objectList.playMusic(); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectAnimPlay.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectAnimPlay.hpp index a595a3862..2d596d9b1 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectAnimPlay.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectAnimPlay.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_ANIM_PLAY) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.animateObjects(ptrCellStore); + objectList.animateObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp index 95d8a0e7b..4fb1cf593 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectAttach.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_ATTACH) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - //event.attachObjects(ptrCellStore); + //objectList.attachObjects(ptrCellStore); } }; diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp index d8f69cbab..981b0b76f 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectCollision.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_COLLISION) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - //event.setObjectCollisions(ptrCellStore); + //objectList.setObjectCollisions(ptrCellStore); } }; diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectDelete.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectDelete.hpp index 65a8d51d6..2013ff143 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectDelete.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectDelete.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_DELETE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.deleteObjects(ptrCellStore); + objectList.deleteObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectLock.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectLock.hpp index bb2614708..c39293433 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectLock.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectLock.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_LOCK) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.lockObjects(ptrCellStore); + objectList.lockObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectMove.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectMove.hpp index baa9179fc..e45c415a0 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectMove.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectMove.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_MOVE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.moveObjects(ptrCellStore); + objectList.moveObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectPlace.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectPlace.hpp index 5ee9d41f1..805208e6a 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectPlace.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectPlace.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_PLACE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.placeObjects(ptrCellStore); + objectList.placeObjects(ptrCellStore); } }; diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectReset.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectReset.hpp index 385e6b79c..8fa943af3 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectReset.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectReset.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_RESET) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - //event.resetObjects(ptrCellStore); + //objectList.resetObjects(ptrCellStore); } }; diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectRotate.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectRotate.hpp index 6528d5b05..48f5df284 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectRotate.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectRotate.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_ROTATE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.rotateObjects(ptrCellStore); + objectList.rotateObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectScale.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectScale.hpp index 65d3559a1..49deaf110 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectScale.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectScale.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_SCALE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.scaleObjects(ptrCellStore); + objectList.scaleObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectSpawn.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectSpawn.hpp index 53fce90ca..bc0dc8c6c 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectSpawn.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectSpawn.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_SPAWN) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.spawnObjects(ptrCellStore); + objectList.spawnObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp index b2e7e0b2f..337097e67 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_STATE) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.setObjectStates(ptrCellStore); + objectList.setObjectStates(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectTrap.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectTrap.hpp index ff79e140e..4c7baa95e 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorObjectTrap.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectTrap.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_OBJECT_TRAP) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.triggerTrapObjects(ptrCellStore); + objectList.triggerTrapObjects(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalFloat.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalFloat.hpp index 010b0d2e8..f26b9bc07 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalFloat.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalFloat.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_SCRIPT_GLOBAL_FLOAT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - //event.setGlobalFloats(); + //objectList.setGlobalFloats(); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalShort.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalShort.hpp index 3c80157c6..22e8dab02 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalShort.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptGlobalShort.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_SCRIPT_GLOBAL_SHORT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - event.setGlobalShorts(); + objectList.setGlobalShorts(); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptLocalFloat.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptLocalFloat.hpp index e03ee122d..1290d1a7a 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptLocalFloat.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptLocalFloat.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_SCRIPT_LOCAL_FLOAT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.setLocalFloats(ptrCellStore); + objectList.setLocalFloats(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptLocalShort.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptLocalShort.hpp index 4e97b9252..c7c65e196 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptLocalShort.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptLocalShort.hpp @@ -13,11 +13,11 @@ namespace mwmp BPP_INIT(ID_SCRIPT_LOCAL_SHORT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { - BaseObjectProcessor::Do(packet, event); + BaseObjectProcessor::Do(packet, objectList); - event.setLocalShorts(ptrCellStore); + objectList.setLocalShorts(ptrCellStore); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptMemberFloat.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptMemberFloat.hpp index 150377cc7..2ac2f8c0b 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptMemberFloat.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptMemberFloat.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_SCRIPT_MEMBER_FLOAT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - //event.setMemberFloats(); + //objectList.setMemberFloats(); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorScriptMemberShort.hpp b/apps/openmw/mwmp/processors/world/ProcessorScriptMemberShort.hpp index e7ee13e27..d6d698339 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorScriptMemberShort.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorScriptMemberShort.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_SCRIPT_MEMBER_SHORT) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - event.setMemberShorts(); + objectList.setMemberShorts(); } }; } diff --git a/apps/openmw/mwmp/processors/world/ProcessorVideoPlay.hpp b/apps/openmw/mwmp/processors/world/ProcessorVideoPlay.hpp index 429ad0d0b..07e0c7ac7 100644 --- a/apps/openmw/mwmp/processors/world/ProcessorVideoPlay.hpp +++ b/apps/openmw/mwmp/processors/world/ProcessorVideoPlay.hpp @@ -13,10 +13,10 @@ namespace mwmp BPP_INIT(ID_VIDEO_PLAY) } - virtual void Do(ObjectPacket &packet, WorldEvent &event) + virtual void Do(ObjectPacket &packet, ObjectList &objectList) { LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); - event.playVideo(); + objectList.playVideo(); } }; } diff --git a/apps/openmw/mwscript/animationextensions.cpp b/apps/openmw/mwscript/animationextensions.cpp index 93eae86e9..bf7dd9957 100644 --- a/apps/openmw/mwscript/animationextensions.cpp +++ b/apps/openmw/mwscript/animationextensions.cpp @@ -10,7 +10,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -82,10 +82,10 @@ namespace MWScript */ if (mwmp::Main::isValidPacketScript(ptr.getClass().getScript(ptr))) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectAnimPlay(ptr, group, mode); - worldEvent->sendObjectAnimPlay(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectAnimPlay(ptr, group, mode); + objectList->sendObjectAnimPlay(); } /* End of tes3mp addition diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 0a6b942c2..9a810e0e3 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -19,7 +19,7 @@ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -211,10 +211,10 @@ namespace MWScript */ if (sendPackets) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addScriptLocalShort(mReference, index, value); - worldEvent->sendScriptLocalShort(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addScriptLocalShort(mReference, index, value); + objectList->sendScriptLocalShort(); } /* End of tes3mp addition @@ -245,10 +245,10 @@ namespace MWScript */ if (sendPackets && value == (int) value) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addScriptLocalFloat(mReference, index, value); - worldEvent->sendScriptLocalFloat(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addScriptLocalFloat(mReference, index, value); + objectList->sendScriptLocalFloat(); } /* End of tes3mp addition @@ -304,10 +304,10 @@ namespace MWScript */ if (sendPackets) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addScriptGlobalShort(name, value); - worldEvent->sendScriptGlobalShort(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addScriptGlobalShort(name, value); + objectList->sendScriptGlobalShort(); } /* End of tes3mp addition @@ -594,10 +594,10 @@ namespace MWScript { if (ref.isInCell() && !ref.getRefData().isEnabled()) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectState(ref, true); - worldEvent->sendObjectState(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectState(ref, true); + objectList->sendObjectState(); } } /* @@ -622,10 +622,10 @@ namespace MWScript { if (ref.isInCell() && ref.getRefData().isEnabled()) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectState(ref, false); - worldEvent->sendObjectState(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectState(ref, false); + objectList->sendObjectState(); } } /* @@ -685,10 +685,10 @@ namespace MWScript */ if (sendPackets && !global) { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addScriptMemberShort(id, index, value); - worldEvent->sendScriptMemberShort(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addScriptMemberShort(id, index, value); + objectList->sendScriptMemberShort(); } /* End of tes3mp addition diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 42c50542a..382f6012e 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -9,7 +9,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -103,10 +103,10 @@ namespace MWScript Send an ID_VIDEO_PLAY packet every time a video is played through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addVideoPlay(name, allowSkipping); - worldEvent->sendVideoPlay(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addVideoPlay(name, allowSkipping); + objectList->sendVideoPlay(); /* End of tes3mp addition */ @@ -213,10 +213,10 @@ namespace MWScript Send an ID_OBJECT_LOCK packet every time an object is locked through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(ptr, lockLevel); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(ptr, lockLevel); + objectList->sendObjectLock(); /* End of tes3mp addition */ @@ -253,10 +253,10 @@ namespace MWScript Send an ID_OBJECT_LOCK packet every time an object is unlocked through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectLock(ptr, 0); - worldEvent->sendObjectLock(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectLock(ptr, 0); + objectList->sendObjectLock(); /* End of tes3mp addition */ @@ -733,10 +733,10 @@ namespace MWScript Send an ID_OBJECT_DELETE packet every time an object is deleted through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(ptr); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(ptr); + objectList->sendObjectDelete(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index c66944837..47016fdb0 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -87,10 +87,10 @@ namespace MWScript Send an ID_MUSIC_PLAY packet every time new music is streamed through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addMusicPlay(sound); - worldEvent->sendMusicPlay(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addMusicPlay(sound); + objectList->sendMusicPlay(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 933331de6..88a28a21c 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -10,7 +10,7 @@ #include "../mwmp/Networking.hpp" #include "../mwmp/LocalPlayer.hpp" #include "../mwmp/PlayerList.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -74,10 +74,10 @@ namespace MWScript return; else { - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectScale(ptr, scale); - worldEvent->sendObjectScale(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectScale(ptr, scale); + objectList->sendObjectScale(); } } /* @@ -582,18 +582,18 @@ namespace MWScript Send an ID_OBJECT_PLACE or ID_OBJECT_SPAWN packet every time an object is placed in the world through a script */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); if (ptr.getClass().isActor()) { - worldEvent->addObjectSpawn(ptr); - worldEvent->sendObjectSpawn(); + objectList->addObjectSpawn(ptr); + objectList->sendObjectSpawn(); } else { - worldEvent->addObjectPlace(ptr); - worldEvent->sendObjectPlace(); + objectList->addObjectPlace(ptr); + objectList->sendObjectPlace(); } /* End of tes3mp addition diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index c9c83e8b9..c8742aa7b 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/LocalPlayer.hpp" /* End of tes3mp addition @@ -40,10 +40,10 @@ namespace MWWorld Send an ID_PLAYER_INVENTORY packet as well because of the item thus gained by the player */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectDelete(getTarget()); - worldEvent->sendObjectDelete(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectDelete(getTarget()); + objectList->sendObjectDelete(); mwmp::Main::get().getLocalPlayer()->sendInventory(); /* End of tes3mp addition diff --git a/apps/openmw/mwworld/actiontrap.cpp b/apps/openmw/mwworld/actiontrap.cpp index ad07b0715..3facae94a 100644 --- a/apps/openmw/mwworld/actiontrap.cpp +++ b/apps/openmw/mwworld/actiontrap.cpp @@ -7,7 +7,7 @@ */ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" /* End of tes3mp addition */ @@ -48,8 +48,8 @@ namespace MWWorld Send an ID_OBJECT_TRAP packet every time a trap is triggered */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); ESM::Position pos; @@ -58,8 +58,8 @@ namespace MWWorld else pos = actor.getRefData().getPosition(); - worldEvent->addObjectTrap(mTrapSource, pos, false); - worldEvent->sendObjectTrap(); + objectList->addObjectTrap(mTrapSource, pos, false); + objectList->sendObjectTrap(); /* End of tes3mp addition */ diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index df9fe175c..aaf3e6147 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -17,7 +17,7 @@ #include "../mwmp/DedicatedPlayer.hpp" #include "../mwmp/LocalActor.hpp" #include "../mwmp/DedicatedActor.hpp" -#include "../mwmp/WorldEvent.hpp" +#include "../mwmp/ObjectList.hpp" #include "../mwmp/CellController.hpp" /* End of tes3mp addition @@ -2421,10 +2421,10 @@ namespace MWWorld Send an ID_DOOR_STATE packet every time a door is activated */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addDoorState(door, state); - worldEvent->sendDoorState(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addDoorState(door, state); + objectList->sendDoorState(); /* End of tes3mp addition */ @@ -2440,10 +2440,10 @@ namespace MWWorld Send an ID_DOOR_STATE packet every time a door is activated */ - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addDoorState(door, state); - worldEvent->sendDoorState(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addDoorState(door, state); + objectList->sendDoorState(); /* End of tes3mp addition */ @@ -3484,10 +3484,10 @@ namespace MWWorld */ MWWorld::Ptr ptr = safePlaceObject(ref.getPtr(), getPlayerPtr(), getPlayerPtr().getCell(), 0, 220.f); - mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); - worldEvent->reset(); - worldEvent->addObjectSpawn(ptr); - worldEvent->sendObjectSpawn(); + mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList(); + objectList->reset(); + objectList->addObjectSpawn(ptr); + objectList->sendObjectSpawn(); deleteObject(ptr); /* diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 55409a7cf..2eb4b5e5d 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -150,7 +150,7 @@ add_component_dir (openmw-mp ) add_component_dir (openmw-mp/Base - BaseActor BaseEvent BasePacketProcessor BasePlayer BaseStructs + BaseActor BaseObjectList BasePacketProcessor BasePlayer BaseStructs ) add_component_dir (openmw-mp/Controllers diff --git a/components/openmw-mp/Base/BaseEvent.hpp b/components/openmw-mp/Base/BaseObject.hpp similarity index 87% rename from components/openmw-mp/Base/BaseEvent.hpp rename to components/openmw-mp/Base/BaseObject.hpp index 6229b94cc..295a80c90 100644 --- a/components/openmw-mp/Base/BaseEvent.hpp +++ b/components/openmw-mp/Base/BaseObject.hpp @@ -22,7 +22,7 @@ namespace mwmp } }; - struct WorldObject + struct BaseObject { std::string refId; int refNumIndex; @@ -63,20 +63,20 @@ namespace mwmp std::vector containerItems; unsigned int containerItemCount; - RakNet::RakNetGUID guid; // only for events that can also affect players + RakNet::RakNetGUID guid; // only for object lists that can also include players bool isPlayer; }; - class BaseEvent + class BaseObjectList { public: - BaseEvent(RakNet::RakNetGUID guid) : guid(guid) + BaseObjectList(RakNet::RakNetGUID guid) : guid(guid) { } - BaseEvent() + BaseObjectList() { } @@ -99,8 +99,8 @@ namespace mwmp RakNet::RakNetGUID guid; - std::vector worldObjects; - unsigned int worldObjectCount; + std::vector baseObjects; + unsigned int baseObjectCount; ESM::Cell cell; std::string consoleCommand; diff --git a/components/openmw-mp/Packets/Object/ObjectPacket.cpp b/components/openmw-mp/Packets/Object/ObjectPacket.cpp index 563cc7a71..87cc30bf7 100644 --- a/components/openmw-mp/Packets/Object/ObjectPacket.cpp +++ b/components/openmw-mp/Packets/Object/ObjectPacket.cpp @@ -20,10 +20,10 @@ ObjectPacket::~ObjectPacket() } -void ObjectPacket::setEvent(BaseEvent *event) +void ObjectPacket::setObjectList(BaseObjectList *objectList) { - this->event = event; - guid = event->guid; + this->objectList = objectList; + guid = objectList->guid; } void ObjectPacket::Packet(RakNet::BitStream *bs, bool send) @@ -31,16 +31,16 @@ void ObjectPacket::Packet(RakNet::BitStream *bs, bool send) if (!PacketHeader(bs, send)) return; - WorldObject worldObject; - for (unsigned int i = 0; i < event->worldObjectCount; i++) + BaseObject baseObject; + for (unsigned int i = 0; i < objectList->baseObjectCount; i++) { if (send) - worldObject = event->worldObjects.at(i); + baseObject = objectList->baseObjects.at(i); - Object(worldObject, send); + Object(baseObject, send); if (!send) - event->worldObjects.push_back(worldObject); + objectList->baseObjects.push_back(baseObject); } } @@ -49,30 +49,30 @@ bool ObjectPacket::PacketHeader(RakNet::BitStream *bs, bool send) BasePacket::Packet(bs, send); if (send) - event->worldObjectCount = (unsigned int)(event->worldObjects.size()); + objectList->baseObjectCount = (unsigned int)(objectList->baseObjects.size()); else - event->worldObjects.clear(); + objectList->baseObjects.clear(); - RW(event->worldObjectCount, send); + RW(objectList->baseObjectCount, send); - if (event->worldObjectCount > maxObjects) + if (objectList->baseObjectCount > maxObjects) { - event->isValid = false; + objectList->isValid = false; return false; } if (hasCellData) { - RW(event->cell.mData, send, 1); - RW(event->cell.mName, send, 1); + RW(objectList->cell.mData, send, 1); + RW(objectList->cell.mName, send, 1); } return true; } -void ObjectPacket::Object(WorldObject &worldObject, bool send) +void ObjectPacket::Object(BaseObject &baseObject, bool send) { - RW(worldObject.refId, send); - RW(worldObject.refNumIndex, send); - RW(worldObject.mpNum, send); + RW(baseObject.refId, send); + RW(baseObject.refNumIndex, send); + RW(baseObject.mpNum, send); } diff --git a/components/openmw-mp/Packets/Object/ObjectPacket.hpp b/components/openmw-mp/Packets/Object/ObjectPacket.hpp index 9c1cf40dd..226b961ea 100644 --- a/components/openmw-mp/Packets/Object/ObjectPacket.hpp +++ b/components/openmw-mp/Packets/Object/ObjectPacket.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include @@ -19,14 +19,14 @@ namespace mwmp ~ObjectPacket(); - void setEvent(BaseEvent *event); + void setObjectList(BaseObjectList *objectList); virtual void Packet(RakNet::BitStream *bs, bool send); protected: - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); bool PacketHeader(RakNet::BitStream *bs, bool send); - BaseEvent *event; + BaseObjectList *objectList; static const int maxObjects = 3000; bool hasCellData; }; diff --git a/components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp b/components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp index 33e7ab535..3da66461a 100644 --- a/components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp +++ b/components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp @@ -13,22 +13,22 @@ void PacketConsoleCommand::Packet(RakNet::BitStream *bs, bool send) if (!PacketHeader(bs, send)) return; - RW(event->consoleCommand, send); + RW(objectList->consoleCommand, send); - WorldObject worldObject; - for (unsigned int i = 0; i < event->worldObjectCount; i++) + BaseObject baseObject; + for (unsigned int i = 0; i < objectList->baseObjectCount; i++) { if (send) - worldObject = event->worldObjects.at(i); + baseObject = objectList->baseObjects.at(i); - RW(worldObject.isPlayer, send); + RW(baseObject.isPlayer, send); - if (worldObject.isPlayer) - RW(worldObject.guid, send); + if (baseObject.isPlayer) + RW(baseObject.guid, send); else - Object(worldObject, send); + Object(baseObject, send); if (!send) - event->worldObjects.push_back(worldObject); + objectList->baseObjects.push_back(baseObject); } } diff --git a/components/openmw-mp/Packets/Object/PacketContainer.cpp b/components/openmw-mp/Packets/Object/PacketContainer.cpp index a33df6f75..e01802cfb 100644 --- a/components/openmw-mp/Packets/Object/PacketContainer.cpp +++ b/components/openmw-mp/Packets/Object/PacketContainer.cpp @@ -15,36 +15,36 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send) if (!PacketHeader(bs, send)) return; - RW(event->action, send); - RW(event->containerSubAction, send); + RW(objectList->action, send); + RW(objectList->containerSubAction, send); - WorldObject worldObject; - for (unsigned int i = 0; i < event->worldObjectCount; i++) + BaseObject baseObject; + for (unsigned int i = 0; i < objectList->baseObjectCount; i++) { if (send) { - worldObject = event->worldObjects.at(i); - worldObject.containerItemCount = (unsigned int) (worldObject.containerItems.size()); + baseObject = objectList->baseObjects.at(i); + baseObject.containerItemCount = (unsigned int) (baseObject.containerItems.size()); } else - worldObject.containerItems.clear(); + baseObject.containerItems.clear(); - Object(worldObject, send); + Object(baseObject, send); - RW(worldObject.containerItemCount, send); + RW(baseObject.containerItemCount, send); - if (worldObject.containerItemCount > maxObjects || worldObject.refId.empty() || (worldObject.refNumIndex != 0 && worldObject.mpNum != 0)) + if (baseObject.containerItemCount > maxObjects || baseObject.refId.empty() || (baseObject.refNumIndex != 0 && baseObject.mpNum != 0)) { - event->isValid = false; + objectList->isValid = false; return; } ContainerItem containerItem; - for (unsigned int j = 0; j < worldObject.containerItemCount; j++) + for (unsigned int j = 0; j < baseObject.containerItemCount; j++) { if (send) - containerItem = worldObject.containerItems.at(j); + containerItem = baseObject.containerItems.at(j); RW(containerItem.refId, send); RW(containerItem.count, send); @@ -53,9 +53,9 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send) RW(containerItem.actionCount, send); if (!send) - worldObject.containerItems.push_back(containerItem); + baseObject.containerItems.push_back(containerItem); } if (!send) - event->worldObjects.push_back(worldObject); + objectList->baseObjects.push_back(baseObject); } } diff --git a/components/openmw-mp/Packets/Object/PacketDoorDestination.cpp b/components/openmw-mp/Packets/Object/PacketDoorDestination.cpp index 45717075b..5a2c9d43e 100644 --- a/components/openmw-mp/Packets/Object/PacketDoorDestination.cpp +++ b/components/openmw-mp/Packets/Object/PacketDoorDestination.cpp @@ -9,19 +9,19 @@ PacketDoorDestination::PacketDoorDestination(RakNet::RakPeerInterface *peer) : O hasCellData = true; } -void PacketDoorDestination::Object(WorldObject &worldObject, bool send) +void PacketDoorDestination::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); + ObjectPacket::Object(baseObject, send); - RW(worldObject.teleportState, send); + RW(baseObject.teleportState, send); - if (worldObject.teleportState) + if (baseObject.teleportState) { - RW(worldObject.destinationCell.mData, send, 1); - RW(worldObject.destinationCell.mName, send, 1); + RW(baseObject.destinationCell.mData, send, 1); + RW(baseObject.destinationCell.mName, send, 1); - RW(worldObject.destinationPosition.pos, send, 1); - RW(worldObject.destinationPosition.rot[0], send, 1); - RW(worldObject.destinationPosition.rot[2], send, 1); + RW(baseObject.destinationPosition.pos, send, 1); + RW(baseObject.destinationPosition.rot[0], send, 1); + RW(baseObject.destinationPosition.rot[2], send, 1); } } diff --git a/components/openmw-mp/Packets/Object/PacketDoorDestination.hpp b/components/openmw-mp/Packets/Object/PacketDoorDestination.hpp index 64d23cfae..079409d3f 100644 --- a/components/openmw-mp/Packets/Object/PacketDoorDestination.hpp +++ b/components/openmw-mp/Packets/Object/PacketDoorDestination.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketDoorDestination(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketDoorState.cpp b/components/openmw-mp/Packets/Object/PacketDoorState.cpp index 51bc92c6a..483b499d9 100644 --- a/components/openmw-mp/Packets/Object/PacketDoorState.cpp +++ b/components/openmw-mp/Packets/Object/PacketDoorState.cpp @@ -9,8 +9,8 @@ PacketDoorState::PacketDoorState(RakNet::RakPeerInterface *peer) : ObjectPacket( hasCellData = true; } -void PacketDoorState::Object(WorldObject &worldObject, bool send) +void PacketDoorState::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.doorState, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.doorState, send); } diff --git a/components/openmw-mp/Packets/Object/PacketDoorState.hpp b/components/openmw-mp/Packets/Object/PacketDoorState.hpp index 11f0e7bd9..ce5bf52ae 100644 --- a/components/openmw-mp/Packets/Object/PacketDoorState.hpp +++ b/components/openmw-mp/Packets/Object/PacketDoorState.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketDoorState(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketMusicPlay.cpp b/components/openmw-mp/Packets/Object/PacketMusicPlay.cpp index 3c5263697..2f5c0fc97 100644 --- a/components/openmw-mp/Packets/Object/PacketMusicPlay.cpp +++ b/components/openmw-mp/Packets/Object/PacketMusicPlay.cpp @@ -8,7 +8,7 @@ PacketMusicPlay::PacketMusicPlay(RakNet::RakPeerInterface *peer) : ObjectPacket( packetID = ID_MUSIC_PLAY; } -void PacketMusicPlay::Object(WorldObject &worldObject, bool send) +void PacketMusicPlay::Object(BaseObject &baseObject, bool send) { - RW(worldObject.filename, send); + RW(baseObject.filename, send); } diff --git a/components/openmw-mp/Packets/Object/PacketMusicPlay.hpp b/components/openmw-mp/Packets/Object/PacketMusicPlay.hpp index cd465ffdc..cd445a9ff 100644 --- a/components/openmw-mp/Packets/Object/PacketMusicPlay.hpp +++ b/components/openmw-mp/Packets/Object/PacketMusicPlay.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketMusicPlay(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.cpp b/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.cpp index 5d641d940..7786416cc 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.cpp @@ -9,9 +9,9 @@ PacketObjectAnimPlay::PacketObjectAnimPlay(RakNet::RakPeerInterface *peer) : Obj hasCellData = true; } -void PacketObjectAnimPlay::Object(WorldObject &worldObject, bool send) +void PacketObjectAnimPlay::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.animGroup, send); - RW(worldObject.animMode, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.animGroup, send); + RW(baseObject.animMode, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp b/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp index c7e4d4e6c..42cb39401 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectAnimPlay(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectAttach.cpp b/components/openmw-mp/Packets/Object/PacketObjectAttach.cpp index b96a4cf8f..6ec6b7b22 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectAttach.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectAttach.cpp @@ -9,8 +9,8 @@ PacketObjectAttach::PacketObjectAttach(RakNet::RakPeerInterface *peer) : ObjectP hasCellData = true; } -void PacketObjectAttach::Object(WorldObject &worldObject, bool send) +void PacketObjectAttach::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); + ObjectPacket::Object(baseObject, send); // Placeholder } diff --git a/components/openmw-mp/Packets/Object/PacketObjectAttach.hpp b/components/openmw-mp/Packets/Object/PacketObjectAttach.hpp index 680dc57f7..e03a331f0 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectAttach.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectAttach.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectAttach(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectCollision.cpp b/components/openmw-mp/Packets/Object/PacketObjectCollision.cpp index 50d72e298..fbf1e339d 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectCollision.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectCollision.cpp @@ -9,8 +9,8 @@ PacketObjectCollision::PacketObjectCollision(RakNet::RakPeerInterface *peer) : O hasCellData = true; } -void PacketObjectCollision::Object(WorldObject &worldObject, bool send) +void PacketObjectCollision::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); + ObjectPacket::Object(baseObject, send); // Placeholder } diff --git a/components/openmw-mp/Packets/Object/PacketObjectCollision.hpp b/components/openmw-mp/Packets/Object/PacketObjectCollision.hpp index 74bd1a085..ddaca261e 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectCollision.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectCollision.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectCollision(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectLock.cpp b/components/openmw-mp/Packets/Object/PacketObjectLock.cpp index 9daf1d098..1880db92d 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectLock.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectLock.cpp @@ -9,8 +9,8 @@ PacketObjectLock::PacketObjectLock(RakNet::RakPeerInterface *peer) : ObjectPacke hasCellData = true; } -void PacketObjectLock::Object(WorldObject &worldObject, bool send) +void PacketObjectLock::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.lockLevel, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.lockLevel, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectLock.hpp b/components/openmw-mp/Packets/Object/PacketObjectLock.hpp index d02426aa4..f5f4c7291 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectLock.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectLock.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectLock(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectMove.cpp b/components/openmw-mp/Packets/Object/PacketObjectMove.cpp index 4c043ebbf..fd46e0a43 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectMove.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectMove.cpp @@ -9,8 +9,8 @@ PacketObjectMove::PacketObjectMove(RakNet::RakPeerInterface *peer) : ObjectPacke hasCellData = true; } -void PacketObjectMove::Object(WorldObject &worldObject, bool send) +void PacketObjectMove::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.position.pos, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.position.pos, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectMove.hpp b/components/openmw-mp/Packets/Object/PacketObjectMove.hpp index d45183b50..56e7a6d9c 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectMove.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectMove.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectMove(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectPlace.cpp b/components/openmw-mp/Packets/Object/PacketObjectPlace.cpp index 2bc4682c3..2c65bee41 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectPlace.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectPlace.cpp @@ -9,13 +9,13 @@ PacketObjectPlace::PacketObjectPlace(RakNet::RakPeerInterface *peer) : ObjectPac hasCellData = true; } -void PacketObjectPlace::Object(WorldObject &worldObject, bool send) +void PacketObjectPlace::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.count, send); - RW(worldObject.charge, send); - RW(worldObject.enchantmentCharge, send); - RW(worldObject.goldValue, send); - RW(worldObject.position, send); - RW(worldObject.droppedByPlayer, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.count, send); + RW(baseObject.charge, send); + RW(baseObject.enchantmentCharge, send); + RW(baseObject.goldValue, send); + RW(baseObject.position, send); + RW(baseObject.droppedByPlayer, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectPlace.hpp b/components/openmw-mp/Packets/Object/PacketObjectPlace.hpp index d3ac45119..930810d48 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectPlace.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectPlace.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectPlace(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectReset.cpp b/components/openmw-mp/Packets/Object/PacketObjectReset.cpp index 1d9b81635..2fc9230a9 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectReset.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectReset.cpp @@ -9,8 +9,8 @@ PacketObjectReset::PacketObjectReset(RakNet::RakPeerInterface *peer) : ObjectPac hasCellData = true; } -void PacketObjectReset::Object(WorldObject &worldObject, bool send) +void PacketObjectReset::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); + ObjectPacket::Object(baseObject, send); // Placeholder } diff --git a/components/openmw-mp/Packets/Object/PacketObjectReset.hpp b/components/openmw-mp/Packets/Object/PacketObjectReset.hpp index 32c0deb5f..5040c5b0b 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectReset.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectReset.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectReset(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectRotate.cpp b/components/openmw-mp/Packets/Object/PacketObjectRotate.cpp index c7665ab4e..40756fa9d 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectRotate.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectRotate.cpp @@ -9,10 +9,10 @@ PacketObjectRotate::PacketObjectRotate(RakNet::RakPeerInterface *peer) : ObjectP hasCellData = true; } -void PacketObjectRotate::Object(WorldObject &worldObject, bool send) +void PacketObjectRotate::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.position.rot[0], send); - RW(worldObject.position.rot[1], send); - RW(worldObject.position.rot[2], send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.position.rot[0], send); + RW(baseObject.position.rot[1], send); + RW(baseObject.position.rot[2], send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectRotate.hpp b/components/openmw-mp/Packets/Object/PacketObjectRotate.hpp index 4134e6ab5..489f0073d 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectRotate.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectRotate.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectRotate(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectScale.cpp b/components/openmw-mp/Packets/Object/PacketObjectScale.cpp index 5483e39c5..7698ac335 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectScale.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectScale.cpp @@ -9,8 +9,8 @@ PacketObjectScale::PacketObjectScale(RakNet::RakPeerInterface *peer) : ObjectPac hasCellData = true; } -void PacketObjectScale::Object(WorldObject &worldObject, bool send) +void PacketObjectScale::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.scale, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.scale, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectScale.hpp b/components/openmw-mp/Packets/Object/PacketObjectScale.hpp index 93548ebfc..c7489aa85 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectScale.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectScale.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectScale(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp b/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp index 00e686e13..0b5de8111 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp @@ -9,26 +9,26 @@ PacketObjectSpawn::PacketObjectSpawn(RakNet::RakPeerInterface *peer) : ObjectPac hasCellData = true; } -void PacketObjectSpawn::Object(WorldObject &worldObject, bool send) +void PacketObjectSpawn::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.position, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.position, send); - RW(worldObject.hasMaster, send); + RW(baseObject.hasMaster, send); - if (worldObject.hasMaster) + if (baseObject.hasMaster) { - RW(worldObject.master.isPlayer, send); + RW(baseObject.master.isPlayer, send); - if (worldObject.master.isPlayer) + if (baseObject.master.isPlayer) { - RW(worldObject.master.guid, send); + RW(baseObject.master.guid, send); } else { - RW(worldObject.master.refId, send, 1); - RW(worldObject.master.refNumIndex, send); - RW(worldObject.master.mpNum, send); + RW(baseObject.master.refId, send, 1); + RW(baseObject.master.refNumIndex, send); + RW(baseObject.master.mpNum, send); } } } diff --git a/components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp b/components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp index 2fb5d2c32..81468c44e 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectSpawn(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectState.cpp b/components/openmw-mp/Packets/Object/PacketObjectState.cpp index 1ca4dc338..b122f8b8b 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectState.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectState.cpp @@ -9,8 +9,8 @@ PacketObjectState::PacketObjectState(RakNet::RakPeerInterface *peer) : ObjectPac hasCellData = true; } -void PacketObjectState::Object(WorldObject &worldObject, bool send) +void PacketObjectState::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.objectState, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.objectState, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectState.hpp b/components/openmw-mp/Packets/Object/PacketObjectState.hpp index 8daa07de3..3d64a74ee 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectState.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectState.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectState(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketObjectTrap.cpp b/components/openmw-mp/Packets/Object/PacketObjectTrap.cpp index 832618c91..36b884862 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectTrap.cpp +++ b/components/openmw-mp/Packets/Object/PacketObjectTrap.cpp @@ -9,11 +9,11 @@ PacketObjectTrap::PacketObjectTrap(RakNet::RakPeerInterface *peer) : ObjectPacke hasCellData = true; } -void PacketObjectTrap::Object(WorldObject &worldObject, bool send) +void PacketObjectTrap::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.isDisarmed, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.isDisarmed, send); - if (!worldObject.isDisarmed) - RW(worldObject.position, send); + if (!baseObject.isDisarmed) + RW(baseObject.position, send); } diff --git a/components/openmw-mp/Packets/Object/PacketObjectTrap.hpp b/components/openmw-mp/Packets/Object/PacketObjectTrap.hpp index c9a9505d7..7349cde56 100644 --- a/components/openmw-mp/Packets/Object/PacketObjectTrap.hpp +++ b/components/openmw-mp/Packets/Object/PacketObjectTrap.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketObjectTrap(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.cpp b/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.cpp index 5c6c39756..7fa837382 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.cpp @@ -8,8 +8,8 @@ PacketScriptGlobalFloat::PacketScriptGlobalFloat(RakNet::RakPeerInterface *peer) packetID = ID_SCRIPT_GLOBAL_FLOAT; } -void PacketScriptGlobalFloat::Object(WorldObject &worldObject, bool send) +void PacketScriptGlobalFloat::Object(BaseObject &baseObject, bool send) { - RW(worldObject.varName, send); - RW(worldObject.floatVal, send); + RW(baseObject.varName, send); + RW(baseObject.floatVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.hpp b/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.hpp index 9c59099b8..5b1e8ed63 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptGlobalFloat.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptGlobalFloat(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.cpp b/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.cpp index f30f49bba..3f94d8cbf 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.cpp @@ -8,8 +8,8 @@ PacketScriptGlobalShort::PacketScriptGlobalShort(RakNet::RakPeerInterface *peer) packetID = ID_SCRIPT_GLOBAL_SHORT; } -void PacketScriptGlobalShort::Object(WorldObject &worldObject, bool send) +void PacketScriptGlobalShort::Object(BaseObject &baseObject, bool send) { - RW(worldObject.varName, send); - RW(worldObject.shortVal, send); + RW(baseObject.varName, send); + RW(baseObject.shortVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp b/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp index af89cf21d..9c6508b16 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptGlobalShort(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.cpp b/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.cpp index 32eb34d21..45d256733 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.cpp @@ -9,9 +9,9 @@ PacketScriptLocalFloat::PacketScriptLocalFloat(RakNet::RakPeerInterface *peer) : hasCellData = true; } -void PacketScriptLocalFloat::Object(WorldObject &worldObject, bool send) +void PacketScriptLocalFloat::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.index, send); - RW(worldObject.floatVal, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.index, send); + RW(baseObject.floatVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp b/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp index 40497430d..de5b6c6e0 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptLocalFloat(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &worldObject, bool send); + virtual void Object(BaseObject &baseObject, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptLocalShort.cpp b/components/openmw-mp/Packets/Object/PacketScriptLocalShort.cpp index ae6b7caca..b2315592c 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptLocalShort.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptLocalShort.cpp @@ -9,9 +9,9 @@ PacketScriptLocalShort::PacketScriptLocalShort(RakNet::RakPeerInterface *peer) : hasCellData = true; } -void PacketScriptLocalShort::Object(WorldObject &worldObject, bool send) +void PacketScriptLocalShort::Object(BaseObject &baseObject, bool send) { - ObjectPacket::Object(worldObject, send); - RW(worldObject.index, send); - RW(worldObject.shortVal, send); + ObjectPacket::Object(baseObject, send); + RW(baseObject.index, send); + RW(baseObject.shortVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp b/components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp index b0b1fa35b..d2d0284e4 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptLocalShort(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &obj, bool send); + virtual void Object(BaseObject &obj, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.cpp b/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.cpp index 187ff9d3f..eae7644c8 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.cpp @@ -8,9 +8,9 @@ PacketScriptMemberFloat::PacketScriptMemberFloat(RakNet::RakPeerInterface *peer) packetID = ID_SCRIPT_MEMBER_FLOAT; } -void PacketScriptMemberFloat::Object(WorldObject &worldObject, bool send) +void PacketScriptMemberFloat::Object(BaseObject &baseObject, bool send) { - RW(worldObject.refId, send); - RW(worldObject.index, send); - RW(worldObject.floatVal, send); + RW(baseObject.refId, send); + RW(baseObject.index, send); + RW(baseObject.floatVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.hpp b/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.hpp index ccd7a49be..270fed933 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptMemberFloat.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptMemberFloat(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &obj, bool send); + virtual void Object(BaseObject &obj, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketScriptMemberShort.cpp b/components/openmw-mp/Packets/Object/PacketScriptMemberShort.cpp index e7d038a7e..8cae9ab07 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptMemberShort.cpp +++ b/components/openmw-mp/Packets/Object/PacketScriptMemberShort.cpp @@ -8,9 +8,9 @@ PacketScriptMemberShort::PacketScriptMemberShort(RakNet::RakPeerInterface *peer) packetID = ID_SCRIPT_MEMBER_SHORT; } -void PacketScriptMemberShort::Object(WorldObject &worldObject, bool send) +void PacketScriptMemberShort::Object(BaseObject &baseObject, bool send) { - RW(worldObject.refId, send); - RW(worldObject.index, send); - RW(worldObject.shortVal, send); + RW(baseObject.refId, send); + RW(baseObject.index, send); + RW(baseObject.shortVal, send); } diff --git a/components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp b/components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp index 155e85165..3dc53f214 100644 --- a/components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp +++ b/components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketScriptMemberShort(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &obj, bool send); + virtual void Object(BaseObject &obj, bool send); }; } diff --git a/components/openmw-mp/Packets/Object/PacketVideoPlay.cpp b/components/openmw-mp/Packets/Object/PacketVideoPlay.cpp index d0cae224b..5db172bf9 100644 --- a/components/openmw-mp/Packets/Object/PacketVideoPlay.cpp +++ b/components/openmw-mp/Packets/Object/PacketVideoPlay.cpp @@ -8,8 +8,8 @@ PacketVideoPlay::PacketVideoPlay(RakNet::RakPeerInterface *peer) : ObjectPacket( packetID = ID_VIDEO_PLAY; } -void PacketVideoPlay::Object(WorldObject &worldObject, bool send) +void PacketVideoPlay::Object(BaseObject &baseObject, bool send) { - RW(worldObject.filename, send); - RW(worldObject.allowSkipping, send); + RW(baseObject.filename, send); + RW(baseObject.allowSkipping, send); } diff --git a/components/openmw-mp/Packets/Object/PacketVideoPlay.hpp b/components/openmw-mp/Packets/Object/PacketVideoPlay.hpp index 8d751efd1..9f5ecfa8d 100644 --- a/components/openmw-mp/Packets/Object/PacketVideoPlay.hpp +++ b/components/openmw-mp/Packets/Object/PacketVideoPlay.hpp @@ -10,7 +10,7 @@ namespace mwmp public: PacketVideoPlay(RakNet::RakPeerInterface *peer); - virtual void Object(WorldObject &obj, bool send); + virtual void Object(BaseObject &obj, bool send); }; }