mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r21136) -Fix [FS#4213]: bridge speed limits should apply to all wagons of a vehicle, not just the head of the vehicle
This commit is contained in:
parent
b8cb654adc
commit
d1dfb27699
@ -669,7 +669,8 @@ static int RoadVehAccelerate(RoadVehicle *v)
|
||||
|
||||
/* Apply bridge speed limit */
|
||||
if (v->state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) {
|
||||
v->cur_speed = min(v->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed * 2);
|
||||
RoadVehicle *first = v->First();
|
||||
first->cur_speed = min(first->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed * 2);
|
||||
}
|
||||
|
||||
/* Update statusbar only if speed has changed to save CPU time */
|
||||
|
@ -3296,8 +3296,8 @@ static void TrainController(Train *v, Vehicle *nomove)
|
||||
* - for tunnels, only the part when the vehicle is not visible (part of enter/exit tile too)
|
||||
* - for bridges, only the middle part - without the bridge heads */
|
||||
if (!(v->vehstatus & VS_HIDDEN)) {
|
||||
v->cur_speed =
|
||||
min(v->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed);
|
||||
Train *first = v->First();
|
||||
first->cur_speed = min(first->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed);
|
||||
}
|
||||
|
||||
if (IsTileType(gp.new_tile, MP_TUNNELBRIDGE) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
|
||||
|
@ -1562,13 +1562,13 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti
|
||||
}
|
||||
}
|
||||
} else { // IsBridge(tile)
|
||||
|
||||
if (v->IsPrimaryVehicle() && v->type != VEH_SHIP) {
|
||||
if (v->type != VEH_SHIP) {
|
||||
/* modify speed of vehicle */
|
||||
uint16 spd = GetBridgeSpec(GetBridgeType(tile))->speed;
|
||||
|
||||
if (v->type == VEH_ROAD) spd *= 2;
|
||||
if (v->cur_speed > spd) v->cur_speed = spd;
|
||||
Vehicle *first = v->First();
|
||||
first->cur_speed = min(first->cur_speed, spd);
|
||||
}
|
||||
|
||||
if (vdir == dir) {
|
||||
|
Loading…
Reference in New Issue
Block a user