1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

(svn r16120) [0.7] -Backport from trunk:

- Fix: Road was removed when both the Remove button was active and Ctrl was pressed [FS#2582] (r16119)
- Fix: Connect tried to validate too much of the company ID with too little information on hand [FS#2849] (r16096)
- Fix: Insanely fast trains would not stop in time for stations/'jump' over waypoints/via stations within a tick, which would cause the order not to be processed causing the train to go in loops until (with luck) it 'hit' the tile [FS#2824] (r16079)
- Fix: Content download progress bar 'resetting' due to mathematical overflow [FS#2845] (r16071)
- Fix: Memory leak when querying a server multiple times (r16064)
This commit is contained in:
rubidium
2009-04-22 08:48:08 +00:00
parent d9ed2d380f
commit f7cc97fe5c
9 changed files with 27 additions and 62 deletions

View File

@@ -4325,14 +4325,28 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
} else {
TrainCheckIfLineEnds(v);
/* Loop until the train has finished moving. */
do {
for (;;) {
j -= adv_spd;
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. */
adv_spd = (v->direction & 1) ? 192 : 256;
} while (j >= adv_spd);
/* No more moving this tick */
if (j < adv_spd || v->cur_speed == 0) break;
OrderType order_type = v->current_order.GetType();
/* Do not skip waypoints (incl. 'via' stations) when passing through at full speed. */
if ((order_type == OT_GOTO_WAYPOINT &&
v->dest_tile == v->tile) ||
(order_type == OT_GOTO_STATION &&
(v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) &&
IsTileType(v->tile, MP_STATION) &&
v->current_order.GetDestination() == GetStationIndex(v->tile))) {
ProcessOrders(v);
}
}
SetLastSpeed(v, v->cur_speed);
}