本文整理汇总了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");
}
示例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;
}
}
示例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");
}