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

Function GetGRFPresetList

src/settings.cpp:1544–1556  ·  view source on GitHub ↗

* Get the list of known NewGrf presets. * @returns List of preset names. */

Source from the content-addressed store, hash-verified

1542 * @returns List of preset names.
1543 */
1544StringList GetGRFPresetList()
1545{
1546 StringList list;
1547
1548 ConfigIniFile ini(_config_file);
1549 for (const IniGroup &group : ini.groups) {
1550 if (group.name.starts_with("preset-")) {
1551 list.push_back(group.name.substr(7));
1552 }
1553 }
1554
1555 return list;
1556}
1557
1558/**
1559 * Load a NewGRF configuration by preset-name.

Callers 4

NewGRFWindowMethod · 0.85
OnClickMethod · 0.85
OnQueryTextFinishedMethod · 0.85
SavePresetWindowMethod · 0.85

Calls 2

push_backMethod · 0.80
substrMethod · 0.80

Tested by

no test coverage detected