Reorder functions for server script translocations

coverity_scan^2
David Cernat 8 years ago
parent c85e6a5f91
commit e0c88150c3

@ -49,6 +49,44 @@ double TranslocationFunctions::GetPosZ(unsigned short pid) noexcept
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
{
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);
}
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
{
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);
}
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
{
Player *player;
@ -136,52 +186,3 @@ bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
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);
}

@ -35,17 +35,17 @@ public:
static double GetPosX(unsigned short pid) noexcept;
static double GetPosY(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 double GetAngleX(unsigned short pid) noexcept;
static double GetAngleY(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 SetCell(unsigned short pid, const char *name) 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 int GetExteriorX(unsigned short pid) noexcept;
static int GetExteriorY(unsigned short pid) noexcept;

Loading…
Cancel
Save