[Server] Add postInit method and move getPluginListSample in to it

0.6.1
Koncord 8 years ago
parent 8422ae0ce8
commit f2b8a939ef

@ -202,8 +202,6 @@ void Networking::update(RakNet::Packet *packet)
packetPreInit.setChecksums(&plugins); packetPreInit.setChecksums(&plugins);
packetPreInit.Read(); packetPreInit.Read();
static auto samples = getPluginListSample();
auto plugin = plugins.begin(); auto plugin = plugins.begin();
if (samples.size() == plugins.size()) if (samples.size() == plugins.size())
{ {
@ -501,3 +499,9 @@ void Networking::InitQuery(std::string queryAddr, unsigned short queryPort)
{ {
mclient = new MasterClient(peer, queryAddr, queryPort); mclient = new MasterClient(peer, queryAddr, queryPort);
} }
void Networking::postInit()
{
Script::Call<Script::CallbackIdentity("OnServerPostInit")>();
samples = getPluginListSample();
}

@ -56,6 +56,7 @@ namespace mwmp
static const Networking &get(); static const Networking &get();
static Networking *getPtr(); static Networking *getPtr();
void postInit();
private: private:
PacketPreInit::PluginContainer getPluginListSample(); PacketPreInit::PluginContainer getPluginListSample();
std::string serverPassword; std::string serverPassword;
@ -75,6 +76,7 @@ namespace mwmp
bool running; bool running;
int exitCode; int exitCode;
PacketPreInit::PluginContainer samples;
}; };
} }

@ -253,7 +253,7 @@ int main(int argc, char *argv[])
networking.getMasterClient()->Start(); networking.getMasterClient()->Start();
} }
Script::Call<Script::CallbackIdentity("OnServerPostInit")>(); networking.postInit();
int code = networking.mainLoop(); int code = networking.mainLoop();

Loading…
Cancel
Save