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

Function ConLoadHeightmap

src/console_cmds.cpp:511–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511static bool ConLoadHeightmap(std::span<std::string_view> argv)
512{
513 if (argv.empty()) {
514 IConsolePrint(CC_HELP, "Load a heightmap by name or index. Usage: 'load_heightmap <file | number>'.");
515 return true;
516 }
517
518 if (argv.size() != 2) return false;
519
520 std::string_view file = argv[1];
521 _console_file_list_heightmap.ValidateFileList();
522 const FiosItem *item = _console_file_list_heightmap.FindItem(file);
523 if (item != nullptr) {
524 if (item->type.abstract == FT_HEIGHTMAP) {
525 _switch_mode = SM_START_HEIGHTMAP;
526 _file_to_saveload.Set(*item);
527 } else {
528 IConsolePrint(CC_ERROR, "'{}' is not a heightmap.", file);
529 }
530 } else {
531 IConsolePrint(CC_ERROR, "'{}' cannot be found.", file);
532 }
533
534 return true;
535}
536
537static bool ConRemove(std::span<std::string_view> argv)
538{

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