Exemple #1
0
void SetCVar(CCommand* pCommand, tvector<tstring>& asTokens, const tstring& sCommand)
{
	CVar* pCVar = dynamic_cast<CVar*>(pCommand);
	TAssert(pCVar);
	if (!pCVar)
		return;

	if (asTokens.size() > 1)
		pCVar->SetValue(asTokens[1]);

	TMsg(sprintf(tstring("%s = %s\n"), pCVar->GetName().c_str(), pCVar->GetValue().c_str()));
}
Exemple #2
0
void CConsole::WriteVariables( void )
{
	CVar* cv;

	std::ofstream file( "config//config.cfg" ,ios::out );
	file.clear();

	for (int i=0;i<m_CommandList.Size();i++)
	{
		if ( !m_CommandList[i]->IsFlagSet( FCVAR_ARCHIVE ) )
			continue;

		cv = (CVar*)m_CommandList[i];
		file << cv->GetName();
		file << " ";
		file << cv->GetString() << "\n";
	}
	
	file.close();
}