Ejemplo n.º 1
0
/*----------------------------------------------------------------------------*/
void XmlParser::agregarArista(Mapa* mapa,xmlpp::TextReader& reader)
{
	int arcoId=-1;	
	
	string orientacion = reader.get_attribute (ATRIB_ORIENTACION);
	arcoId=getAtributoInt(reader,ATRIB_ID);
	cargarArista(mapa,reader,arcoId,orientacion);
}
Ejemplo n.º 2
0
/*----------------------------------------------------------------------------*/
void XmlParser::cargarMundo(Mundo* mundo,xmlpp::TextReader& reader)
{
	do
    {   	
		buscarElemento(reader);
		string path = reader.get_attribute(ATRIB_PATH);
		if(path!="")
		{
			mundo->getNiveles()->push(path);
		}	
    }while(reader.read());
}
Ejemplo n.º 3
0
inline bool get_attribute(T &res,
                          xmlpp::TextReader &reader,
                          const str &eltname)
{
    str val(reader.get_attribute(eltname));


    if(!val.empty()) {
       std::istringstream str_in(val);
       str_in >> res;

       return true;
    }
Ejemplo n.º 4
0
/*----------------------------------------------------------------------------*/
void XmlParser::agregarElementos(Mapa* mapa,xmlpp::TextReader& reader)
{
	do
    {   
		string tipoElemento = reader.get_attribute(ATRIB_TIPO);
		if(tipoElemento==POWER_UP)
			agregarPowerUp(mapa,reader);
		if(tipoElemento==BONUS)
			agregarBonus(mapa,reader);
		if(tipoElemento==CASA_FANTASMAS)
			agregarCasaFantasmas(mapa,reader);
		if(tipoElemento==SALIDA_PACMAN)
			agregarSalidaPacMan(mapa,reader);
				
    }while(reader.read());
	
	//Se agregan las pantillas al mapa
	agregarPastillas(mapa);
}
Ejemplo n.º 5
0
/*----------------------------------------------------------------------------*/
void XmlParser::agregarCasaFantasmas(Mapa* mapa,xmlpp::TextReader& reader)
{
	int idVertice=0;
	int idPuerta = getAtributoInt(reader,ATRIB_ID_VERTICE);
	tVecVerticeId vertices; 
	elementosNoPastillas.push_back(idPuerta);

	for(int i=1;i<7;i++)
	{
		idVertice=getAtributoInt(reader,ATRIB_ID_VERTICE+StrToken::intToString(i));
		elementosNoPastillas.push_back(idVertice);
		vertices.push_back(idVertice);

	}	
	string orientacion=reader.get_attribute(ATRIB_ORIENTACION);
	CasaFantasmas casaFantasmas(idPuerta,orientacionParser(orientacion));
	casaFantasmas.setVerticesId(vertices);
	Modelo::getInstance()->SetCasaFantasmas(casaFantasmas);
}
Ejemplo n.º 6
0
/*----------------------------------------------------------------------------*/
int XmlParser::getAtributoInt(xmlpp::TextReader& reader,string atrib)
{
	int intValor=-1;
	StrToken::stringTo<int>(intValor,reader.get_attribute (atrib));	
	return intValor;
}