diff options
author | rubidium <rubidium@openttd.org> | 2010-11-10 20:15:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-10 20:15:48 +0000 |
commit | d1dfb276992e309d54c55a07ef79aa600a38b8f4 (patch) | |
tree | 50f75235cc7d4f293b0b0dc04c8613bad95e33b2 | |
parent | b8cb654adcc280303b6e442b7c476968996efa88 (diff) | |
download | openttd-d1dfb276992e309d54c55a07ef79aa600a38b8f4.tar.xz |
(svn r21136) -Fix [FS#4213]: bridge speed limits should apply to all wagons of a vehicle, not just the head of the vehicle
-rw-r--r-- | src/roadveh_cmd.cpp | 3 | ||||
-rw-r--r-- | src/train_cmd.cpp | 4 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 188deb876..5fa694909 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -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 */ diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 399fd8253..ca09c07ac 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -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)) { diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index f7645b26f..22973d62d 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -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) { |