From 5b39916894c01f9c084fe3bea49c129075352fb6 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 12 Nov 2016 21:16:05 +0200 Subject: [PATCH] Use new SendPos() method in server scripts to send position packets --- apps/openmw-mp/Script/Functions/Translocations.cpp | 12 ++++++++---- apps/openmw-mp/Script/Functions/Translocations.hpp | 10 +++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Translocations.cpp b/apps/openmw-mp/Script/Functions/Translocations.cpp index 669fad8f9..8929dfb7e 100644 --- a/apps/openmw-mp/Script/Functions/Translocations.cpp +++ b/apps/openmw-mp/Script/Functions/Translocations.cpp @@ -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); +} + diff --git a/apps/openmw-mp/Script/Functions/Translocations.hpp b/apps/openmw-mp/Script/Functions/Translocations.hpp index 0213d8ad7..ebbb7ef87 100644 --- a/apps/openmw-mp/Script/Functions/Translocations.hpp +++ b/apps/openmw-mp/Script/Functions/Translocations.hpp @@ -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