From 12bd5082b897b3df20cf84eebda07d3135cdbe43 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 11 Dec 2013 12:39:13 +0100 Subject: Added a HOOK_WORLD_STARTED hook and a cRoot::CreateAndInitializeWorld function for plugins. --- src/Root.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Root.cpp') diff --git a/src/Root.cpp b/src/Root.cpp index c99bf76b7..09f29c985 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -299,12 +299,30 @@ void cRoot::LoadWorlds(cIniFile & IniFile) +cWorld * cRoot::CreateAndInitializeWorld(const AString & a_WorldName) +{ + if (m_WorldsByName[a_WorldName] != NULL) + { + return NULL; + } + cWorld* NewWorld = new cWorld(a_WorldName.c_str()); + m_WorldsByName[a_WorldName] = NewWorld; + NewWorld->Start(); + NewWorld->InitializeSpawn(); + return NewWorld; +} + + + + + void cRoot::StartWorlds(void) { for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) { itr->second->Start(); itr->second->InitializeSpawn(); + m_PluginManager->CallHookWorldStarted(*itr->second); } } -- cgit v1.2.3