forked from teamnwah/openmw-tes3coop
[Server] Rename Translocations into Positions
This commit is contained in:
parent
96bd21a7ca
commit
62f359e250
5 changed files with 80 additions and 87 deletions
|
@ -74,7 +74,7 @@ set(SERVER
|
||||||
|
|
||||||
Script/Functions/CharClass.cpp Script/Functions/Chat.cpp Script/Functions/GUI.cpp
|
Script/Functions/CharClass.cpp Script/Functions/Chat.cpp Script/Functions/GUI.cpp
|
||||||
Script/Functions/Items.cpp Script/Functions/Quests.cpp Script/Functions/Stats.cpp
|
Script/Functions/Items.cpp Script/Functions/Quests.cpp Script/Functions/Stats.cpp
|
||||||
Script/Functions/Spells.cpp Script/Functions/Timer.cpp Script/Functions/Translocations.cpp
|
Script/Functions/Spells.cpp Script/Functions/Timer.cpp Script/Functions/Positions.cpp
|
||||||
Script/Functions/World.cpp
|
Script/Functions/World.cpp
|
||||||
|
|
||||||
Script/API/TimerAPI.cpp Script/API/PublicFnAPI.cpp
|
Script/API/TimerAPI.cpp Script/API/PublicFnAPI.cpp
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
//
|
#include "Positions.hpp"
|
||||||
// Created by koncord on 29.02.16.
|
|
||||||
//
|
|
||||||
#include "Translocations.hpp"
|
|
||||||
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include <apps/openmw-mp/Player.hpp>
|
#include <apps/openmw-mp/Player.hpp>
|
||||||
|
@ -11,7 +8,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void TranslocationFunctions::GetPos(unsigned short pid, float *x, float *y, float *z) noexcept
|
void PositionFunctions::GetPos(unsigned short pid, float *x, float *y, float *z) noexcept
|
||||||
{
|
{
|
||||||
*x = 0.00;
|
*x = 0.00;
|
||||||
*y = 0.00;
|
*y = 0.00;
|
||||||
|
@ -25,7 +22,7 @@ void TranslocationFunctions::GetPos(unsigned short pid, float *x, float *y, floa
|
||||||
*z = player->position.pos[2];
|
*z = player->position.pos[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetPosX(unsigned short pid) noexcept
|
double PositionFunctions::GetPosX(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -33,7 +30,7 @@ double TranslocationFunctions::GetPosX(unsigned short pid) noexcept
|
||||||
return player->position.pos[0];
|
return player->position.pos[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetPosY(unsigned short pid) noexcept
|
double PositionFunctions::GetPosY(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -41,7 +38,7 @@ double TranslocationFunctions::GetPosY(unsigned short pid) noexcept
|
||||||
return player->position.pos[1];
|
return player->position.pos[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetPosZ(unsigned short pid) noexcept
|
double PositionFunctions::GetPosZ(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -49,7 +46,7 @@ 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
|
void PositionFunctions::GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept
|
||||||
{
|
{
|
||||||
*x = 0.00;
|
*x = 0.00;
|
||||||
*y = 0.00;
|
*y = 0.00;
|
||||||
|
@ -63,7 +60,7 @@ void TranslocationFunctions::GetAngle(unsigned short pid, float *x, float *y, fl
|
||||||
*z = player->position.rot[2];
|
*z = player->position.rot[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
|
double PositionFunctions::GetAngleX(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -71,7 +68,7 @@ double TranslocationFunctions::GetAngleX(unsigned short pid) noexcept
|
||||||
return player->position.rot[0];
|
return player->position.rot[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
|
double PositionFunctions::GetAngleY(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -79,7 +76,7 @@ double TranslocationFunctions::GetAngleY(unsigned short pid) noexcept
|
||||||
return player->position.rot[1];
|
return player->position.rot[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
|
double PositionFunctions::GetAngleZ(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0.0f);
|
GET_PLAYER(pid, player, 0.0f);
|
||||||
|
@ -87,7 +84,7 @@ double TranslocationFunctions::GetAngleZ(unsigned short pid) noexcept
|
||||||
return player->position.rot[2];
|
return player->position.rot[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept
|
void PositionFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
@ -97,7 +94,7 @@ void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, doub
|
||||||
player->position.pos[2] = z;
|
player->position.pos[2] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
|
void PositionFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, );
|
GET_PLAYER(pid, player, );
|
||||||
|
@ -107,7 +104,7 @@ void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, do
|
||||||
player->position.rot[2] = z;
|
player->position.rot[2] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
|
const char* PositionFunctions::GetCell(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0);
|
GET_PLAYER(pid, player, 0);
|
||||||
|
@ -115,7 +112,7 @@ const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
|
||||||
return player->cell.mName.c_str();
|
return player->cell.mName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexcept
|
void PositionFunctions::SetCell(unsigned short pid, const char *name) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
@ -135,7 +132,7 @@ void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexc
|
||||||
player->cell.mName = name;
|
player->cell.mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
|
void PositionFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
@ -156,21 +153,21 @@ void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexc
|
||||||
player->cell.mData.mY = y;
|
player->cell.mData.mY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept
|
int PositionFunctions::GetExteriorX(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,0);
|
GET_PLAYER(pid, player,0);
|
||||||
return player->cell.mData.mX;
|
return player->cell.mData.mX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TranslocationFunctions::GetExteriorY(unsigned short pid) noexcept
|
int PositionFunctions::GetExteriorY(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,0);
|
GET_PLAYER(pid, player,0);
|
||||||
return player->cell.mData.mY;
|
return player->cell.mData.mY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
|
bool PositionFunctions::IsInExterior(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, false);
|
GET_PLAYER(pid, player, false);
|
||||||
|
@ -178,7 +175,7 @@ bool TranslocationFunctions::IsInExterior(unsigned short pid) noexcept
|
||||||
return player->cell.isExterior();
|
return player->cell.isExterior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslocationFunctions::SendPos(unsigned short pid) noexcept
|
void PositionFunctions::SendPos(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, );
|
GET_PLAYER(pid, player, );
|
||||||
|
@ -186,7 +183,7 @@ 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
|
void PositionFunctions::SendCell(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, );
|
GET_PLAYER(pid, player, );
|
58
apps/openmw-mp/Script/Functions/Positions.hpp
Normal file
58
apps/openmw-mp/Script/Functions/Positions.hpp
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#ifndef OPENMW_POSITIONAPI_HPP
|
||||||
|
#define OPENMW_POSITIONAPI_HPP
|
||||||
|
|
||||||
|
#include "../Types.hpp"
|
||||||
|
|
||||||
|
#define POSITIONAPI \
|
||||||
|
{"GetPos", PositionFunctions::GetPos},\
|
||||||
|
{"GetPosX", PositionFunctions::GetPosX},\
|
||||||
|
{"GetPosY", PositionFunctions::GetPosY},\
|
||||||
|
{"GetPosZ", PositionFunctions::GetPosZ},\
|
||||||
|
\
|
||||||
|
{"GetAngle", PositionFunctions::GetAngle},\
|
||||||
|
{"GetAngleX", PositionFunctions::GetAngleX},\
|
||||||
|
{"GetAngleY", PositionFunctions::GetAngleY},\
|
||||||
|
{"GetAngleZ", PositionFunctions::GetAngleZ},\
|
||||||
|
\
|
||||||
|
{"SetPos", PositionFunctions::SetPos},\
|
||||||
|
{"SetAngle", PositionFunctions::SetAngle},\
|
||||||
|
\
|
||||||
|
{"GetCell", PositionFunctions::GetCell},\
|
||||||
|
{"SetCell", PositionFunctions::SetCell},\
|
||||||
|
{"SetExterior", PositionFunctions::SetExterior},\
|
||||||
|
{"GetExteriorX", PositionFunctions::GetExteriorX},\
|
||||||
|
{"GetExteriorY", PositionFunctions::GetExteriorY},\
|
||||||
|
{"IsInExterior", PositionFunctions::IsInExterior},\
|
||||||
|
\
|
||||||
|
{"SendPos", PositionFunctions::SendPos},\
|
||||||
|
{"SendCell", PositionFunctions::SendCell}
|
||||||
|
|
||||||
|
|
||||||
|
class PositionFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void GetPos(unsigned short pid, float *x, float *y, float *z) noexcept;
|
||||||
|
static double GetPosX(unsigned short pid) noexcept;
|
||||||
|
static double GetPosY(unsigned short pid) noexcept;
|
||||||
|
static double GetPosZ(unsigned short pid) 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 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;
|
||||||
|
static bool IsInExterior(unsigned short pid) noexcept;
|
||||||
|
|
||||||
|
static void SendPos(unsigned short pid) noexcept;
|
||||||
|
static void SendCell(unsigned short pid) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //OPENMW_POSITIONAPI_HPP
|
|
@ -1,62 +0,0 @@
|
||||||
//
|
|
||||||
// Created by koncord on 30.08.16.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef OPENMW_TRANSLOCATIONS_HPP
|
|
||||||
#define OPENMW_TRANSLOCATIONS_HPP
|
|
||||||
|
|
||||||
#include "../Types.hpp"
|
|
||||||
|
|
||||||
#define TRANSLOCATIONFUNCTIONS \
|
|
||||||
{"GetPos", TranslocationFunctions::GetPos},\
|
|
||||||
{"GetPosX", TranslocationFunctions::GetPosX},\
|
|
||||||
{"GetPosY", TranslocationFunctions::GetPosY},\
|
|
||||||
{"GetPosZ", TranslocationFunctions::GetPosZ},\
|
|
||||||
\
|
|
||||||
{"GetAngle", TranslocationFunctions::GetAngle},\
|
|
||||||
{"GetAngleX", TranslocationFunctions::GetAngleX},\
|
|
||||||
{"GetAngleY", TranslocationFunctions::GetAngleY},\
|
|
||||||
{"GetAngleZ", TranslocationFunctions::GetAngleZ},\
|
|
||||||
\
|
|
||||||
{"SetPos", TranslocationFunctions::SetPos},\
|
|
||||||
{"SetAngle", TranslocationFunctions::SetAngle},\
|
|
||||||
\
|
|
||||||
{"GetCell", TranslocationFunctions::GetCell},\
|
|
||||||
{"SetCell", TranslocationFunctions::SetCell},\
|
|
||||||
{"SetExterior", TranslocationFunctions::SetExterior},\
|
|
||||||
{"GetExteriorX", TranslocationFunctions::GetExteriorX},\
|
|
||||||
{"GetExteriorY", TranslocationFunctions::GetExteriorY},\
|
|
||||||
{"IsInExterior", TranslocationFunctions::IsInExterior},\
|
|
||||||
\
|
|
||||||
{"SendPos", TranslocationFunctions::SendPos},\
|
|
||||||
{"SendCell", TranslocationFunctions::SendCell}
|
|
||||||
|
|
||||||
|
|
||||||
class TranslocationFunctions
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static void GetPos(unsigned short pid, float *x, float *y, float *z) noexcept;
|
|
||||||
static double GetPosX(unsigned short pid) noexcept;
|
|
||||||
static double GetPosY(unsigned short pid) noexcept;
|
|
||||||
static double GetPosZ(unsigned short pid) 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 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;
|
|
||||||
static bool IsInExterior(unsigned short pid) noexcept;
|
|
||||||
|
|
||||||
static void SendPos(unsigned short pid) noexcept;
|
|
||||||
static void SendCell(unsigned short pid) noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //OPENMW_TRANSLOCATIONS_HPP
|
|
|
@ -6,7 +6,7 @@
|
||||||
#define SCRIPTFUNCTIONS_HPP
|
#define SCRIPTFUNCTIONS_HPP
|
||||||
|
|
||||||
#include <Script/Functions/CharClass.hpp>
|
#include <Script/Functions/CharClass.hpp>
|
||||||
#include <Script/Functions/Translocations.hpp>
|
#include <Script/Functions/Positions.hpp>
|
||||||
#include <Script/Functions/GUI.hpp>
|
#include <Script/Functions/GUI.hpp>
|
||||||
#include <Script/Functions/Stats.hpp>
|
#include <Script/Functions/Stats.hpp>
|
||||||
#include <Script/Functions/Items.hpp>
|
#include <Script/Functions/Items.hpp>
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
{"SetModname", ScriptFunctions::SetModname},
|
{"SetModname", ScriptFunctions::SetModname},
|
||||||
{"SetHostname", ScriptFunctions::SetHostname},
|
{"SetHostname", ScriptFunctions::SetHostname},
|
||||||
|
|
||||||
TRANSLOCATIONFUNCTIONS,
|
POSITIONAPI,
|
||||||
STATSFUNCTIONS,
|
STATSFUNCTIONS,
|
||||||
ITEMAPI,
|
ITEMAPI,
|
||||||
QUESTAPI,
|
QUESTAPI,
|
||||||
|
|
Loading…
Reference in a new issue