Merge branch 'auto_timetables-sx' into jgrpp

This commit is contained in:
Jonathan G Rennison
2016-01-19 19:32:37 +00:00
2 changed files with 13 additions and 4 deletions

View File

@@ -1714,7 +1714,11 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Set automation bit if target has it. */
if (HasBit(src->vehicle_flags, VF_AUTOMATE_TIMETABLE)) {
SetBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE);
} else {
ClrBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE);
}
ClrBit(dst->vehicle_flags, VF_AUTOFILL_TIMETABLE);
ClrBit(dst->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
dst->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(dst->vehicle_flags, VF_TIMETABLE_STARTED);
@@ -1783,6 +1787,15 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
dst->orders.list = new OrderList(first, dst);
}
/* Set automation bit if target has it. */
if (HasBit(src->vehicle_flags, VF_AUTOMATE_TIMETABLE)) {
SetBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE);
ClrBit(dst->vehicle_flags, VF_AUTOFILL_TIMETABLE);
ClrBit(dst->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
} else {
ClrBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE);
}
InvalidateVehicleOrder(dst, VIWD_REMOVE_ALL_ORDERS);
InvalidateWindowClassesData(GetWindowClassForVehicleType(dst->type), 0);

View File

@@ -323,11 +323,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
w->lateness_counter = 0;
ClrBit(w->vehicle_flags, VF_TIMETABLE_STARTED);
/* Do multiplication, then division to reduce rounding errors. */
#if WALLCLOCK_NETWORK_COMPATIBLE
w->timetable_start = start_date + idx * total_duration / num_vehs / DAY_TICKS;
#else
w->timetable_start = start_date + idx * total_duration / num_vehs;
#endif
SetWindowDirty(WC_VEHICLE_TIMETABLE, w->index);
}