mirror of https://github.com/OpenTTD/OpenTTD
(svn r14036) -Fix [FS#2197,FS#2198]: trains crashing into eachother when signals are changed (michi_cc)
parent
1c04049f1c
commit
b1ed3bad58
|
@ -2504,6 +2504,20 @@ bool AfterLoadGame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reserve all tracks trains are currently on. */
|
||||||
|
if (CheckSavegameVersion(101)) {
|
||||||
|
Vehicle *v;
|
||||||
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
if (v->type == VEH_TRAIN) {
|
||||||
|
if ((v->u.rail.track & TRACK_BIT_WORMHOLE) == TRACK_BIT_WORMHOLE) {
|
||||||
|
TryReserveRailTrack(v->tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(v->tile)));
|
||||||
|
} else if ((v->u.rail.track & TRACK_BIT_MASK) != TRACK_BIT_NONE) {
|
||||||
|
TryReserveRailTrack(v->tile, TrackBitsToTrack(v->u.rail.track));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GamelogPrintDebug(1);
|
GamelogPrintDebug(1);
|
||||||
|
|
||||||
return InitializeWindowsAndCaches();
|
return InitializeWindowsAndCaches();
|
||||||
|
|
|
@ -3695,6 +3695,8 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goto reverse_train_direction;
|
goto reverse_train_direction;
|
||||||
|
} else {
|
||||||
|
TryReserveRailTrack(gp.new_tile, TrackBitsToTrack(chosen_track));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
static const TrackBits _matching_tracks[8] = {
|
static const TrackBits _matching_tracks[8] = {
|
||||||
|
@ -3777,7 +3779,10 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
|
||||||
|
|
||||||
if (IsTileType(gp.new_tile, MP_TUNNELBRIDGE) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
|
if (IsTileType(gp.new_tile, MP_TUNNELBRIDGE) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
|
||||||
/* Perform look-ahead on tunnel exit. */
|
/* Perform look-ahead on tunnel exit. */
|
||||||
if (IsFrontEngine(v)) CheckNextTrainTile(v);
|
if (IsFrontEngine(v)) {
|
||||||
|
TryReserveRailTrack(gp.new_tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(gp.new_tile)));
|
||||||
|
CheckNextTrainTile(v);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
v->x_pos = gp.x;
|
v->x_pos = gp.x;
|
||||||
v->y_pos = gp.y;
|
v->y_pos = gp.y;
|
||||||
|
|
Loading…
Reference in New Issue