From 4bde7d80f501fcb68dc376769ce7bb43272e6900 Mon Sep 17 00:00:00 2001 From: Koncord Date: Fri, 16 Feb 2018 05:12:01 +0800 Subject: [PATCH] [Server] Use regular Ptrs where possible to avoid seizure Ptrs by lua --- apps/openmw-mp/Networking.cpp | 18 +++++++++--------- apps/openmw-mp/Players.cpp | 12 +++++++----- apps/openmw-mp/Players.hpp | 2 +- apps/openmw-mp/Script/LuaState.cpp | 12 ++++++------ .../actor/ProcessorActorEquipment.hpp | 2 +- .../processors/actor/ProcessorActorList.hpp | 2 +- .../processors/actor/ProcessorActorTest.hpp | 2 +- .../processors/player/ProcessorChatMsg.hpp | 2 +- .../player/ProcessorGUIMessageBox.hpp | 2 +- .../processors/player/ProcessorGameWeather.hpp | 2 +- .../player/ProcessorPlayerAttribute.hpp | 2 +- .../processors/player/ProcessorPlayerBook.hpp | 2 +- .../player/ProcessorPlayerBounty.hpp | 2 +- .../player/ProcessorPlayerCellChange.hpp | 2 +- .../player/ProcessorPlayerCharGen.hpp | 2 +- .../processors/player/ProcessorPlayerDeath.hpp | 2 +- .../player/ProcessorPlayerDisposition.hpp | 2 +- .../player/ProcessorPlayerEquipment.hpp | 2 +- .../player/ProcessorPlayerFaction.hpp | 2 +- .../player/ProcessorPlayerInventory.hpp | 2 +- .../player/ProcessorPlayerJournal.hpp | 2 +- .../player/ProcessorPlayerKillCount.hpp | 2 +- .../processors/player/ProcessorPlayerLevel.hpp | 2 +- .../player/ProcessorPlayerQuickKeys.hpp | 2 +- .../processors/player/ProcessorPlayerRest.hpp | 2 +- .../player/ProcessorPlayerResurrect.hpp | 2 +- .../player/ProcessorPlayerShapeshift.hpp | 2 +- .../processors/player/ProcessorPlayerSkill.hpp | 2 +- .../player/ProcessorPlayerSpellbook.hpp | 2 +- .../processors/player/ProcessorPlayerTopic.hpp | 2 +- .../processors/world/ProcessorObjectDelete.hpp | 2 +- .../processors/world/ProcessorObjectLock.hpp | 2 +- .../processors/world/ProcessorObjectPlace.hpp | 2 +- .../processors/world/ProcessorObjectScale.hpp | 2 +- .../processors/world/ProcessorObjectSpawn.hpp | 2 +- .../processors/world/ProcessorObjectState.hpp | 2 +- .../processors/world/ProcessorObjectTrap.hpp | 2 +- 37 files changed, 56 insertions(+), 54 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index f1e6f1a3a..8382f4424 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -121,7 +121,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) player->setLoadState(Player::LOADED); player->joinChannel(0, "Default"); - bool result = luaState.getEventCtrl().Call(player); + bool result = luaState.getEventCtrl().Call(player.get()); if (!result) { @@ -297,13 +297,13 @@ void Networking::newPlayer(RakNet::RakNetGUID guid) // If we are iterating over a player who has inputted their name, proceed else if (pl->getLoadState() == Player::POSTLOADED) { - playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_POSITION)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl.get()); - playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl.get()); + playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_POSITION)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl); + playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl); playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid); playerPacketController->GetPacket(ID_PLAYER_STATS_DYNAMIC)->Send(guid); @@ -325,7 +325,7 @@ void Networking::disconnectPlayer(RakNet::RakNetGUID guid) if (player == nullptr) return; - luaState.getEventCtrl().Call(player); + luaState.getEventCtrl().Call(player.get()); playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player.get()); playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(true); diff --git a/apps/openmw-mp/Players.cpp b/apps/openmw-mp/Players.cpp index d860d4d61..58fea7c7f 100644 --- a/apps/openmw-mp/Players.cpp +++ b/apps/openmw-mp/Players.cpp @@ -13,8 +13,8 @@ std::queue Players::updateQueue; void Players::Init(LuaState &lua) { sol::table playersTable = lua.getState()->create_named_table("Players"); - playersTable.set_function("getByPID", &Players::getPlayerByPID); - playersTable.set_function("getByGUID", &Players::getPlayerByGUID); + playersTable.set_function("getByPID", [](int pid) { return Players::getPlayerByPID(pid).get(); }); + playersTable.set_function("getByGUID", [](RakNet::RakNetGUID guid) { return Players::getPlayerByGUID(guid).get(); }); playersTable.set_function("for_each", [](sol::function func) { for (shared_ptr player : store) @@ -103,15 +103,17 @@ void Players::deletePlayerByGUID(RakNet::RakNetGUID guid) if (it != ls.end()) { (*it)->markedForDeletion = true; + mwmp::Networking::get().getState().getState()->collect_garbage(); + size_t useCount = it->use_count(); ls.erase(it); - LOG_APPEND(Log::LOG_TRACE, "- references: %d", it->use_count()); + LOG_APPEND(Log::LOG_TRACE, "- references: %d", useCount - 1); } } -void Players::for_each(std::function)> func) +void Players::for_each(std::function func) { for (auto &player : store) - func(player); + func(player.get()); } Players::Store::const_iterator Players::begin() diff --git a/apps/openmw-mp/Players.hpp b/apps/openmw-mp/Players.hpp index 9c9dabda5..c097ff85a 100644 --- a/apps/openmw-mp/Players.hpp +++ b/apps/openmw-mp/Players.hpp @@ -47,7 +47,7 @@ public: static Store::const_iterator end(); static size_t size(); - static void for_each(std::function)> func); + static void for_each(std::function func); static void processUpdated(); private: diff --git a/apps/openmw-mp/Script/LuaState.cpp b/apps/openmw-mp/Script/LuaState.cpp index 5f6cd6db3..320d4c69d 100644 --- a/apps/openmw-mp/Script/LuaState.cpp +++ b/apps/openmw-mp/Script/LuaState.cpp @@ -255,12 +255,12 @@ LuaState::LuaState() lua->set_function("setHour", [](double hour) { auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&hour, &packet](std::shared_ptr player){ + Players::for_each([&hour, &packet](Player *player){ player->hour = hour; player->month = -1; player->day = -1; - packet->setPlayer(player.get()); + packet->setPlayer(player); packet->Send(false); }); }); @@ -268,24 +268,24 @@ LuaState::LuaState() lua->set_function("setMonth", [](int month) { auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&month, &packet](std::shared_ptr player){ + Players::for_each([&month, &packet](Player *player){ player->hour = -1; player->month = month; player->day = -1; - packet->setPlayer(player.get()); + packet->setPlayer(player); packet->Send(false); }); }); lua->set_function("setDay", [](int day) { auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&day, &packet](std::shared_ptr player){ + Players::for_each([&day, &packet](Player *player){ player->hour = -1; player->month = -1; player->day = day; - packet->setPlayer(player.get()); + packet->setPlayer(player); packet->Send(false); }); }); diff --git a/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp b/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp index 6fb63562c..af3c2b154 100644 --- a/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp @@ -25,7 +25,7 @@ namespace mwmp actors.emplace_back(actor); } - Networking::get().getState().getEventCtrl().Call(player, actors); + Networking::get().getState().getEventCtrl().Call(player.get(), actors); Networking::get().getState().getActorCtrl().sendActors(player, actors, actorList.cell, true); } diff --git a/apps/openmw-mp/processors/actor/ProcessorActorList.hpp b/apps/openmw-mp/processors/actor/ProcessorActorList.hpp index 42db7c70c..cc716bd12 100644 --- a/apps/openmw-mp/processors/actor/ProcessorActorList.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorList.hpp @@ -26,7 +26,7 @@ namespace mwmp actors.emplace_back(actor); } - Networking::get().getState().getEventCtrl().Call(player, actors); + Networking::get().getState().getEventCtrl().Call(player.get(), actors); Networking::get().getState().getActorCtrl().sendActors(player, actors, actorList.cell, true); } diff --git a/apps/openmw-mp/processors/actor/ProcessorActorTest.hpp b/apps/openmw-mp/processors/actor/ProcessorActorTest.hpp index cab10ce4e..96e8efbb2 100644 --- a/apps/openmw-mp/processors/actor/ProcessorActorTest.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorTest.hpp @@ -24,7 +24,7 @@ namespace mwmp actors.emplace_back(actor); } - Networking::get().getState().getEventCtrl().Call(player, actors); + Networking::get().getState().getEventCtrl().Call(player.get(), actors); Networking::get().getState().getActorCtrl().sendActors(player, actors, actorList.cell, true); } diff --git a/apps/openmw-mp/processors/player/ProcessorChatMsg.hpp b/apps/openmw-mp/processors/player/ProcessorChatMsg.hpp index 08fb831fb..a2c3c4c48 100644 --- a/apps/openmw-mp/processors/player/ProcessorChatMsg.hpp +++ b/apps/openmw-mp/processors/player/ProcessorChatMsg.hpp @@ -30,7 +30,7 @@ namespace mwmp player->message(player->chat.channel, "#FF0000Command not found.\n"); // inform player that command not found break; case CommandController::ExecResult::NOT_CMD: // cmd length < 2 or message is not cmd - lua.getEventCtrl().Call(player, player->chat.message, player->chat.channel); + lua.getEventCtrl().Call(player.get(), player->chat.message, player->chat.channel); break; case CommandController::ExecResult::SUCCESS: // returned true from function break; diff --git a/apps/openmw-mp/processors/player/ProcessorGUIMessageBox.hpp b/apps/openmw-mp/processors/player/ProcessorGUIMessageBox.hpp index a7fedfb65..de7e6bc1e 100644 --- a/apps/openmw-mp/processors/player/ProcessorGUIMessageBox.hpp +++ b/apps/openmw-mp/processors/player/ProcessorGUIMessageBox.hpp @@ -21,7 +21,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player, player->guiMessageBox.id, + Networking::get().getState().getEventCtrl().Call(player.get(), player->guiMessageBox.id, player->guiMessageBox.data); } }; diff --git a/apps/openmw-mp/processors/player/ProcessorGameWeather.hpp b/apps/openmw-mp/processors/player/ProcessorGameWeather.hpp index fb5bff6d9..e48a8e23b 100644 --- a/apps/openmw-mp/processors/player/ProcessorGameWeather.hpp +++ b/apps/openmw-mp/processors/player/ProcessorGameWeather.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerAttribute.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerAttribute.hpp index a7667dfda..6c982e5af 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerAttribute.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerAttribute.hpp @@ -25,7 +25,7 @@ namespace mwmp player->sendToLoaded(packet); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } } }; diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerBook.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerBook.hpp index 1ca96bd1c..f5644ed87 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerBook.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerBook.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp index 957f512df..2d0d700f2 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp @@ -15,7 +15,7 @@ namespace mwmp void Do(PlayerPacket &packet, const std::shared_ptr &player) override { - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp index 68d0615a6..b0ef4d951 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp @@ -71,7 +71,7 @@ namespace mwmp packet.setPlayer(player.get()); packet.Send(true); //send to other clients - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); LOG_APPEND(Log::LOG_INFO, "- Finished processing ID_PLAYER_CELL_CHANGE"); } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerCharGen.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerCharGen.hpp index 48a28f56b..75bb620e0 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerCharGen.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerCharGen.hpp @@ -22,7 +22,7 @@ namespace mwmp DEBUG_PRINTF(strPacketID.c_str()); if (player->charGenState.currentStage == player->charGenState.endStage) - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerDeath.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerDeath.hpp index 335afd8d0..162c5eb04 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerDeath.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerDeath.hpp @@ -26,7 +26,7 @@ namespace mwmp packet.Send(true); - Networking::get().getState().getEventCtrl().Call(player, player->deathReason); + Networking::get().getState().getEventCtrl().Call(player.get(), player->deathReason); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerDisposition.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerDisposition.hpp index 864fe0278..95de870d4 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerDisposition.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerDisposition.hpp @@ -19,7 +19,7 @@ namespace mwmp packet.Send(true); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerEquipment.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerEquipment.hpp index b62557db4..fec0d3b24 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerEquipment.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerEquipment.hpp @@ -23,7 +23,7 @@ namespace mwmp player->sendToLoaded(packet); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp index 3db79db22..8022046c0 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerInventory.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerInventory.hpp index 4efe375e6..42168272d 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerInventory.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerInventory.hpp @@ -21,7 +21,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerJournal.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerJournal.hpp index 44c7d67e2..c26315e40 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerJournal.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerJournal.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp index 4f005c9d6..99089a310 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp @@ -19,7 +19,7 @@ namespace mwmp packet.Send(true); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerLevel.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerLevel.hpp index 11a8a09ee..fde8aca61 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerLevel.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerLevel.hpp @@ -16,7 +16,7 @@ namespace mwmp void Do(PlayerPacket &packet, const std::shared_ptr &player) override { if (!player->creatureStats.mDead) - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerQuickKeys.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerQuickKeys.hpp index 9dd7703cc..7bee11dfb 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerQuickKeys.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerQuickKeys.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerRest.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerRest.hpp index f9df64bd4..1660622d8 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerRest.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerRest.hpp @@ -17,7 +17,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerResurrect.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerResurrect.hpp index b70a3a32f..cfd6496b2 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerResurrect.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerResurrect.hpp @@ -25,7 +25,7 @@ namespace mwmp packet.Send(true); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerShapeshift.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerShapeshift.hpp index 15e72b6f2..41c32f2f9 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerShapeshift.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerShapeshift.hpp @@ -19,7 +19,7 @@ namespace mwmp packet.Send(true); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerSkill.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerSkill.hpp index c96fcdf3f..b262a8972 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerSkill.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerSkill.hpp @@ -24,7 +24,7 @@ namespace mwmp //myPacket->Send(player, true); player->sendToLoaded(packet); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } } }; diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerSpellbook.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerSpellbook.hpp index 4ef7ed7be..dfdd7a45a 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerSpellbook.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerSpellbook.hpp @@ -21,7 +21,7 @@ namespace mwmp { DEBUG_PRINTF(strPacketID.c_str()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerTopic.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerTopic.hpp index f03b289b8..26c625f4f 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerTopic.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerTopic.hpp @@ -18,7 +18,7 @@ namespace mwmp DEBUG_PRINTF(strPacketID.c_str()); //Todo: Script::Call(player.getId()); - Networking::get().getState().getEventCtrl().Call(player); + Networking::get().getState().getEventCtrl().Call(player.get()); } }; } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp b/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp index 0cb9505dc..ab685f35b 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp @@ -22,7 +22,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp b/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp index 6fa206ceb..2028ab9ab 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectLock.hpp @@ -22,7 +22,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp index 1e95ab34e..d348f8c62 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp @@ -29,7 +29,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp b/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp index 74c9ded96..9216f6ac5 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectScale.hpp @@ -22,7 +22,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp b/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp index a183edffb..4b037551b 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp @@ -29,7 +29,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectState.hpp b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp index 62d40ea44..10ce5923b 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectState.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp @@ -22,7 +22,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); } diff --git a/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp b/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp index 657439346..989d28f77 100644 --- a/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp +++ b/apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp @@ -22,7 +22,7 @@ namespace mwmp auto objCtrl = Networking::get().getState().getObjectCtrl(); auto objects = objCtrl.copyObjects(event); - Networking::get().getState().getEventCtrl().Call(player, objects); + Networking::get().getState().getEventCtrl().Call(player.get(), objects); objCtrl.sendObjects(player, objects, event.cell); }