Time in minutes is no longer scaled by day length.

Time in minutes now based on the existing date ticks * the day length,
plus the tick skip counter, instead of just the date ticks.
Change the format of the {DATE_WALLCLOCK_*} string params
to use date ticks scaled by the day length, as above.
Update status bar clock.
This commit is contained in:
Jonathan G Rennison
2015-08-30 18:54:59 +01:00
parent 5d7ad2ba7b
commit 29809f2001
3 changed files with 10 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ typedef int32 Date; ///< The type to store our dates in
typedef uint16 DateFract; ///< The fraction of a date we're in, i.e. the number of ticks since the last date changeover
typedef int32 Ticks; ///< The type to store ticks in
typedef int32 DateTicks; ///< The type to store dates in when tick-precision is required
typedef int64 DateTicksScaled; ///< The type to store dates scaled by the day length factor in when tick-precision is required
typedef int32 Minutes; ///< The type to store minutes in
typedef int32 Year; ///< Type for the year, note: 0 based, i.e. starts at the year 0.
@@ -32,7 +33,9 @@ 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 DATE_UNIT_SIZE (_settings_client.gui.time_in_minutes ? _settings_client.gui.ticks_per_minute : DAY_TICKS)
#define CURRENT_SCALED_TICKS (((((DateTicksScaled)_date * DAY_TICKS) + _date_fract) * _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
static const int STATION_ACCEPTANCE_TICKS = 250; ///< cycle duration for updating station acceptance
@@ -111,7 +114,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 ((((DateTicks)_date * DAY_TICKS) + _date_fract) / _settings_client.gui.ticks_per_minute)
#define CURRENT_MINUTE (CURRENT_SCALED_TICKS / _settings_client.gui.ticks_per_minute)
/**
* Data structure to convert between Date and triplet (year, month, and day).