void BlackMarketMgr::Update() { uint32 curTime = time(NULL); SQLTransaction trans = CharacterDatabase.BeginTransaction(); for (BMAuctionEntryMap::const_iterator itr = GetAuctionsBegin(); itr != GetAuctionsEnd();) { BMAuctionEntry* auction = itr->second; if (auction->IsExpired()) { if (auction->bidder) SendAuctionWon(auction, trans); auction->DeleteFromDB(trans); BMAuctionsMap.erase((itr++)->first); } else ++itr; } int32 add = sWorld->getIntConfig(CONFIG_BLACKMARKET_MAX_AUCTIONS) - BMAuctionsMap.size(); if (add > 0) CreateAuctions(add, trans); CharacterDatabase.CommitTransaction(trans); }
void BlackMarketMgr::Update() { SQLTransaction trans = CharacterDatabase.BeginTransaction(); // Delete expired auctions for (auto itr = m_bmAuctionsMap.begin(); itr != m_bmAuctionsMap.end();) { BMAuctionEntry* auction = itr->second; if (auction->IsExpired()) { if (auction->bidder) SendAuctionWon(auction, trans); auction->DeleteFromDB(trans); itr = m_bmAuctionsMap.erase(itr); } else ++itr; } // Add New Auctions int32 add = sWorld->getIntConfig(CONFIG_BLACKMARKET_MAX_AUCTIONS) - m_bmAuctionsMap.size(); if (add > 0) CreateAuctions(add, trans); CharacterDatabase.CommitTransaction(trans); }