MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GRFSaveConfig

Function GRFSaveConfig

src/settings.cpp:1252–1262  ·  view source on GitHub ↗

Save a GRF configuration to the given group name */

Source from the content-addressed store, hash-verified

1250
1251/* Save a GRF configuration to the given group name */
1252static void GRFSaveConfig(IniFile &ini, std::string_view grpname, const GRFConfigList &list)
1253{
1254 IniGroup &group = ini.GetOrCreateGroup(grpname);
1255 group.Clear();
1256
1257 for (const auto &c : list) {
1258 std::string key = fmt::format("{:08X}|{}|{}", std::byteswap(c->ident.grfid),
1259 FormatArrayAsHex(c->ident.md5sum), c->filename);
1260 group.GetOrCreateItem(key).SetValue(GRFBuildParamList(*c));
1261 }
1262}
1263
1264/* Common handler for saving/loading variables to the configuration file */
1265static void HandleSettingDescs(IniFile &generic_ini, IniFile &private_ini, IniFile &secrets_ini, SettingDescProc *proc, SettingDescProcList *proc_list, bool only_startup = false)

Callers 2

SaveToConfigFunction · 0.85
SaveGRFPresetToConfigFunction · 0.85

Calls 6

byteswapFunction · 0.85
FormatArrayAsHexFunction · 0.85
GRFBuildParamListFunction · 0.85
formatFunction · 0.50
ClearMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected