summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 356cfc7ab..e1cabd88f 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1073,6 +1073,23 @@ DEF_CONSOLE_CMD(ConRestart)
return true;
}
+DEF_CONSOLE_CMD(ConReload)
+{
+ if (argc == 0) {
+ IConsoleHelp("Reload game. Usage: 'reload'");
+ IConsoleHelp("Reloads a game.");
+ IConsoleHelp(" * if you started from a savegame / scenario / heightmap, that exact same savegame / scenario / heightmap will be loaded.");
+ IConsoleHelp(" * if you started from a new game, this acts the same as 'restart'.");
+ return true;
+ }
+
+ /* Don't copy the _newgame pointers to the real pointers, so call SwitchToMode directly */
+ _settings_game.game_creation.map_x = MapLogX();
+ _settings_game.game_creation.map_y = FindFirstBit(MapSizeY());
+ _switch_mode = SM_RELOADGAME;
+ return true;
+}
+
/**
* Print a text buffer line by line to the console. Lines are separated by '\n'.
* @param buf The buffer to print.
@@ -2113,6 +2130,7 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("list_aliases", ConListAliases);
IConsoleCmdRegister("newgame", ConNewGame);
IConsoleCmdRegister("restart", ConRestart);
+ IConsoleCmdRegister("reload", ConReload);
IConsoleCmdRegister("getseed", ConGetSeed);
IConsoleCmdRegister("getdate", ConGetDate);
IConsoleCmdRegister("getsysdate", ConGetSysDate);