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

Function ConLoadScenario

src/console_cmds.cpp:485–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485static bool ConLoadScenario(std::span<std::string_view> argv)
486{
487 if (argv.empty()) {
488 IConsolePrint(CC_HELP, "Load a scenario by name or index. Usage: 'load_scenario <file | number>'.");
489 return true;
490 }
491
492 if (argv.size() != 2) return false;
493
494 std::string_view file = argv[1];
495 _console_file_list_scenario.ValidateFileList();
496 const FiosItem *item = _console_file_list_scenario.FindItem(file);
497 if (item != nullptr) {
498 if (item->type.abstract == FT_SCENARIO) {
499 _switch_mode = SM_LOAD_GAME;
500 _file_to_saveload.Set(*item);
501 } else {
502 IConsolePrint(CC_ERROR, "'{}' is not a scenario.", file);
503 }
504 } else {
505 IConsolePrint(CC_ERROR, "'{}' cannot be found.", file);
506 }
507
508 return true;
509}
510
511static bool ConLoadHeightmap(std::span<std::string_view> argv)
512{

Callers

nothing calls this directly

Calls 6

ValidateFileListMethod · 0.80
FindItemMethod · 0.80
IConsolePrintFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected