Core/BattlegroundMap: Load all cells when created & mark all creatures as active (#29410)

This commit is contained in:
Jeremy
2023-11-14 18:40:39 +01:00
committed by GitHub
parent 740136af41
commit e72bde5236
6 changed files with 25 additions and 0 deletions

View File

@@ -548,6 +548,9 @@ bool Map::AddToMap(T* obj)
return false; //Should delete object
}
if (IsAlwaysActive())
obj->setActive(true);
Cell cell(cellCoord);
if (obj->isActiveObject())
EnsureGridLoadedForActiveObject(cell, obj);
@@ -3295,6 +3298,11 @@ bool Map::IsGarrison() const
return i_mapEntry && i_mapEntry->IsGarrison();
}
bool Map::IsAlwaysActive() const
{
return IsBattlegroundOrArena();
}
bool Map::GetEntrancePos(int32 &mapid, float &x, float &y)
{
if (!i_mapEntry)

View File

@@ -338,6 +338,8 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
bool IsBattlegroundOrArena() const;
bool IsScenario() const;
bool IsGarrison() const;
// Currently, this means that every entity added to this map will be marked as active
bool IsAlwaysActive() const;
bool GetEntrancePos(int32& mapid, float& x, float& y);
void AddObjectToRemoveList(WorldObject* obj);

View File

@@ -122,6 +122,10 @@ BattlegroundMap* MapManager::CreateBattleground(uint32 mapId, uint32 instanceId,
ASSERT(map->IsBattlegroundOrArena());
map->SetBG(bg);
bg->SetBgMap(map);
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUNDMAP_LOAD_GRIDS))
map->LoadAllCells();
return map;
}

View File

@@ -803,6 +803,7 @@ void World::LoadConfigSettings(bool reload)
TC_LOG_ERROR("server.loading", "InstanceMapLoadAllGrids enabled, but GridUnload also enabled. GridUnload must be disabled to enable instance map pre-loading. Instance map pre-loading disabled");
m_bool_configs[CONFIG_INSTANCEMAP_LOAD_GRIDS] = false;
}
m_bool_configs[CONFIG_BATTLEGROUNDMAP_LOAD_GRIDS] = sConfigMgr->GetBoolDefault("BattlegroundMapLoadAllGrids", true);
m_int_configs[CONFIG_INTERVAL_SAVE] = sConfigMgr->GetIntDefault("PlayerSaveInterval", 15 * MINUTE * IN_MILLISECONDS);
m_int_configs[CONFIG_INTERVAL_DISCONNECT_TOLERANCE] = sConfigMgr->GetIntDefault("DisconnectToleranceInterval", 0);
m_bool_configs[CONFIG_STATS_SAVE_ONLY_ON_LOGOUT] = sConfigMgr->GetBoolDefault("PlayerSave.Stats.SaveOnlyOnLogout", true);

View File

@@ -195,6 +195,7 @@ enum WorldBoolConfigs
CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID,
CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE,
CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT,
CONFIG_BATTLEGROUNDMAP_LOAD_GRIDS,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -329,6 +329,15 @@ BaseMapLoadAllGrids = 0
InstanceMapLoadAllGrids = 0
#
# BattlegroundMapLoadAllGrids
# Description: Load all grids for battleground maps upon load.
# Upon loading an battleground map, all creatures/objects in the map will be pre-loaded
# Default: 1 - (Preload all grids in the instance upon load)
# 0 - (Don't preload all base maps, dynamically load as used)
BattlegroundMapLoadAllGrids = 1
#
# SocketTimeOutTime
# Description: Time (in milliseconds) after which a connection being idle on the character