Here's the function from
common/rulesys.cpp:
Code:
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
char vstr[100];
switch(type) {
case IntRule:
sprintf(vstr, "%d", m_RuleIntValues[index]);
break;
case RealRule:
sprintf(vstr, "%.13f", m_RuleRealValues[index]);
break;
case BoolRule:
sprintf(vstr, "%s", m_RuleBoolValues[index]?"true":"false");
break;
}
char errbuf[MYSQL_ERRMSG_SIZE];
char* query = 0;
if (!db->RunQuery(query, MakeAnyLenString(&query,
"REPLACE INTO rule_values (ruleset_id, rule_name, rule_value) "
" VALUES(%d, '%s', '%s')",
m_activeRuleset, _GetRuleName(type, index), vstr),errbuf))
{
_log(RULES__ERROR, "Fauled to set rule in the database: %s: %s", query,errbuf);
}
safe_delete_array(query);
}
I'd commit the change real quick, but I don't really have enough time to test it out. If someone else ends up committing this, please change that typo
