From 217894100add217511e508f0c2ce93153ec9abec Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 1 May 2017 00:49:58 +0300 Subject: [PATCH] [Server] Add ReadCellActorList() script function --- apps/openmw-mp/Script/Functions/Actors.cpp | 7 +++++++ apps/openmw-mp/Script/Functions/Actors.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/apps/openmw-mp/Script/Functions/Actors.cpp b/apps/openmw-mp/Script/Functions/Actors.cpp index 06f4c0a10..7d5306bd3 100644 --- a/apps/openmw-mp/Script/Functions/Actors.cpp +++ b/apps/openmw-mp/Script/Functions/Actors.cpp @@ -25,6 +25,13 @@ void ActorFunctions::ReadLastActorList() noexcept readActorList = mwmp::Networking::getPtr()->getLastActorList(); } +void ActorFunctions::ReadCellActorList(const char* cellDescription) noexcept +{ + ESM::Cell esmCell = Utils::getCellFromDescription(cellDescription); + Cell *serverCell = CellController::get()->getCell(&esmCell); + readActorList = serverCell->getActorList(); +} + void ActorFunctions::InitializeActorList(unsigned short pid) noexcept { Player *player; diff --git a/apps/openmw-mp/Script/Functions/Actors.hpp b/apps/openmw-mp/Script/Functions/Actors.hpp index 34e47750a..43b043bf1 100644 --- a/apps/openmw-mp/Script/Functions/Actors.hpp +++ b/apps/openmw-mp/Script/Functions/Actors.hpp @@ -3,6 +3,7 @@ #define ACTORAPI \ {"ReadLastActorList", ActorFunctions::ReadLastActorList},\ + {"ReadCellActorList", ActorFunctions::ReadCellActorList},\ {"InitializeActorList", ActorFunctions::InitializeActorList},\ \ {"GetActorListSize", ActorFunctions::GetActorListSize},\ @@ -57,6 +58,7 @@ class ActorFunctions public: static void ReadLastActorList() noexcept; + static void ReadCellActorList(const char* cellDescription) noexcept; static void InitializeActorList(unsigned short pid) noexcept; static unsigned int GetActorListSize() noexcept;