本文整理汇总了C++中TList::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ TList::Find方法的具体用法?C++ TList::Find怎么用?C++ TList::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TList
的用法示例。
在下文中一共展示了TList::Find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
static void ScanQuake3Models(const char *path)
{
/*----- get a list of directories -----*/
// NOTE: use of FS_PATH_NAMES here will not allow to add new skins by mod for model from base dir
CFileList *dirNames = GFileSystem->List(va("%s/models/players/*", path), FS_DIR);
/*--- go through the subdirectories ---*/
for (TListIterator<CFileItem> diritem = *dirNames; diritem; ++diritem)
{
if (pmiList.Find(diritem->name)) continue; // already have model with the same name
// verify the existence of animation.cfg
if (!GFileSystem->FileExists(va("%s/models/players/%s/animation.cfg", path, diritem->name)))
continue;
// verify the existence of at least one skin file
CFileList *skinNames = GFileSystem->List(va("%s/models/players/%s/lower_*.skin", path, diritem->name), FS_FILE|FS_NOEXT);
// count valid skins
TList<CStringItem> skins;
int numSkins = 0;
for (TListIterator<CFileItem> skinItem = *skinNames; skinItem; ++skinItem)
{
const char *str = skinItem->name + 6; // skip "lower_"
// check at least one model
if (!GFileSystem->FileExists(va("%s/models/players/%s/lower.md3", path, diritem->name))) continue;
// may be, have "icon_file.jpg" and "icon_file.tga" ...
if (skins.Find(str)) continue;
skins.CreateAndInsert(str, pmiChain);
numSkins++;
}
delete skinNames;
if (!numSkins) continue;
// create model info
playerModelInfo_t *info = new (diritem->name, pmiChain) playerModelInfo_t;
info->numSkins = numSkins;
info->skins = skins;
info->isQ3mdl = true;
// add model info to pmi
pmiList.Insert(info);
numPlayerModels++;
}
delete dirNames;
}
示例2: BuildStaticCoreInfo
void CLobbyApp::BuildStaticCoreInfo()
{
// build the master core list
// then set coremask for each server
// 1. get ride of the old list
FreeStaticCoreInfo();
// 2. loop thru unpaused servers and build a TList of StaticCoreInfo and the coremask
ListConnections::Iterator iterCnxn(*GetFMServers().GetConnections());
TList<StaticCoreInfo*,StaticCoreInfoEquals> CoreList;
while (!iterCnxn.End())
{
CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
if (pServerT) // skip lost/terminating server
{
pServerT->SetStaticCoreMask(0); // clear the core mask, not really needed here but it doesnt hurt
int c = pServerT->GetcStaticCoreInfo();
if (!pServerT->GetPaused()) // skip paused serveR
for (int i=0; i<c; i++)
{
if (!CoreList.Find(&(pServerT->GetvStaticCoreInfo()[i])))
CoreList.PushFront(&(pServerT->GetvStaticCoreInfo()[i]));
}
}
iterCnxn.Next();
}
// 3. Allocate mem
m_cStaticCoreInfo = CoreList.GetCount();
if (m_cStaticCoreInfo)
m_vStaticCoreInfo = new StaticCoreInfo[m_cStaticCoreInfo];
else
return; // no core, all done
// 4. transform the TList into an array
for (int i = 0; i < m_cStaticCoreInfo; i++)
Strcpy(m_vStaticCoreInfo[i].cbIGCFile,CoreList[i]->cbIGCFile);
CoreList.SetEmpty();
// 5. loop thru unpaused servers and build the coremask
ListConnections::Iterator iterCnxn2(*GetFMServers().GetConnections());
while (!iterCnxn2.End())
{
CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn2.Value());
if (pServerT) // skip lost/terminating server
{
int c = pServerT->GetcStaticCoreInfo();
pServerT->SetStaticCoreMask(0); // clear the core mask
if (!pServerT->GetPaused()) // skip paused server
for (int i=0; i<c; i++)
{
for (int j = 0; j < m_cStaticCoreInfo; j++)
if (strcmp(pServerT->GetvStaticCoreInfo()[i].cbIGCFile,m_vStaticCoreInfo[j].cbIGCFile) == 0)
pServerT->SetStaticCoreMask(pServerT->GetStaticCoreMask() | 1<<j);
}
}
iterCnxn2.Next();
}
}