Exemple #1
0
void CVarManager::saveToDb(sqlite3x::sqlite3_command &cmd, uint8 flags)
{
	for (uint32 x=0; x<getCount(); x++)
	{
		CVar* cvarNode = getItem(x);

		if (cvarNode->getFlags() & CFLAG_NOSAVE)
			continue;

		//dont save if user = true and usercvar = false || user = false and usercvar = true
		if ((flags & CFLAG_USER) ^ (cvarNode->getFlags() & CFLAG_USER))
			continue;

		if ((flags & CFLAG_WINUSER) ^ (cvarNode->getFlags() & CFLAG_WINUSER))
			continue;

		//dont save if setting hasnt changed
		if (!cvarNode->getExitString() || (strcmp(cvarNode->getExitString(), cvarNode->getDefault())) == 0)
			continue;

		cmd.bind(1, std::string(cvarNode->getName()));
		cmd.bind(2, std::string(cvarNode->getExitString()));
		cmd.executenonquery();
	}
}
Exemple #2
0
void CVarManager::cleanUserCvars()
{
	for (uint32 x=0; x<getCount(); x++)
	{
		CVar* cvarNode = getItem(x);

		if (cvarNode->getFlags() & CFLAG_USER)
			cvarNode->setDefault();
	}

	m_uiUserId = -1;
}