Ejemplo n.º 1
0
COption* CProfileOptions::GetOption(const char* option) const
{
	if(!option || !option[0])
		return NULL;

	bool returnValue = false;
	std::vector<COption*>::const_iterator it = m_allOptions.begin();
	std::vector<COption*>::const_iterator end = m_allOptions.end();
	for(; it!=end; ++it)
	{
		COption* pOption = (*it);
		if (pOption->GetName().compare(option)==0)
		{
			return pOption;
		}
	}
	return NULL;
}
Ejemplo n.º 2
0
void CProfileOptions::CCVarSink::OnElementFound(ICVar *pCVar)
{
	if (pCVar == 0)
		return;

	const char* name = pCVar->GetName();
	const char* val = pCVar->GetString();

	COption* pOption = m_pOptions->GetOptionByCVar(name);
	if(!pOption)
		return;

	if(!pOption->IsWriteToConfig())
		return;

	const char* optionName = pOption->GetName().c_str();
	const char* writeValue = pOption->Get().c_str();

	const std::vector<SPendingOption>& pendingOptions = m_pOptions->GetPendingOptions();

	std::vector<SPendingOption>::const_iterator it = pendingOptions.begin();
	std::vector<SPendingOption>::const_iterator end = pendingOptions.end();

	for(; it!=end; ++it)
	{
		const SPendingOption& option = (*it);

		if(!option.writeToConfig)
			continue;

		if(option.command.compareNoCase(optionName))
			continue;

		writeValue = option.param.c_str();
		break;
	}

	CryFixedStringT<128> format;
	pOption->GetWriteToConfigString(format, pCVar, writeValue);
	fputs(format.c_str(), m_pFile);
}