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 */
|
/* Apply bridge speed limit */
|
||||||
if (v->state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) {
|
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 */
|
/* 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 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 */
|
* - for bridges, only the middle part - without the bridge heads */
|
||||||
if (!(v->vehstatus & VS_HIDDEN)) {
|
if (!(v->vehstatus & VS_HIDDEN)) {
|
||||||
v->cur_speed =
|
Train *first = v->First();
|
||||||
min(v->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed);
|
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)) {
|
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)
|
} else { // IsBridge(tile)
|
||||||
|
if (v->type != VEH_SHIP) {
|
||||||
if (v->IsPrimaryVehicle() && v->type != VEH_SHIP) {
|
|
||||||
/* modify speed of vehicle */
|
/* modify speed of vehicle */
|
||||||
uint16 spd = GetBridgeSpec(GetBridgeType(tile))->speed;
|
uint16 spd = GetBridgeSpec(GetBridgeType(tile))->speed;
|
||||||
|
|
||||||
if (v->type == VEH_ROAD) spd *= 2;
|
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) {
|
if (vdir == dir) {
|
||||||
|
Loading…
Reference in New Issue
Block a user