summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-19 10:00:30 +0000
committertruelight <truelight@openttd.org>2006-08-19 10:00:30 +0000
commit7abad2b20ee239c96f702b2463c98aca4f58aacf (patch)
treecd9ad6758b68622254b2545359b5d87f88f7074b /console_cmds.c
parentd3f2180438830f8fefc1e319276d33a914fee767 (diff)
downloadopenttd-7abad2b20ee239c96f702b2463c98aca4f58aacf.tar.xz
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
- New optional landscape generator (TerraGenesis Perlin) - Load heightmaps (either BMP or PNG) - Progress dialog while generating worlds (no longer a 'hanging' screen) - New dialogs for NewGame, Create Scenario and Play Heightmap - Easier to configure your landscape - More things to configure (tree-placer, ..) - Speedup of world generation - New console command 'restart': restart the map EXACTLY as it was when you first started it (needs a game made after or with this commit) - New console command 'getseed': get the seed of your map and share it with others (of course only works with generated maps) - Many new, world generation related, things - Many internal cleanups and rewrites Many tnx to those people who helped making this: Belugas, DaleStan, glx, KUDr, RichK67, Rubidium, and TrueLight (alfabetic) Many tnx to those who helped testing: Arnau, Bjarni, and tokai (alfabetic) And to all other people who helped testing and sending comments / bugs Stats: 673 lines changed, 3534 new lines, 79 new strings
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/console_cmds.c b/console_cmds.c
index d006af5b7..ae716d79a 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -20,6 +20,7 @@
#include "station.h"
#include "strings.h"
#include "screenshot.h"
+#include "genworld.h"
#include "date.h"
#ifdef ENABLE_NETWORK
@@ -871,17 +872,44 @@ DEF_CONSOLE_CMD(ConEchoC)
return true;
}
+DEF_CONSOLE_CMD(ConNewGame)
+{
+ if (argc == 0) {
+ IConsoleHelp("Start a new game. Usage: 'newgame [seed]'");
+ IConsoleHelp("The server can force a new game using 'newgame'; any client joined will rejoin after the server is done generating the new game.");
+ return true;
+ }
+
+ StartNewGameWithoutGUI((argc == 2) ? (uint)atoi(argv[1]) : GENERATE_NEW_SEED);
+ return true;
+}
+
extern void SwitchMode(int new_mode);
-DEF_CONSOLE_CMD(ConNewGame)
+DEF_CONSOLE_CMD(ConRestart)
+{
+ if (argc == 0) {
+ IConsoleHelp("Restart game. Usage: 'restart'");
+ IConsoleHelp("Restarts a game. It tries to reproduce the exact same map as the game started with.");
+ return true;
+ }
+
+ /* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */
+ _patches.map_x = MapLogX();
+ _patches.map_y = FindFirstBit(MapSizeY());
+ SwitchMode(SM_NEWGAME);
+ return true;
+}
+
+DEF_CONSOLE_CMD(ConGetSeed)
{
if (argc == 0) {
- IConsoleHelp("Start a new game. Usage: 'newgame'");
- IConsoleHelp("The server can force a new game using 'newgame', any client using it will part and start a single-player game");
+ IConsoleHelp("Returns the seed used to create this game. Usage: 'getseed'");
+ IConsoleHelp("The seed can be used to reproduce the exact same map as the game started with.");
return true;
}
- GenRandomNewGame(Random(), InteractiveRandom());
+ IConsolePrintF(_icolour_def, "Generation Seed: %u", _patches.generation_seed);
return true;
}
@@ -1413,6 +1441,8 @@ void IConsoleStdLibRegister(void)
IConsoleCmdRegister("list_vars", ConListVariables);
IConsoleCmdRegister("list_aliases", ConListAliases);
IConsoleCmdRegister("newgame", ConNewGame);
+ IConsoleCmdRegister("restart", ConRestart);
+ IConsoleCmdRegister("getseed", ConGetSeed);
IConsoleCmdRegister("quit", ConExit);
IConsoleCmdRegister("resetengines", ConResetEngines);
IConsoleCmdRegister("return", ConReturn);