aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <none@none>2010-09-15 10:35:54 +0200
committerShauren <none@none>2010-09-15 10:35:54 +0200
commit48786f29963d2977a441e615ccaffe87cb627341 (patch)
tree67cb4e1d299616b043ef81c8225c2ac0937a0090 /src
parent5a312bdc3e67f92ed83e512798cfaed981637b3d (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Pools/PoolMgr.cpp15
-rw-r--r--src/server/game/World/World.cpp12
2 files changed, 15 insertions, 12 deletions
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 9eec6222a66..03689a8507e 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -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;
}
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 6fef44a60aa..5b8f849eefb 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -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();