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

coverity_scan^2
David Cernat 8 years ago
parent 70823d011d
commit 2f644e9b14

@ -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…
Cancel
Save