1
0
Fork 0

(svn r5072) - Backport from trunk (r5071):

- Fix (FS#184): "Erroneous train reversal on waypoints". When processing the next train order, do not even consider reversing the train if the last order was to a waypoint.
release/0.4
peter1138 2006-06-02 13:23:22 +00:00
parent 86e4f20be8
commit ca175e873f
1 changed files with 8 additions and 8 deletions

View File

@ -2288,7 +2288,7 @@ bad:;
static bool ProcessTrainOrder(Vehicle *v) static bool ProcessTrainOrder(Vehicle *v)
{ {
const Order *order; const Order *order;
bool result; bool at_waypoint = false;
// These are un-interruptible // These are un-interruptible
if (v->current_order.type >= OT_GOTO_DEPOT && if (v->current_order.type >= OT_GOTO_DEPOT &&
@ -2308,6 +2308,7 @@ static bool ProcessTrainOrder(Vehicle *v)
// check if we've reached the waypoint? // check if we've reached the waypoint?
if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) { if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
v->cur_order_index++; v->cur_order_index++;
at_waypoint = true;
} }
// check if we've reached a non-stop station while TTDPatch nonstop is enabled.. // check if we've reached a non-stop station while TTDPatch nonstop is enabled..
@ -2342,29 +2343,28 @@ static bool ProcessTrainOrder(Vehicle *v)
v->dest_tile = 0; v->dest_tile = 0;
result = false; InvalidateVehicleOrder(v);
switch (order->type) { switch (order->type) {
case OT_GOTO_STATION: case OT_GOTO_STATION:
if (order->station == v->last_station_visited) if (order->station == v->last_station_visited)
v->last_station_visited = INVALID_STATION; v->last_station_visited = INVALID_STATION;
v->dest_tile = GetStation(order->station)->xy; v->dest_tile = GetStation(order->station)->xy;
result = CheckReverseTrain(v);
break; break;
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
v->dest_tile = GetDepot(order->station)->xy; v->dest_tile = GetDepot(order->station)->xy;
result = CheckReverseTrain(v);
break; break;
case OT_GOTO_WAYPOINT: case OT_GOTO_WAYPOINT:
v->dest_tile = GetWaypoint(order->station)->xy; v->dest_tile = GetWaypoint(order->station)->xy;
result = CheckReverseTrain(v);
break; break;
default:
return false;
} }
InvalidateVehicleOrder(v); return !at_waypoint && CheckReverseTrain(v);
return result;
} }
static void MarkTrainDirty(Vehicle *v) static void MarkTrainDirty(Vehicle *v)