diff options
author | frosch <frosch@openttd.org> | 2011-01-31 20:44:15 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-01-31 20:44:15 +0000 |
commit | a97d52a29a990132a8a5e4dd60304483617cec50 (patch) | |
tree | 0d8d42d633feabb438f812cedf0534a3c665074e /src/timetable_cmd.cpp | |
parent | 67a5cd0b185158ca4926c8cb45f1735a1001e00b (diff) | |
download | openttd-a97d52a29a990132a8a5e4dd60304483617cec50.tar.xz |
(svn r21933) -Codechange: Split cur_order_index into cur_auto_order_index and cur_real_order_index to keep track of the current real order in an unambiguous way.
-Fix [FS#4440]: Automatic orders behave now stable wrt. service orders and are not added or removed depending on the need of servicing.
-Fix: Various other issues with automatic orders, e.g. vehicles getting stuck with "no orders" when there are automatic orders at the end of the order list.
Diffstat (limited to 'src/timetable_cmd.cpp')
-rw-r--r-- | src/timetable_cmd.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 94c9812ef..688a5d15e 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -33,7 +33,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time v->orders.list->UpdateOrderTimetable(delta); for (v = v->FirstShared(); v != NULL; v = v->NextShared()) { - if (v->cur_order_index == order_number && v->current_order.Equals(*order)) { + if (v->cur_real_order_index == order_number && v->current_order.Equals(*order)) { if (is_journey) { v->current_order.travel_time = time; } else { @@ -248,7 +248,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) bool just_started = false; /* This vehicle is arriving at the first destination in the timetable. */ - if (v->cur_order_index == first_manual_order && travelling) { + if (v->cur_real_order_index == first_manual_order && travelling) { /* If the start date hasn't been set, or it was set automatically when * the vehicle last arrived at the first destination, update it to the * current time. Otherwise set the late counter appropriately to when @@ -288,10 +288,10 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) * processing of different orders when filling the timetable. */ time_taken = CeilDiv(max(time_taken, 1U), DAY_TICKS) * DAY_TICKS; - ChangeTimetable(v, v->cur_order_index, time_taken, travelling); + ChangeTimetable(v, v->cur_real_order_index, time_taken, travelling); } - if (v->cur_order_index == first_manual_order && travelling) { + if (v->cur_real_order_index == first_manual_order && travelling) { /* If we just started we would have returned earlier and have not reached * this code. So obviously, we have completed our round: So turn autofill * off again. */ |