1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 22:45:34 +00:00

Send Cell instead of CellId because of problems with the latter

This commit is contained in:
David Cernat 2016-10-22 20:09:13 +03:00
parent 103b1e3f72
commit 6e43baf73e
4 changed files with 15 additions and 7 deletions

View file

@ -633,7 +633,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
WorldPacket *myPacket = worldController.GetPacket(packet->data[0]);
WorldEvent *event = new WorldEvent(id);
MWWorld::CellStore *ptrCellStore = MWBase::Environment::get().getWorld()->getCell(event->cellId);
MWWorld::CellStore *ptrCellStore;
switch (packet->data[0])
{
@ -649,10 +649,17 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
{
myPacket->Packet(&bsIn, event, false);
if (event->cell.isExterior())
ptrCellStore = MWBase::Environment::get().getWorld()->getExterior(event->cell.mData.mX, event->cell.mData.mY);
else
ptrCellStore = MWBase::Environment::get().getWorld()->getInterior(event->cell.mName);
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_DELETE");
LOG_APPEND(Log::LOG_WARN, "- cellRefId: %s, %i",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum);
LOG_APPEND(Log::LOG_WARN, "- cell: %s",
event->cell.getDescription().c_str());
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);

View file

@ -26,7 +26,8 @@ namespace MWWorld
// Added by tes3mp
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
event->cellId = getTarget().getCell()->getCell()->getCellId();
event->cell = *getTarget().getCell()->getCell();
event->cellRef.mRefID = getTarget().getCellRef().getRefId();
event->cellRef.mRefNum = getTarget().getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_DELETE)->Send(event);

View file

@ -23,7 +23,7 @@ namespace mwmp
RakNet::RakNetGUID guid;
ESM::CellId cellId;
ESM::Cell cell;
ESM::CellRef cellRef;
};
}

View file

@ -15,8 +15,8 @@ void PacketObjectDelete::Packet(RakNet::BitStream *bs, WorldEvent *event, bool s
RW(event->cellRef.mRefID, send);
RW(event->cellRef.mRefNum, send);
RW(event->cellId.mPaged, send);
RW(event->cellId.mIndex.mX, send);
RW(event->cellId.mIndex.mY, send);
RW(event->cellId.mWorldspace, send);
RW(event->cell.mData.mFlags, send);
RW(event->cell.mCellId.mIndex.mX, send);
RW(event->cell.mCellId.mIndex.mY, send);
RW(event->cell.mName, send);
}