1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 21:49:55 +00:00

[Server] Add script functions for getting info about cell state changes

This commit is contained in:
David Cernat 2017-01-26 16:37:47 +02:00
parent 70823d011d
commit 2f644e9b14
2 changed files with 34 additions and 7 deletions

View file

@ -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;

View file

@ -4,6 +4,10 @@
#include "../Types.hpp"
#define CELLAPI \
{"GetCellStateChangesSize", CellFunctions:GetCellStateChangesSize},\
\
{"GetCellStateDescription", CellFunctions:GetCellStateDescription},\
\
{"GetCell", CellFunctions::GetCell},\
{"SetCell", CellFunctions::SetCell},\
{"SetExterior", CellFunctions::SetExterior},\
@ -17,6 +21,10 @@
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;