mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
feat(Core/Config): Add parameter to load all grids of all non-instanced maps on server start (#2283)
This commit is contained in:
@@ -1326,6 +1326,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
// Prevent players AFK from being logged out
|
||||
m_int_configs[CONFIG_AFK_PREVENT_LOGOUT] = sConfigMgr->GetIntDefault("PreventAFKLogout", 0);
|
||||
|
||||
// Preload all grids of all non-instanced maps
|
||||
m_bool_configs[CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS] = sConfigMgr->GetIntDefault("PreloadAllNonInstancedMapGrids", false);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
sScriptMgr->OnAfterConfigLoad(reload);
|
||||
}
|
||||
@@ -1958,6 +1961,27 @@ void World::SetInitialWorldSettings()
|
||||
sEluna->RunScripts();
|
||||
sEluna->OnConfigLoad(false,false); // Must be done after Eluna is initialized and scripts have run.
|
||||
#endif
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS))
|
||||
{
|
||||
sLog->outString("Loading all grids for all non-instanced maps...");
|
||||
|
||||
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(i);
|
||||
|
||||
if (mapEntry && !mapEntry->Instanceable())
|
||||
{
|
||||
Map* map = sMapMgr->CreateBaseMap(mapEntry->MapID);
|
||||
|
||||
if (map)
|
||||
{
|
||||
sLog->outString(">> Loading all grids for map %u", map->GetId());
|
||||
map->LoadAllCells();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
|
||||
sLog->outString();
|
||||
|
||||
@@ -169,6 +169,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_CHECK_GOBJECT_LOS,
|
||||
CONFIG_CLOSE_IDLE_CONNECTIONS,
|
||||
CONFIG_LFG_LOCATION_ALL, // Player can join LFG anywhere
|
||||
CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user