bool Brothel::LoadBrothelXML( TiXmlHandle hBrothel )
{
    //no need to init this, we just created it
    TiXmlElement* pBrothel = hBrothel.ToElement();
    
    if( pBrothel == nullptr )
    {
        return false;
    }
    
    if( pBrothel->Attribute( "Name" ) )
    {
        m_Name = pBrothel->Attribute( "Name" );
    }
    
    int tempInt = 0;
    
    std::string message = "Loading brothel: ";
    message += m_Name;
    g_LogFile.write( message );
    
    // load variables for sex restrictions
    pBrothel->QueryValueAttribute<bool>( "RestrictAnal", &m_RestrictAnal );
    pBrothel->QueryValueAttribute<bool>( "RestrictBDSM", &m_RestrictBDSM );
    pBrothel->QueryValueAttribute<bool>( "RestrictBeast", &m_RestrictBeast );
    pBrothel->QueryValueAttribute<bool>( "RestrictGroup", &m_RestrictGroup );
    pBrothel->QueryValueAttribute<bool>( "RestrictNormal", &m_RestrictNormal );
    pBrothel->QueryValueAttribute<bool>( "RestrictLesbian", &m_RestrictLesbian );
    
    pBrothel->QueryValueAttribute<unsigned short>( "AdvertisingBudget", &m_AdvertisingBudget );
    pBrothel->QueryIntAttribute( "Bar", &tempInt );
    m_Bar = tempInt;
    tempInt = 0;
    pBrothel->QueryIntAttribute( "Fame", &tempInt );
    m_Fame = tempInt;
    tempInt = 0;
    pBrothel->QueryIntAttribute( "GamblingHall", &tempInt );
    m_GamblingHall = tempInt;
    tempInt = 0;
    pBrothel->QueryValueAttribute<unsigned short>( "Happiness", &m_Happiness );
    pBrothel->QueryIntAttribute( "HasBarStaff", &tempInt );
    m_HasBarStaff = tempInt;
    tempInt = 0;
    pBrothel->QueryIntAttribute( "id", &m_id );
    pBrothel->QueryIntAttribute( "HasGambStaff", &tempInt );
    m_HasGambStaff = tempInt;
    tempInt = 0;
    pBrothel->QueryIntAttribute( "NumRooms", &tempInt );
    m_NumRooms = tempInt;
    tempInt = 0;
    pBrothel->QueryIntAttribute( "Filthiness", &m_Filthiness );
    pBrothel->QueryIntAttribute( "SecurityLevel", &m_SecurityLevel );
    
    m_Finance.loadGoldXML( hBrothel.FirstChild( "Gold" ) );
    
    // Load girls
    m_NumGirls = 0;
    TiXmlElement* pGirls = pBrothel->FirstChildElement( "Girls" );
    
    if( pGirls )
    {
        for( TiXmlElement* pGirl = pGirls->FirstChildElement( "Girl" );
                pGirl != nullptr;
                pGirl = pGirl->NextSiblingElement( "Girl" ) ) // load each girl and add her
        {
            Girl* girl = new Girl();
            bool success = girl->LoadGirlXML( TiXmlHandle( pGirl ) );
            
            if( success == true )
            {
                AddGirl( girl );
            }
            else
            {
                delete girl;
                continue;
            }
        }
    }
    
    //commented out before the conversion to XML
    //building.load(ifs);
    return true;
}
Beispiel #2
0
bool sCentre::LoadCentreXML(TiXmlHandle hBrothel)
{
	//no need to init this, we just created it
	TiXmlElement* pBrothel = hBrothel.ToElement();
	if (pBrothel == 0)
	{
		return false;
	}

	if (pBrothel->Attribute("Name"))
	{
		m_Name = pBrothel->Attribute("Name");
	}

	int tempInt = 0;

	std::string message = "Loading centre: ";
	message += m_Name;
	g_LogFile.write(message);

	pBrothel->QueryIntAttribute("id", &m_id);
	pBrothel->QueryIntAttribute("NumRooms", &tempInt); m_NumRooms = tempInt; tempInt = 0;
	pBrothel->QueryIntAttribute("MaxNumRooms", &tempInt); m_MaxNumRooms = tempInt; tempInt = 0;
	if (m_MaxNumRooms < 200)		m_MaxNumRooms = 200;
	else if (m_MaxNumRooms > 600)	m_MaxNumRooms = 600;
	pBrothel->QueryIntAttribute("Filthiness", &m_Filthiness);
	pBrothel->QueryIntAttribute("SecurityLevel", &m_SecurityLevel);
	// load variables for sex restrictions
	pBrothel->QueryValueAttribute<bool>("RestrictAnal", &m_RestrictAnal);
	pBrothel->QueryValueAttribute<bool>("RestrictBDSM", &m_RestrictBDSM);
	pBrothel->QueryValueAttribute<bool>("RestrictBeast", &m_RestrictBeast);
	pBrothel->QueryValueAttribute<bool>("RestrictFoot", &m_RestrictFoot);
	pBrothel->QueryValueAttribute<bool>("RestrictGroup", &m_RestrictGroup);
	pBrothel->QueryValueAttribute<bool>("RestrictHand", &m_RestrictHand);
	pBrothel->QueryValueAttribute<bool>("RestrictLesbian", &m_RestrictLesbian);
	pBrothel->QueryValueAttribute<bool>("RestrictNormal", &m_RestrictNormal);
	pBrothel->QueryValueAttribute<bool>("RestrictOral", &m_RestrictOral);
	pBrothel->QueryValueAttribute<bool>("RestrictStrip", &m_RestrictStrip);
	pBrothel->QueryValueAttribute<bool>("RestrictTitty", &m_RestrictTitty);

	pBrothel->QueryValueAttribute<unsigned short>("AdvertisingBudget", &m_AdvertisingBudget);
	pBrothel->QueryIntAttribute("AntiPregPotions", &m_AntiPregPotions);
	pBrothel->QueryIntAttribute("AntiPregUsed", &m_AntiPregUsed);
	pBrothel->QueryValueAttribute<bool>("KeepPotionsStocked", &m_KeepPotionsStocked);

	// Load girls
	m_NumGirls = 0;
	TiXmlElement* pGirls = pBrothel->FirstChildElement("Girls");
	if (pGirls)
	{
		for (TiXmlElement* pGirl = pGirls->FirstChildElement("Girl");
			pGirl != 0;
			pGirl = pGirl->NextSiblingElement("Girl"))// load each girl and add her
		{
			sGirl* girl = new sGirl();
			bool success = girl->LoadGirlXML(TiXmlHandle(pGirl));
			if (success == true)
			{
				girl->m_InCentre = true;
				AddGirl(girl);
			}
			else
			{
				delete girl;
				continue;
			}
		}
	}

	//commented out before the conversion to XML
	//building.load(ifs);
	return true;
}