mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Pools: Fixed a possible infinite loop in quest pools
Core/Pools: Fixed loading of quest pools Core/Pools: Fixed possible startup crash Closes issue #4015. --HG-- branch : trunk
This commit is contained in:
@@ -480,7 +480,8 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32
|
||||
ActivePoolObjects::iterator itr = currentQuests.begin();
|
||||
std::advance(itr, urand(0, currentQuests.size()-1));
|
||||
newQuests.insert(*itr);
|
||||
} while (newQuests.size() < limit);
|
||||
currentQuests.erase(*itr);
|
||||
} while (newQuests.size() < limit && !currentQuests.empty()); // failsafe
|
||||
}
|
||||
|
||||
if (newQuests.empty())
|
||||
@@ -842,7 +843,9 @@ void PoolMgr::LoadQuestPools()
|
||||
QUEST_NONE = 0,
|
||||
QUEST_DAILY = 1,
|
||||
QUEST_WEEKLY = 2
|
||||
} pooledType = QUEST_NONE;
|
||||
};
|
||||
|
||||
std::map<uint32, uint32> poolTypeMap;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -871,14 +874,14 @@ void PoolMgr::LoadQuestPools()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pooledType)
|
||||
pooledType = pQuest->IsDaily() ? QUEST_DAILY : QUEST_WEEKLY;
|
||||
if (poolTypeMap[pool_id] == QUEST_NONE)
|
||||
poolTypeMap[pool_id] = pQuest->IsDaily() ? QUEST_DAILY : QUEST_WEEKLY;
|
||||
|
||||
eQuestTypes currType = pQuest->IsDaily() ? QUEST_DAILY : QUEST_WEEKLY;
|
||||
|
||||
if (pooledType != currType)
|
||||
if (poolTypeMap[pool_id] != currType)
|
||||
{
|
||||
sLog.outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, pooledType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY");
|
||||
sLog.outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1407,21 +1407,18 @@ void World::SetInitialWorldSettings()
|
||||
sLog.outString("Loading Vehicle Accessories...");
|
||||
sObjectMgr.LoadVehicleAccessories(); // must be after LoadCreatureTemplates()
|
||||
|
||||
sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
|
||||
sLog.outString("Loading Creature Respawn Data..."); // must be after PackInstances()
|
||||
sObjectMgr.LoadCreatureRespawnTimes();
|
||||
|
||||
sLog.outString("Loading Gameobject Data...");
|
||||
sObjectMgr.LoadGameobjects();
|
||||
|
||||
sLog.outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
|
||||
sLog.outString("Loading Gameobject Respawn Data..."); // must be after PackInstances()
|
||||
sObjectMgr.LoadGameobjectRespawnTimes();
|
||||
|
||||
sLog.outString("Loading Objects Pooling Data...");
|
||||
sPoolMgr.LoadFromDB();
|
||||
|
||||
sLog.outString("Loading Game Event Data...");
|
||||
sGameEventMgr.LoadFromDB();
|
||||
|
||||
sLog.outString("Loading Weather Data...");
|
||||
sWeatherMgr.LoadWeatherData();
|
||||
|
||||
@@ -1429,7 +1426,7 @@ void World::SetInitialWorldSettings()
|
||||
sObjectMgr.LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
|
||||
|
||||
sLog.outString("Checking Quest Disables");
|
||||
sDisableMgr.CheckQuestDisables(); // must be after loading quests
|
||||
sDisableMgr.CheckQuestDisables(); // must be after loading quests
|
||||
|
||||
sLog.outString("Loading Quest POI");
|
||||
sObjectMgr.LoadQuestPOI();
|
||||
@@ -1440,6 +1437,9 @@ void World::SetInitialWorldSettings()
|
||||
sLog.outString("Loading Quest Pooling Data...");
|
||||
sPoolMgr.LoadQuestPools();
|
||||
|
||||
sLog.outString("Loading Game Event Data..."); // must be after loading pools fully
|
||||
sGameEventMgr.LoadFromDB();
|
||||
|
||||
sLog.outString("Loading Dungeon boss data...");
|
||||
sLFGMgr.LoadDungeonEncounters();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user