mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[11126] Rewrite InstanceSaveMgr related code.
* For better fit name to related map type class InstanceMap renamed -> DungeonMap. This clarify usage Instanceable()/IsDungeon() because BG/Arenas maps also instanceable maps. * InstanceSave have many code related to only DungeonMap case, so it replaced by 3 new classes: - MapPersistentState as base class, used for non-instanceable maps (continents and some other) (!Instenceable()) - DungeonPersistentState subclass of MapPersistentState, used for DungeonMap states (IsDungoen()) - BattlegroundPersistentState subclass of MapPersistentState, used for BattlegroundMap states (IsBattleGroundOrArena()) Now all dungeon resets code moved to subclass and all player/gpoup bound functions/structures also use it. * Map::GetInstanceSave renamed to Map::GetPersistentState and DungeonMap have specialized version return DungeonPersistentState (same pointer in fact with proper subcalss type) * InstanceResetScheduler renamed to DungeonResetScheduler
This commit is contained in:
parent
0d16b0bdc7
commit
dde16bc48c
22 changed files with 683 additions and 550 deletions
|
|
@ -102,7 +102,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
|
|||
if(entry->Instanceable())
|
||||
{
|
||||
MANGOS_ASSERT(obj->GetTypeId() == TYPEID_PLAYER);
|
||||
//create InstanceMap object
|
||||
//create DungeonMap object
|
||||
if(obj->GetTypeId() == TYPEID_PLAYER)
|
||||
m = CreateInstance(id, (Player*)obj);
|
||||
}
|
||||
|
|
@ -370,14 +370,14 @@ Map* MapManager::CreateInstance(uint32 id, Player * player)
|
|||
map = FindMap(id, NewInstanceId);
|
||||
MANGOS_ASSERT(map);
|
||||
}
|
||||
else if (InstanceSave* pSave = player->GetBoundInstanceSaveForSelfOrGroup(id))
|
||||
else if (DungeonPersistentState* pSave = player->GetBoundInstanceSaveForSelfOrGroup(id))
|
||||
{
|
||||
// solo/perm/group
|
||||
NewInstanceId = pSave->GetInstanceId();
|
||||
map = FindMap(id, NewInstanceId);
|
||||
// it is possible that the save exists but the map doesn't
|
||||
if (!map)
|
||||
pNewMap = CreateInstanceMap(id, NewInstanceId, pSave->GetDifficulty(), pSave);
|
||||
pNewMap = CreateDungeonMap(id, NewInstanceId, pSave->GetDifficulty(), pSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -386,7 +386,7 @@ Map* MapManager::CreateInstance(uint32 id, Player * player)
|
|||
NewInstanceId = sObjectMgr.GenerateLowGuid(HIGHGUID_INSTANCE);
|
||||
|
||||
Difficulty diff = player->GetGroup() ? player->GetGroup()->GetDifficulty(entry->IsRaid()) : player->GetDifficulty(entry->IsRaid());
|
||||
pNewMap = CreateInstanceMap(id, NewInstanceId, diff);
|
||||
pNewMap = CreateDungeonMap(id, NewInstanceId, diff);
|
||||
}
|
||||
|
||||
//add a new map object into the registry
|
||||
|
|
@ -399,17 +399,17 @@ Map* MapManager::CreateInstance(uint32 id, Player * player)
|
|||
return map;
|
||||
}
|
||||
|
||||
InstanceMap* MapManager::CreateInstanceMap(uint32 id, uint32 InstanceId, Difficulty difficulty, InstanceSave *save)
|
||||
DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState *save)
|
||||
{
|
||||
// make sure we have a valid map id
|
||||
if (!sMapStore.LookupEntry(id))
|
||||
{
|
||||
sLog.outError("CreateInstanceMap: no entry for map %d", id);
|
||||
sLog.outError("CreateDungeonMap: no entry for map %d", id);
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
if (!ObjectMgr::GetInstanceTemplate(id))
|
||||
{
|
||||
sLog.outError("CreateInstanceMap: no instance template for map %d", id);
|
||||
sLog.outError("CreateDungeonMap: no instance template for map %d", id);
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
|
||||
|
|
@ -417,10 +417,9 @@ InstanceMap* MapManager::CreateInstanceMap(uint32 id, uint32 InstanceId, Difficu
|
|||
if (!GetMapDifficultyData(id, difficulty))
|
||||
difficulty = DUNGEON_DIFFICULTY_NORMAL;
|
||||
|
||||
DEBUG_LOG("MapInstanced::CreateInstanceMap: %s map instance %d for %d created with difficulty %d", save?"":"new ", InstanceId, id, difficulty);
|
||||
DEBUG_LOG("MapInstanced::CreateDungeonMap: %s map instance %d for %d created with difficulty %d", save?"":"new ", InstanceId, id, difficulty);
|
||||
|
||||
InstanceMap *map = new InstanceMap(id, i_gridCleanUpDelay, InstanceId, difficulty);
|
||||
MANGOS_ASSERT(map->IsDungeon());
|
||||
DungeonMap *map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId, difficulty);
|
||||
|
||||
// Dungeons can have saved instance data
|
||||
bool load_data = save != NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue