Replace day length scaled tick macros with global variables.

This is to avoid needing to expensively re-calculate them all the time.
Instead update them by incrementing.
This commit is contained in:
Jonathan G Rennison
2016-09-10 00:32:00 +01:00
parent d733955d33
commit 375b069f82
16 changed files with 54 additions and 27 deletions

View File

@@ -33,9 +33,6 @@ static const int DAY_TICKS = 74; ///< ticks per day
static const int DAYS_IN_YEAR = 365; ///< days per year
static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
#define CURRENT_SCALED_TICKS (((((DateTicksScaled)_date * DAY_TICKS) + _date_fract) * _settings_game.economy.day_length_factor) + _tick_skip_counter)
#define SCALED_TICK_COUNTER ((((uint32)_tick_counter) * _settings_game.economy.day_length_factor) + _tick_skip_counter)
#define DATE_UNIT_SIZE (_settings_client.gui.time_in_minutes ? _settings_client.gui.ticks_per_minute : (DAY_TICKS * _settings_game.economy.day_length_factor))
static const int STATION_RATING_TICKS = 185; ///< cycle duration for updating station rating
@@ -115,7 +112,7 @@ static const Year MAX_YEAR = 5000000;
#define MINUTES_DATE(day, hour, minute) ((day * 1440) + (hour * 60) + minute)
/** Get the current date in minutes */
#define CURRENT_MINUTE (CURRENT_SCALED_TICKS / _settings_client.gui.ticks_per_minute)
#define CURRENT_MINUTE (_scaled_date_ticks / _settings_client.gui.ticks_per_minute)
/**
* Data structure to convert between Date and triplet (year, month, and day).