diff --git a/apps/openmw-mp/Script/Functions/Cells.cpp b/apps/openmw-mp/Script/Functions/Cells.cpp index d3000e186..87e5f1294 100644 --- a/apps/openmw-mp/Script/Functions/Cells.cpp +++ b/apps/openmw-mp/Script/Functions/Cells.cpp @@ -46,27 +46,21 @@ const char *CellFunctions::GetCell(unsigned short pid) noexcept Player *player; 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; GET_PLAYER(pid, player,); 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 - // 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; + player->cell = Utils::getCellFromDescription(cellDescription); } -void CellFunctions::SetExterior(unsigned short pid, int x, int y) noexcept +void CellFunctions::SetExteriorCell(unsigned short pid, int x, int y) noexcept { Player *player; GET_PLAYER(pid, player,); diff --git a/apps/openmw-mp/Script/Functions/Cells.hpp b/apps/openmw-mp/Script/Functions/Cells.hpp index 69b0fcf13..db878283a 100644 --- a/apps/openmw-mp/Script/Functions/Cells.hpp +++ b/apps/openmw-mp/Script/Functions/Cells.hpp @@ -11,7 +11,7 @@ \ {"GetCell", CellFunctions::GetCell},\ {"SetCell", CellFunctions::SetCell},\ - {"SetExterior", CellFunctions::SetExterior},\ + {"SetExteriorCell", CellFunctions::SetExteriorCell},\ {"GetExteriorX", CellFunctions::GetExteriorX},\ {"GetExteriorY", CellFunctions::GetExteriorY},\ {"IsInExterior", CellFunctions::IsInExterior},\ @@ -31,8 +31,8 @@ public: 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; + static void SetCell(unsigned short pid, const char *cellDescription) noexcept; + static void SetExteriorCell(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;