mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 10:36:42 +00:00
[Server] Modernize getting and setting of player cells
This commit is contained in:
parent
0d3976950b
commit
db7709ee18
2 changed files with 8 additions and 14 deletions
|
@ -46,27 +46,21 @@ const char *CellFunctions::GetCell(unsigned short pid) noexcept
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, 0);
|
GET_PLAYER(pid, player, 0);
|
||||||
|
|
||||||
return player->cell.mName.c_str();
|
return player->cell.getDescription().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellFunctions::SetCell(unsigned short pid, const char *name) noexcept
|
void CellFunctions::SetCell(unsigned short pid, const char *cellDescription) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %s", player->npc.mName.c_str(),
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Script is moving %s from %s to %s", player->npc.mName.c_str(),
|
||||||
player->cell.getDescription().c_str(), name);
|
player->cell.getDescription().c_str(), cellDescription);
|
||||||
|
|
||||||
// If the player is currently in an exterior, turn on the interior flag
|
player->cell = Utils::getCellFromDescription(cellDescription);
|
||||||
// from the cell so the player doesn't get teleported to their exterior
|
|
||||||
// grid position (which we haven't changed)
|
|
||||||
if (player->cell.isExterior())
|
|
||||||
player->cell.mData.mFlags |= ESM::Cell::Interior;
|
|
||||||
|
|
||||||
player->cell.mName = name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
|
void CellFunctions::SetExteriorCell(unsigned short pid, int x, int y) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
\
|
\
|
||||||
{"GetCell", CellFunctions::GetCell},\
|
{"GetCell", CellFunctions::GetCell},\
|
||||||
{"SetCell", CellFunctions::SetCell},\
|
{"SetCell", CellFunctions::SetCell},\
|
||||||
{"SetExterior", CellFunctions::SetExterior},\
|
{"SetExteriorCell", CellFunctions::SetExteriorCell},\
|
||||||
{"GetExteriorX", CellFunctions::GetExteriorX},\
|
{"GetExteriorX", CellFunctions::GetExteriorX},\
|
||||||
{"GetExteriorY", CellFunctions::GetExteriorY},\
|
{"GetExteriorY", CellFunctions::GetExteriorY},\
|
||||||
{"IsInExterior", CellFunctions::IsInExterior},\
|
{"IsInExterior", CellFunctions::IsInExterior},\
|
||||||
|
@ -31,8 +31,8 @@ public:
|
||||||
static const char *GetCellStateDescription(unsigned short pid, unsigned int i) noexcept;
|
static const char *GetCellStateDescription(unsigned short pid, unsigned int i) noexcept;
|
||||||
|
|
||||||
static const char *GetCell(unsigned short pid) noexcept;
|
static const char *GetCell(unsigned short pid) noexcept;
|
||||||
static void SetCell(unsigned short pid, const char *name) noexcept;
|
static void SetCell(unsigned short pid, const char *cellDescription) noexcept;
|
||||||
static void SetExterior(unsigned short pid, int x, int y) noexcept;
|
static void SetExteriorCell(unsigned short pid, int x, int y) noexcept;
|
||||||
static int GetExteriorX(unsigned short pid) noexcept;
|
static int GetExteriorX(unsigned short pid) noexcept;
|
||||||
static int GetExteriorY(unsigned short pid) noexcept;
|
static int GetExteriorY(unsigned short pid) noexcept;
|
||||||
static bool IsInExterior(unsigned short pid) noexcept;
|
static bool IsInExterior(unsigned short pid) noexcept;
|
||||||
|
|
Loading…
Reference in a new issue