diff options
author | Patric Stout <truebrain@openttd.org> | 2021-07-01 20:06:04 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-07-02 14:30:14 +0200 |
commit | 4f3bf84af4eb03936c0242871d7fb5b3b3214e2d (patch) | |
tree | b6a55421947e24445d14f564cc2102b684f32532 | |
parent | 66dc0ce1965bd033b6b52712c3db7a768ff2fba9 (diff) | |
download | openttd-4f3bf84af4eb03936c0242871d7fb5b3b3214e2d.tar.xz |
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.
-rw-r--r-- | src/settings.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 2a8c5b6cc..db84b0ca7 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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 */ |