本文整理汇总了C++中AuctionEntry::LoadFromFieldList方法的典型用法代码示例。如果您正苦于以下问题:C++ AuctionEntry::LoadFromFieldList方法的具体用法?C++ AuctionEntry::LoadFromFieldList怎么用?C++ AuctionEntry::LoadFromFieldList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuctionEntry
的用法示例。
在下文中一共展示了AuctionEntry::LoadFromFieldList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteExpiredAuctionsAtStartup
void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
{
// Deletes expired auctions. Should be called at server start before loading auctions.
// DO NOT USE after auctions are already loaded since this deletes from the DB
// and assumes the auctions HAVE NOT been loaded into a list or AuctionEntryMap yet
uint32 oldMSTime = getMSTime();
uint32 expirecount = 0;
time_t curTime = sWorld->GetGameTime();
// Query the DB to see if there are any expired auctions
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_EXPIRED_AUCTIONS);
stmt->setUInt32(0, (uint32)curTime+60);
PreparedQueryResult expAuctions = CharacterDatabase.Query(stmt);
if (!expAuctions)
{
sLog->outString(">> No expired auctions to delete");
sLog->outString();
return;
}
do
{
Field* fields = expAuctions->Fetch();
AuctionEntry* auction = new AuctionEntry();
// Can't use LoadFromDB() because it assumes the auction map is loaded
if (!auction->LoadFromFieldList(fields))
{
// For some reason the record in the DB is broken (possibly corrupt
// faction info). Delete the object and move on.
delete auction;
continue;
}
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (auction->bidder == 0)
{
// Cancel the auction, there was no bidder
sAuctionMgr->SendAuctionExpiredMail(auction, trans);
}
else
{
// Send the item to the winner and money to seller
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
}
// Call the appropriate AuctionHouseObject script
// ** Do we need to do this while core is still loading? **
sScriptMgr->OnAuctionExpire(GetAuctionsMap(auction->factionTemplateId), auction);
// Delete the auction from the DB
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
// Release memory
delete auction;
++expirecount;
} while (expAuctions->NextRow());
sLog->outString(">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}