Feature: Use real-time "wallclock" timekeeping units (#11341)

This commit is contained in:
Tyler Trahan
2024-01-23 11:36:09 -05:00
committed by GitHub
parent bbdbf9a589
commit fd9e72a7e7
30 changed files with 546 additions and 140 deletions

View File

@@ -159,7 +159,15 @@ struct SubsidyListWindow : Window {
if (IsInsideMM(pos, 0, cap)) {
/* Displays the two offered towns */
SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::Gui);
SetDParam(7, TimerGameEconomy::date - ymd.day + s->remaining * 32);
/* If using wallclock units, show minutes remaining. Otherwise show the date when the subsidy ends. */
if (TimerGameEconomy::UsingWallclockUnits()) {
SetDParam(7, STR_SUBSIDIES_OFFERED_EXPIRY_TIME);
SetDParam(8, s->remaining + 1); // We get the rest of the current economy month for free, since the expiration is checked on each new month.
} else {
SetDParam(7, STR_SUBSIDIES_OFFERED_EXPIRY_DATE);
SetDParam(8, TimerGameEconomy::date - ymd.day + s->remaining * 32);
}
DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_OFFERED_FROM_TO);
}
pos++;
@@ -183,7 +191,15 @@ struct SubsidyListWindow : Window {
if (IsInsideMM(pos, 0, cap)) {
SetupSubsidyDecodeParam(s, SubsidyDecodeParamType::Gui);
SetDParam(7, s->awarded);
SetDParam(8, TimerGameEconomy::date - ymd.day + s->remaining * 32);
/* If using wallclock units, show minutes remaining. Otherwise show the date when the subsidy ends. */
if (TimerGameEconomy::UsingWallclockUnits()) {
SetDParam(8, STR_SUBSIDIES_SUBSIDISED_EXPIRY_TIME);
SetDParam(9, s->remaining);
}
else {
SetDParam(8, STR_SUBSIDIES_SUBSIDISED_EXPIRY_DATE);
SetDParam(9, TimerGameEconomy::date - ymd.day + s->remaining * 32);
}
/* Displays the two connected stations */
DrawString(tr.left, tr.right, tr.top + pos * GetCharacterHeight(FS_NORMAL), STR_SUBSIDIES_SUBSIDISED_FROM_TO);