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
@@ -308,6 +308,8 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
void AuctionHouseMgr::LoadAuctionItems()
{
uint32 oldMSTime = getMSTime();
// data needs to be at first place for Item::LoadFromDB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_AUCTION_ITEMS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -316,14 +318,14 @@ void AuctionHouseMgr::LoadAuctionItems()
{
barGoLink bar(1);
bar.step();
sLog.outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
sLog.outString();
sLog.outString(">> Loaded 0 auction items");
return;
}
barGoLink bar(result->GetRowCount());
uint32 count = 0;
do
{
bar.step();
@@ -352,36 +354,37 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
sLog.outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
sLog.outString(">> Loaded %u auction items", count);
}
void AuctionHouseMgr::LoadAuctions()
{
uint32 oldMSTime = getMSTime();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_AUCTIONS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
barGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
sLog.outString();
return;
}
barGoLink bar(result->GetRowCount());
uint32 count = 0;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
uint32 count = 0;
AuctionEntry *aItem;
do
{
Field* fields = result->Fetch();
bar.step();
aItem = new AuctionEntry();
AuctionEntry *aItem = new AuctionEntry();
if (!aItem->LoadFromDB(fields))
{
aItem->DeleteFromDB(trans);
@@ -395,8 +398,8 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
sLog.outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog.outString();
sLog.outString(">> Loaded %u auctions", count);
}
void AuctionHouseMgr::AddAItem(Item* it)