Reorder functions for server script translocations

This commit is contained in:
David Cernat 2016-11-12 21:01:38 +02:00
parent c85e6a5f91
commit e0c88150c3
2 changed files with 61 additions and 60 deletions

View file

@ -49,6 +49,44 @@ double TranslocationFunctions::GetPosZ(unsigned short pid) noexcept
return player->Position()->pos[2]; return player->Position()->pos[2];
} }
void TranslocationFunctions::GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept
{
*x = 0.00;
*y = 0.00;
*z = 0.00;
Player *player;
GET_PLAYER(pid, player, );
*x = player->Position()->rot[0];
*y = player->Position()->rot[1];
*z = player->Position()->rot[2];
}
double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[0];
}
double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[1];
}
double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[2];
}
void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept
{ {
Player *player; Player *player;
@ -61,6 +99,26 @@ void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, doub
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
} }
void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
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
{
Player *player;
GET_PLAYER(pid, player, 0);
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
{ {
Player *player; Player *player;
@ -83,14 +141,6 @@ void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexc
mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
} }
const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->GetCell()->mName.c_str();
}
void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
{ {
Player *player; Player *player;
@ -136,52 +186,3 @@ bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
return player->GetCell()->isExterior(); return player->GetCell()->isExterior();
} }
void TranslocationFunctions::GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept
{
*x = 0.00;
*y = 0.00;
*z = 0.00;
Player *player;
GET_PLAYER(pid, player,);
*x = player->Position()->rot[0];
*y = player->Position()->rot[1];
*z = player->Position()->rot[2];
}
double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[0];
}
double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[1];
}
double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->Position()->rot[2];
}
void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
{
Player *player;
GET_PLAYER(pid, player,);
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);
}

View file

@ -35,17 +35,17 @@ public:
static double GetPosX(unsigned short pid) noexcept; static double GetPosX(unsigned short pid) noexcept;
static double GetPosY(unsigned short pid) noexcept; static double GetPosY(unsigned short pid) noexcept;
static double GetPosZ(unsigned short pid) noexcept; static double GetPosZ(unsigned short pid) noexcept;
static void SetPos(unsigned short pid, double x, double y, double z) noexcept;
static void GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept; static void GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept;
static double GetAngleX(unsigned short pid) noexcept; static double GetAngleX(unsigned short pid) noexcept;
static double GetAngleY(unsigned short pid) noexcept; static double GetAngleY(unsigned short pid) noexcept;
static double GetAngleZ(unsigned short pid) noexcept; static double GetAngleZ(unsigned short pid) noexcept;
static void SetPos(unsigned short pid, double x, double y, double z) noexcept;
static void SetAngle(unsigned short pid, double x, double y, double z) noexcept; static void SetAngle(unsigned short pid, double x, double y, double z) noexcept;
static void SetCell(unsigned short pid, const char *name) noexcept;
static const char *GetCell(unsigned short pid) noexcept; static const char *GetCell(unsigned short pid) noexcept;
static void SetCell(unsigned short pid, const char *name) noexcept;
static void SetExterior(unsigned short pid, int x, int y) noexcept; static void SetExterior(unsigned short pid, int x, int y) noexcept;
static int GetExteriorX(unsigned short pid) noexcept; static int GetExteriorX(unsigned short pid) noexcept;
static int GetExteriorY(unsigned short pid) noexcept; static int GetExteriorY(unsigned short pid) noexcept;