forked from OpenTTD/OpenTTD
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1049,6 +1049,52 @@ DEF_CONSOLE_CMD(ConNewGame) | |
return true; | ||
} | ||
|
||
DEF_CONSOLE_CMD(ConNewHeightMapGame) | ||
{ | ||
bool answer = true; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
if (argc == 0) { | ||
IConsoleHelp("Load a game by name or index. Usage: 'newheightmapgame [<file | number> [seed]]'"); | ||
IConsoleHelp("The server can force a new game using 'newheightmapgame'; any client joined will rejoin after the server is done generating the new game."); | ||
} | ||
|
||
if (argc >=1 && argc <= 3) { | ||
const char *file = NULL; | ||
|
||
if (argc == 1) { | ||
file = _file_to_saveload.title; | ||
} | ||
|
||
if (argc >= 2) { | ||
file = argv[1]; | ||
} | ||
|
||
// _console_file_list.ValidateFileList(); | ||
This comment has been minimized.
Sorry, something went wrong.
planetmaker
|
||
_console_file_list.BuildFileList(FT_HEIGHTMAP, SLO_LOAD); | ||
const FiosItem *item = _console_file_list.FindItem(file); | ||
if (item != NULL) { | ||
if (GetAbstractFileType(item->type) == FT_HEIGHTMAP) { | ||
_switch_mode = SM_LOAD_HEIGHTMAP; | ||
_file_to_saveload.SetMode(item->type); | ||
_file_to_saveload.SetName(FiosBrowseTo(item)); | ||
_file_to_saveload.SetTitle(item->title); | ||
|
||
StartNewHeightMapGameWithoutGUI((argc == 3) ? strtoul(argv[2], NULL, 10) : GENERATE_NEW_SEED); | ||
} else { | ||
IConsolePrintF(CC_ERROR, "%s: Not a heightmap.", file); | ||
} | ||
} else { | ||
IConsolePrintF(CC_ERROR, "%s: No such file or directory.", file); | ||
} | ||
|
||
_console_file_list.InvalidateFileList(); | ||
} | ||
|
||
if (argc > 3) answer = false; | ||
|
||
return answer; | ||
} | ||
|
||
DEF_CONSOLE_CMD(ConRestart) | ||
{ | ||
if (argc == 0) { | ||
|
@@ -1943,6 +1989,7 @@ void IConsoleStdLibRegister() | |
IConsoleCmdRegister("list_cmds", ConListCommands); | ||
IConsoleCmdRegister("list_aliases", ConListAliases); | ||
IConsoleCmdRegister("newgame", ConNewGame); | ||
IConsoleCmdRegister("newheightmapgame", ConNewHeightMapGame); | ||
IConsoleCmdRegister("restart", ConRestart); | ||
IConsoleCmdRegister("getseed", ConGetSeed); | ||
IConsoleCmdRegister("getdate", ConGetDate); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
probably not the most descriptive variable name. Maybe like 'heightmap_loaded'