mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[Server] Add script functions for getting info about cell state changes
This commit is contained in:
parent
70823d011d
commit
2f644e9b14
2 changed files with 34 additions and 7 deletions
|
@ -8,6 +8,25 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
unsigned int CellFunctions::GetCellStateChangesSize(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->cellStateChanges.count;
|
||||
}
|
||||
|
||||
const char* CellFunctions::GetCellStateDescription(unsigned short pid, unsigned int i) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, "");
|
||||
|
||||
if (i >= player->cellStateChanges.count)
|
||||
return "invalid";
|
||||
|
||||
return player->cellStateChanges.cells.at(i).getDescription().c_str();
|
||||
}
|
||||
|
||||
const char* CellFunctions::GetCell(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
|
|
@ -4,19 +4,27 @@
|
|||
#include "../Types.hpp"
|
||||
|
||||
#define CELLAPI \
|
||||
{"GetCell", CellFunctions::GetCell},\
|
||||
{"SetCell", CellFunctions::SetCell},\
|
||||
{"SetExterior", CellFunctions::SetExterior},\
|
||||
{"GetExteriorX", CellFunctions::GetExteriorX},\
|
||||
{"GetExteriorY", CellFunctions::GetExteriorY},\
|
||||
{"IsInExterior", CellFunctions::IsInExterior},\
|
||||
{"GetCellStateChangesSize", CellFunctions:GetCellStateChangesSize},\
|
||||
\
|
||||
{"SendCell", CellFunctions::SendCell}
|
||||
{"GetCellStateDescription", CellFunctions:GetCellStateDescription},\
|
||||
\
|
||||
{"GetCell", CellFunctions::GetCell},\
|
||||
{"SetCell", CellFunctions::SetCell},\
|
||||
{"SetExterior", CellFunctions::SetExterior},\
|
||||
{"GetExteriorX", CellFunctions::GetExteriorX},\
|
||||
{"GetExteriorY", CellFunctions::GetExteriorY},\
|
||||
{"IsInExterior", CellFunctions::IsInExterior},\
|
||||
\
|
||||
{"SendCell", CellFunctions::SendCell}
|
||||
|
||||
|
||||
class CellFunctions
|
||||
{
|
||||
public:
|
||||
static unsigned int GetCellStateChangesSize(unsigned short pid) noexcept;
|
||||
|
||||
static const char *GetCellStateDescription(unsigned short pid, unsigned int i) 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;
|
||||
|
|
Loading…
Reference in a new issue