• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ aurora::GFF3File类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中aurora::GFF3File的典型用法代码示例。如果您正苦于以下问题:C++ GFF3File类的具体用法?C++ GFF3File怎么用?C++ GFF3File使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getName

Common::UString Module::getName(const Common::UString &module) {
	/* Return the localized name of the first (and only) area of the module,
	 * which is the closest thing to the name of the module.
	 *
	 * To do that, if looks through the module directory for a matching RIM file
	 * (case-insensitively) and opens it without indexing into the ResourceManager.
	 * It then opens the module.ifo, grabs the name of the area, opens its ARE file
	 * and returns the localized "Name" field.
	 *
	 * If there's any error while doing all this, an empty string is returned.
	 */

	try {
		const Common::FileList modules(ConfigMan.getString("KOTOR_moduleDir"));

		const Aurora::RIMFile rim(new Common::ReadFile(modules.findFirst(module + ".rim", true)));
		const uint32 ifoIndex = rim.findResource("module", Aurora::kFileTypeIFO);

		const Aurora::GFF3File ifo(rim.getResource(ifoIndex), MKTAG('I', 'F', 'O', ' '));

		const Aurora::GFF3List &areas = ifo.getTopLevel().getList("Mod_Area_list");
		if (areas.empty())
			return "";

		const uint32 areIndex = rim.findResource((*areas.begin())->getString("Area_Name"), Aurora::kFileTypeARE);

		const Aurora::GFF3File are(rim.getResource(areIndex), MKTAG('A', 'R', 'E', ' '));

		return are.getTopLevel().getString("Name");

	} catch (...) {
	}

	return "";
}
开发者ID:clone2727,项目名称:xoreos,代码行数:35,代码来源:module.cpp


示例2: loadCampaignFile

void Campaign::loadCampaignFile(const CampaignDescription &desc) {
	Common::ReadFile *file = 0;
	Aurora::GFF3File *gff  = 0;
	try {

		try {
			if (desc.file.empty())
				throw Common::Exception("Campaign file is empty");

			file = new Common::ReadFile(desc.file);
			gff  = new Aurora::GFF3File(file, MKTAG('M', 'M', 'D', ' '));
		} catch (Common::Exception &UNUSED(e)) {
			delete file;
			throw;
		}

		_startModule = gff->getTopLevel().getString("StartingMod");

		const Aurora::GFF3List &modules = gff->getTopLevel().getList("Meta_Mod_list");
		for (Aurora::GFF3List::const_iterator m = modules.begin(); m != modules.end(); ++m)
			_modules.push_back((*m)->getString("Mod_Name"));

		if (_startModule.empty())
			throw Common::Exception("No starting module");

	} catch (Common::Exception &e) {
		delete gff;

		e.add("Failed to load campaign \"%s\" (\"%s\")", desc.tag.c_str(), desc.name.getString().c_str());
		throw;
	}

	delete gff;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:34,代码来源:campaign.cpp


示例3: load

void Placeable::load(const Aurora::GFF3Struct &placeable) {
	Common::UString temp = placeable.getString("TemplateResRef");

	Aurora::GFF3File *utp = 0;
	if (!temp.empty()) {
		try {
			utp = new Aurora::GFF3File(temp, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' '));
		} catch (...) {
		}
	}

	Situated::load(placeable, utp ? &utp->getTopLevel() : 0);

	delete utp;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:15,代码来源:placeable.cpp


示例4: load

void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
	Common::UString temp = waypoint.getString("TemplateResRef");

	Aurora::GFF3File *utw = 0;
	if (!temp.empty()) {
		try {
			utw = new Aurora::GFF3File(temp, Aurora::kFileTypeUTW, MKTAG('U', 'T', 'W', ' '));
		} catch (...) {
		}
	}

	load(waypoint, utw ? &utw->getTopLevel() : 0);

	delete utw;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:15,代码来源:waypoint.cpp


示例5: getDescription

Common::UString Module::getDescription(const Common::UString &module) {
	try {
		const Common::FileList modules(ConfigMan.getString("NWN2_moduleDir"));

		const Aurora::ERFFile mod(new Common::ReadFile(modules.findFirst(module + ".mod", true)));
		const uint32 ifoIndex = mod.findResource("module", Aurora::kFileTypeIFO);

		const Aurora::GFF3File ifo(mod.getResource(ifoIndex), MKTAG('I', 'F', 'O', ' '));

		return ifo.getTopLevel().getString("Mod_Description");

	} catch (...) {
	}

	return "";
}
开发者ID:clone2727,项目名称:xoreos,代码行数:16,代码来源:module.cpp


示例6: load

void Door::load(const Aurora::GFF3Struct &door) {
	Common::UString temp = door.getString("TemplateResRef");

	Aurora::GFF3File *utd = 0;
	if (!temp.empty()) {
		try {
			utd = new Aurora::GFF3File(temp, Aurora::kFileTypeUTD, MKTAG('U', 'T', 'D', ' '));
		} catch (...) {
		}
	}

	Situated::load(door, utd ? &utd->getTopLevel() : 0);

	delete utd;

	setModelState();
}
开发者ID:strand,项目名称:xoreos,代码行数:17,代码来源:door.cpp


示例7: load

void Trigger::load(const Aurora::GFF3Struct &trigger) {
	Common::UString temp = trigger.getString("ResRef");

	if (!temp.empty()) {
		Aurora::GFF3File *trg = 0;
		try {
			trg = new Aurora::GFF3File(temp, Aurora::kFileTypeTRG, MKTAG('T', 'R', 'G', ' '));
			loadBlueprint(trg->getTopLevel());
		} catch (...) {
			warning("Trigger \"%s\" has no blueprint", temp.c_str());
			delete trg;
			throw;
		}
		delete trg;
	}

	loadInstance(trigger);
}
开发者ID:clone2727,项目名称:xoreos,代码行数:18,代码来源:trigger.cpp


示例8: load

void GUI::load(const Common::UString &resref) {
	_name = resref;

	Aurora::GFF3File *gff = 0;
	try {
		gff = new Aurora::GFF3File(resref, Aurora::kFileTypeGUI, MKTAG('G', 'U', 'I', ' '));

		loadWidget(gff->getTopLevel(), 0);

	} catch (Common::Exception &e) {
		delete gff;

		e.add("Can't load GUI \"%s\"", resref.c_str());
		throw;
	}

	delete gff;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:18,代码来源:gui.cpp


示例9: load

void Placeable::load(const Aurora::GFF3Struct &placeable) {
	_resRef = placeable.getString("TemplateResRef");

	Aurora::GFF3File *utp = 0;
	if (!_resRef.empty()) {
		try {
			utp = new Aurora::GFF3File(_resRef, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' '));
		} catch (...) {
		}
	}

	try {
		load(placeable, utp ? &utp->getTopLevel() : 0);
	} catch (...) {
		delete utp;
		throw;
	}

	delete utp;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:20,代码来源:placeable.cpp


示例10: loadCharacter

void Creature::loadCharacter(const Common::UString &bic, bool local) {
	Aurora::GFF3File *gff = openPC(bic, local);

	try {
		load(gff->getTopLevel(), 0);
	} catch (...) {
		delete gff;
		throw;
	}

	delete gff;

	// All BICs should be PCs.
	_isPC = true;

	// Set the PC tag to something recognizable for now.
	// Let's hope no script depends on it being "".

	_tag = Common::UString::format("[PC: %s]", _name.c_str());
}
开发者ID:clone2727,项目名称:xoreos,代码行数:20,代码来源:creature.cpp


示例11: load

void Creature::load(const Aurora::GFF3Struct &creature) {
	Common::UString temp = creature.getString("TemplateResRef");

	Aurora::GFF3File *utc = 0;
	if (!temp.empty()) {
		try {
			utc = new Aurora::GFF3File(temp, Aurora::kFileTypeUTC, MKTAG('U', 'T', 'C', ' '));
		} catch (...) {
		}
	}

	try {
		load(creature, utc ? &utc->getTopLevel() : 0);
	} catch (...) {
		delete utc;
		throw;
	}

	delete utc;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:20,代码来源:creature.cpp


示例12: getPCListInfo

void Creature::getPCListInfo(const Common::UString &bic, bool local,
                             Common::UString &name, Common::UString &classes,
                             Common::UString &portrait) {

	Aurora::GFF3File *gff = openPC(bic, local);

	try {
		const Aurora::GFF3Struct &top = gff->getTopLevel();

		// Reading name
		const Common::UString firstName = top.getString("FirstName");
		const Common::UString lastName  = top.getString("LastName");

		name = firstName + " " + lastName;
		name.trim();

		// Reading portrait (failure non-fatal)
		try {
			loadPortrait(top, portrait);
		} catch (...) {
			portrait.clear();

			Common::exceptionDispatcherWarning("Can't read portrait for PC \"%s\"", bic.c_str());
		}

		// Reading classes
		std::vector<Class> classLevels;
		uint8 hitDice;

		loadClasses(top, classLevels, hitDice);
		getClassString(classLevels, classes);

		classes = "(" + classes + ")";

	} catch (...) {
		delete gff;
		throw;
	}

	delete gff;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:41,代码来源:creature.cpp


示例13: load

void Placeable::load(const Aurora::GFF3Struct &placeable) {
	Common::UString temp = placeable.getString("TemplateResRef");

	Aurora::GFF3File *utp = 0;
	if (!temp.empty()) {
		try {
			utp = new Aurora::GFF3File(temp, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' '));
		} catch (...) {
		}
	}

	try {
		Situated::load(placeable, utp ? &utp->getTopLevel() : 0);
	} catch (...) {
		delete utp;
		throw;
	}

	if (!utp)
		warning("Placeable \"%s\" has no blueprint", _tag.c_str());

	delete utp;
}
开发者ID:jbowtie,项目名称:xoreos,代码行数:23,代码来源:placeable.cpp


示例14: readCampaign

bool Campaign::readCampaign(const Common::UString &mmdFile, CampaignDescription &desc) {
	Common::ReadFile *file = new Common::ReadFile;
	if (!file->open(mmdFile)) {
		delete file;
		return false;
	}

	Aurora::GFF3File *gff = 0;
	try {
		gff = new Aurora::GFF3File(file, MKTAG('M', 'M', 'D', ' '));
	} catch (...) {
		return false;
	}

	gff->getTopLevel().getLocString("Meta_Name", desc.name);
	gff->getTopLevel().getLocString("Meta_Desc", desc.description);

	delete gff;

	desc.file = mmdFile;
	desc.tag  = Common::FilePath::getStem(mmdFile).toLower();

	return true;
}
开发者ID:Glyth,项目名称:xoreos,代码行数:24,代码来源:campaign.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ aurora::GFF3List类代码示例发布时间:2022-05-31
下一篇:
C++ audio::Timestamp类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap