Send cell coordinates in tes3mp using mData instead of mCellId.mIndex

pull/78/head
David Cernat 8 years ago
parent cbc132612a
commit 0a44bea91d

@ -393,13 +393,10 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
myPacket->Read(event);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %i, %i, %i, %s",
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.mData.mFlags,
event->cell.mCellId.mIndex.mX,
event->cell.mCellId.mIndex.mY,
event->cell.mName.c_str());
event->cell.getDescription().c_str());
myPacket->Send(event, true);

@ -108,8 +108,8 @@ void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexc
player->GetCell()->mData.mFlags &= ~ESM::Cell::Interior;
}
player->GetCell()->mCellId.mIndex.mX = x;
player->GetCell()->mCellId.mIndex.mY = y;
player->GetCell()->mData.mX = x;
player->GetCell()->mData.mY = y;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
}
@ -118,14 +118,14 @@ int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player,0);
return player->GetCell()->mCellId.mIndex.mX;
return player->GetCell()->mData.mX;
}
int TranslocationFunctions::GetExteriorY(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player,0);
return player->GetCell()->mCellId.mIndex.mY;
return player->GetCell()->mData.mY;
}
bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept

@ -427,7 +427,7 @@ void DedicatedPlayer::updateCell()
MWWorld::CellStore *cellStore;
if (cell.isExterior() == 1)
cellStore = world->getExterior(cell.mCellId.mIndex.mX, cell.mCellId.mIndex.mY);
cellStore = world->getExterior(cell.mData.mX, cell.mData.mY);
else if (!cell.mName.empty())
cellStore = world->getInterior(cell.mName);
// Go no further if cell data is invalid

@ -308,11 +308,11 @@ void LocalPlayer::updateCell(bool forceUpdate)
}
else if (ptrCell->isExterior())
{
if (ptrCell->mCellId.mIndex.mX != GetCell()->mCellId.mIndex.mX)
if (ptrCell->mData.mX != GetCell()->mData.mX)
{
shouldUpdate = true;
}
else if (ptrCell->mCellId.mIndex.mY != GetCell()->mCellId.mIndex.mY)
else if (ptrCell->mData.mY != GetCell()->mData.mY)
{
shouldUpdate = true;
}
@ -613,8 +613,8 @@ void LocalPlayer::setCell()
world->getPlayer().setTeleported(true);
int x = GetCell()->mCellId.mIndex.mX;
int y = GetCell()->mCellId.mIndex.mY;
int x = GetCell()->mData.mX;
int y = GetCell()->mData.mY;
if (GetCell()->isExterior())
{

@ -661,10 +661,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %i, %i, %i, %s",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.mData.mFlags,
event->cell.mCellId.mIndex.mX,
event->cell.mCellId.mIndex.mY,
event->cell.mName.c_str());
event->cell.getDescription().c_str());
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);

@ -29,13 +29,10 @@ namespace MWWorld
event->cellRef.mRefNum = getTarget().getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_DELETE)->Send(event);
printf("Sending ID_WORLD_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %i, %i, %i, %s",
printf("Sending ID_WORLD_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.mData.mFlags,
event->cell.mCellId.mIndex.mX,
event->cell.mCellId.mIndex.mY,
event->cell.mName.c_str());
event->cell.getDescription().c_str());
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
}

@ -18,9 +18,7 @@ void mwmp::PacketCell::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, b
PlayerPacket::Packet(bs, player, send);
RW(player->GetCell()->mData.mFlags, send);
RW(player->GetCell()->mCellId.mIndex.mX, send);
RW(player->GetCell()->mCellId.mIndex.mY, send);
RW(player->GetCell()->mData.mX, send);
RW(player->GetCell()->mData.mY, send);
RW(player->GetCell()->mName, send);
}

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

@ -17,7 +17,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
RW(event->cellRef.mPos, send);
RW(event->cell.mData.mFlags, send);
RW(event->cell.mCellId.mIndex.mX, send);
RW(event->cell.mCellId.mIndex.mY, send);
RW(event->cell.mData.mX, send);
RW(event->cell.mData.mY, send);
RW(event->cell.mName, send);
}

Loading…
Cancel
Save