From 84c604cb949c2c36f97728849c5160af4a0e161a Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 19 Jan 2016 19:25:11 +0000 Subject: [PATCH 1/2] Fix auto timetable not being unset when sharing orders. Copy auto timetable when copying orders. Clear autofill timetable when sharing, or copying automated orders. --- src/order_cmd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index b53a7da479..3163ff658a 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1624,7 +1624,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); @@ -1693,6 +1697,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); From 2d3a75e3c023c54c08a404d87f944cae9b387be6 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 19 Jan 2016 19:28:32 +0000 Subject: [PATCH 2/2] Revert "Fix distribution of shared order timetable start dates." This reverts commit 37140f00384b0c1fef557fd7d91864aa0d63ec9b. This is in the wrong branch. --- src/timetable_cmd.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 3a0902e689..5c2849bc24 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -313,11 +313,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); }