* 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 *
| 439 | * @see FiosGetScenarioList |
| 440 | */ |
| 441 | std::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. |
no test coverage detected