aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlinencloth <none@none>2010-09-17 04:25:00 +0200
committerlinencloth <none@none>2010-09-17 04:25:00 +0200
commit5de48a67c6b650e98271acc704de8c4ed432bf4f (patch)
tree0737c4c61d6567a98da3d316b5e636ded57b4b0b /src
parentf12a61f9f4117c63b26e7ffdc015286028d39490 (diff)
Core: Optimize quest POI points loading
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 7255f56808b..63be505a3d0 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -7058,7 +7058,7 @@ void ObjectMgr::LoadQuestPOI()
uint32 count = 0;
- // 0 1 2 3
+ // 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT questId, id, objIndex, mapid, WorldMapAreaId, FloorId, unk3, unk4 FROM quest_poi order by questId");
if (!result)
@@ -7072,6 +7072,34 @@ void ObjectMgr::LoadQuestPOI()
return;
}
+ std::vector<std::vector<std::vector<QuestPOIPoint> > > POIs;
+
+ // 0 1 2 3
+ QueryResult points = WorldDatabase.PQuery("SELECT questId, id, x, y FROM quest_poi_points ORDER BY questId DESC, idx");
+ if (points)
+ {
+ // The first result should have the highest questId
+ Field *fields = points->Fetch();
+ uint32 questId = fields[0].GetUInt32();
+ POIs.resize(questId + 1);
+
+ do
+ {
+ Field *fields = points->Fetch();
+
+ uint32 questId = fields[0].GetUInt32();
+ uint32 id = fields[1].GetUInt32();
+ int32 x = fields[2].GetInt32();
+ int32 y = fields[3].GetInt32();
+
+ if(POIs[questId].size() <= id + 1)
+ POIs[questId].resize(id + 10);
+
+ QuestPOIPoint point(x, y);
+ POIs[questId][id].push_back(point);
+ } while (points->NextRow());
+ }
+
barGoLink bar(result->GetRowCount());
do
@@ -7089,20 +7117,7 @@ void ObjectMgr::LoadQuestPOI()
uint32 unk4 = fields[7].GetUInt32();
QuestPOI POI(id, objIndex, mapId, WorldMapAreaId, FloorId, unk3, unk4);
-
- QueryResult points = WorldDatabase.PQuery("SELECT x, y FROM quest_poi_points WHERE questId='%u' AND id='%i' ORDER BY idx", questId, id);
-
- if (points)
- {
- do
- {
- Field *pointFields = points->Fetch();
- int32 x = pointFields[0].GetInt32();
- int32 y = pointFields[1].GetInt32();
- QuestPOIPoint point(x, y);
- POI.points.push_back(point);
- } while (points->NextRow());
- }
+ POI.points = POIs[questId][id];
mQuestPOIMap[questId].push_back(POI);