當前位置: 首頁>>代碼示例>>C++>>正文


C++ TList::CreateAndInsert方法代碼示例

本文整理匯總了C++中TList::CreateAndInsert方法的典型用法代碼示例。如果您正苦於以下問題:C++ TList::CreateAndInsert方法的具體用法?C++ TList::CreateAndInsert怎麽用?C++ TList::CreateAndInsert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TList的用法示例。


在下文中一共展示了TList::CreateAndInsert方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
開發者ID:RkShaRkz,項目名稱:Quake2,代碼行數:44,代碼來源:cl_playermodel.cpp


注:本文中的TList::CreateAndInsert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。