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

Function ConNewGame

src/console_cmds.cpp:1319–1339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319static bool ConNewGame(std::span<std::string_view> argv)
1320{
1321 if (argv.empty()) {
1322 IConsolePrint(CC_HELP, "Start a new game. Usage: 'newgame [seed]'.");
1323 IConsolePrint(CC_HELP, "The server can force a new game using 'newgame'; any client joined will rejoin after the server is done generating the new game.");
1324 return true;
1325 }
1326
1327 uint32_t seed = GENERATE_NEW_SEED;
1328 if (argv.size() >= 2) {
1329 auto param = ParseInteger(argv[1]);
1330 if (!param.has_value()) {
1331 IConsolePrint(CC_ERROR, "The given seed must be a valid number.");
1332 return true;
1333 }
1334 seed = *param;
1335 }
1336
1337 StartNewGameWithoutGUI(seed);
1338 return true;
1339}
1340
1341static bool ConRestart(std::span<std::string_view> argv)
1342{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected