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

Function ConRestart

src/console_cmds.cpp:1341–1360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339}
1340
1341static bool ConRestart(std::span<std::string_view> argv)
1342{
1343 if (argv.empty() || argv.size() > 2) {
1344 IConsolePrint(CC_HELP, "Restart game. Usage: 'restart [current|newgame]'.");
1345 IConsolePrint(CC_HELP, "Restarts a game, using either the current or newgame (default) settings.");
1346 IConsolePrint(CC_HELP, " * if you started from a new game, and your current/newgame settings haven't changed, the game will be identical to when you started it.");
1347 IConsolePrint(CC_HELP, " * if you started from a savegame / scenario / heightmap, the game might be different, because the current/newgame settings might differ.");
1348 return true;
1349 }
1350
1351 if (argv.size() == 1 || std::string_view(argv[1]) == "newgame") {
1352 StartNewGameWithoutGUI(_settings_game.game_creation.generation_seed);
1353 } else {
1354 _settings_game.game_creation.map_x = Map::LogX();
1355 _settings_game.game_creation.map_y = Map::LogY();
1356 _switch_mode = SM_RESTARTGAME;
1357 }
1358
1359 return true;
1360}
1361
1362static bool ConReload(std::span<std::string_view> argv)
1363{

Callers

nothing calls this directly

Calls 4

StartNewGameWithoutGUIFunction · 0.85
IConsolePrintFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected