mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +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)
|
static void SaveVersionInConfig(IniFile &ini)
|
||||||
{
|
{
|
||||||
IniGroup *group = ini.GetGroup("version");
|
IniGroup *group = ini.GetGroup("version");
|
||||||
|
group->GetItem("version_string", true)->SetValue(_openttd_revision);
|
||||||
char version[9];
|
group->GetItem("version_number", true)->SetValue(fmt::format("{:08X}", _openttd_newgrf_version));
|
||||||
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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save a GRF configuration to the given group name */
|
/* Save a GRF configuration to the given group name */
|
||||||
|
Loading…
Reference in New Issue
Block a user