From fd694cd2324a7e2d61d833a78024b68fd3605053 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 19 Dec 2010 17:06:33 +0100 Subject: 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 --- src/server/game/Addons/AddonMgr.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/server/game/Addons') diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 2bce694299e..3350829efdf 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -34,32 +34,39 @@ AddonMgr::~AddonMgr() void AddonMgr::LoadFromDB() { + uint32 oldMSTime = getMSTime(); + QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); + if (!result) { - sLog.outErrorDb("The table `addons` is empty"); + barGoLink bar(1); + bar.step(); + sLog.outString(">> Loaded 0 known addons. DB table `addons` is empty!"); + sLog.outString(); return; } barGoLink bar(result->GetRowCount()); uint32 count = 0; - Field *fields; do { - fields = result->Fetch(); + Field *fields = result->Fetch(); bar.step(); - count++; std::string name = fields[0].GetString(); uint32 crc = fields[1].GetUInt32(); SavedAddon addon(name, crc); m_knownAddons.push_back(addon); - } while (result->NextRow()); + ++count; + } + while (result->NextRow()); + + sLog.outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog.outString(); - sLog.outString(">> Loaded %u known addons", count); } void AddonMgr::SaveAddon(AddonInfo const& addon) -- cgit v1.2.3