* Get the TimerGameTick::TickCounter tick of a given date. * @param start_date The date when the timetable starts. * @return The first tick of this date. */
| 27 | * @return The first tick of this date. |
| 28 | */ |
| 29 | TimerGameTick::TickCounter GetStartTickFromDate(TimerGameEconomy::Date start_date) |
| 30 | { |
| 31 | /* Calculate the offset in ticks from the current date. */ |
| 32 | TimerGameTick::Ticks tick_offset = (start_date - TimerGameEconomy::date).base() * Ticks::DAY_TICKS; |
| 33 | |
| 34 | /* Compensate for the current date_fract. */ |
| 35 | tick_offset -= TimerGameEconomy::date_fract; |
| 36 | |
| 37 | /* Return the current tick plus the offset. */ |
| 38 | return TimerGameTick::counter + tick_offset; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get a date from a given start tick of timetable. |
no test coverage detected