Codechange: Move calendar date functions inside TimerGameCalendar (#10753)
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include "cheat_type.h"
|
||||
#include "company_base.h"
|
||||
#include "company_func.h"
|
||||
#include "date_func.h"
|
||||
#include "saveload/saveload.h"
|
||||
#include "vehicle_base.h"
|
||||
#include "textbuf_gui.h"
|
||||
@@ -108,9 +107,9 @@ static int32 ClickChangeDateCheat(int32 new_value, int32 change_direction)
|
||||
new_value = Clamp(new_value, MIN_YEAR, MAX_YEAR);
|
||||
if (new_value == TimerGameCalendar::year) return TimerGameCalendar::year;
|
||||
|
||||
YearMonthDay ymd;
|
||||
ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
||||
TimerGameCalendar::Date new_date = ConvertYMDToDate(new_value, ymd.month, ymd.day);
|
||||
TimerGameCalendar::YearMonthDay ymd;
|
||||
TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
||||
TimerGameCalendar::Date new_date = TimerGameCalendar::ConvertYMDToDate(new_value, ymd.month, ymd.day);
|
||||
|
||||
/* Shift cached dates before we change the date. */
|
||||
for (auto v : Vehicle::Iterate()) v->ShiftDates(new_date - TimerGameCalendar::date);
|
||||
@@ -323,7 +322,7 @@ struct CheatWindow : Window {
|
||||
switch (ce->str) {
|
||||
/* Display date for change date cheat */
|
||||
case STR_CHEAT_CHANGE_DATE:
|
||||
SetDParam(0, ConvertYMDToDate(MAX_YEAR, 11, 31));
|
||||
SetDParam(0, TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 11, 31));
|
||||
width = std::max(width, GetStringBoundingBox(ce->str).width);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user