diff options
author | QAston <none@none> | 2009-05-15 18:00:50 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-05-15 18:00:50 +0200 |
commit | a796012723dd2410a150264a4f32f00bc570ef76 (patch) | |
tree | d55cada7db3c9c752815c79d9d164069acd99edc /src/game/WaypointManager.cpp | |
parent | ae461a4158d6376e28e7bc53d3f7ad5690a5064e (diff) | |
parent | ad92f5e210b7a2c0584cdabd30560fe723d160be (diff) |
*Merge some fixes from tc1
--HG--
branch : trunk
Diffstat (limited to 'src/game/WaypointManager.cpp')
-rw-r--r-- | src/game/WaypointManager.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index a677fd5b6d2..26be14d89fa 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -24,12 +24,12 @@ #include "ProgressBar.h" #include "MapManager.h" -UNORDERED_MAP<uint32, WaypointPath*> waypoint_map; +WaypointPathMap WaypointPathHolder; WaypointStore WaypointMgr; void WaypointStore::Free() { - waypoint_map.clear(); + WaypointPathHolder.clear(); } void WaypointStore::Load() @@ -37,7 +37,7 @@ void WaypointStore::Load() QueryResult *result = WorldDatabase.PQuery("SELECT MAX(`id`) FROM `waypoint_data`"); if(!result) { - sLog.outError(" an error occured while loading the table `waypoint_data` ( maybe it doesn't exist ?)\n"); + sLog.outError("an error occured while loading the table `waypoint_data` (maybe it doesn't exist ?)"); exit(1); // Stop server at loading non exited table or not accessable table } @@ -47,7 +47,7 @@ void WaypointStore::Load() result = WorldDatabase.PQuery("SELECT `id`,`point`,`position_x`,`position_y`,`position_z`,`move_flag`,`delay`,`action`,`action_chance` FROM `waypoint_data` ORDER BY `id`, `point`"); if(!result) { - sLog.outErrorDb("The table `creature_addon` is empty or corrupted"); + sLog.outErrorDb("The table `waypoint_data` is empty or corrupted"); return; } @@ -87,22 +87,21 @@ void WaypointStore::Load() path_data->push_back(wp); - if(id != last_id) - waypoint_map[id] = path_data; + if(id != last_id) + WaypointPathHolder[id] = path_data; last_id = id; } while(result->NextRow()) ; - delete result; } void WaypointStore::UpdatePath(uint32 id) { - - if(waypoint_map.find(id)!= waypoint_map.end()) - waypoint_map[id]->clear(); + // TODO: this will cause memory leak + if(WaypointPathHolder.find(id) != WaypointPathHolder.end()) + WaypointPathHolder[id]->clear(); QueryResult *result; @@ -145,7 +144,7 @@ void WaypointStore::UpdatePath(uint32 id) }while (result->NextRow()); - waypoint_map[id] = path_data; + WaypointPathHolder[id] = path_data; delete result; } |