Remove costly recalculation of a date format we already have.

(cherry picked from commit 6aca18d18252f1c2f6d4a215999b7d7afb7df813)

See #36
This commit is contained in:
keldorkatarn
2018-04-10 04:51:24 +02:00
committed by Jonathan G Rennison
parent 9ab2b8fa3e
commit 4955996b35
8 changed files with 12 additions and 19 deletions

View File

@@ -146,9 +146,6 @@ struct SubsidyListWindow : Window {
{
if (widget != WID_SUL_PANEL) return;
YearMonthDay ymd;
ConvertDateToYMD(_date, &ymd);
int right = r.right - WD_FRAMERECT_RIGHT;
int y = r.top + WD_FRAMERECT_TOP;
int x = r.left + WD_FRAMERECT_LEFT;
@@ -167,7 +164,7 @@ struct SubsidyListWindow : Window {
if (IsInsideMM(pos, 0, cap)) {
/* Displays the two offered towns */
SetupSubsidyDecodeParam(s, true);
SetDParam(7, _date - ymd.day + s->remaining * 32);
SetDParam(7, _date - _cur_date_ymd.day + s->remaining * 32);
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_OFFERED_FROM_TO);
}
pos++;
@@ -191,7 +188,7 @@ struct SubsidyListWindow : Window {
if (IsInsideMM(pos, 0, cap)) {
SetupSubsidyDecodeParam(s, true);
SetDParam(7, s->awarded);
SetDParam(8, _date - ymd.day + s->remaining * 32);
SetDParam(8, _date - _cur_date_ymd.day + s->remaining * 32);
/* Displays the two connected stations */
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_SUBSIDISED_FROM_TO);