summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-13 14:52:41 +0000
committerrubidium <rubidium@openttd.org>2007-06-13 14:52:41 +0000
commit779fd2fa42ef00e586f9a1dc5f0b1e7b37f65938 (patch)
treec2d33e7cf2415b2669e6ce7c7254e4046b94573d
parentf782a311f8bf371faa026f423719a21c399ed31b (diff)
downloadopenttd-779fd2fa42ef00e586f9a1dc5f0b1e7b37f65938.tar.xz
(svn r10137) -Add: console command to get the current game date.
-rw-r--r--src/console_cmds.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 5ab671150..0fe85c86d 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -941,6 +941,20 @@ DEF_CONSOLE_CMD(ConGetSeed)
return true;
}
+DEF_CONSOLE_CMD(ConGetDate)
+{
+ if (argc == 0) {
+ IConsoleHelp("Returns the current date (day-month-year) of the game. Usage: 'getdate'");
+ return true;
+ }
+
+ YearMonthDay ymd;
+ ConvertDateToYMD(_date, &ymd);
+ IConsolePrintF(_icolour_def, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year);
+ return true;
+}
+
+
DEF_CONSOLE_CMD(ConAlias)
{
IConsoleAlias *alias;
@@ -1496,6 +1510,7 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("newgame", ConNewGame);
IConsoleCmdRegister("restart", ConRestart);
IConsoleCmdRegister("getseed", ConGetSeed);
+ IConsoleCmdRegister("getdate", ConGetDate);
IConsoleCmdRegister("quit", ConExit);
IConsoleCmdRegister("resetengines", ConResetEngines);
IConsoleCmdRegister("return", ConReturn);