From b18c6dec9d6dde0f276e6b9a85ededc491e9e7fe Mon Sep 17 00:00:00 2001 From: Koncord Date: Wed, 30 Aug 2017 22:50:47 +0800 Subject: [PATCH] [Server] Fix sendList() Remove return from requestContainers() Rename "Cells" usertype to "Cell" --- apps/openmw-mp/Actors.cpp | 9 ++++++++- apps/openmw-mp/Cells.cpp | 2 +- apps/openmw-mp/Object.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/openmw-mp/Actors.cpp b/apps/openmw-mp/Actors.cpp index aa26634d4..bfd062d57 100644 --- a/apps/openmw-mp/Actors.cpp +++ b/apps/openmw-mp/Actors.cpp @@ -87,7 +87,7 @@ void ActorController::Init(LuaState &lua) sol::table playersTable = lua.getState()->create_named_table("Actors"); playersTable.set_function("createActor", [&lua](){ - lua.getActorCtrl().createActor(); + return lua.getActorCtrl().createActor(); }); playersTable.set_function("sendActors", [&lua](shared_ptr player, vector> actors, @@ -239,9 +239,16 @@ void ActorController::sendList(std::shared_ptr player, std::vectorguid; actorList.action = mwmp::BaseActorList::SET; + for(auto &actor : actors) + { + actorList.baseActors.push_back(actor->actor); + } + auto packet = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST); packet->setActorList(&actorList); packet->Send(actorList.guid); + if (sendToAll) + CellController::get()->getCell(&actorList.cell)->sendToLoaded(packet, &actorList); } void ActorController::requestList(std::shared_ptr player, const ESM::Cell &cell) diff --git a/apps/openmw-mp/Cells.cpp b/apps/openmw-mp/Cells.cpp index 1a399f0fe..626baa82c 100644 --- a/apps/openmw-mp/Cells.cpp +++ b/apps/openmw-mp/Cells.cpp @@ -13,7 +13,7 @@ using namespace std; void Cells::Init(LuaState &lua) { - lua.getState()->new_usertype("Cells", + lua.getState()->new_usertype("Cell", "cell", sol::property(&Cells::getCell, &Cells::setCell), "getExterior", &Cells::getExterior, "setExterior", &Cells::setExterior, diff --git a/apps/openmw-mp/Object.cpp b/apps/openmw-mp/Object.cpp index 8b4f7b9d8..7b3426abc 100644 --- a/apps/openmw-mp/Object.cpp +++ b/apps/openmw-mp/Object.cpp @@ -268,7 +268,7 @@ void ObjectController::Init(LuaState &lua) }); objectCtrl.set_function("requestContainers", [&lua](shared_ptr player) { - return lua.getObjectCtrl().requestContainers(player); + lua.getObjectCtrl().requestContainers(player); });