Use new SendPos() method in server scripts to send position packets

coverity_scan^2
David Cernat 8 years ago
parent e0c88150c3
commit 5b39916894

@ -95,8 +95,6 @@ void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, doub
player->Position()->pos[0] = x;
player->Position()->pos[1] = y;
player->Position()->pos[2] = z;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
}
void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
@ -107,8 +105,6 @@ void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, do
player->Position()->rot[0] = x;
player->Position()->rot[1] = y;
player->Position()->rot[2] = z;
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
}
const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
@ -186,3 +182,11 @@ bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
return player->GetCell()->isExterior();
}
void TranslocationFunctions::SendPos(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
}

@ -12,12 +12,13 @@
{"GetPosX", TranslocationFunctions::GetPosX},\
{"GetPosY", TranslocationFunctions::GetPosY},\
{"GetPosZ", TranslocationFunctions::GetPosZ},\
{"SetPos", TranslocationFunctions::SetPos},\
\
{"GetAngle", TranslocationFunctions::GetAngle},\
{"GetAngleX", TranslocationFunctions::GetAngleX},\
{"GetAngleY", TranslocationFunctions::GetAngleY},\
{"GetAngleZ", TranslocationFunctions::GetAngleZ},\
\
{"SetPos", TranslocationFunctions::SetPos},\
{"SetAngle", TranslocationFunctions::SetAngle},\
\
{"GetCell", TranslocationFunctions::GetCell},\
@ -25,7 +26,9 @@
{"SetExterior", TranslocationFunctions::SetExterior},\
{"GetExteriorX", TranslocationFunctions::GetExteriorX},\
{"GetExteriorY", TranslocationFunctions::GetExteriorY},\
{"IsInExterior", TranslocationFunctions::IsInExterior}
{"IsInExterior", TranslocationFunctions::IsInExterior}\
\
{"SendPos", TranslocationFunctions::SendPosition}
class TranslocationFunctions
@ -49,8 +52,9 @@ public:
static void SetExterior(unsigned short pid, int x, int y) noexcept;
static int GetExteriorX(unsigned short pid) noexcept;
static int GetExteriorY(unsigned short pid) noexcept;
static bool IsInExterior(unsigned short pid) noexcept;
static void SendPos(unsigned short pid) noexcept;
};
#endif //OPENMW_TRANSLOCATIONS_HPP

Loading…
Cancel
Save