From f2b8a939efd978957552052b3811db2e15990e45 Mon Sep 17 00:00:00 2001 From: Koncord Date: Sun, 7 May 2017 02:49:58 +0800 Subject: [PATCH] [Server] Add postInit method and move getPluginListSample in to it --- apps/openmw-mp/Networking.cpp | 8 ++++++-- apps/openmw-mp/Networking.hpp | 2 ++ apps/openmw-mp/main.cpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index c9a5c25a6..84ae6d606 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -202,8 +202,6 @@ void Networking::update(RakNet::Packet *packet) packetPreInit.setChecksums(&plugins); packetPreInit.Read(); - static auto samples = getPluginListSample(); - auto plugin = plugins.begin(); if (samples.size() == plugins.size()) { @@ -501,3 +499,9 @@ void Networking::InitQuery(std::string queryAddr, unsigned short queryPort) { mclient = new MasterClient(peer, queryAddr, queryPort); } + +void Networking::postInit() +{ + Script::Call(); + samples = getPluginListSample(); +} diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index dc8254b31..92474e727 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -56,6 +56,7 @@ namespace mwmp static const Networking &get(); static Networking *getPtr(); + void postInit(); private: PacketPreInit::PluginContainer getPluginListSample(); std::string serverPassword; @@ -75,6 +76,7 @@ namespace mwmp bool running; int exitCode; + PacketPreInit::PluginContainer samples; }; } diff --git a/apps/openmw-mp/main.cpp b/apps/openmw-mp/main.cpp index 5c4c0e823..c02d271d5 100644 --- a/apps/openmw-mp/main.cpp +++ b/apps/openmw-mp/main.cpp @@ -253,7 +253,7 @@ int main(int argc, char *argv[]) networking.getMasterClient()->Start(); } - Script::Call(); + networking.postInit(); int code = networking.mainLoop();