当前位置: 首页>>代码示例>>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;未经允许,请勿转载。