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
This commit is contained in:
leak
2010-12-19 17:06:33 +01:00
parent 9c35e10444
commit fd694cd232
36 changed files with 2645 additions and 2286 deletions

View File

@@ -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)