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

Function GraphicsSetSaveConfig

src/settings.cpp:1233–1249  ·  view source on GitHub ↗

* Save BaseGraphics set selection and configuration. */

Source from the content-addressed store, hash-verified

1231 * Save BaseGraphics set selection and configuration.
1232 */
1233static void GraphicsSetSaveConfig(IniFile &ini)
1234{
1235 const GraphicsSet *used_set = BaseGraphics::GetUsedSet();
1236 if (used_set == nullptr) return;
1237
1238 IniGroup &group = ini.GetOrCreateGroup("graphicsset");
1239 group.Clear();
1240
1241 group.GetOrCreateItem("name").SetValue(used_set->name);
1242 group.GetOrCreateItem("shortname").SetValue(fmt::format("{:08X}", std::byteswap(used_set->shortname)));
1243
1244 const GRFConfig *extra_cfg = used_set->GetExtraConfig();
1245 if (extra_cfg != nullptr && !extra_cfg->param.empty()) {
1246 group.GetOrCreateItem("extra_version").SetValue(fmt::format("{}", extra_cfg->version));
1247 group.GetOrCreateItem("extra_params").SetValue(GRFBuildParamList(*extra_cfg));
1248 }
1249}
1250
1251/* Save a GRF configuration to the given group name */
1252static void GRFSaveConfig(IniFile &ini, std::string_view grpname, const GRFConfigList &list)

Callers 1

SaveToConfigFunction · 0.85

Calls 7

byteswapFunction · 0.85
GRFBuildParamListFunction · 0.85
GetExtraConfigMethod · 0.80
formatFunction · 0.50
ClearMethod · 0.45
SetValueMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected