* Callback for FiosGetFileList. It tells if a file is a savegame 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 savegame, and the title of the file (if any). * @see FiosGetFileList * @see FiosGetSavegameList
| 390 | * @see FiosGetSavegameList |
| 391 | */ |
| 392 | std::tuple<FiosType, std::string> FiosGetSavegameListCallback(SaveLoadOperation fop, std::string_view file, std::string_view ext) |
| 393 | { |
| 394 | /* Show savegame files |
| 395 | * .SAV OpenTTD saved game |
| 396 | * .SS1 Transport Tycoon Deluxe preset game |
| 397 | * .SV1 Transport Tycoon Deluxe (Patch) saved game |
| 398 | * .SV2 Transport Tycoon Deluxe (Patch) saved 2-player game */ |
| 399 | |
| 400 | if (StrEqualsIgnoreCase(ext, ".sav")) { |
| 401 | return { FIOS_TYPE_FILE, GetFileTitle(file, SAVE_DIR) }; |
| 402 | } |
| 403 | |
| 404 | if (fop == SLO_LOAD) { |
| 405 | if (StrEqualsIgnoreCase(ext, ".ss1") || StrEqualsIgnoreCase(ext, ".sv1") || |
| 406 | StrEqualsIgnoreCase(ext, ".sv2")) { |
| 407 | return { FIOS_TYPE_OLDFILE, GetOldSaveGameName(file) }; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | return { FIOS_TYPE_INVALID, {} }; |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Get a list of savegames. |
no test coverage detected