本文整理汇总了C++中CGameManager::GetFilterSet方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameManager::GetFilterSet方法的具体用法?C++ CGameManager::GetFilterSet怎么用?C++ CGameManager::GetFilterSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameManager
的用法示例。
在下文中一共展示了CGameManager::GetFilterSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize_Rescan2
//Create scanning threads
void Initialize_Rescan2(GAME_INFO *pGI, bool (*filterServerItem)(SERVER_INFO *lp,GAME_INFO *pGI, vFILTER_SETS *vFilterSets))
{
g_log.AddLogInfo(GS_LOG_DEBUG,"Entering Initialize_Rescan2 function.");
//SCAN_FilterServerItem = filterServerItem;
vFILTER_SETS vFS;
vFS = pGI->vFilterSets;
vFS.insert(vFS.end(),gm.GetFilterSet(GLOBAL_FILTER).begin(),gm.GetFilterSet(GLOBAL_FILTER).end());
sort(vFS.begin(),vFS.end(),Sort_Filter_By_GroupName);
vSRV_INF::iterator iLst;
pGI->vRefScanSI.clear();
pGI->dwViewFlags |= SCAN_SERVERLIST;
for ( iLst = pGI->vSI.begin( ); iLst != pGI->vSI.end( ); iLst++ )
{
SERVER_INFO *pSI = *iLst;
REF_SERVER_INFO refSI;
refSI.pServerInfo = pSI;
if(filterServerItem!=NULL)
{
if(filterServerItem(pSI,pGI,&vFS))
{
pGI->vRefScanSI.push_back(refSI);
}
}
else
{
pGI->vRefScanSI.push_back(refSI);
}
}
if(pGI->dwViewFlags & SCAN_SERVERLIST)
pGI->dwViewFlags ^= SCAN_SERVERLIST;
g_log.AddLogInfo(GS_LOG_INFO,"Preparing to scan %d servers of a total %d.",pGI->vRefScanSI.size(),pGI->vSI.size());
if(pGI->dwViewFlags & FORCE_SCAN_FILTERED)
pGI->dwViewFlags = 0;
if(g_hwndProgressBar!=NULL)
{
//Initililze Progressbar
SendMessage(g_hwndProgressBar, PBM_SETSTEP, (WPARAM) 1, 0);
SendMessage(g_hwndProgressBar, PBM_SETRANGE, (WPARAM) 0,MAKELPARAM(0,pGI->vRefScanSI.size()));
SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM) 0, 0);
}
HANDLE hThreadIndex[MAX_THREADS];
DWORD dwThreadId[MAX_THREADS];
for(DWORD i=0; i<AppCFG.dwThreads;i++)
hThreadIndex[i]=NULL;
SCANNER_dwThreadCounter=0;
pGI->dwScanIdx = 0;
//Create and setup Continue Event, this is important! Otherwise ETSV can crash.
SCAN_hContinueEvent = CreateEvent(NULL,TRUE,TRUE,"ScanContinueEvent");
if (SCAN_hContinueEvent == NULL)
g_log.AddLogInfo(GS_LOG_DEBUG,"CreateEvent failed (%d)\n", GetLastError());
if (! ResetEvent(SCAN_hContinueEvent) )
g_log.AddLogInfo(GS_LOG_DEBUG,"ResetEvent failed (%d)\n", GetLastError());
DWORD dwMaxThreads = (AppCFG.dwThreads>pGI->vRefScanSI.size())?pGI->vRefScanSI.size():AppCFG.dwThreads;
//---------------------------------
//Multi thread scanning code
//---------------------------------
//Startup the threads!!!
for (DWORD i=0; i<dwMaxThreads;i++)
{
hThreadIndex[SCANNER_dwThreadCounter] = CreateThread( NULL, 0, &Get_ServerStatusThread2, (LPVOID) pGI ,0, &dwThreadId[SCANNER_dwThreadCounter]);
if (hThreadIndex[SCANNER_dwThreadCounter] == NULL)
{
dbg_print("Error creating thread!\n");
}
else
{
//g_log.AddLogInfo(GS_LOG_INFO,"Thread created! %d",i);
EnterCriticalSection( &SCANNER_CSthreadcounter );
SCANNER_dwThreadCounter++;
LeaveCriticalSection( &SCANNER_CSthreadcounter );
//SetThreadName(dwThreadId[SCANNER_dwThreadCounter], "Get_ServerStatusThread2");
}
}
//All threads created in graceful way and counter increased properly
if (! SetEvent(SCAN_hContinueEvent) )
dbg_print("SetEvent failed\n");
//After this this the thread counter can decrease properly with a noncorrupted handle
DWORD dwStartTick = GetTickCount();
DWORD iWaitIndex = 0;
DWORD i=0;
//Wait for all threads to finish...
//g_log.AddLogInfo(GS_LOG_DEBUG,"AppCFG.dwThreads %d",AppCFG.dwThreads);
//.........这里部分代码省略.........