📄 stall.cpp.svn-base
字号:
#include "StdAfx.h"
initialiseSingleton( AuctionMgr );
void AuctionMgr::LoadSTALLs()
{
Log.Notice("AuctionMgr", "
QueryResult * res = CharacterDatabase.Query("SELECT MAX(auctionId) FROM STALL");
if(res)
{
maxId = res->Fetch()[0].GetUInt32();
delete res;
}
res = WorldDatabase.Query("SELECT DISTINCT `group` FROM STALL");
STALL * ah;
map<uint32, STALL*> tempmap;
if(res)
{
uint32 period = (res->GetRowCount() / 20) + 1;
uint32 c = 0;
do
{
ah = new STALL(res->Fetch()[0].GetUInt32());
ah->LoadSTALL();
STALLs.push_back(ah);
tempmap.insert( make_pair( res->Fetch()[0].GetUInt32(), ah ) );
if( !((++c) % period) )
Log.Notice("STALL", "Done %u/%u, %u%% complete.", c, res->GetRowCount(), float2int32( (float(c) / float(res->GetRowCount()))*100.0f ));
}while(res->NextRow());
delete res;
}
res = WorldDatabase.Query("SELECT creature_entry, `group` FROM STALL");
if(res)
{
do
{
STALLEntryMap.insert( make_pair( res->Fetch()[0].GetUInt32(), tempmap[res->Fetch()[1].GetUInt32()] ) );
} while(res->NextRow());
delete res;
}
}
STALL * AuctionMgr::GetSTALL(uint32 Entry)
{
HM_NAMESPACE::hash_map<uint32, STALL*>::iterator itr = STALLEntryMap.find(Entry);
if(itr == STALLEntryMap.end()) return NULL;
return itr->second;
}
void AuctionMgr::Update()
{
if((++loopcount % 100))
return;
vector<STALL*>::iterator itr = STALLs.begin();
for(; itr != STALLs.end(); ++itr)
{
(*itr)->UpdateDeletionQueue();
// Actual auction loop is on a seperate timer.
if(!(loopcount % 1200))
(*itr)->UpdateSTALL();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -