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

Function PickerSaveConfig

src/picker_gui.cpp:99–108  ·  view source on GitHub ↗

* Save favourites of a picker to config. * @param ini IniFile to save to. * @param callbacks Picker to save. */

Source from the content-addressed store, hash-verified

97 * @param callbacks Picker to save.
98 */
99static void PickerSaveConfig(IniFile &ini, const PickerCallbacks &callbacks)
100{
101 IniGroup &group = ini.GetOrCreateGroup(callbacks.ini_group);
102 group.Clear();
103
104 for (const PickerItem &item : callbacks.saved) {
105 std::string key = fmt::format("{:08X}|{}", std::byteswap(item.grfid), item.local_id);
106 group.CreateItem(key);
107 }
108}
109
110/**
111 * Load favourites of all registered Pickers from config.

Callers 1

SaveToConfigFunction · 0.85

Calls 3

byteswapFunction · 0.85
formatFunction · 0.50
ClearMethod · 0.45

Tested by

no test coverage detected