mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 07:29:44 +00:00
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:
parent
66dc0ce196
commit
4f3bf84af4
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user