mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11129] Added WorldMap/WorldPersistentState subclass for non-instanceable maps.
This let have symmetric Map/MapPersistentState (sub)classes hierarchy.
This commit is contained in:
parent
98aff742c1
commit
6d26ec0e7f
6 changed files with 62 additions and 26 deletions
|
|
@ -56,13 +56,6 @@ MapEntry const* MapPersistentState::GetMapEntry() const
|
|||
return sMapStore.LookupEntry(m_mapid);
|
||||
}
|
||||
|
||||
bool MapPersistentState::CanBeUnload() const
|
||||
{
|
||||
// prevent unload if used for loaded map
|
||||
// prevent unload if respawn data still exist (will not prevent reset by scheduler)
|
||||
return !m_usedByMap && m_creatureRespawnTimes.empty() && m_goRespawnTimes.empty();
|
||||
}
|
||||
|
||||
/* true if the instance state is still valid */
|
||||
bool MapPersistentState::UnloadIfEmpty()
|
||||
{
|
||||
|
|
@ -135,7 +128,14 @@ void MapPersistentState::ClearRespawnTimes()
|
|||
UnloadIfEmpty();
|
||||
}
|
||||
|
||||
//== WorldPersistentState functions ========================
|
||||
|
||||
bool WorldPersistentState::CanBeUnload() const
|
||||
{
|
||||
// prevent unload if used for loaded map
|
||||
// prevent unload if respawn data still exist (will not prevent reset by scheduler)
|
||||
return MapPersistentState::CanBeUnload() && HasRespawnTimes();
|
||||
}
|
||||
|
||||
//== DungeonPersistentState functions =====================
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ DungeonPersistentState::~DungeonPersistentState()
|
|||
bool DungeonPersistentState::CanBeUnload() const
|
||||
{
|
||||
// prevent unload if any bounded groups or online bounded player still exists
|
||||
return MapPersistentState::CanBeUnload() && m_playerList.empty() && m_groupList.empty();
|
||||
return MapPersistentState::CanBeUnload() && HasBounds() && HasRespawnTimes();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -222,7 +222,7 @@ bool BattleGroundPersistentState::CanBeUnload() const
|
|||
{
|
||||
// prevent unload if used for loaded map
|
||||
// BGs/Arenas not locked by respawn data/etc
|
||||
return !IsUsedByMap();
|
||||
return MapPersistentState::CanBeUnload();
|
||||
}
|
||||
|
||||
//== DungeonResetScheduler functions ======================
|
||||
|
|
@ -521,7 +521,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
|
|||
else if (mapEntry->IsBattleGroundOrArena())
|
||||
state = new BattleGroundPersistentState(mapEntry->MapID, instanceId, difficulty);
|
||||
else
|
||||
state = new MapPersistentState(mapEntry->MapID, instanceId, difficulty);
|
||||
state = new WorldPersistentState(mapEntry->MapID);
|
||||
|
||||
|
||||
if (instanceId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue