mirror of https://github.com/OpenTTD/OpenTTD
(svn r16087) -Fix (r16079): slow trains wouldn't crash into eachother anymore
parent
b66783afab
commit
2a2b40461d
|
@ -4372,29 +4372,28 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
|
||||||
} else {
|
} else {
|
||||||
TrainCheckIfLineEnds(v);
|
TrainCheckIfLineEnds(v);
|
||||||
/* Loop until the train has finished moving. */
|
/* Loop until the train has finished moving. */
|
||||||
do {
|
for (;;) {
|
||||||
j -= adv_spd;
|
j -= adv_spd;
|
||||||
TrainController(v, NULL);
|
TrainController(v, NULL);
|
||||||
|
/* Don't continue to move if the train crashed. */
|
||||||
|
if (CheckTrainCollision(v)) break;
|
||||||
/* 192 spd used for going straight, 256 for going diagonally. */
|
/* 192 spd used for going straight, 256 for going diagonally. */
|
||||||
adv_spd = (v->direction & 1) ? 192 : 256;
|
adv_spd = (v->direction & 1) ? 192 : 256;
|
||||||
|
|
||||||
if (j >= adv_spd) {
|
/* No more moving this tick */
|
||||||
/* Don't continue to move if the train crashed or isn't moving. */
|
if (j < adv_spd || v->cur_speed == 0) break;
|
||||||
if (CheckTrainCollision(v) || v->cur_speed == 0) break;
|
|
||||||
|
|
||||||
OrderType order_type = v->current_order.GetType();
|
OrderType order_type = v->current_order.GetType();
|
||||||
/* Do not skip waypoints (incl. 'via' stations) when passing through at full speed. */
|
/* Do not skip waypoints (incl. 'via' stations) when passing through at full speed. */
|
||||||
if ((order_type == OT_GOTO_WAYPOINT &&
|
if ((order_type == OT_GOTO_WAYPOINT &&
|
||||||
v->dest_tile == v->tile) ||
|
v->dest_tile == v->tile) ||
|
||||||
(order_type == OT_GOTO_STATION &&
|
(order_type == OT_GOTO_STATION &&
|
||||||
(v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) &&
|
(v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) &&
|
||||||
IsTileType(v->tile, MP_STATION) &&
|
IsTileType(v->tile, MP_STATION) &&
|
||||||
v->current_order.GetDestination() == GetStationIndex(v->tile))) {
|
v->current_order.GetDestination() == GetStationIndex(v->tile))) {
|
||||||
ProcessOrders(v);
|
ProcessOrders(v);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} while (j >= adv_spd);
|
}
|
||||||
SetLastSpeed(v, v->cur_speed);
|
SetLastSpeed(v, v->cur_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue