Codechange: simplify SaveVersionInConfig()

Clearly someone really wanted to generalize the function, but
in reality it makes it a lot longer than needed. Let's keep it
simple.
This commit is contained in:
Patric Stout 2021-07-01 20:06:04 +02:00 committed by Patric Stout
parent 66dc0ce196
commit 4f3bf84af4
1 changed files with 2 additions and 12 deletions

View File

@ -1524,18 +1524,8 @@ static void GameSaveConfig(IniFile &ini, const char *grpname)
static void SaveVersionInConfig(IniFile &ini)
{
IniGroup *group = ini.GetGroup("version");
char version[9];
seprintf(version, lastof(version), "%08X", _openttd_newgrf_version);
const char * const versions[][2] = {
{ "version_string", _openttd_revision },
{ "version_number", version }
};
for (uint i = 0; i < lengthof(versions); i++) {
group->GetItem(versions[i][0], true)->SetValue(versions[i][1]);
}
group->GetItem("version_string", true)->SetValue(_openttd_revision);
group->GetItem("version_number", true)->SetValue(fmt::format("{:08X}", _openttd_newgrf_version));
}
/* Save a GRF configuration to the given group name */