(svn r10137) -Add: console command to get the current game date.
authorrubidium
Wed, 13 Jun 2007 14:52:41 +0000
changeset 6890 bebf22f6c449
parent 6889 2160bf28040b
child 6891 824359de2f5e
(svn r10137) -Add: console command to get the current game date.
src/console_cmds.cpp
--- a/src/console_cmds.cpp	Wed Jun 13 10:31:40 2007 +0000
+++ b/src/console_cmds.cpp	Wed Jun 13 14:52:41 2007 +0000
@@ -941,6 +941,20 @@
 	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 @@
 	IConsoleCmdRegister("newgame",      ConNewGame);
 	IConsoleCmdRegister("restart",      ConRestart);
 	IConsoleCmdRegister("getseed",      ConGetSeed);
+	IConsoleCmdRegister("getdate",      ConGetDate);
 	IConsoleCmdRegister("quit",         ConExit);
 	IConsoleCmdRegister("resetengines", ConResetEngines);
 	IConsoleCmdRegister("return",       ConReturn);