@@ -36,12 +36,13 @@
#include "ai/ai_config.hpp"
#include "newgrf.h"
#include "console_func.h"
#include "engine_base.h"
#include "game/game.hpp"
#include "table/strings.h"
#include <time.h>
#include "safeguards.h"
/* scriptfile handling */
static bool _script_running; ///< Script is running (used to abort execution when #ConReturn is encountered).
@@ -1299,19 +1300,33 @@ 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'");
IConsoleHelp("Returns the current date (year-month-day) of the game. Usage: 'getdate'");
YearMonthDay ymd;
ConvertDateToYMD(_date, &ymd);
IConsolePrintF(CC_DEFAULT, "Date: %d-%d-%d", ymd.day, ymd.month + 1, ymd.year);
IConsolePrintF(CC_DEFAULT, "Date: %04d-%02d-%02d", ymd.year, ymd.month + 1, ymd.day);
DEF_CONSOLE_CMD(ConGetSysDate)
IConsoleHelp("Returns the current date (year-month-day) of your system. Usage: 'getsysdate'");
time_t t;
time(&t);
auto timeinfo = localtime(&t);
IConsolePrintF(CC_DEFAULT, "System Date: %04d-%02d-%02d %02d:%02d:%02d", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
DEF_CONSOLE_CMD(ConAlias)
@@ -1922,12 +1937,13 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("list_cmds", ConListCommands);
IConsoleCmdRegister("list_aliases", ConListAliases);
IConsoleCmdRegister("newgame", ConNewGame);
IConsoleCmdRegister("restart", ConRestart);
IConsoleCmdRegister("getseed", ConGetSeed);
IConsoleCmdRegister("getdate", ConGetDate);
IConsoleCmdRegister("getsysdate", ConGetSysDate);
IConsoleCmdRegister("quit", ConExit);
IConsoleCmdRegister("resetengines", ConResetEngines, ConHookNoNetwork);
IConsoleCmdRegister("reset_enginepool", ConResetEnginePool, ConHookNoNetwork);
IConsoleCmdRegister("return", ConReturn);
IConsoleCmdRegister("screenshot", ConScreenShot);
IConsoleCmdRegister("script", ConScript);
Status change: