[General] Rename Event into ObjectList & WorldObject into BaseObject

pull/423/head
David Cernat 7 years ago
parent 6bf3a0be1e
commit 78234f9071

@ -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()) if (players.empty())
return; return;
@ -229,9 +229,9 @@ void Cell::sendToLoaded(mwmp::ObjectPacket *objectPacket, mwmp::BaseEvent *baseE
for (auto pl : plList) 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 // Send the packet to this eligible guid
objectPacket->Send(pl->guid); objectPacket->Send(pl->guid);

@ -9,7 +9,7 @@
#include <string> #include <string>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/openmw-mp/Base/BaseActor.hpp> #include <components/openmw-mp/Base/BaseActor.hpp>
#include <components/openmw-mp/Base/BaseEvent.hpp> #include <components/openmw-mp/Base/BaseObject.hpp>
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp> #include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
#include <components/openmw-mp/Packets/Object/ObjectPacket.hpp> #include <components/openmw-mp/Packets/Object/ObjectPacket.hpp>
@ -41,7 +41,7 @@ public:
TPlayers getPlayers() const; TPlayers getPlayers() const;
void sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseActorList *baseActorList) 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; std::string getDescription() const;

@ -4,7 +4,7 @@
#include <deque> #include <deque>
#include <string> #include <string>
#include <components/esm/records.hpp> #include <components/esm/records.hpp>
#include <components/openmw-mp/Base/BaseEvent.hpp> #include <components/openmw-mp/Base/BaseObject.hpp>
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp> #include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
#include <components/openmw-mp/Packets/Object/ObjectPacket.hpp> #include <components/openmw-mp/Packets/Object/ObjectPacket.hpp>

@ -188,7 +188,7 @@ void Networking::processObjectPacket(RakNet::Packet *packet)
if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED) if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED)
return; 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]); 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; return &baseActorList;
} }
BaseEvent *Networking::getLastEvent() BaseObjectList *Networking::getLastObjectList()
{ {
return &baseEvent; return &baseObjectList;
} }
int Networking::getCurrentMpNum() int Networking::getCurrentMpNum()

@ -46,7 +46,7 @@ namespace mwmp
ObjectPacketController *getObjectPacketController() const; ObjectPacketController *getObjectPacketController() const;
BaseActorList *getLastActorList(); BaseActorList *getLastActorList();
BaseEvent *getLastEvent(); BaseObjectList *getLastObjectList();
int getCurrentMpNum(); int getCurrentMpNum();
void setCurrentMpNum(int value); void setCurrentMpNum(int value);
@ -75,7 +75,7 @@ namespace mwmp
MasterClient *mclient; MasterClient *mclient;
BaseActorList baseActorList; BaseActorList baseActorList;
BaseEvent baseEvent; BaseObjectList baseObjectList;
PlayerPacketController *playerPacketController; PlayerPacketController *playerPacketController;
ActorPacketController *actorPacketController; ActorPacketController *actorPacketController;

@ -1,5 +1,5 @@
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Base/BaseEvent.hpp> #include <components/openmw-mp/Base/BaseObject.hpp>
#include <apps/openmw-mp/Networking.hpp> #include <apps/openmw-mp/Networking.hpp>
#include <apps/openmw-mp/Player.hpp> #include <apps/openmw-mp/Player.hpp>
@ -10,280 +10,280 @@
using namespace mwmp; using namespace mwmp;
BaseEvent *readEvent; BaseObjectList *readObjectList;
BaseEvent writeEvent; BaseObjectList writeObjectList;
WorldObject tempWorldObject; BaseObject tempObject;
const WorldObject emptyWorldObject = {}; const BaseObject emptyObject = {};
ContainerItem tempContainerItem; ContainerItem tempContainerItem;
const ContainerItem emptyContainerItem = {}; 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; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
writeEvent.cell.blank(); writeObjectList.cell.blank();
writeEvent.worldObjects.clear(); writeObjectList.baseObjects.clear();
writeEvent.guid = player->guid; writeObjectList.guid = player->guid;
} }
unsigned int WorldFunctions::GetObjectChangesSize() noexcept 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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(); .containerItems.at(itemIndex).refId.c_str();
} }
int WorldFunctions::GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept int WorldFunctions::GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex) noexcept
{ {
return readEvent->worldObjects.at(objectIndex) return readObjectList->baseObjects.at(objectIndex)
.containerItems.at(itemIndex).count; .containerItems.at(itemIndex).count;
} }
int WorldFunctions::GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept int WorldFunctions::GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept
{ {
return readEvent->worldObjects.at(objectIndex) return readObjectList->baseObjects.at(objectIndex)
.containerItems.at(itemIndex).charge; .containerItems.at(itemIndex).charge;
} }
double WorldFunctions::GetContainerItemEnchantmentCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept double WorldFunctions::GetContainerItemEnchantmentCharge(unsigned int objectIndex, unsigned int itemIndex) noexcept
{ {
return readEvent->worldObjects.at(objectIndex) return readObjectList->baseObjects.at(objectIndex)
.containerItems.at(itemIndex).enchantmentCharge; .containerItems.at(itemIndex).enchantmentCharge;
} }
int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept
{ {
return readEvent->worldObjects.at(objectIndex) return readObjectList->baseObjects.at(objectIndex)
.containerItems.at(itemIndex).actionCount; .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 void WorldFunctions::SetObjectRefId(const char* refId) noexcept
{ {
tempWorldObject.refId = refId; tempObject.refId = refId;
} }
void WorldFunctions::SetObjectRefNumIndex(int refNumIndex) noexcept void WorldFunctions::SetObjectRefNumIndex(int refNumIndex) noexcept
{ {
tempWorldObject.refNumIndex = refNumIndex; tempObject.refNumIndex = refNumIndex;
} }
void WorldFunctions::SetObjectMpNum(int mpNum) noexcept void WorldFunctions::SetObjectMpNum(int mpNum) noexcept
{ {
tempWorldObject.mpNum = mpNum; tempObject.mpNum = mpNum;
} }
void WorldFunctions::SetObjectCount(int count) noexcept void WorldFunctions::SetObjectCount(int count) noexcept
{ {
tempWorldObject.count = count; tempObject.count = count;
} }
void WorldFunctions::SetObjectCharge(int charge) noexcept void WorldFunctions::SetObjectCharge(int charge) noexcept
{ {
tempWorldObject.charge = charge; tempObject.charge = charge;
} }
void WorldFunctions::SetObjectEnchantmentCharge(double enchantmentCharge) noexcept void WorldFunctions::SetObjectEnchantmentCharge(double enchantmentCharge) noexcept
{ {
tempWorldObject.enchantmentCharge = enchantmentCharge; tempObject.enchantmentCharge = enchantmentCharge;
} }
void WorldFunctions::SetObjectGoldValue(int goldValue) noexcept void WorldFunctions::SetObjectGoldValue(int goldValue) noexcept
{ {
tempWorldObject.goldValue = goldValue; tempObject.goldValue = goldValue;
} }
void WorldFunctions::SetObjectScale(double scale) noexcept void WorldFunctions::SetObjectScale(double scale) noexcept
{ {
tempWorldObject.scale = scale; tempObject.scale = scale;
} }
void WorldFunctions::SetObjectState(bool objectState) noexcept void WorldFunctions::SetObjectState(bool objectState) noexcept
{ {
tempWorldObject.objectState = objectState; tempObject.objectState = objectState;
} }
void WorldFunctions::SetObjectLockLevel(int lockLevel) noexcept void WorldFunctions::SetObjectLockLevel(int lockLevel) noexcept
{ {
tempWorldObject.lockLevel = lockLevel; tempObject.lockLevel = lockLevel;
} }
void WorldFunctions::SetObjectDisarmState(bool disarmState) noexcept void WorldFunctions::SetObjectDisarmState(bool disarmState) noexcept
{ {
tempWorldObject.isDisarmed = disarmState; tempObject.isDisarmed = disarmState;
} }
void WorldFunctions::SetObjectMasterState(bool masterState) noexcept void WorldFunctions::SetObjectMasterState(bool masterState) noexcept
{ {
tempWorldObject.hasMaster = masterState; tempObject.hasMaster = masterState;
} }
void WorldFunctions::SetObjectPosition(double x, double y, double z) noexcept void WorldFunctions::SetObjectPosition(double x, double y, double z) noexcept
{ {
tempWorldObject.position.pos[0] = x; tempObject.position.pos[0] = x;
tempWorldObject.position.pos[1] = y; tempObject.position.pos[1] = y;
tempWorldObject.position.pos[2] = z; tempObject.position.pos[2] = z;
} }
void WorldFunctions::SetObjectRotation(double x, double y, double z) noexcept void WorldFunctions::SetObjectRotation(double x, double y, double z) noexcept
{ {
tempWorldObject.position.rot[0] = x; tempObject.position.rot[0] = x;
tempWorldObject.position.rot[1] = y; tempObject.position.rot[1] = y;
tempWorldObject.position.rot[2] = z; tempObject.position.rot[2] = z;
} }
void WorldFunctions::SetObjectDoorState(int doorState) noexcept void WorldFunctions::SetObjectDoorState(int doorState) noexcept
{ {
tempWorldObject.doorState = doorState; tempObject.doorState = doorState;
} }
void WorldFunctions::SetObjectDoorTeleportState(bool teleportState) noexcept void WorldFunctions::SetObjectDoorTeleportState(bool teleportState) noexcept
{ {
tempWorldObject.teleportState = teleportState; tempObject.teleportState = teleportState;
} }
void WorldFunctions::SetObjectDoorDestinationCell(const char* cellDescription) noexcept 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 void WorldFunctions::SetObjectDoorDestinationPosition(double x, double y, double z) noexcept
{ {
tempWorldObject.destinationPosition.pos[0] = x; tempObject.destinationPosition.pos[0] = x;
tempWorldObject.destinationPosition.pos[1] = y; tempObject.destinationPosition.pos[1] = y;
tempWorldObject.destinationPosition.pos[2] = z; tempObject.destinationPosition.pos[2] = z;
} }
void WorldFunctions::SetObjectDoorDestinationRotation(double x, double z) noexcept void WorldFunctions::SetObjectDoorDestinationRotation(double x, double z) noexcept
{ {
tempWorldObject.destinationPosition.rot[0] = x; tempObject.destinationPosition.rot[0] = x;
tempWorldObject.destinationPosition.rot[2] = z; tempObject.destinationPosition.rot[2] = z;
} }
void WorldFunctions::SetPlayerAsObject(unsigned short pid) noexcept void WorldFunctions::SetPlayerAsObject(unsigned short pid) noexcept
@ -291,8 +291,8 @@ void WorldFunctions::SetPlayerAsObject(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
tempWorldObject.guid = player->guid; tempObject.guid = player->guid;
tempWorldObject.isPlayer = true; tempObject.isPlayer = true;
} }
void WorldFunctions::SetContainerItemRefId(const char* refId) noexcept 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 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; tempObject.droppedByPlayer = false;
writeEvent.worldObjects.push_back(tempWorldObject); writeObjectList.baseObjects.push_back(tempObject);
tempWorldObject = emptyWorldObject; tempObject = emptyObject;
} }
void WorldFunctions::AddContainerItem() noexcept void WorldFunctions::AddContainerItem() noexcept
{ {
tempWorldObject.containerItems.push_back(tempContainerItem); tempObject.containerItems.push_back(tempContainerItem);
tempContainerItem = emptyContainerItem; tempContainerItem = emptyContainerItem;
} }
@ -338,7 +338,7 @@ void WorldFunctions::AddContainerItem() noexcept
void WorldFunctions::SendObjectPlace(bool broadcast) noexcept void WorldFunctions::SendObjectPlace(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_PLACE); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_PLACE);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -348,7 +348,7 @@ void WorldFunctions::SendObjectPlace(bool broadcast) noexcept
void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SPAWN); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SPAWN);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -358,7 +358,7 @@ void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept
void WorldFunctions::SendObjectDelete(bool broadcast) noexcept void WorldFunctions::SendObjectDelete(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_DELETE); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_DELETE);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -368,7 +368,7 @@ void WorldFunctions::SendObjectDelete(bool broadcast) noexcept
void WorldFunctions::SendObjectLock(bool broadcast) noexcept void WorldFunctions::SendObjectLock(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_LOCK); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_LOCK);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -378,7 +378,7 @@ void WorldFunctions::SendObjectLock(bool broadcast) noexcept
void WorldFunctions::SendObjectTrap(bool broadcast) noexcept void WorldFunctions::SendObjectTrap(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_TRAP); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_TRAP);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -388,7 +388,7 @@ void WorldFunctions::SendObjectTrap(bool broadcast) noexcept
void WorldFunctions::SendObjectScale(bool broadcast) noexcept void WorldFunctions::SendObjectScale(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SCALE); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SCALE);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -398,7 +398,7 @@ void WorldFunctions::SendObjectScale(bool broadcast) noexcept
void WorldFunctions::SendObjectState(bool broadcast) noexcept void WorldFunctions::SendObjectState(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -408,7 +408,7 @@ void WorldFunctions::SendObjectState(bool broadcast) noexcept
void WorldFunctions::SendDoorState(bool broadcast) noexcept void WorldFunctions::SendDoorState(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_STATE); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_STATE);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
@ -418,21 +418,21 @@ void WorldFunctions::SendDoorState(bool broadcast) noexcept
void WorldFunctions::SendDoorDestination(bool broadcast) noexcept void WorldFunctions::SendDoorDestination(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_DESTINATION); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_DESTINATION);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)
packet->Send(true); 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); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONTAINER);
if (useLastReadEvent) if (useLastReadObjectList)
packet->setEvent(readEvent); packet->setObjectList(readObjectList);
else else
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
@ -443,7 +443,7 @@ void WorldFunctions::SendContainer(bool broadcast, bool useLastReadEvent) noexce
void WorldFunctions::SendConsoleCommand(bool broadcast) noexcept void WorldFunctions::SendConsoleCommand(bool broadcast) noexcept
{ {
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND); mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND);
packet->setEvent(&writeEvent); packet->setObjectList(&writeObjectList);
packet->Send(false); packet->Send(false);
if (broadcast) if (broadcast)

@ -2,12 +2,12 @@
#define OPENMW_WORLDAPI_HPP #define OPENMW_WORLDAPI_HPP
#define WORLDAPI \ #define WORLDAPI \
{"ReadLastEvent", WorldFunctions::ReadLastEvent},\ {"ReadLastObjectList", WorldFunctions::ReadLastObjectList},\
{"InitializeEvent", WorldFunctions::InitializeEvent},\ {"InitializeObjectList", WorldFunctions::InitializeObjectList},\
\ \
{"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\ {"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\
{"GetEventAction", WorldFunctions::GetEventAction},\ {"GetObjectListAction", WorldFunctions::GetObjectListAction},\
{"GetEventContainerSubAction", WorldFunctions::GetEventContainerSubAction},\ {"GetObjectListContainerSubAction", WorldFunctions::GetObjectListContainerSubAction},\
\ \
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\ {"GetObjectRefId", WorldFunctions::GetObjectRefId},\
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\ {"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
@ -34,9 +34,9 @@
{"GetContainerItemEnchantmentCharge", WorldFunctions::GetContainerItemEnchantmentCharge},\ {"GetContainerItemEnchantmentCharge", WorldFunctions::GetContainerItemEnchantmentCharge},\
{"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\ {"GetContainerItemActionCount", WorldFunctions::GetContainerItemActionCount},\
\ \
{"SetEventCell", WorldFunctions::SetEventCell},\ {"SetObjectListCell", WorldFunctions::SetObjectListCell},\
{"SetEventAction", WorldFunctions::SetEventAction},\ {"SetObjectListAction", WorldFunctions::SetObjectListAction},\
{"SetEventConsoleCommand", WorldFunctions::SetEventConsoleCommand},\ {"SetObjectListConsoleCommand", WorldFunctions::SetObjectListConsoleCommand},\
\ \
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\ {"SetObjectRefId", WorldFunctions::SetObjectRefId},\
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\ {"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
@ -68,7 +68,7 @@
\ \
{"SetReceivedContainerItemActionCount", WorldFunctions::SetReceivedContainerItemActionCount},\ {"SetReceivedContainerItemActionCount", WorldFunctions::SetReceivedContainerItemActionCount},\
\ \
{"AddWorldObject", WorldFunctions::AddWorldObject},\ {"AddObject", WorldFunctions::AddObject},\
{"AddContainerItem", WorldFunctions::AddContainerItem},\ {"AddContainerItem", WorldFunctions::AddContainerItem},\
\ \
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\ {"SendObjectPlace", WorldFunctions::SendObjectPlace},\
@ -92,52 +92,52 @@ class WorldFunctions
public: 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 * \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. * 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 * \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. * \return The number of indexes.
*/ */
static unsigned int GetObjectChangesSize() noexcept; 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). * \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). * \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. * \return The refId.
*/ */
static const char *GetObjectRefId(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -146,7 +146,7 @@ public:
static int GetObjectRefNumIndex(unsigned int i) noexcept; 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. * \param i The index of the object.
* \return The mpNum. * \return The mpNum.
@ -154,7 +154,7 @@ public:
static int GetObjectMpNum(unsigned int i) noexcept; 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. * \param i The index of the object.
* \return The object count. * \return The object count.
@ -162,7 +162,7 @@ public:
static int GetObjectCount(unsigned int i) noexcept; 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. * \param i The index of the object.
* \return The charge. * \return The charge.
@ -170,7 +170,7 @@ public:
static int GetObjectCharge(unsigned int i) noexcept; 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. * \param i The index of the object.
* \return The enchantment charge. * \return The enchantment charge.
@ -178,7 +178,7 @@ public:
static double GetObjectEnchantmentCharge(unsigned int i) noexcept; 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. * changes.
* *
* This is used solely to get the gold value of gold. It is not used for other objects. * 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; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -198,7 +198,7 @@ public:
static double GetObjectScale(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -207,7 +207,7 @@ public:
static bool GetObjectState(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -216,7 +216,7 @@ public:
static int GetObjectDoorState(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -225,7 +225,7 @@ public:
static int GetObjectLockLevel(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -234,7 +234,7 @@ public:
static double GetObjectPosX(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -243,7 +243,7 @@ public:
static double GetObjectPosY(unsigned int i) noexcept; 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. * \param i The index of the object.
* \return The Z position. * \return The Z position.
@ -251,7 +251,7 @@ public:
static double GetObjectPosZ(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -260,7 +260,7 @@ public:
static double GetObjectRotX(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
@ -269,7 +269,7 @@ public:
static double GetObjectRotY(unsigned int i) noexcept; 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. * changes.
* *
* \param i The index of the object. * \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 * \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. * \param i The index of the object.
* \return The number of container item indexes. * \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 * \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 objectIndex The index of the object.
* \param itemIndex The index of the container item. * \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 * \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 objectIndex The index of the object.
* \param itemIndex The index of the container item. * \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 * \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 objectIndex The index of the object.
* \param itemIndex The index of the container item. * \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 * \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 objectIndex The index of the object.
* \param itemIndex The index of the container item. * \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 * \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 objectIndex The index of the object.
* \param itemIndex The index of the container item. * \param itemIndex The index of the container item.
@ -337,7 +337,7 @@ public:
static int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept; 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 * 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. * by a comma followed by another number.
@ -345,29 +345,29 @@ public:
* \param cellDescription The description of the cell. * \param cellDescription The description of the cell.
* \return void * \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). * \param action The action type (0 for SET, 1 for ADD, 2 for REMOVE, 3 for REQUEST).
* \return void * \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. * have been added, it will run once without any object reference.
* *
* \param consoleCommand The console command. * \param consoleCommand The console command.
* \return void * \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. * \param refId The refId.
* \return void * \return void
@ -375,7 +375,7 @@ public:
static void SetObjectRefId(const char* refId) noexcept; 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 * Every object loaded from .ESM and .ESP data files has a unique refNumIndex which needs to be
* retained to refer to it in packets. * retained to refer to it in packets.
@ -389,7 +389,7 @@ public:
static void SetObjectRefNumIndex(int refNumIndex) noexcept; 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 * 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 * 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; 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. * This determines the quantity of an object, with the exception of gold.
* *
@ -414,7 +414,7 @@ public:
static void SetObjectCount(int count) noexcept; 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. * Object durabilities are set through this value.
* *
@ -424,7 +424,7 @@ public:
static void SetObjectCharge(int charge) noexcept; 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. * Object durabilities are set through this value.
* *
@ -434,7 +434,7 @@ public:
static void SetObjectEnchantmentCharge(double enchantmentCharge) noexcept; 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. * 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; 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. * Objects are smaller or larger than their default size based on their scale.
* *
@ -454,7 +454,7 @@ public:
static void SetObjectScale(double scale) noexcept; 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. * Objects are enabled or disabled based on their object state.
* *
@ -464,7 +464,7 @@ public:
static void SetObjectState(bool objectState) noexcept; 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. * \param lockLevel The lock level.
* \return void * \return void
@ -472,7 +472,7 @@ public:
static void SetObjectLockLevel(int lockLevel) noexcept; 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. * \param disarmState The disarmState.
* \return void * \return void
@ -480,7 +480,7 @@ public:
static void SetObjectDisarmState(bool disarmState) noexcept; 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 * This only affects living actors and determines whether they are followers of another
* living actor. * living actor.
@ -491,7 +491,7 @@ public:
static void SetObjectMasterState(bool masterState) noexcept; 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 x The X position.
* \param y The Y position. * \param y The Y position.
@ -501,7 +501,7 @@ public:
static void SetObjectPosition(double x, double y, double z) noexcept; 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 x The X rotation.
* \param y The Y rotation. * \param y The Y rotation.
@ -511,7 +511,7 @@ public:
static void SetObjectRotation(double x, double y, double z) noexcept; 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. * Doors are open or closed based on their door state.
* *
@ -521,7 +521,7 @@ public:
static void SetObjectDoorState(int doorState) noexcept; 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 * 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. * destination. If it's false, it opens and closes like a regular door.
@ -532,7 +532,7 @@ public:
static void SetObjectDoorTeleportState(bool teleportState) noexcept; 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 * 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. * by a comma followed by another number.
@ -543,7 +543,7 @@ public:
static void SetObjectDoorDestinationCell(const char* cellDescription) noexcept; 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 x The X position.
* \param y The Y position. * \param y The Y position.
@ -553,7 +553,7 @@ public:
static void SetObjectDoorDestinationPosition(double x, double y, double z) noexcept; 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 * 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. * 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; 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. * Currently only used for ConsoleCommand packets.
* *
* \param pid The pid of the player. * \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 * \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 * 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 * 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; 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. * one can be set up.
* *
* \return void * \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 * \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 * In the process, the server's temporary container item will automatically be cleared so a new
* one can be set up. * one can be set up.
@ -645,7 +645,7 @@ public:
* \brief Send an ObjectPlace packet. * \brief Send an ObjectPlace packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -655,7 +655,7 @@ public:
* \brief Send an ObjectSpawn packet. * \brief Send an ObjectSpawn packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -665,7 +665,7 @@ public:
* \brief Send an ObjectDelete packet. * \brief Send an ObjectDelete packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -675,7 +675,7 @@ public:
* \brief Send an ObjectLock packet. * \brief Send an ObjectLock packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -685,7 +685,7 @@ public:
* \brief Send an ObjectTrap packet. * \brief Send an ObjectTrap packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -695,7 +695,7 @@ public:
* \brief Send an ObjectScale packet. * \brief Send an ObjectScale packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -705,7 +705,7 @@ public:
* \brief Send an ObjectState packet. * \brief Send an ObjectState packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -715,7 +715,7 @@ public:
* \brief Send a DoorState packet. * \brief Send a DoorState packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -725,7 +725,7 @@ public:
* \brief Send a DoorDestination packet. * \brief Send a DoorDestination packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */
@ -735,17 +735,17 @@ public:
* \brief Send a Container packet. * \brief Send a Container packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \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. * \brief Send a ConsoleCommand packet.
* *
* \param broadcast Whether this packet should be sent only to the player for whom the current * \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 * \return void
*/ */

@ -10,17 +10,17 @@ using namespace mwmp;
template<class T> template<class T>
typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors; typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors;
void WorldProcessor::Do(ObjectPacket &packet, Player &player, BaseEvent &event) void WorldProcessor::Do(ObjectPacket &packet, Player &player, BaseObjectList &objectList)
{ {
packet.Send(true); 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 // Clear our BaseObjectList before loading new data in it
event.cell.blank(); objectList.cell.blank();
event.worldObjects.clear(); objectList.baseObjects.clear();
event.guid = packet.guid; objectList.guid = packet.guid;
for (auto &processor : processors) for (auto &processor : processors)
{ {
@ -29,14 +29,14 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept
Player *player = Players::getPlayer(packet.guid); Player *player = Players::getPlayer(packet.guid);
ObjectPacket *myPacket = Networking::get().getObjectPacketController()->GetPacket(packet.data[0]); ObjectPacket *myPacket = Networking::get().getObjectPacketController()->GetPacket(packet.data[0]);
myPacket->setEvent(&event); myPacket->setObjectList(&objectList);
event.isValid = true; objectList.isValid = true;
if (!processor.second->avoidReading) if (!processor.second->avoidReading)
myPacket->Read(); myPacket->Read();
if (event.isValid) if (objectList.isValid)
processor.second->Do(*myPacket, *player, event); processor.second->Do(*myPacket, *player, objectList);
else else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str());

@ -19,9 +19,9 @@ namespace mwmp
{ {
public: 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;
}; };
} }

@ -13,16 +13,16 @@ namespace mwmp
BPP_INIT(ID_CONTAINER) 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_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 // 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 // container packets to ensure their integrity based on what exists in the
// server data // server data
Script::Call<Script::CallbackIdentity("OnContainer")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnContainer")>(player.getId(), objectList.cell.getDescription().c_str());
LOG_APPEND(Log::LOG_INFO, "- Finished processing ID_CONTAINER"); LOG_APPEND(Log::LOG_INFO, "- Finished processing ID_CONTAINER");
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_DOOR_STATE) 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); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnDoorState")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnDoorState")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -13,13 +13,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_DELETE) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectDelete")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectDelete")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -13,13 +13,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_LOCK) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectLock")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectLock")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -14,13 +14,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_PLACE) 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()); 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, // 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(false);
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectPlace")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectPlace")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -13,13 +13,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_SCALE) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectScale")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectScale")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -14,13 +14,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_SPAWN) 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()); 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, // 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(false);
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectSpawn")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectSpawn")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -13,13 +13,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_STATE) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectState")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectState")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -13,13 +13,13 @@ namespace mwmp
BPP_INIT(ID_OBJECT_TRAP) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnObjectTrap")>(player.getId(), event.cell.getDescription().c_str()); Script::Call<Script::CallbackIdentity("OnObjectTrap")>(player.getId(), objectList.cell.getDescription().c_str());
} }
}; };
} }

@ -97,7 +97,7 @@ add_openmw_dir (mwbase
inputmanager windowmanager statemanager 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 Cell CellController MechanicsHelper RecordHelper GUIController
) )

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -189,10 +189,10 @@ namespace MWClass
Send an ID_OBJECT_TRAP packet every time a trap is disarmed Send an ID_OBJECT_TRAP packet every time a trap is disarmed
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); objectList->addObjectTrap(ptr, ptr.getRefData().getPosition(), true);
worldEvent->sendObjectTrap(); objectList->sendObjectTrap();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -205,10 +205,10 @@ namespace MWClass
*/ */
if (isLocked) if (isLocked)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(ptr, 0); objectList->addObjectLock(ptr, 0);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -183,10 +183,10 @@ namespace MWClass
Send an ID_OBJECT_TRAP packet every time a trap is disarmed Send an ID_OBJECT_TRAP packet every time a trap is disarmed
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectTrap(ptr, ptr.getRefData().getPosition(), true); objectList->addObjectTrap(ptr, ptr.getRefData().getPosition(), true);
worldEvent->sendObjectTrap(); objectList->sendObjectTrap();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -199,10 +199,10 @@ namespace MWClass
*/ */
if (isLocked) if (isLocked)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(ptr, 0); objectList->addObjectLock(ptr, 0);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -12,7 +12,7 @@
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
@ -112,22 +112,22 @@ namespace MWGui
Send an ID_CONTAINER packet every time an item starts being dragged Send an ID_CONTAINER packet every time an item starts being dragged
from a container from a container
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->cell = *mPtr.getCell()->getCell(); objectList->cell = *mPtr.getCell()->getCell();
worldEvent->action = mwmp::BaseEvent::REMOVE; objectList->action = mwmp::BaseObjectList::REMOVE;
worldEvent->containerSubAction = mwmp::BaseEvent::DRAG; objectList->containerSubAction = mwmp::BaseObjectList::DRAG;
mwmp::WorldObject worldObject = worldEvent->getWorldObject(mPtr); mwmp::BaseObject baseObject = objectList->getBaseObject(mPtr);
MWWorld::Ptr itemPtr = mModel->getItem(mSelectedItem).mBase; MWWorld::Ptr itemPtr = mModel->getItem(mSelectedItem).mBase;
worldEvent->addContainerItem(worldObject, itemPtr, count); objectList->addContainerItem(baseObject, itemPtr, count);
worldEvent->addObject(worldObject); 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(); 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", 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()); itemPtr.getCellRef().getRefId().c_str(), itemPtr.getRefData().getCount());
/* /*
End of tes3mp addition End of tes3mp addition
@ -158,13 +158,13 @@ namespace MWGui
*/ */
if (success) if (success)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->cell = *mPtr.getCell()->getCell(); objectList->cell = *mPtr.getCell()->getCell();
worldEvent->action = mwmp::BaseEvent::ADD; objectList->action = mwmp::BaseObjectList::ADD;
worldEvent->containerSubAction = mwmp::BaseEvent::DROP; objectList->containerSubAction = mwmp::BaseObjectList::DROP;
mwmp::WorldObject worldObject = worldEvent->getWorldObject(mPtr); mwmp::BaseObject baseObject = objectList->getBaseObject(mPtr);
MWWorld::Ptr itemPtr = mDragAndDrop->mItem.mBase; MWWorld::Ptr itemPtr = mDragAndDrop->mItem.mBase;
mwmp::ContainerItem containerItem; mwmp::ContainerItem containerItem;
containerItem.refId = itemPtr.getCellRef().getRefId(); containerItem.refId = itemPtr.getCellRef().getRefId();
@ -175,14 +175,14 @@ namespace MWGui
containerItem.charge = itemPtr.getCellRef().getCharge(); containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge(); containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge();
worldObject.containerItems.push_back(containerItem); baseObject.containerItems.push_back(containerItem);
worldEvent->addObject(worldObject); 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(); 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", 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); 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 Send an ID_CONTAINER packet every time the Take All button is used on
a container a container
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->cell = *mPtr.getCell()->getCell(); objectList->cell = *mPtr.getCell()->getCell();
worldEvent->action = mwmp::BaseEvent::REMOVE; objectList->action = mwmp::BaseObjectList::REMOVE;
worldEvent->containerSubAction = mwmp::BaseEvent::TAKE_ALL; objectList->containerSubAction = mwmp::BaseObjectList::TAKE_ALL;
worldEvent->addEntireContainer(mPtr); 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(); 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", 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(), 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 End of tes3mp addition
*/ */
@ -380,10 +380,10 @@ namespace MWGui
*/ */
if (!mPtr.getClass().isPersistent(mPtr)) if (!mPtr.getClass().isPersistent(mPtr))
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(mPtr); objectList->addObjectDelete(mPtr);
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -14,7 +14,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwworld/cellstore.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 Send an ID_OBJECT_PLACE packet every time an object is dropped into the world from
the inventory screen the inventory screen
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectPlace(dropped, true); objectList->addObjectPlace(dropped, true);
worldEvent->sendObjectPlace(); objectList->sendObjectPlace();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -24,7 +24,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwworld/cellstore.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 Send an ID_PLAYER_INVENTORY packet as well because of the item thus gained
by the player by the player
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(object); objectList->addObjectDelete(object);
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
mwmp::Main::get().getLocalPlayer()->sendInventory(); mwmp::Main::get().getLocalPlayer()->sendInventory();
/* /*
End of tes3mp addition End of tes3mp addition

@ -23,7 +23,7 @@
#include "../mwmp/PlayerList.hpp" #include "../mwmp/PlayerList.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"
#include "../mwmp/MechanicsHelper.hpp" #include "../mwmp/MechanicsHelper.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -1726,10 +1726,10 @@ namespace MWMechanics
Send an ID_OBJECT_DELETE packet every time a summoned creature despawns Send an ID_OBJECT_DELETE packet every time a summoned creature despawns
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(ptr); objectList->addObjectDelete(ptr);
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -73,10 +73,10 @@ namespace MWMechanics
Send an ID_OBJECT_LOCK packet every time an object is unlocked here Send an ID_OBJECT_LOCK packet every time an object is unlocked here
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(lock, 0); objectList->addObjectLock(lock, 0);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -132,10 +132,10 @@ namespace MWMechanics
Send an ID_OBJECT_TRAP packet every time a trap is disarmed Send an ID_OBJECT_TRAP packet every time a trap is disarmed
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectTrap(trap, trap.getRefData().getPosition(), true); objectList->addObjectTrap(trap, trap.getRefData().getPosition(), true);
worldEvent->sendObjectTrap(); objectList->sendObjectTrap();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -19,7 +19,7 @@
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/PlayerList.hpp" #include "../mwmp/PlayerList.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/MechanicsHelper.hpp" #include "../mwmp/MechanicsHelper.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
@ -680,10 +680,10 @@ namespace MWMechanics
Send an ID_OBJECT_LOCK packet every time an object is locked here Send an ID_OBJECT_LOCK packet every time an object is locked here
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(target, static_cast<int>(magnitude)); objectList->addObjectLock(target, static_cast<int>(magnitude));
worldEvent->sendObjectLock(); objectList->sendObjectLock();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -714,10 +714,10 @@ namespace MWMechanics
Send an ID_OBJECT_LOCK packet every time an object is unlocked here Send an ID_OBJECT_LOCK packet every time an object is unlocked here
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(target, 0); objectList->addObjectLock(target, 0);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -11,7 +11,7 @@
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -105,10 +105,10 @@ namespace MWMechanics
if (mwmp::Main::get().getCellController()->hasLocalAuthority(*placed.getCell()->getCell())) if (mwmp::Main::get().getCellController()->hasLocalAuthority(*placed.getCell()->getCell()))
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectSpawn(placed, mActor); objectList->addObjectSpawn(placed, mActor);
worldEvent->sendObjectSpawn(); objectList->sendObjectSpawn();
} }
MWBase::Environment::get().getWorld()->deleteObject(placed); MWBase::Environment::get().getWorld()->deleteObject(placed);
@ -162,10 +162,10 @@ namespace MWMechanics
Send an ID_OBJECT_DELETE packet every time a summoned creature despawns Send an ID_OBJECT_DELETE packet every time a summoned creature despawns
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(ptr); objectList->addObjectDelete(ptr);
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -19,7 +19,7 @@
#include "LocalPlayer.hpp" #include "LocalPlayer.hpp"
#include "DedicatedPlayer.hpp" #include "DedicatedPlayer.hpp"
#include "PlayerList.hpp" #include "PlayerList.hpp"
#include "WorldEvent.hpp" #include "ObjectList.hpp"
#include "CellController.hpp" #include "CellController.hpp"
using namespace mwmp; using namespace mwmp;
@ -35,8 +35,8 @@ osg::Vec3f MechanicsHelper::getLinearInterpolation(osg::Vec3f start, osg::Vec3f
void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore) void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
{ {
MWWorld::CellRefList<ESM::CreatureLevList> *creatureLevList = cellStore->getCreatureLists(); MWWorld::CellRefList<ESM::CreatureLevList> *creatureLevList = cellStore->getCreatureLists();
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
int spawnCount = 0; int spawnCount = 0;
@ -53,7 +53,7 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition()); manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition());
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(manualRef.getPtr(), ptr.getCell(), MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(manualRef.getPtr(), ptr.getCell(),
ptr.getCellRef().getPosition()); ptr.getCellRef().getPosition());
worldEvent->addObjectSpawn(placed); objectList->addObjectSpawn(placed);
MWBase::Environment::get().getWorld()->deleteObject(placed); MWBase::Environment::get().getWorld()->deleteObject(placed);
spawnCount++; spawnCount++;
@ -61,7 +61,7 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
} }
if (spawnCount > 0) if (spawnCount > 0)
worldEvent->sendObjectSpawn(); objectList->sendObjectSpawn();
} }
Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr) Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr)

@ -430,7 +430,7 @@ void Networking::receiveMessage(RakNet::Packet *packet)
} }
else if (objectPacketController.ContainsPacket(packet->data[0])) 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]); 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; return &actorList;
} }
WorldEvent *Networking::getWorldEvent() ObjectList *Networking::getObjectList()
{ {
return &worldEvent; return &objectList;
} }
bool Networking::isConnected() bool Networking::isConnected()

@ -10,7 +10,7 @@
#include <string> #include <string>
#include "ActorList.hpp" #include "ActorList.hpp"
#include "WorldEvent.hpp" #include "ObjectList.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp> #include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
@ -44,7 +44,7 @@ namespace mwmp
LocalPlayer *getLocalPlayer(); LocalPlayer *getLocalPlayer();
ActorList *getActorList(); ActorList *getActorList();
WorldEvent *getWorldEvent(); ObjectList *getObjectList();
private: private:
bool connected; bool connected;
@ -57,7 +57,7 @@ namespace mwmp
ObjectPacketController objectPacketController; ObjectPacketController objectPacketController;
ActorList actorList; ActorList actorList;
WorldEvent worldEvent; ObjectList objectList;
void receiveMessage(RakNet::Packet *packet); void receiveMessage(RakNet::Packet *packet);

@ -1,25 +1,25 @@
#ifndef OPENMW_WORLDEVENT_HPP #ifndef OPENMW_WORLDEVENT_HPP
#define OPENMW_WORLDEVENT_HPP #define OPENMW_WORLDEVENT_HPP
#include <components/openmw-mp/Base/BaseEvent.hpp> #include <components/openmw-mp/Base/BaseObject.hpp>
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include <RakNetTypes.h> #include <RakNetTypes.h>
namespace mwmp namespace mwmp
{ {
class Networking; class Networking;
class WorldEvent : public BaseEvent class ObjectList : public BaseObjectList
{ {
public: public:
WorldEvent(); ObjectList();
virtual ~WorldEvent(); virtual ~ObjectList();
void reset(); void reset();
void addObject(WorldObject worldObject); void addObject(BaseObject baseObject);
WorldObject getWorldObject(const MWWorld::Ptr& ptr); BaseObject getBaseObject(const MWWorld::Ptr& ptr);
void addContainerItem(mwmp::WorldObject& worldObject, const MWWorld::Ptr& itemPtr, int actionCount); void addContainerItem(mwmp::BaseObject& baseObject, const MWWorld::Ptr& itemPtr, int actionCount);
void addEntireContainer(const MWWorld::Ptr& ptr); void addEntireContainer(const MWWorld::Ptr& ptr);
void editContainers(MWWorld::CellStore* cellStore); void editContainers(MWWorld::CellStore* cellStore);
@ -47,7 +47,7 @@ namespace mwmp
void playVideo(); void playVideo();
void addAllContainers(MWWorld::CellStore* cellStore); void addAllContainers(MWWorld::CellStore* cellStore);
void addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector<WorldObject>& requestObjects); void addRequestedContainers(MWWorld::CellStore* cellStore, const std::vector<BaseObject>& requestObjects);
void addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer = false); void addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer = false);
void addObjectSpawn(const MWWorld::Ptr& ptr); void addObjectSpawn(const MWWorld::Ptr& ptr);

@ -8,7 +8,7 @@
#include <components/openmw-mp/Log.hpp> #include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp> #include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
#include "../WorldEvent.hpp" #include "../ObjectList.hpp"
#include "../ActorList.hpp" #include "../ActorList.hpp"
#include "BaseClientPacketProcessor.hpp" #include "BaseClientPacketProcessor.hpp"

@ -1,7 +1,3 @@
//
// Created by koncord on 16.04.17.
//
#include "WorldProcessor.hpp" #include "WorldProcessor.hpp"
#include "../Main.hpp" #include "../Main.hpp"
#include "../Networking.hpp" #include "../Networking.hpp"
@ -11,15 +7,15 @@ using namespace mwmp;
template<class T> template<class T>
typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::processors; typename BasePacketProcessor<T>::processors_t BasePacketProcessor<T>::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); RakNet::BitStream bsIn(&packet.data[1], packet.length, false);
bsIn.Read(guid); bsIn.Read(guid);
event.guid = guid; objectList.guid = guid;
ObjectPacket *myPacket = Main::get().getNetworking()->getObjectPacket(packet.data[0]); ObjectPacket *myPacket = Main::get().getNetworking()->getObjectPacket(packet.data[0]);
myPacket->setEvent(&event); myPacket->setObjectList(&objectList);
myPacket->SetReadStream(&bsIn); myPacket->SetReadStream(&bsIn);
for (auto &processor: processors) for (auto &processor: processors)
@ -29,13 +25,13 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
myGuid = Main::get().getLocalPlayer()->guid; myGuid = Main::get().getLocalPlayer()->guid;
request = packet.length == myPacket->headerSize(); request = packet.length == myPacket->headerSize();
event.isValid = true; objectList.isValid = true;
if (!request && !processor.second->avoidReading) if (!request && !processor.second->avoidReading)
myPacket->Read(); myPacket->Read();
if (event.isValid) if (objectList.isValid)
processor.second->Do(*myPacket, event); processor.second->Do(*myPacket, objectList);
else else
LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_ERROR, "Received %s that failed integrity check and was ignored!", processor.second->strPacketID.c_str());

@ -8,7 +8,7 @@
#include <components/openmw-mp/Log.hpp> #include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Packets/Object/ObjectPacket.hpp> #include <components/openmw-mp/Packets/Object/ObjectPacket.hpp>
#include "../WorldEvent.hpp" #include "../ObjectList.hpp"
#include "../LocalPlayer.hpp" #include "../LocalPlayer.hpp"
#include "../DedicatedPlayer.hpp" #include "../DedicatedPlayer.hpp"
#include "BaseClientPacketProcessor.hpp" #include "BaseClientPacketProcessor.hpp"
@ -18,9 +18,9 @@ namespace mwmp
class WorldProcessor : public BasePacketProcessor<WorldProcessor>, public BaseClientPacketProcessor class WorldProcessor : public BasePacketProcessor<WorldProcessor>, public BaseClientPacketProcessor
{ {
public: 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);
}; };
} }

@ -15,13 +15,13 @@ namespace mwmp
class BaseObjectProcessor : public WorldProcessor class BaseObjectProcessor : public WorldProcessor
{ {
public: 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; 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: protected:
MWWorld::CellStore *ptrCellStore; MWWorld::CellStore *ptrCellStore;

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_CONSOLE_COMMAND) 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);
} }
}; };
} }

@ -13,43 +13,43 @@ namespace mwmp
BPP_INIT(ID_CONTAINER) 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 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", 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()); objectList.cell.getDescription().c_str());
event.reset(); objectList.reset();
event.cell = *ptrCellStore->getCell(); objectList.cell = *ptrCellStore->getCell();
event.action = mwmp::BaseEvent::SET; objectList.action = mwmp::BaseObjectList::SET;
event.addAllContainers(ptrCellStore); objectList.addAllContainers(ptrCellStore);
event.sendContainer(); objectList.sendContainer();
} }
else else
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", event.worldObjectCount, event.worldObjectCount == 1 ? "object" : "objects"); LOG_APPEND(Log::LOG_VERBOSE, "- Request was for %i %s", objectList.baseObjectCount, objectList.baseObjectCount == 1 ? "object" : "objects");
std::vector<WorldObject> requestObjects = event.worldObjects; std::vector<BaseObject> requestObjects = objectList.baseObjects;
event.reset(); objectList.reset();
event.cell = *ptrCellStore->getCell(); objectList.cell = *ptrCellStore->getCell();
event.action = mwmp::BaseEvent::SET; objectList.action = mwmp::BaseObjectList::SET;
event.addRequestedContainers(ptrCellStore, requestObjects); objectList.addRequestedContainers(ptrCellStore, requestObjects);
if (event.worldObjects.size() > 0) if (objectList.baseObjects.size() > 0)
event.sendContainer(); objectList.sendContainer();
} }
} }
// Otherwise, edit containers based on the information received // Otherwise, edit containers based on the information received
else else
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet", event.worldObjectCount); LOG_APPEND(Log::LOG_VERBOSE, "- Editing container contents to match those of packet", objectList.baseObjectCount);
event.editContainers(ptrCellStore); objectList.editContainers(ptrCellStore);
} }
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_DOOR_DESTINATION) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_DOOR_STATE) 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);
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_MUSIC_PLAY) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playMusic(); objectList.playMusic();
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_ANIM_PLAY) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_ATTACH) 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);
} }
}; };

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_COLLISION) 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);
} }
}; };

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_DELETE) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_LOCK) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_MOVE) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_PLACE) 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);
} }
}; };

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_RESET) 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);
} }
}; };

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_ROTATE) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_SCALE) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_SPAWN) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_STATE) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_OBJECT_TRAP) 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);
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_GLOBAL_FLOAT) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
//event.setGlobalFloats(); //objectList.setGlobalFloats();
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_GLOBAL_SHORT) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setGlobalShorts(); objectList.setGlobalShorts();
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_LOCAL_FLOAT) 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);
} }
}; };
} }

@ -13,11 +13,11 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_LOCAL_SHORT) 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);
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_MEMBER_FLOAT) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
//event.setMemberFloats(); //objectList.setMemberFloats();
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_SCRIPT_MEMBER_SHORT) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setMemberShorts(); objectList.setMemberShorts();
} }
}; };
} }

@ -13,10 +13,10 @@ namespace mwmp
BPP_INIT(ID_VIDEO_PLAY) 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()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playVideo(); objectList.playVideo();
} }
}; };
} }

@ -10,7 +10,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -82,10 +82,10 @@ namespace MWScript
*/ */
if (mwmp::Main::isValidPacketScript(ptr.getClass().getScript(ptr))) if (mwmp::Main::isValidPacketScript(ptr.getClass().getScript(ptr)))
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectAnimPlay(ptr, group, mode); objectList->addObjectAnimPlay(ptr, group, mode);
worldEvent->sendObjectAnimPlay(); objectList->sendObjectAnimPlay();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -19,7 +19,7 @@
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -211,10 +211,10 @@ namespace MWScript
*/ */
if (sendPackets) if (sendPackets)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addScriptLocalShort(mReference, index, value); objectList->addScriptLocalShort(mReference, index, value);
worldEvent->sendScriptLocalShort(); objectList->sendScriptLocalShort();
} }
/* /*
End of tes3mp addition End of tes3mp addition
@ -245,10 +245,10 @@ namespace MWScript
*/ */
if (sendPackets && value == (int) value) if (sendPackets && value == (int) value)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addScriptLocalFloat(mReference, index, value); objectList->addScriptLocalFloat(mReference, index, value);
worldEvent->sendScriptLocalFloat(); objectList->sendScriptLocalFloat();
} }
/* /*
End of tes3mp addition End of tes3mp addition
@ -304,10 +304,10 @@ namespace MWScript
*/ */
if (sendPackets) if (sendPackets)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addScriptGlobalShort(name, value); objectList->addScriptGlobalShort(name, value);
worldEvent->sendScriptGlobalShort(); objectList->sendScriptGlobalShort();
} }
/* /*
End of tes3mp addition End of tes3mp addition
@ -594,10 +594,10 @@ namespace MWScript
{ {
if (ref.isInCell() && !ref.getRefData().isEnabled()) if (ref.isInCell() && !ref.getRefData().isEnabled())
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectState(ref, true); objectList->addObjectState(ref, true);
worldEvent->sendObjectState(); objectList->sendObjectState();
} }
} }
/* /*
@ -622,10 +622,10 @@ namespace MWScript
{ {
if (ref.isInCell() && ref.getRefData().isEnabled()) if (ref.isInCell() && ref.getRefData().isEnabled())
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectState(ref, false); objectList->addObjectState(ref, false);
worldEvent->sendObjectState(); objectList->sendObjectState();
} }
} }
/* /*
@ -685,10 +685,10 @@ namespace MWScript
*/ */
if (sendPackets && !global) if (sendPackets && !global)
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addScriptMemberShort(id, index, value); objectList->addScriptMemberShort(id, index, value);
worldEvent->sendScriptMemberShort(); objectList->sendScriptMemberShort();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -9,7 +9,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -103,10 +103,10 @@ namespace MWScript
Send an ID_VIDEO_PLAY packet every time a video is played Send an ID_VIDEO_PLAY packet every time a video is played
through a script through a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addVideoPlay(name, allowSkipping); objectList->addVideoPlay(name, allowSkipping);
worldEvent->sendVideoPlay(); objectList->sendVideoPlay();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -213,10 +213,10 @@ namespace MWScript
Send an ID_OBJECT_LOCK packet every time an object is locked Send an ID_OBJECT_LOCK packet every time an object is locked
through a script through a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(ptr, lockLevel); objectList->addObjectLock(ptr, lockLevel);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -253,10 +253,10 @@ namespace MWScript
Send an ID_OBJECT_LOCK packet every time an object is unlocked Send an ID_OBJECT_LOCK packet every time an object is unlocked
through a script through a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectLock(ptr, 0); objectList->addObjectLock(ptr, 0);
worldEvent->sendObjectLock(); objectList->sendObjectLock();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -733,10 +733,10 @@ namespace MWScript
Send an ID_OBJECT_DELETE packet every time an object is deleted Send an ID_OBJECT_DELETE packet every time an object is deleted
through a script through a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(ptr); objectList->addObjectDelete(ptr);
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -87,10 +87,10 @@ namespace MWScript
Send an ID_MUSIC_PLAY packet every time new music is streamed through Send an ID_MUSIC_PLAY packet every time new music is streamed through
a script a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addMusicPlay(sound); objectList->addMusicPlay(sound);
worldEvent->sendMusicPlay(); objectList->sendMusicPlay();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -10,7 +10,7 @@
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/PlayerList.hpp" #include "../mwmp/PlayerList.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -74,10 +74,10 @@ namespace MWScript
return; return;
else else
{ {
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectScale(ptr, scale); objectList->addObjectScale(ptr, scale);
worldEvent->sendObjectScale(); objectList->sendObjectScale();
} }
} }
/* /*
@ -582,18 +582,18 @@ namespace MWScript
Send an ID_OBJECT_PLACE or ID_OBJECT_SPAWN packet every time an object is placed Send an ID_OBJECT_PLACE or ID_OBJECT_SPAWN packet every time an object is placed
in the world through a script in the world through a script
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
if (ptr.getClass().isActor()) if (ptr.getClass().isActor())
{ {
worldEvent->addObjectSpawn(ptr); objectList->addObjectSpawn(ptr);
worldEvent->sendObjectSpawn(); objectList->sendObjectSpawn();
} }
else else
{ {
worldEvent->addObjectPlace(ptr); objectList->addObjectPlace(ptr);
worldEvent->sendObjectPlace(); objectList->sendObjectPlace();
} }
/* /*
End of tes3mp addition End of tes3mp addition

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/LocalPlayer.hpp" #include "../mwmp/LocalPlayer.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
@ -40,10 +40,10 @@ namespace MWWorld
Send an ID_PLAYER_INVENTORY packet as well because of the item thus gained Send an ID_PLAYER_INVENTORY packet as well because of the item thus gained
by the player by the player
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectDelete(getTarget()); objectList->addObjectDelete(getTarget());
worldEvent->sendObjectDelete(); objectList->sendObjectDelete();
mwmp::Main::get().getLocalPlayer()->sendInventory(); mwmp::Main::get().getLocalPlayer()->sendInventory();
/* /*
End of tes3mp addition End of tes3mp addition

@ -7,7 +7,7 @@
*/ */
#include "../mwmp/Main.hpp" #include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp" #include "../mwmp/Networking.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -48,8 +48,8 @@ namespace MWWorld
Send an ID_OBJECT_TRAP packet every time a trap is triggered Send an ID_OBJECT_TRAP packet every time a trap is triggered
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
ESM::Position pos; ESM::Position pos;
@ -58,8 +58,8 @@ namespace MWWorld
else else
pos = actor.getRefData().getPosition(); pos = actor.getRefData().getPosition();
worldEvent->addObjectTrap(mTrapSource, pos, false); objectList->addObjectTrap(mTrapSource, pos, false);
worldEvent->sendObjectTrap(); objectList->sendObjectTrap();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -17,7 +17,7 @@
#include "../mwmp/DedicatedPlayer.hpp" #include "../mwmp/DedicatedPlayer.hpp"
#include "../mwmp/LocalActor.hpp" #include "../mwmp/LocalActor.hpp"
#include "../mwmp/DedicatedActor.hpp" #include "../mwmp/DedicatedActor.hpp"
#include "../mwmp/WorldEvent.hpp" #include "../mwmp/ObjectList.hpp"
#include "../mwmp/CellController.hpp" #include "../mwmp/CellController.hpp"
/* /*
End of tes3mp addition End of tes3mp addition
@ -2421,10 +2421,10 @@ namespace MWWorld
Send an ID_DOOR_STATE packet every time a door is activated Send an ID_DOOR_STATE packet every time a door is activated
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addDoorState(door, state); objectList->addDoorState(door, state);
worldEvent->sendDoorState(); objectList->sendDoorState();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -2440,10 +2440,10 @@ namespace MWWorld
Send an ID_DOOR_STATE packet every time a door is activated Send an ID_DOOR_STATE packet every time a door is activated
*/ */
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addDoorState(door, state); objectList->addDoorState(door, state);
worldEvent->sendDoorState(); objectList->sendDoorState();
/* /*
End of tes3mp addition End of tes3mp addition
*/ */
@ -3484,10 +3484,10 @@ namespace MWWorld
*/ */
MWWorld::Ptr ptr = safePlaceObject(ref.getPtr(), getPlayerPtr(), getPlayerPtr().getCell(), 0, 220.f); MWWorld::Ptr ptr = safePlaceObject(ref.getPtr(), getPlayerPtr(), getPlayerPtr().getCell(), 0, 220.f);
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
worldEvent->reset(); objectList->reset();
worldEvent->addObjectSpawn(ptr); objectList->addObjectSpawn(ptr);
worldEvent->sendObjectSpawn(); objectList->sendObjectSpawn();
deleteObject(ptr); deleteObject(ptr);
/* /*

@ -150,7 +150,7 @@ add_component_dir (openmw-mp
) )
add_component_dir (openmw-mp/Base add_component_dir (openmw-mp/Base
BaseActor BaseEvent BasePacketProcessor BasePlayer BaseStructs BaseActor BaseObjectList BasePacketProcessor BasePlayer BaseStructs
) )
add_component_dir (openmw-mp/Controllers add_component_dir (openmw-mp/Controllers

@ -22,7 +22,7 @@ namespace mwmp
} }
}; };
struct WorldObject struct BaseObject
{ {
std::string refId; std::string refId;
int refNumIndex; int refNumIndex;
@ -63,20 +63,20 @@ namespace mwmp
std::vector<ContainerItem> containerItems; std::vector<ContainerItem> containerItems;
unsigned int containerItemCount; 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; bool isPlayer;
}; };
class BaseEvent class BaseObjectList
{ {
public: public:
BaseEvent(RakNet::RakNetGUID guid) : guid(guid) BaseObjectList(RakNet::RakNetGUID guid) : guid(guid)
{ {
} }
BaseEvent() BaseObjectList()
{ {
} }
@ -99,8 +99,8 @@ namespace mwmp
RakNet::RakNetGUID guid; RakNet::RakNetGUID guid;
std::vector<WorldObject> worldObjects; std::vector<BaseObject> baseObjects;
unsigned int worldObjectCount; unsigned int baseObjectCount;
ESM::Cell cell; ESM::Cell cell;
std::string consoleCommand; std::string consoleCommand;

@ -20,10 +20,10 @@ ObjectPacket::~ObjectPacket()
} }
void ObjectPacket::setEvent(BaseEvent *event) void ObjectPacket::setObjectList(BaseObjectList *objectList)
{ {
this->event = event; this->objectList = objectList;
guid = event->guid; guid = objectList->guid;
} }
void ObjectPacket::Packet(RakNet::BitStream *bs, bool send) void ObjectPacket::Packet(RakNet::BitStream *bs, bool send)
@ -31,16 +31,16 @@ void ObjectPacket::Packet(RakNet::BitStream *bs, bool send)
if (!PacketHeader(bs, send)) if (!PacketHeader(bs, send))
return; return;
WorldObject worldObject; BaseObject baseObject;
for (unsigned int i = 0; i < event->worldObjectCount; i++) for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
{ {
if (send) if (send)
worldObject = event->worldObjects.at(i); baseObject = objectList->baseObjects.at(i);
Object(worldObject, send); Object(baseObject, send);
if (!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); BasePacket::Packet(bs, send);
if (send) if (send)
event->worldObjectCount = (unsigned int)(event->worldObjects.size()); objectList->baseObjectCount = (unsigned int)(objectList->baseObjects.size());
else 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; return false;
} }
if (hasCellData) if (hasCellData)
{ {
RW(event->cell.mData, send, 1); RW(objectList->cell.mData, send, 1);
RW(event->cell.mName, send, 1); RW(objectList->cell.mName, send, 1);
} }
return true; return true;
} }
void ObjectPacket::Object(WorldObject &worldObject, bool send) void ObjectPacket::Object(BaseObject &baseObject, bool send)
{ {
RW(worldObject.refId, send); RW(baseObject.refId, send);
RW(worldObject.refNumIndex, send); RW(baseObject.refNumIndex, send);
RW(worldObject.mpNum, send); RW(baseObject.mpNum, send);
} }

@ -5,7 +5,7 @@
#include <RakNetTypes.h> #include <RakNetTypes.h>
#include <BitStream.h> #include <BitStream.h>
#include <PacketPriority.h> #include <PacketPriority.h>
#include <components/openmw-mp/Base/BaseEvent.hpp> #include <components/openmw-mp/Base/BaseObject.hpp>
#include <components/openmw-mp/Packets/BasePacket.hpp> #include <components/openmw-mp/Packets/BasePacket.hpp>
@ -19,14 +19,14 @@ namespace mwmp
~ObjectPacket(); ~ObjectPacket();
void setEvent(BaseEvent *event); void setObjectList(BaseObjectList *objectList);
virtual void Packet(RakNet::BitStream *bs, bool send); virtual void Packet(RakNet::BitStream *bs, bool send);
protected: protected:
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
bool PacketHeader(RakNet::BitStream *bs, bool send); bool PacketHeader(RakNet::BitStream *bs, bool send);
BaseEvent *event; BaseObjectList *objectList;
static const int maxObjects = 3000; static const int maxObjects = 3000;
bool hasCellData; bool hasCellData;
}; };

@ -13,22 +13,22 @@ void PacketConsoleCommand::Packet(RakNet::BitStream *bs, bool send)
if (!PacketHeader(bs, send)) if (!PacketHeader(bs, send))
return; return;
RW(event->consoleCommand, send); RW(objectList->consoleCommand, send);
WorldObject worldObject; BaseObject baseObject;
for (unsigned int i = 0; i < event->worldObjectCount; i++) for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
{ {
if (send) if (send)
worldObject = event->worldObjects.at(i); baseObject = objectList->baseObjects.at(i);
RW(worldObject.isPlayer, send); RW(baseObject.isPlayer, send);
if (worldObject.isPlayer) if (baseObject.isPlayer)
RW(worldObject.guid, send); RW(baseObject.guid, send);
else else
Object(worldObject, send); Object(baseObject, send);
if (!send) if (!send)
event->worldObjects.push_back(worldObject); objectList->baseObjects.push_back(baseObject);
} }
} }

@ -15,36 +15,36 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
if (!PacketHeader(bs, send)) if (!PacketHeader(bs, send))
return; return;
RW(event->action, send); RW(objectList->action, send);
RW(event->containerSubAction, send); RW(objectList->containerSubAction, send);
WorldObject worldObject; BaseObject baseObject;
for (unsigned int i = 0; i < event->worldObjectCount; i++) for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->worldObjects.at(i); baseObject = objectList->baseObjects.at(i);
worldObject.containerItemCount = (unsigned int) (worldObject.containerItems.size()); baseObject.containerItemCount = (unsigned int) (baseObject.containerItems.size());
} }
else 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; return;
} }
ContainerItem containerItem; ContainerItem containerItem;
for (unsigned int j = 0; j < worldObject.containerItemCount; j++) for (unsigned int j = 0; j < baseObject.containerItemCount; j++)
{ {
if (send) if (send)
containerItem = worldObject.containerItems.at(j); containerItem = baseObject.containerItems.at(j);
RW(containerItem.refId, send); RW(containerItem.refId, send);
RW(containerItem.count, send); RW(containerItem.count, send);
@ -53,9 +53,9 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
RW(containerItem.actionCount, send); RW(containerItem.actionCount, send);
if (!send) if (!send)
worldObject.containerItems.push_back(containerItem); baseObject.containerItems.push_back(containerItem);
} }
if (!send) if (!send)
event->worldObjects.push_back(worldObject); objectList->baseObjects.push_back(baseObject);
} }
} }

@ -9,19 +9,19 @@ PacketDoorDestination::PacketDoorDestination(RakNet::RakPeerInterface *peer) : O
hasCellData = true; 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(baseObject.destinationCell.mData, send, 1);
RW(worldObject.destinationCell.mName, send, 1); RW(baseObject.destinationCell.mName, send, 1);
RW(worldObject.destinationPosition.pos, send, 1); RW(baseObject.destinationPosition.pos, send, 1);
RW(worldObject.destinationPosition.rot[0], send, 1); RW(baseObject.destinationPosition.rot[0], send, 1);
RW(worldObject.destinationPosition.rot[2], send, 1); RW(baseObject.destinationPosition.rot[2], send, 1);
} }
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketDoorDestination(RakNet::RakPeerInterface *peer); PacketDoorDestination(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketDoorState::PacketDoorState(RakNet::RakPeerInterface *peer) : ObjectPacket(
hasCellData = true; hasCellData = true;
} }
void PacketDoorState::Object(WorldObject &worldObject, bool send) void PacketDoorState::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.doorState, send); RW(baseObject.doorState, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketDoorState(RakNet::RakPeerInterface *peer); PacketDoorState(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketMusicPlay::PacketMusicPlay(RakNet::RakPeerInterface *peer) : ObjectPacket(
packetID = ID_MUSIC_PLAY; 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);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketMusicPlay(RakNet::RakPeerInterface *peer); PacketMusicPlay(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,9 +9,9 @@ PacketObjectAnimPlay::PacketObjectAnimPlay(RakNet::RakPeerInterface *peer) : Obj
hasCellData = true; hasCellData = true;
} }
void PacketObjectAnimPlay::Object(WorldObject &worldObject, bool send) void PacketObjectAnimPlay::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.animGroup, send); RW(baseObject.animGroup, send);
RW(worldObject.animMode, send); RW(baseObject.animMode, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectAnimPlay(RakNet::RakPeerInterface *peer); PacketObjectAnimPlay(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectAttach::PacketObjectAttach(RakNet::RakPeerInterface *peer) : ObjectP
hasCellData = true; 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 // Placeholder
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectAttach(RakNet::RakPeerInterface *peer); PacketObjectAttach(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectCollision::PacketObjectCollision(RakNet::RakPeerInterface *peer) : O
hasCellData = true; 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 // Placeholder
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectCollision(RakNet::RakPeerInterface *peer); PacketObjectCollision(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectLock::PacketObjectLock(RakNet::RakPeerInterface *peer) : ObjectPacke
hasCellData = true; hasCellData = true;
} }
void PacketObjectLock::Object(WorldObject &worldObject, bool send) void PacketObjectLock::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.lockLevel, send); RW(baseObject.lockLevel, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectLock(RakNet::RakPeerInterface *peer); PacketObjectLock(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectMove::PacketObjectMove(RakNet::RakPeerInterface *peer) : ObjectPacke
hasCellData = true; hasCellData = true;
} }
void PacketObjectMove::Object(WorldObject &worldObject, bool send) void PacketObjectMove::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.position.pos, send); RW(baseObject.position.pos, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectMove(RakNet::RakPeerInterface *peer); PacketObjectMove(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,13 +9,13 @@ PacketObjectPlace::PacketObjectPlace(RakNet::RakPeerInterface *peer) : ObjectPac
hasCellData = true; hasCellData = true;
} }
void PacketObjectPlace::Object(WorldObject &worldObject, bool send) void PacketObjectPlace::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.count, send); RW(baseObject.count, send);
RW(worldObject.charge, send); RW(baseObject.charge, send);
RW(worldObject.enchantmentCharge, send); RW(baseObject.enchantmentCharge, send);
RW(worldObject.goldValue, send); RW(baseObject.goldValue, send);
RW(worldObject.position, send); RW(baseObject.position, send);
RW(worldObject.droppedByPlayer, send); RW(baseObject.droppedByPlayer, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectPlace(RakNet::RakPeerInterface *peer); PacketObjectPlace(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectReset::PacketObjectReset(RakNet::RakPeerInterface *peer) : ObjectPac
hasCellData = true; 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 // Placeholder
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectReset(RakNet::RakPeerInterface *peer); PacketObjectReset(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,10 +9,10 @@ PacketObjectRotate::PacketObjectRotate(RakNet::RakPeerInterface *peer) : ObjectP
hasCellData = true; hasCellData = true;
} }
void PacketObjectRotate::Object(WorldObject &worldObject, bool send) void PacketObjectRotate::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.position.rot[0], send); RW(baseObject.position.rot[0], send);
RW(worldObject.position.rot[1], send); RW(baseObject.position.rot[1], send);
RW(worldObject.position.rot[2], send); RW(baseObject.position.rot[2], send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectRotate(RakNet::RakPeerInterface *peer); PacketObjectRotate(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

@ -9,8 +9,8 @@ PacketObjectScale::PacketObjectScale(RakNet::RakPeerInterface *peer) : ObjectPac
hasCellData = true; hasCellData = true;
} }
void PacketObjectScale::Object(WorldObject &worldObject, bool send) void PacketObjectScale::Object(BaseObject &baseObject, bool send)
{ {
ObjectPacket::Object(worldObject, send); ObjectPacket::Object(baseObject, send);
RW(worldObject.scale, send); RW(baseObject.scale, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectScale(RakNet::RakPeerInterface *peer); PacketObjectScale(RakNet::RakPeerInterface *peer);
virtual void Object(WorldObject &worldObject, bool send); virtual void Object(BaseObject &baseObject, bool send);
}; };
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save