* Create the new 'set date' window * @param desc the window description * @param window_number number of the window * @param parent the parent window, i.e. if this closes we should close too * @param initial_date the initial date to show * @param min_year the minimum year to show in the year dropdown * @param max_year the maximum year (inclusive) to show in the year dropdown * @param
| 42 | * @param callback the callback to call once a date has been selected |
| 43 | */ |
| 44 | SetDateWindow(WindowDesc &desc, WindowNumber window_number, Window *parent, TimerGameEconomy::Date initial_date, TimerGameEconomy::Year min_year, TimerGameEconomy::Year max_year, SetDateCallback &&callback) : |
| 45 | Window(desc), |
| 46 | callback(std::move(callback)), |
| 47 | min_year(std::max(EconomyTime::MIN_YEAR, min_year)), |
| 48 | max_year(std::min(EconomyTime::MAX_YEAR, max_year)) |
| 49 | { |
| 50 | assert(this->min_year <= this->max_year); |
| 51 | this->parent = parent; |
| 52 | this->InitNested(window_number); |
| 53 | |
| 54 | if (initial_date == 0) initial_date = TimerGameEconomy::date; |
| 55 | this->date = TimerGameEconomy::ConvertDateToYMD(initial_date); |
| 56 | this->date.year = Clamp(this->date.year, min_year, max_year); |
| 57 | } |
| 58 | |
| 59 | Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override |
| 60 | { |
nothing calls this directly
no test coverage detected