Exemple #1
0
	/**
	 * Constructor
	 *
	 * @param fileName The full filename.
	 * @param fac The entity factory.
	 * @param driverFactory The driver factory;
	 * @param weaponery The weaponery
	*/
	LevelReader::LevelReader(std::string fileName, IGameEntityFactory* fac,
	                         IDriverFactory* driverFactory,
	                         Weaponery* weaponery):
	             fLevel(fileName.c_str()), fEntityFactory(fac),
	             fDriverFactory(driverFactory),
	             fWeaponery(weaponery) {
		fLevel.LoadFile();
		
		parseAmmo();
		parseWeapons();
		fShipTypes = parseShipTypes();
	}
GameElements::ConfigurationLoader::ConfigurationLoader( const ::std::string & file, Ogre::SceneManager * sceneManager )
{
	TinyXML::TiXmlDocument document(file.c_str()) ;
	bool res = document.LoadFile() ;
	if(document.Error())
	{
		::std::cout<<"An error occurred while loading configuration file"<<::std::endl ;
		::std::cout<<document.ErrorDesc()<<::std::endl ;
		return ;
 	}
	TinyXML::TiXmlElement * root = document.RootElement() ;
	// Parses weapons
	parseWeapons(root);
	// Parses units
	parseUnits(root);
	// Parses maps
	parseMaps(root, sceneManager);
}