1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 09:06:43 +00:00

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

This commit is contained in:
Koncord 2017-05-07 02:49:58 +08:00
parent 8422ae0ce8
commit f2b8a939ef
3 changed files with 9 additions and 3 deletions

View file

@ -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();
}

View file

@ -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;
}; };
} }

View file

@ -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();