Changeset - r25748:2c5cea3968c5
[Not reviewed]
master
0 1 0
Patric Stout - 3 years ago 2021-07-01 18:06:04
truebrain@openttd.org
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.
1 file changed with 2 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/settings.cpp
Show inline comments
 
@@ -1524,18 +1524,8 @@ static void GameSaveConfig(IniFile &ini,
 
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 */
0 comments (0 inline, 0 general)