Codechange: Split dates and timers into Economy and Calendar time (#10700)

This commit is contained in:
Tyler Trahan
2024-01-22 09:04:34 -05:00
committed by GitHub
parent 419f48dfb3
commit 735abfe111
65 changed files with 952 additions and 550 deletions

View File

@@ -23,6 +23,7 @@
#include "timer/timer_window.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_calendar.h"
#include "timer/timer_game_economy.h"
#include "zoom_func.h"
#include "widgets/graph_widget.h"
@@ -181,8 +182,8 @@ protected:
byte num_vert_lines;
/* The starting month and year that values are plotted against. */
TimerGameCalendar::Month month;
TimerGameCalendar::Year year;
TimerGameEconomy::Month month;
TimerGameEconomy::Year year;
bool draw_dates = true; ///< Should we draw months and years on the time axis?
@@ -380,8 +381,8 @@ protected:
if (this->draw_dates) {
x = r.left;
y = r.bottom + ScaleGUITrad(2);
TimerGameCalendar::Month month = this->month;
TimerGameCalendar::Year year = this->year;
TimerGameEconomy::Month month = this->month;
TimerGameEconomy::Year year = this->year;
for (int i = 0; i < this->num_on_x_axis; i++) {
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
SetDParam(1, year);
@@ -497,8 +498,8 @@ public:
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
if (this->draw_dates) {
TimerGameCalendar::Month month = this->month;
TimerGameCalendar::Year year = this->year;
TimerGameEconomy::Month month = this->month;
TimerGameEconomy::Year year = this->year;
for (int i = 0; i < this->num_on_x_axis; i++) {
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
SetDParam(1, year);
@@ -577,8 +578,8 @@ public:
nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent));
}
int mo = (TimerGameCalendar::month / 3 - nums) * 3;
auto yr = TimerGameCalendar::year;
int mo = (TimerGameEconomy::month / 3 - nums) * 3;
auto yr = TimerGameEconomy::year;
while (mo < 0) {
yr--;
mo += 12;