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

Function FiosGetScenarioListCallback

src/fios.cpp:441–459  ·  view source on GitHub ↗

* Callback for FiosGetFileList. It tells if a file is a scenario or not. * @param fop Purpose of collecting the list. * @param file Name of the file to check. * @param ext A pointer to the extension identifier inside file * @return a FIOS_TYPE_* type of the found file, FIOS_TYPE_INVALID if not a scenario and the title of the file (if any). * @see FiosGetFileList * @see FiosGetScenarioList *

Source from the content-addressed store, hash-verified

439 * @see FiosGetScenarioList
440 */
441std::tuple<FiosType, std::string> FiosGetScenarioListCallback(SaveLoadOperation fop, std::string_view file, std::string_view ext)
442{
443 /* Show scenario files
444 * .SCN OpenTTD style scenario file
445 * .SV0 Transport Tycoon Deluxe (Patch) scenario
446 * .SS0 Transport Tycoon Deluxe preset scenario */
447 if (StrEqualsIgnoreCase(ext, ".scn")) {
448 return { FIOS_TYPE_SCENARIO, GetFileTitle(file, SCENARIO_DIR) };
449
450 }
451
452 if (fop == SLO_LOAD) {
453 if (StrEqualsIgnoreCase(ext, ".sv0") || StrEqualsIgnoreCase(ext, ".ss0")) {
454 return { FIOS_TYPE_OLD_SCENARIO, GetOldSaveGameName(file) };
455 }
456 }
457
458 return { FIOS_TYPE_INVALID, {} };
459}
460
461/**
462 * Get a list of scenarios.

Callers 1

openttd_mainFunction · 0.85

Calls 3

StrEqualsIgnoreCaseFunction · 0.85
GetFileTitleFunction · 0.85
GetOldSaveGameNameFunction · 0.85

Tested by

no test coverage detected