Merge branch 'master' into jgrpp-nrt
# Conflicts: # src/console_cmds.cpp # src/script/api/script_order.cpp # src/station_cmd.cpp # src/statusbar_gui.cpp # src/town_gui.cpp
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include "town.h"
|
||||
#include "industry.h"
|
||||
#include "string_func_extra.h"
|
||||
#include <time.h>
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
@@ -1367,11 +1368,25 @@ DEF_CONSOLE_CMD(ConGetSeed)
|
||||
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'");
|
||||
return true;
|
||||
}
|
||||
|
||||
IConsolePrintF(CC_DEFAULT, "Date: %d-%d-%d", _cur_date_ymd.day, _cur_date_ymd.month + 1, _cur_date_ymd.year);
|
||||
IConsolePrintF(CC_DEFAULT, "Date: %04d-%02d-%02d", _cur_date_ymd.year, _cur_date_ymd.month + 1, _cur_date_ymd.day);
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConGetSysDate)
|
||||
{
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Returns the current date (year-month-day) of your system. Usage: 'getsysdate'");
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2303,6 +2318,7 @@ void IConsoleStdLibRegister()
|
||||
IConsoleCmdRegister("restart", ConRestart);
|
||||
IConsoleCmdRegister("getseed", ConGetSeed);
|
||||
IConsoleCmdRegister("getdate", ConGetDate);
|
||||
IConsoleCmdRegister("getsysdate", ConGetSysDate);
|
||||
IConsoleCmdRegister("quit", ConExit);
|
||||
IConsoleCmdRegister("resetengines", ConResetEngines, ConHookNoNetwork);
|
||||
IConsoleCmdRegister("reset_enginepool", ConResetEnginePool, ConHookNoNetwork);
|
||||
|
Reference in New Issue
Block a user