* Get a date from a given start tick of timetable. * @param start_tick The TimerGameTick::TickCounter when the timetable starts. * @return The date when we reach this tick. */
| 44 | * @return The date when we reach this tick. |
| 45 | */ |
| 46 | TimerGameEconomy::Date GetDateFromStartTick(TimerGameTick::TickCounter start_tick) |
| 47 | { |
| 48 | /* Calculate the offset in ticks from the current counter tick. */ |
| 49 | TimerGameTick::Ticks tick_offset = start_tick - TimerGameTick::counter; |
| 50 | |
| 51 | /* Compensate for the current date_fract. */ |
| 52 | tick_offset += TimerGameEconomy::date_fract; |
| 53 | |
| 54 | /* Return the current date plus the offset in days. */ |
| 55 | return TimerGameEconomy::date + (tick_offset / Ticks::DAY_TICKS); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Change/update a particular timetable entry. |
no outgoing calls
no test coverage detected