Changing day length or date no longer changes time in minutes
Add offset variables for scaled date ticks. Adjust offset when changing day length or date, such that scaled date ticks remain the same. Store _scaled_tick_counter and scaled date ticks offset in the savagame.
This commit is contained in:
@@ -251,8 +251,9 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
|
||||
*/
|
||||
static void ChangeTimetableStartIntl(uint32 p1, DateTicksScaled date)
|
||||
{
|
||||
DateTicks date_part = date / _settings_game.economy.day_length_factor;
|
||||
uint32 sub_ticks = date % _settings_game.economy.day_length_factor;
|
||||
DateTicks date_part;
|
||||
uint16 sub_ticks;
|
||||
std::tie(date_part, sub_ticks) = ScaledDateTicksToDateTicksAndSubTicks(date);
|
||||
DoCommandP(0, p1 | (sub_ticks << 21), (Ticks)(date_part - (((DateTicks)_date * DAY_TICKS) + _date_fract)), CMD_SET_TIMETABLE_START | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
|
||||
}
|
||||
|
||||
@@ -815,7 +816,7 @@ struct TimetableWindow : GeneralVehicleWindow {
|
||||
/* We are running towards the first station so we can start the
|
||||
* timetable at the given time. */
|
||||
SetDParam(0, STR_JUST_DATE_WALLCLOCK_TINY);
|
||||
SetDParam(1, (((DateTicksScaled) v->timetable_start) * _settings_game.economy.day_length_factor) + v->timetable_start_subticks);
|
||||
SetDParam(1, DateTicksToScaledDateTicks(v->timetable_start) + v->timetable_start_subticks);
|
||||
DrawString(tr, STR_TIMETABLE_STATUS_START_AT);
|
||||
} else if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
|
||||
/* We aren't running on a timetable yet, so how can we be "on time"
|
||||
|
Reference in New Issue
Block a user