Ejemplo n.º 1
0
void CModHandler::loadGameContent()
{
	CStopWatch timer, totalTime;

	CContentHandler content;
	logGlobal->infoStream() << "\tInitializing content handler: " << timer.getDiff() << " ms";

	// first - load virtual "core" mod that contains all data
	// TODO? move all data into real mods? RoE, AB, SoD, WoG
	content.preloadModData("core", JsonNode(ResourceID("config/gameConfig.json")));
	logGlobal->infoStream() << "\tParsing original game data: " << timer.getDiff() << " ms";

	for(const TModID & modName : activeMods)
	{
		logGlobal->infoStream() << "\t\t" << allMods[modName].name;

		std::string modFileName = "mods/" + modName + "/mod.json";

		const JsonNode config = JsonNode(ResourceID(modFileName));
		JsonUtils::validate(config, "vcmi:mod", modName);

		content.preloadModData(modName, config);
	}
	logGlobal->infoStream() << "\tParsing mod data: " << timer.getDiff() << " ms";

	content.loadMod("core");
	logGlobal->infoStream() << "\tLoading original game data: " << timer.getDiff() << " ms";

	for(const TModID & modName : activeMods)
	{
		content.loadMod(modName);
		logGlobal->infoStream() << "\t\t" << allMods[modName].name;
	}
	logGlobal->infoStream() << "\tLoading mod data: " << timer.getDiff() << "ms";

	VLC->creh->loadCrExpBon();
	VLC->creh->buildBonusTreeForTiers(); //do that after all new creatures are loaded
	identifiers.finalize();
	logGlobal->infoStream() << "\tResolving identifiers: " << timer.getDiff() << " ms";

	content.afterLoadFinalization();
	logGlobal->infoStream() << "\tHandlers post-load finalization: " << timer.getDiff() << " ms";

	logGlobal->infoStream() << "\tAll game content loaded in " << totalTime.getDiff() << " ms";
}
Ejemplo n.º 2
0
void CModHandler::load()
{
	CStopWatch totalTime, timer;

	CContentHandler content;
	logGlobal->infoStream() << "\tInitializing content handler: " << timer.getDiff() << " ms";

	for(const TModID & modName : activeMods)
	{
		logGlobal->traceStream() << "Generating checksum for " << modName;
		allMods[modName].updateChecksum(calculateModChecksum(modName, CResourceHandler::get(modName)));
	}

	// first - load virtual "core" mod that contains all data
	// TODO? move all data into real mods? RoE, AB, SoD, WoG
	content.preloadData(coreMod);
	for(const TModID & modName : activeMods)
		content.preloadData(allMods[modName]);
	logGlobal->infoStream() << "\tParsing mod data: " << timer.getDiff() << " ms";

	content.load(coreMod);
	for(const TModID & modName : activeMods)
		content.load(allMods[modName]);

	logGlobal->infoStream() << "\tLoading mod data: " << timer.getDiff() << "ms";

	VLC->creh->loadCrExpBon();
	VLC->creh->buildBonusTreeForTiers(); //do that after all new creatures are loaded

	identifiers.finalize();
	logGlobal->infoStream() << "\tResolving identifiers: " << timer.getDiff() << " ms";

	content.afterLoadFinalization();
	logGlobal->infoStream() << "\tHandlers post-load finalization: " << timer.getDiff() << " ms";
	logGlobal->infoStream() << "\tAll game content loaded in " << totalTime.getDiff() << " ms";
}