Codechange: Move calendar date functions inside TimerGameCalendar (#10753)

This commit is contained in:
Tyler Trahan
2023-05-04 09:14:12 -04:00
committed by GitHub
parent 7669aac865
commit 6501f84b4a
43 changed files with 224 additions and 281 deletions

View File

@@ -9,7 +9,6 @@
#include "../stdafx.h"
#include "../strings_func.h"
#include "../date_func.h"
#include "../fios.h"
#include "network_client.h"
#include "network_gui.h"
@@ -38,6 +37,7 @@
#include "../company_cmd.h"
#include "../timer/timer.h"
#include "../timer/timer_window.h"
#include "../timer/timer_game_calendar.h"
#include "../widgets/network_widget.h"
@@ -432,8 +432,8 @@ protected:
if (nwi_header->IsWidgetVisible(WID_NG_DATE)) {
/* current date */
Rect date = this->GetWidget<NWidgetBase>(WID_NG_DATE)->GetCurrentRect();
YearMonthDay ymd;
ConvertDateToYMD(cur_item->info.game_date, &ymd);
TimerGameCalendar::YearMonthDay ymd;
TimerGameCalendar::ConvertDateToYMD(cur_item->info.game_date, &ymd);
SetDParam(0, ymd.year);
DrawString(date.left, date.right, y + text_y_offset, STR_JUST_INT, TC_BLACK, SA_HOR_CENTER);
}
@@ -441,9 +441,9 @@ protected:
if (nwi_header->IsWidgetVisible(WID_NG_YEARS)) {
/* number of years the game is running */
Rect years = this->GetWidget<NWidgetBase>(WID_NG_YEARS)->GetCurrentRect();
YearMonthDay ymd_cur, ymd_start;
ConvertDateToYMD(cur_item->info.game_date, &ymd_cur);
ConvertDateToYMD(cur_item->info.start_date, &ymd_start);
TimerGameCalendar::YearMonthDay ymd_cur, ymd_start;
TimerGameCalendar::ConvertDateToYMD(cur_item->info.game_date, &ymd_cur);
TimerGameCalendar::ConvertDateToYMD(cur_item->info.start_date, &ymd_start);
SetDParam(0, ymd_cur.year - ymd_start.year);
DrawString(years.left, years.right, y + text_y_offset, STR_JUST_INT, TC_BLACK, SA_HOR_CENTER);
}