1
0

Added a HOOK_WORLD_STARTED hook and a cRoot::CreateAndInitializeWorld function for plugins.

This commit is contained in:
STRWarrior
2013-12-11 12:39:13 +01:00
parent 9cfd8f6910
commit 12bd5082b8
9 changed files with 98 additions and 2 deletions

View File

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