mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use economy dates when drawing graphs
parent
1e98680bf6
commit
89eedf49aa
|
@ -23,6 +23,7 @@
|
||||||
#include "timer/timer_window.h"
|
#include "timer/timer_window.h"
|
||||||
#include "timer/timer_game_tick.h"
|
#include "timer/timer_game_tick.h"
|
||||||
#include "timer/timer_game_calendar.h"
|
#include "timer/timer_game_calendar.h"
|
||||||
|
#include "timer/timer_game_economy.h"
|
||||||
#include "zoom_func.h"
|
#include "zoom_func.h"
|
||||||
|
|
||||||
#include "widgets/graph_widget.h"
|
#include "widgets/graph_widget.h"
|
||||||
|
@ -184,8 +185,8 @@ protected:
|
||||||
byte num_vert_lines;
|
byte num_vert_lines;
|
||||||
|
|
||||||
/* The starting month and year that values are plotted against. */
|
/* The starting month and year that values are plotted against. */
|
||||||
TimerGameCalendar::Month month;
|
TimerGameEconomy::Month month;
|
||||||
TimerGameCalendar::Year year;
|
TimerGameEconomy::Year year;
|
||||||
|
|
||||||
bool draw_dates = true; ///< Should we draw months and years on the time axis?
|
bool draw_dates = true; ///< Should we draw months and years on the time axis?
|
||||||
|
|
||||||
|
@ -383,8 +384,8 @@ protected:
|
||||||
if (this->draw_dates) {
|
if (this->draw_dates) {
|
||||||
x = r.left;
|
x = r.left;
|
||||||
y = r.bottom + ScaleGUITrad(2);
|
y = r.bottom + ScaleGUITrad(2);
|
||||||
TimerGameCalendar::Month month = this->month;
|
TimerGameEconomy::Month month = this->month;
|
||||||
TimerGameCalendar::Year year = this->year;
|
TimerGameEconomy::Year year = this->year;
|
||||||
for (int i = 0; i < this->num_on_x_axis; i++) {
|
for (int i = 0; i < this->num_on_x_axis; i++) {
|
||||||
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
||||||
SetDParam(1, year);
|
SetDParam(1, year);
|
||||||
|
@ -500,8 +501,8 @@ public:
|
||||||
|
|
||||||
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
|
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
|
||||||
if (this->draw_dates) {
|
if (this->draw_dates) {
|
||||||
TimerGameCalendar::Month month = this->month;
|
TimerGameEconomy::Month month = this->month;
|
||||||
TimerGameCalendar::Year year = this->year;
|
TimerGameEconomy::Year year = this->year;
|
||||||
for (int i = 0; i < this->num_on_x_axis; i++) {
|
for (int i = 0; i < this->num_on_x_axis; i++) {
|
||||||
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
SetDParam(0, month + STR_MONTH_ABBREV_JAN);
|
||||||
SetDParam(1, year);
|
SetDParam(1, year);
|
||||||
|
@ -580,8 +581,8 @@ public:
|
||||||
nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent));
|
nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent));
|
||||||
}
|
}
|
||||||
|
|
||||||
int mo = (TimerGameCalendar::month / 3 - nums) * 3;
|
int mo = (TimerGameEconomy::month / 3 - nums) * 3;
|
||||||
auto yr = TimerGameCalendar::year;
|
auto yr = TimerGameEconomy::year;
|
||||||
while (mo < 0) {
|
while (mo < 0) {
|
||||||
yr--;
|
yr--;
|
||||||
mo += 12;
|
mo += 12;
|
||||||
|
|
Loading…
Reference in New Issue