当前位置: 首页>>代码示例>>C++>>正文


C++ TdfParser::GetDef方法代码示例

本文整理汇总了C++中TdfParser::GetDef方法的典型用法代码示例。如果您正苦于以下问题:C++ TdfParser::GetDef方法的具体用法?C++ TdfParser::GetDef怎么用?C++ TdfParser::GetDef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TdfParser的用法示例。


在下文中一共展示了TdfParser::GetDef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: content_error

CSensorHandler::CSensorHandler()
{
	TdfParser tdfparser;

	try {
		tdfparser.LoadFile("gamedata/sensors.tdf");
	} catch (content_error) {
		// No need to do anything here, we just continue
		// getting default values from the empty tdfparser.
	}

	tdfparser.GetDef(losMipLevel, "1", "Sensors\\Los\\LosMipLevel");
	//loshandler->losMipLevel = losMipLevel;
	tdfparser.GetDef(airMipLevel, "2", "Sensors\\Los\\AirLosMipLevel");
	//loshandler->airLosMipLevel = airLosMipLevel;

	// losMipLevel is used as index to readmap->mipHeightmap,
	// so the max value is CReadMap::numHeightMipMaps - 1
	if (losMipLevel < 0 || losMipLevel >= 7)
		throw content_error("Sensors\\Los\\LosMipLevel out of bounds. "
				"The minimum value is 0. The maximum value is 6.");

	// airLosMipLevel doesn't have such restrictions, it's just used in various
	// bitshifts with signed integers
	if (airMipLevel < 0 || airMipLevel > 30)
		throw content_error("Sensors\\Los\\AirLosMipLevel out of bounds. "
				"The minimum value is 0. The maximum value is 30.");

	tdfparser.GetDef(losMul, "1", "Sensors\\Los\\LosMul");
	tdfparser.GetDef(airLosMul, "1", "Sensors\\Los\\AirLosMul");
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:31,代码来源:SensorHandler.cpp

示例2: LoadUnitRestrictions

void CGameSetup::LoadUnitRestrictions(const TdfParser& file)
{
	int numRestrictions;
	file.GetDef(numRestrictions, "0", "GAME\\NumRestrictions");

	for (int i = 0; i < numRestrictions; ++i) {
		char key[100];
		sprintf(key, "GAME\\RESTRICT\\Unit%d", i);
		string resName = file.SGetValueDef("", key);
		sprintf(key, "GAME\\RESTRICT\\Limit%d", i);
		int resLimit;
		file.GetDef(resLimit, "0", key);

		restrictedUnits[resName] = resLimit;
	}
}
开发者ID:niavok,项目名称:spring,代码行数:16,代码来源:GameSetup.cpp

示例3: catch

CSensorHandler::CSensorHandler(void)
{
	TdfParser tdfparser;

	try {
		tdfparser.LoadFile("gamedata/sensors.tdf");
	} catch (content_error) {
		// No need to do anything here, we just continue
		// getting the values from the empty tdfparser.
	}

	tdfparser.GetDef(losMipLevel, "1", "Sensors\\Los\\LosMipLevel");
	//loshandler->losMipLevel = losMipLevel;
	tdfparser.GetDef(airMipLevel, "2", "Sensors\\Los\\AirLosMipLevel");
	//loshandler->airLosMipLevel = airLosMipLevel;

	tdfparser.GetDef(losMul, "1", "Sensors\\Los\\LosMul");
	tdfparser.GetDef(airLosMul, "1", "Sensors\\Los\\AirLosMul");
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:19,代码来源:SensorHandler.cpp


注:本文中的TdfParser::GetDef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。