aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Pools/PoolMgr.cpp
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/server/game/Pools/PoolMgr.cpp
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/server/game/Pools/PoolMgr.cpp')
-rw-r--r--src/server/game/Pools/PoolMgr.cpp15
1 files changed, 9 insertions, 6 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;
}