diff options
| author | leak <none@none> | 2010-12-19 17:06:33 +0100 |
|---|---|---|
| committer | leak <none@none> | 2010-12-19 17:06:33 +0100 |
| commit | fd694cd2324a7e2d61d833a78024b68fd3605053 (patch) | |
| tree | 2fb48411eb25ff627b56786b66c96dd646a30651 /src/server/game/Movement/Waypoints | |
| parent | 9c35e10444b24848e0a909c46727ac2a312ab5de (diff) | |
Streamlining loading functions for server startup
- Added a couple of timer outputs
- Improved code consistency between loading functions
- Progess bars should look and behave similar on all OS now (sLog.outString() is not needed anymore to replace the progress bar in log files)
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Movement/Waypoints')
| -rwxr-xr-x | src/server/game/Movement/Waypoints/WaypointManager.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index c6dc25d69e6..60751fce1f8 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -36,28 +36,24 @@ void WaypointStore::Free() void WaypointStore::Load() { - QueryResult result = WorldDatabase.Query("SELECT COUNT(id) FROM waypoint_data"); - if (!result) - { - 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 - } + uint32 oldMSTime = getMSTime(); - records = (*result)[0].GetUInt32(); + QueryResult result = WorldDatabase.Query("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point"); - result = WorldDatabase.Query("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 `waypoint_data` is empty or corrupted"); + barGoLink bar(1); + bar.step(); + sLog.outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); + sLog.outString(); return; } - WaypointPath* path_data = NULL; - barGoLink bar(result->GetRowCount()); uint32 count = 0; Field *fields; uint32 last_id = 0; + WaypointPath* path_data = NULL; do { @@ -94,10 +90,11 @@ void WaypointStore::Load() last_id = id; - } while (result->NextRow()) ; + } + while (result->NextRow()) ; + sLog.outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog.outString(); - sLog.outString(">> Loaded %u waypoints", count); } void WaypointStore::UpdatePath(uint32 id) |
