Use new SendCell() method in server scripts to send cell packets

This commit is contained in:
David Cernat 2016-11-12 21:27:09 +02:00
parent 5b39916894
commit 841e93d5e0
2 changed files with 12 additions and 6 deletions

View file

@ -133,8 +133,6 @@ void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexc
} }
player->GetCell()->mName = name; player->GetCell()->mName = name;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
} }
void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
@ -156,8 +154,6 @@ void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexc
player->GetCell()->mData.mX = x; player->GetCell()->mData.mX = x;
player->GetCell()->mData.mY = y; player->GetCell()->mData.mY = y;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
} }
int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept
@ -190,3 +186,11 @@ void TranslocationFunctions::SendPos(unsigned short pid) noexcept
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
} }
void TranslocationFunctions::SendCell(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
}

View file

@ -26,9 +26,10 @@
{"SetExterior", TranslocationFunctions::SetExterior},\ {"SetExterior", TranslocationFunctions::SetExterior},\
{"GetExteriorX", TranslocationFunctions::GetExteriorX},\ {"GetExteriorX", TranslocationFunctions::GetExteriorX},\
{"GetExteriorY", TranslocationFunctions::GetExteriorY},\ {"GetExteriorY", TranslocationFunctions::GetExteriorY},\
{"IsInExterior", TranslocationFunctions::IsInExterior}\ {"IsInExterior", TranslocationFunctions::IsInExterior},\
\ \
{"SendPos", TranslocationFunctions::SendPosition} {"SendPos", TranslocationFunctions::SendPosition},\
{"SendCell", TranslocationFunctions::SendCell}
class TranslocationFunctions class TranslocationFunctions
@ -55,6 +56,7 @@ public:
static bool IsInExterior(unsigned short pid) noexcept; static bool IsInExterior(unsigned short pid) noexcept;
static void SendPos(unsigned short pid) noexcept; static void SendPos(unsigned short pid) noexcept;
static void SendCell(unsigned short pid) noexcept;
}; };
#endif //OPENMW_TRANSLOCATIONS_HPP #endif //OPENMW_TRANSLOCATIONS_HPP