[General] Simplify structure of BaseEvent

0.6.1
David Cernat 8 years ago
parent 250c199188
commit 9d2c5c3502

@ -30,13 +30,13 @@ void WorldFunctions::InitiateEvent(unsigned short pid) noexcept
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
writeEvent.cell.blank(); writeEvent.cell.blank();
writeEvent.objectChanges.objects.clear(); writeEvent.worldObjects.clear();
writeEvent.guid = player->guid; writeEvent.guid = player->guid;
} }
unsigned int WorldFunctions::GetObjectChangesSize() noexcept unsigned int WorldFunctions::GetObjectChangesSize() noexcept
{ {
return readEvent->objectChanges.count; return readEvent->worldObjectCount;
} }
unsigned char WorldFunctions::GetEventAction() noexcept unsigned char WorldFunctions::GetEventAction() noexcept
@ -46,106 +46,106 @@ unsigned char WorldFunctions::GetEventAction() noexcept
const char *WorldFunctions::GetObjectRefId(unsigned int i) noexcept const char *WorldFunctions::GetObjectRefId(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).refId.c_str(); return readEvent->worldObjects.at(i).refId.c_str();
} }
int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).refNumIndex; return readEvent->worldObjects.at(i).refNumIndex;
} }
int WorldFunctions::GetObjectMpNum(unsigned int i) noexcept int WorldFunctions::GetObjectMpNum(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).mpNum; return readEvent->worldObjects.at(i).mpNum;
} }
int WorldFunctions::GetObjectCount(unsigned int i) noexcept int WorldFunctions::GetObjectCount(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).count; return readEvent->worldObjects.at(i).count;
} }
int WorldFunctions::GetObjectCharge(unsigned int i) noexcept int WorldFunctions::GetObjectCharge(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).charge; return readEvent->worldObjects.at(i).charge;
} }
int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).goldValue; return readEvent->worldObjects.at(i).goldValue;
} }
double WorldFunctions::GetObjectScale(unsigned int i) noexcept double WorldFunctions::GetObjectScale(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).scale; return readEvent->worldObjects.at(i).scale;
} }
int WorldFunctions::GetObjectDoorState(unsigned int i) noexcept int WorldFunctions::GetObjectDoorState(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).doorState; return readEvent->worldObjects.at(i).doorState;
} }
int WorldFunctions::GetObjectLockLevel(unsigned int i) noexcept int WorldFunctions::GetObjectLockLevel(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).lockLevel; return readEvent->worldObjects.at(i).lockLevel;
} }
double WorldFunctions::GetObjectPosX(unsigned int i) noexcept double WorldFunctions::GetObjectPosX(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.pos[0]; return readEvent->worldObjects.at(i).position.pos[0];
} }
double WorldFunctions::GetObjectPosY(unsigned int i) noexcept double WorldFunctions::GetObjectPosY(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.pos[1]; return readEvent->worldObjects.at(i).position.pos[1];
} }
double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.pos[2]; return readEvent->worldObjects.at(i).position.pos[2];
} }
double WorldFunctions::GetObjectRotX(unsigned int i) noexcept double WorldFunctions::GetObjectRotX(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.rot[0]; return readEvent->worldObjects.at(i).position.rot[0];
} }
double WorldFunctions::GetObjectRotY(unsigned int i) noexcept double WorldFunctions::GetObjectRotY(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.rot[1]; return readEvent->worldObjects.at(i).position.rot[1];
} }
double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept
{ {
return readEvent->objectChanges.objects.at(i).position.rot[2]; return readEvent->worldObjects.at(i).position.rot[2];
} }
unsigned int WorldFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept unsigned int WorldFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept
{ {
return readEvent->objectChanges.objects.at(objectIndex).containerChanges.count; return readEvent->worldObjects.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->objectChanges.objects.at(objectIndex) return readEvent->worldObjects.at(objectIndex)
.containerChanges.items.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->objectChanges.objects.at(objectIndex) return readEvent->worldObjects.at(objectIndex)
.containerChanges.items.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->objectChanges.objects.at(objectIndex) return readEvent->worldObjects.at(objectIndex)
.containerChanges.items.at(itemIndex).charge; .containerItems.at(itemIndex).charge;
} }
int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept int WorldFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex) noexcept
{ {
return readEvent->objectChanges.objects.at(objectIndex) return readEvent->worldObjects.at(objectIndex)
.containerChanges.items.at(itemIndex).actionCount; .containerItems.at(itemIndex).actionCount;
} }
void WorldFunctions::SetEventCell(const char* cellDescription) noexcept void WorldFunctions::SetEventCell(const char* cellDescription) noexcept
@ -234,14 +234,14 @@ void WorldFunctions::SetContainerItemCharge(int charge) noexcept
void WorldFunctions::AddWorldObject() noexcept void WorldFunctions::AddWorldObject() noexcept
{ {
writeEvent.objectChanges.objects.push_back(tempWorldObject); writeEvent.worldObjects.push_back(tempWorldObject);
tempWorldObject = emptyWorldObject; tempWorldObject = emptyWorldObject;
} }
void WorldFunctions::AddContainerItem() noexcept void WorldFunctions::AddContainerItem() noexcept
{ {
tempWorldObject.containerChanges.items.push_back(tempContainerItem); tempWorldObject.containerItems.push_back(tempContainerItem);
tempContainerItem = emptyContainerItem; tempContainerItem = emptyContainerItem;
} }

@ -29,7 +29,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept
{ {
// Clear our BaseEvent before loading new data in it // Clear our BaseEvent before loading new data in it
event.cell.blank(); event.cell.blank();
event.objectChanges.objects.clear(); event.worldObjects.clear();
event.guid = packet.guid; event.guid = packet.guid;
for (auto &processor : processors) for (auto &processor : processors)

@ -25,7 +25,7 @@ namespace mwmp
// Until we have a timestamp-based system, send packets pertaining to more // Until we have a timestamp-based system, send packets pertaining to more
// than one container (i.e. replies to server requests for container contents) // than one container (i.e. replies to server requests for container contents)
// only to players who have the container's cell loaded // only to players who have the container's cell loaded
if (event.action == BaseEvent::SET && event.objectChanges.count > 1) if (event.action == BaseEvent::SET && event.worldObjectCount > 1)
{ {
Cell *serverCell = CellController::get()->getCell(&event.cell); Cell *serverCell = CellController::get()->getCell(&event.cell);

@ -22,9 +22,9 @@ namespace mwmp
{ {
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.objectChanges.count; i++) for (unsigned int i = 0; i < event.worldObjectCount; i++)
{ {
event.objectChanges.objects.at(i).mpNum = mwmp::Networking::getPtr()->incrementMpNum(); event.worldObjects.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,

@ -133,7 +133,7 @@ namespace MWGui
containerItem.charge = itemPtr.getCellRef().getCharge(); containerItem.charge = itemPtr.getCellRef().getCharge();
containerItem.actionCount = count; containerItem.actionCount = count;
worldObject.containerChanges.items.push_back(containerItem); worldObject.containerItems.push_back(containerItem);
worldEvent->addObject(worldObject); worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent); mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);
@ -197,7 +197,7 @@ namespace MWGui
containerItem.charge = itemPtr.getCellRef().getCharge(); containerItem.charge = itemPtr.getCellRef().getCharge();
worldObject.containerChanges.items.push_back(containerItem); worldObject.containerItems.push_back(containerItem);
worldEvent->addObject(worldObject); worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent); mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);

@ -38,22 +38,22 @@ Networking *WorldEvent::getNetworking()
void WorldEvent::reset() void WorldEvent::reset()
{ {
cell.blank(); cell.blank();
objectChanges.objects.clear(); worldObjects.clear();
guid = mwmp::Main::get().getNetworking()->getLocalPlayer()->guid; guid = mwmp::Main::get().getNetworking()->getLocalPlayer()->guid;
} }
void WorldEvent::addObject(WorldObject worldObject) void WorldEvent::addObject(WorldObject worldObject)
{ {
objectChanges.objects.push_back(worldObject); worldObjects.push_back(worldObject);
} }
void WorldEvent::editContainers(MWWorld::CellStore* cellStore) void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -70,9 +70,9 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
if (action == BaseEvent::SET) if (action == BaseEvent::SET)
containerStore.clear(); containerStore.clear();
for (unsigned int i = 0; i < worldObject.containerChanges.count; i++) for (unsigned int i = 0; i < worldObject.containerItemCount; i++)
{ {
ContainerItem containerItem = worldObject.containerChanges.items.at(i); ContainerItem containerItem = worldObject.containerItems.at(i);
MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (action == BaseEvent::ADD || action == BaseEvent::SET) if (action == BaseEvent::ADD || action == BaseEvent::SET)
@ -127,9 +127,9 @@ void WorldEvent::placeObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- charge: %i\n- count: %i", worldObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- charge: %i\n- count: %i", worldObject.refId.c_str(),
worldObject.refNumIndex, worldObject.mpNum, worldObject.charge, worldObject.count); worldObject.refNumIndex, worldObject.mpNum, worldObject.charge, worldObject.count);
@ -154,9 +154,9 @@ void WorldEvent::deleteObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -176,9 +176,9 @@ void WorldEvent::lockObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -198,9 +198,9 @@ void WorldEvent::unlockObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -220,9 +220,9 @@ void WorldEvent::scaleObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- scale: %f", worldObject.refId.c_str(), worldObject.refNumIndex, LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- scale: %f", worldObject.refId.c_str(), worldObject.refNumIndex,
worldObject.mpNum, worldObject.scale); worldObject.mpNum, worldObject.scale);
@ -243,9 +243,9 @@ void WorldEvent::moveObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -266,9 +266,9 @@ void WorldEvent::rotateObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -289,9 +289,9 @@ void WorldEvent::animateObjects(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -313,9 +313,9 @@ void WorldEvent::activateDoors(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.mpNum);
@ -336,9 +336,9 @@ void WorldEvent::setLocalShorts(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- shortVal: %i", worldObject.refId.c_str(),
worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.shortVal); worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.shortVal);
@ -359,9 +359,9 @@ void WorldEvent::setLocalFloats(MWWorld::CellStore* cellStore)
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i\n- index: %i\n- floatVal: %f", worldObject.refId.c_str(),
worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.floatVal); worldObject.refNumIndex, worldObject.mpNum, worldObject.index, worldObject.floatVal);
@ -382,9 +382,9 @@ void WorldEvent::setMemberShorts()
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s\n- index: %i\n- shortVal: %i\n", worldObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s\n- index: %i\n- shortVal: %i\n", worldObject.refId.c_str(),
worldObject.index, worldObject.shortVal); worldObject.index, worldObject.shortVal);
@ -411,9 +411,9 @@ void WorldEvent::setGlobalShorts()
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s\n- shortVal: %i", worldObject.varName.c_str(), worldObject.shortVal); LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s\n- shortVal: %i", worldObject.varName.c_str(), worldObject.shortVal);
@ -425,9 +425,9 @@ void WorldEvent::playMusic()
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s", worldObject.filename.c_str()); LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s", worldObject.filename.c_str());
@ -439,9 +439,9 @@ void WorldEvent::playVideo()
{ {
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < objectChanges.count; i++) for (unsigned int i = 0; i < worldObjectCount; i++)
{ {
worldObject = objectChanges.objects.at(i); worldObject = worldObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s\n- allowSkipping: %s", worldObject.filename.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- filename: %s\n- allowSkipping: %s", worldObject.filename.c_str(),
worldObject.allowSkipping ? "true" : "false"); worldObject.allowSkipping ? "true" : "false");
@ -607,7 +607,7 @@ void WorldEvent::sendObjectPlace()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -653,7 +653,7 @@ void WorldEvent::sendDoorState()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -681,7 +681,7 @@ void WorldEvent::sendScriptLocalShort()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -697,7 +697,7 @@ void WorldEvent::sendScriptLocalFloat()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT about %s", cell.getDescription().c_str());
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -713,7 +713,7 @@ void WorldEvent::sendScriptMemberShort()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT"); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT");
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -729,7 +729,7 @@ void WorldEvent::sendScriptGlobalShort()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT"); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT");
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it) for (std::vector<mwmp::WorldObject>::iterator it = worldObjects.begin(); it != worldObjects.end(); ++it)
{ {
mwmp::WorldObject worldObject = (*it); mwmp::WorldObject worldObject = (*it);
@ -770,7 +770,7 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
containerItem.count = itemPtr.getRefData().getCount(); containerItem.count = itemPtr.getRefData().getCount();
containerItem.charge = itemPtr.getCellRef().getCharge(); containerItem.charge = itemPtr.getCellRef().getCharge();
worldObject.containerChanges.items.push_back(containerItem); worldObject.containerItems.push_back(containerItem);
} }
addObject(worldObject); addObject(worldObject);

@ -21,12 +21,6 @@ namespace mwmp
} }
}; };
struct ContainerChanges
{
std::vector<ContainerItem> items;
unsigned int count;
};
struct WorldObject struct WorldObject
{ {
std::string refId; std::string refId;
@ -53,13 +47,8 @@ namespace mwmp
float floatVal; float floatVal;
std::string varName; std::string varName;
ContainerChanges containerChanges; std::vector<ContainerItem> containerItems;
}; unsigned int containerItemCount;
struct ObjectChanges
{
std::vector<WorldObject> objects;
unsigned int count;
}; };
class BaseEvent class BaseEvent
@ -85,7 +74,9 @@ namespace mwmp
}; };
RakNet::RakNetGUID guid; RakNet::RakNetGUID guid;
ObjectChanges objectChanges;
std::vector<WorldObject> worldObjects;
unsigned int worldObjectCount;
ESM::Cell cell; ESM::Cell cell;

@ -16,14 +16,14 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
if (send) if (send)
{ {
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
} }
else else
{ {
event->objectChanges.objects.clear(); event->worldObjects.clear();
} }
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -32,30 +32,30 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
worldObject.containerChanges.count = (unsigned int)(worldObject.containerChanges.items.size()); worldObject.containerItemCount = (unsigned int)(worldObject.containerItems.size());
} }
else else
{ {
worldObject.containerChanges.items.clear(); worldObject.containerItems.clear();
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
RW(worldObject.refNumIndex, send); RW(worldObject.refNumIndex, send);
RW(worldObject.mpNum, send); RW(worldObject.mpNum, send);
RW(worldObject.containerChanges.count, send); RW(worldObject.containerItemCount, send);
ContainerItem containerItem; ContainerItem containerItem;
for (unsigned int i = 0; i < worldObject.containerChanges.count; i++) for (unsigned int i = 0; i < worldObject.containerItemCount; i++)
{ {
if (send) if (send)
{ {
containerItem = worldObject.containerChanges.items.at(i); containerItem = worldObject.containerItems.at(i);
} }
RW(containerItem.refId, send); RW(containerItem.refId, send);
@ -65,13 +65,13 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
worldObject.containerChanges.items.push_back(containerItem); worldObject.containerItems.push_back(containerItem);
} }
} }
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketDoorState::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketDoorState::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -40,7 +40,7 @@ void PacketDoorState::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,26 +13,26 @@ void PacketMusicPlay::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.filename, send); RW(worldObject.filename, send);
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -41,7 +41,7 @@ void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -39,7 +39,7 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectLock::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectLock::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -40,7 +40,7 @@ void PacketObjectLock::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectMove::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectMove::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -42,7 +42,7 @@ void PacketObjectMove::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -43,7 +43,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectRotate::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectRotate::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -42,7 +42,7 @@ void PacketObjectRotate::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectScale::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectScale::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -40,7 +40,7 @@ void PacketObjectScale::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketObjectUnlock::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketObjectUnlock::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -39,7 +39,7 @@ void PacketObjectUnlock::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,19 +13,19 @@ void PacketScriptGlobalShort::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.varName, send); RW(worldObject.varName, send);
@ -33,7 +33,7 @@ void PacketScriptGlobalShort::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -41,7 +41,7 @@ void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,11 +13,11 @@ void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
RW(event->cell.mData.mFlags, send); RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send); RW(event->cell.mData.mX, send);
@ -26,11 +26,11 @@ void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, bool send)
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -41,7 +41,7 @@ void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,19 +13,19 @@ void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.refId, send); RW(worldObject.refId, send);
@ -34,7 +34,7 @@ void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

@ -13,19 +13,19 @@ void PacketVideoPlay::Packet(RakNet::BitStream *bs, bool send)
WorldPacket::Packet(bs, send); WorldPacket::Packet(bs, send);
if (!send) if (!send)
event->objectChanges.objects.clear(); event->worldObjects.clear();
else else
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size()); event->worldObjectCount = (unsigned int)(event->worldObjects.size());
RW(event->objectChanges.count, send); RW(event->worldObjectCount, send);
WorldObject worldObject; WorldObject worldObject;
for (unsigned int i = 0; i < event->objectChanges.count; i++) for (unsigned int i = 0; i < event->worldObjectCount; i++)
{ {
if (send) if (send)
{ {
worldObject = event->objectChanges.objects.at(i); worldObject = event->worldObjects.at(i);
} }
RW(worldObject.filename, send); RW(worldObject.filename, send);
@ -33,7 +33,7 @@ void PacketVideoPlay::Packet(RakNet::BitStream *bs, bool send)
if (!send) if (!send)
{ {
event->objectChanges.objects.push_back(worldObject); event->worldObjects.push_back(worldObject);
} }
} }
} }

Loading…
Cancel
Save