Changeset - r24642:720af5d46e64
[Not reviewed]
master
0 3 0
Patric Stout - 4 years ago 2021-01-08 15:23:07
truebrain@openttd.org
Change: change console command "restart" and add "reload"

The current "restart" command is now called "reload", as that is
what it does.
The old "restart" command is now called "restart", as that is what
it did.

As this has not been in any official release yet, this shouldn't
harm any kitten.
3 files changed with 22 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -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);
src/openttd.cpp
Show inline comments
 
@@ -1046,9 +1046,9 @@ void SwitchToMode(SwitchMode new_mode)
 
			MakeNewEditorWorld();
 
			break;
 

	
 
		case SM_RESTARTGAME: // Restart --> Current settings preserved
 
		case SM_RELOADGAME: // Reload with what-ever started the game
 
			if (_file_to_saveload.abstract_ftype == FT_SAVEGAME || _file_to_saveload.abstract_ftype == FT_SCENARIO) {
 
				/* Restart current savegame/scenario */
 
				/* Reload current savegame/scenario */
 
				_switch_mode = _game_mode == GM_EDITOR ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
 
				SwitchToMode(_switch_mode);
 
				break;
 
@@ -1062,6 +1062,7 @@ void SwitchToMode(SwitchMode new_mode)
 
			MakeNewGame(false, new_mode == SM_NEWGAME);
 
			break;
 

	
 
		case SM_RESTARTGAME: // Restart --> 'Random game' with current settings
 
		case SM_NEWGAME: // New Game --> 'Random game'
 
			if (_network_server) {
 
				seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "Random Map");
src/openttd.h
Show inline comments
 
@@ -25,6 +25,7 @@ enum SwitchMode {
 
	SM_NONE,
 
	SM_NEWGAME,           ///< New Game --> 'Random game'.
 
	SM_RESTARTGAME,       ///< Restart --> 'Random game' with current settings.
 
	SM_RELOADGAME,        ///< Reload the savegame / scenario / heightmap you started the game with.
 
	SM_EDITOR,            ///< Switch to scenario editor.
 
	SM_LOAD_GAME,         ///< Load game, Play Scenario.
 
	SM_MENU,              ///< Switch to game intro menu.
0 comments (0 inline, 0 general)