forked from teamnwah/openmw-tes3coop
Rename BasePlayer's GetCell() into getCell()
This commit is contained in:
parent
80d16fe1fd
commit
6cd959fac8
7 changed files with 33 additions and 33 deletions
|
@ -157,7 +157,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
myPacket->Read(player);
|
myPacket->Read(player);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Moved to %s",
|
LOG_APPEND(Log::LOG_INFO, "- Moved to %s",
|
||||||
player->GetCell()->getDescription().c_str());
|
player->getCell()->getDescription().c_str());
|
||||||
|
|
||||||
myPacket->Send(player, true); //send to other clients
|
myPacket->Send(player, true); //send to other clients
|
||||||
Script::Call<Script::CallbackIdentity("onPlayerChangeCell")>(player->getId());
|
Script::Call<Script::CallbackIdentity("onPlayerChangeCell")>(player->getId());
|
||||||
|
|
|
@ -112,7 +112,7 @@ const char* TranslocationFunctions::getCell(unsigned short pid) noexcept
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0);
|
GET_PLAYER(pid, player, 0);
|
||||||
|
|
||||||
return player->GetCell()->mName.c_str();
|
return player->getCell()->mName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::setCell(unsigned short pid, const char *name) noexcept
|
void TranslocationFunctions::setCell(unsigned short pid, const char *name) noexcept
|
||||||
|
@ -122,17 +122,17 @@ void TranslocationFunctions::setCell(unsigned short pid, const char *name) noexc
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %s",
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %s",
|
||||||
player->Npc()->mName.c_str(),
|
player->Npc()->mName.c_str(),
|
||||||
player->GetCell()->getDescription().c_str(),
|
player->getCell()->getDescription().c_str(),
|
||||||
name);
|
name);
|
||||||
|
|
||||||
// If the player is currently in an exterior, turn on the interior flag
|
// If the player is currently in an exterior, turn on the interior flag
|
||||||
// from the cell so the player doesn't get teleported to their exterior
|
// from the cell so the player doesn't get teleported to their exterior
|
||||||
// grid position (which we haven't changed)
|
// grid position (which we haven't changed)
|
||||||
if (player->GetCell()->isExterior()) {
|
if (player->getCell()->isExterior()) {
|
||||||
player->GetCell()->mData.mFlags |= ESM::Cell::Interior;
|
player->getCell()->mData.mFlags |= ESM::Cell::Interior;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->GetCell()->mName = name;
|
player->getCell()->mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::setExterior(unsigned short pid, int x, int y) noexcept
|
void TranslocationFunctions::setExterior(unsigned short pid, int x, int y) noexcept
|
||||||
|
@ -142,32 +142,32 @@ void TranslocationFunctions::setExterior(unsigned short pid, int x, int y) noexc
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %i,%i",
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %i,%i",
|
||||||
player->Npc()->mName.c_str(),
|
player->Npc()->mName.c_str(),
|
||||||
player->GetCell()->getDescription().c_str(),
|
player->getCell()->getDescription().c_str(),
|
||||||
x,
|
x,
|
||||||
y);
|
y);
|
||||||
|
|
||||||
// If the player is currently in an interior, turn off the interior flag
|
// If the player is currently in an interior, turn off the interior flag
|
||||||
// from the cell
|
// from the cell
|
||||||
if (!player->GetCell()->isExterior()) {
|
if (!player->getCell()->isExterior()) {
|
||||||
player->GetCell()->mData.mFlags &= ~ESM::Cell::Interior;
|
player->getCell()->mData.mFlags &= ~ESM::Cell::Interior;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->GetCell()->mData.mX = x;
|
player->getCell()->mData.mX = x;
|
||||||
player->GetCell()->mData.mY = y;
|
player->getCell()->mData.mY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TranslocationFunctions::getExteriorX(unsigned short pid) noexcept
|
int TranslocationFunctions::getExteriorX(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,0);
|
GET_PLAYER(pid, player,0);
|
||||||
return player->GetCell()->mData.mX;
|
return player->getCell()->mData.mX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TranslocationFunctions::getExteriorY(unsigned short pid) noexcept
|
int TranslocationFunctions::getExteriorY(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,0);
|
GET_PLAYER(pid, player,0);
|
||||||
return player->GetCell()->mData.mY;
|
return player->getCell()->mData.mY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslocationFunctions::isInExterior(unsigned short pid) noexcept
|
bool TranslocationFunctions::isInExterior(unsigned short pid) noexcept
|
||||||
|
@ -175,7 +175,7 @@ bool TranslocationFunctions::isInExterior(unsigned short pid) noexcept
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, false);
|
GET_PLAYER(pid, player, false);
|
||||||
|
|
||||||
return player->GetCell()->isExterior();
|
return player->getCell()->isExterior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::sendPos(unsigned short pid) noexcept
|
void TranslocationFunctions::sendPos(unsigned short pid) noexcept
|
||||||
|
|
|
@ -268,9 +268,9 @@ ESM::CustomMarker mwmp::GUIController::CreateMarker(const RakNet::RakNetGUID &gu
|
||||||
|
|
||||||
mEditingMarker.mNote = player->Npc()->mName;
|
mEditingMarker.mNote = player->Npc()->mName;
|
||||||
|
|
||||||
const ESM::Cell *ptrCell = player->GetCell();
|
const ESM::Cell *ptrCell = player->getCell();
|
||||||
|
|
||||||
mEditingMarker.mCell = player->GetCell()->mCellId;
|
mEditingMarker.mCell = player->getCell()->mCellId;
|
||||||
|
|
||||||
mEditingMarker.mWorldX = player->Position()->pos[0];
|
mEditingMarker.mWorldX = player->Position()->pos[0];
|
||||||
mEditingMarker.mWorldY = player->Position()->pos[1];
|
mEditingMarker.mWorldY = player->Position()->pos[1];
|
||||||
|
|
|
@ -312,17 +312,17 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
||||||
{
|
{
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
}
|
}
|
||||||
else if (!Misc::StringUtils::ciEqual(ptrCell->mName, GetCell()->mName))
|
else if (!Misc::StringUtils::ciEqual(ptrCell->mName, getCell()->mName))
|
||||||
{
|
{
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
}
|
}
|
||||||
else if (ptrCell->isExterior())
|
else if (ptrCell->isExterior())
|
||||||
{
|
{
|
||||||
if (ptrCell->mData.mX != GetCell()->mData.mX)
|
if (ptrCell->mData.mX != getCell()->mData.mX)
|
||||||
{
|
{
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
}
|
}
|
||||||
else if (ptrCell->mData.mY != GetCell()->mData.mY)
|
else if (ptrCell->mData.mY != getCell()->mData.mY)
|
||||||
{
|
{
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
}
|
}
|
||||||
|
@ -333,10 +333,10 @@ void LocalPlayer::updateCell(bool forceUpdate)
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_CELL to server");
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_CELL to server");
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s",
|
LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s",
|
||||||
GetCell()->getDescription().c_str(),
|
getCell()->getDescription().c_str(),
|
||||||
ptrCell->getDescription().c_str());
|
ptrCell->getDescription().c_str());
|
||||||
|
|
||||||
(*GetCell()) = *ptrCell;
|
(*getCell()) = *ptrCell;
|
||||||
|
|
||||||
// Make sure the position is updated before a cell packet is sent, or else
|
// Make sure the position is updated before a cell packet is sent, or else
|
||||||
// cell change events in server scripts will have the wrong player position
|
// cell change events in server scripts will have the wrong player position
|
||||||
|
@ -713,10 +713,10 @@ void LocalPlayer::setCell()
|
||||||
|
|
||||||
world->getPlayer().setTeleported(true);
|
world->getPlayer().setTeleported(true);
|
||||||
|
|
||||||
int x = GetCell()->mData.mX;
|
int x = getCell()->mData.mX;
|
||||||
int y = GetCell()->mData.mY;
|
int y = getCell()->mData.mY;
|
||||||
|
|
||||||
if (GetCell()->isExterior())
|
if (getCell()->isExterior())
|
||||||
{
|
{
|
||||||
world->indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
world->indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
||||||
pos.pos[2] = 0;
|
pos.pos[2] = 0;
|
||||||
|
@ -726,7 +726,7 @@ void LocalPlayer::setCell()
|
||||||
world->changeToExteriorCell(pos, true);
|
world->changeToExteriorCell(pos, true);
|
||||||
world->fixPosition(player);
|
world->fixPosition(player);
|
||||||
}
|
}
|
||||||
else if (world->findExteriorPosition(GetCell()->mName, pos))
|
else if (world->findExteriorPosition(getCell()->mName, pos))
|
||||||
{
|
{
|
||||||
world->changeToExteriorCell(pos, true);
|
world->changeToExteriorCell(pos, true);
|
||||||
world->fixPosition(player);
|
world->fixPosition(player);
|
||||||
|
@ -735,8 +735,8 @@ void LocalPlayer::setCell()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
world->findInteriorPosition(GetCell()->mName, pos);
|
world->findInteriorPosition(getCell()->mName, pos);
|
||||||
world->changeToInteriorCell(GetCell()->mName, pos, true);
|
world->changeToInteriorCell(getCell()->mName, pos, true);
|
||||||
}
|
}
|
||||||
// If we've been sent to an invalid interior, ignore the incoming
|
// If we've been sent to an invalid interior, ignore the incoming
|
||||||
// packet about our position in that cell
|
// packet about our position in that cell
|
||||||
|
|
|
@ -465,7 +465,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
MWBase::Environment::get().getWorld()->findInteriorPosition("Pelagiad, Fort Pelagiad", pos);
|
MWBase::Environment::get().getWorld()->findInteriorPosition("Pelagiad, Fort Pelagiad", pos);
|
||||||
MWBase::Environment::get().getWorld()->changeToInteriorCell("Pelagiad, Fort Pelagiad", pos, true);
|
MWBase::Environment::get().getWorld()->changeToInteriorCell("Pelagiad, Fort Pelagiad", pos, true);
|
||||||
(*getLocalPlayer()->Position()) = pos;
|
(*getLocalPlayer()->Position()) = pos;
|
||||||
(*getLocalPlayer()->GetCell()) = *player.getCell()->getCell();
|
(*getLocalPlayer()->getCell()) = *player.getCell()->getCell();
|
||||||
myPacket->Send(getLocalPlayer(), serverAddr);
|
myPacket->Send(getLocalPlayer(), serverAddr);
|
||||||
|
|
||||||
getLocalPlayer()->updateDynamicStats(true);
|
getLocalPlayer()->updateDynamicStats(true);
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
return &movementFlags;
|
return &movementFlags;
|
||||||
}
|
}
|
||||||
virtual ESM::Cell *GetCell()
|
virtual ESM::Cell *getCell()
|
||||||
{
|
{
|
||||||
return &cell;
|
return &cell;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ void mwmp::PacketCell::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, b
|
||||||
{
|
{
|
||||||
PlayerPacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->GetCell()->mData.mFlags, send);
|
RW(player->getCell()->mData.mFlags, send);
|
||||||
RW(player->GetCell()->mData.mX, send);
|
RW(player->getCell()->mData.mX, send);
|
||||||
RW(player->GetCell()->mData.mY, send);
|
RW(player->getCell()->mData.mY, send);
|
||||||
RW(player->GetCell()->mName, send);
|
RW(player->getCell()->mName, send);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue