summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-12-20 19:43:58 +0000
committermichi_cc <michi_cc@openttd.org>2012-12-20 19:43:58 +0000
commit8eb1cb4ebbfa2b00ca27f860555f5397fe5a1c9e (patch)
treedfbd3348f09499226fbc651f293789edf12c5eed /src/roadveh_cmd.cpp
parent0ef3ce8c08a76a946f7333da14a2a4a99c9e3d51 (diff)
downloadopenttd-8eb1cb4ebbfa2b00ca27f860555f5397fe5a1c9e.tar.xz
(svn r24832) -Fix [FS#5397]: [NewGRF] Take bridge speed limits into account for vehicle variable 4C.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 11830973b..0bbef9632 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -421,6 +421,11 @@ inline int RoadVehicle::GetCurrentMaxSpeed() const
} else if ((u->direction & 1) == 0) {
max_speed = this->vcache.cached_max_speed * 3 / 4;
}
+
+ /* Vehicle is on the middle part of a bridge. */
+ if (u->state == RVSB_WORMHOLE && !(u->vehstatus & VS_HIDDEN)) {
+ max_speed = min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed * 2);
+ }
}
return min(max_speed, this->current_order.max_speed * 2);
@@ -1095,12 +1100,6 @@ static bool IndividualRoadVehicleController(RoadVehicle *v, const RoadVehicle *p
/* Vehicle is entering a depot or is on a bridge or in a tunnel */
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
- /* Apply bridge speed limit */
- if (!(v->vehstatus & VS_HIDDEN)) {
- RoadVehicle *first = v->First();
- first->cur_speed = min(first->cur_speed, GetBridgeSpec(GetBridgeType(v->tile))->speed * 2);
- }
-
if (v->IsFrontEngine()) {
const Vehicle *u = RoadVehFindCloseTo(v, gp.x, gp.y, v->direction);
if (u != NULL) {