Add more information to getfulldate console command

This commit is contained in:
Jonathan G Rennison 2024-08-22 17:37:52 +01:00
parent 397a30bffc
commit c40ba9782c
2 changed files with 12 additions and 1 deletions

View File

@ -2809,7 +2809,13 @@ DEF_CONSOLE_CMD(ConGetFullDate)
IConsolePrintF(CC_DEFAULT, "Tick counter: " OTTD_PRINTF64, _tick_counter);
IConsolePrintF(CC_DEFAULT, "Tick counter (scaled): " OTTD_PRINTF64, _scaled_tick_counter);
IConsolePrintF(CC_DEFAULT, "State ticks: " OTTD_PRINTF64 " (offset: " OTTD_PRINTF64 ")", _state_ticks.base(), DateDetail::_state_ticks_offset.base());
IConsolePrintF(CC_DEFAULT, "Effective day length: %d", DayLengthFactor());
IConsolePrintF(CC_DEFAULT, "Effective economy speed reduction factor: %d", DayLengthFactor());
if (!CalTime::IsCalendarFrozen()) IConsolePrintF(CC_DEFAULT, "Ticks per calendar day: %d", TicksPerCalendarDay());
if (_settings_time.time_in_minutes) {
Ticks remainder = _settings_time.GetTickMinutesRemainder(_state_ticks);
ClockFaceMinutes hhmm = _settings_time.ToTickMinutes(_state_ticks).ToClockFaceMinutes();
IConsolePrintF(CC_DEFAULT, "Timetable time: %02d:%02d + %d ticks", hhmm.ClockHour(), hhmm.ClockMinute(), remainder);
}
return true;
}

View File

@ -148,6 +148,11 @@ struct TimeSettings {
return (ticks.base() / this->ticks_per_minute) + this->clock_offset;
}
Ticks GetTickMinutesRemainder(StateTicks ticks) const
{
return static_cast<Ticks>((ticks.base() % this->ticks_per_minute));
}
TickMinutes NowInTickMinutes() const
{
extern StateTicks _state_ticks;