Changeset - r19877:785cbea635d7
[Not reviewed]
master
0 2 0
michi_cc - 12 years ago 2012-12-20 19:43:58
michi_cc@openttd.org
(svn r24832) -Fix [FS#5397]: [NewGRF] Take bridge speed limits into account for vehicle variable 4C.
2 files changed with 10 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -421,6 +421,11 @@ inline int RoadVehicle::GetCurrentMaxSpe
 
		} 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 IndividualRoadVehicleControl
 
		/* 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) {
src/train_cmd.cpp
Show inline comments
 
@@ -403,6 +403,11 @@ int Train::GetCurrentMaxSpeed() const
 
			max_speed = min(max_speed, 61);
 
			break;
 
		}
 

	
 
		/* Vehicle is on the middle part of a bridge. */
 
		if (u->track == TRACK_BIT_WORMHOLE && !(u->vehstatus & VS_HIDDEN)) {
 
			max_speed = min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed);
 
		}
 
	}
 

	
 
	max_speed = min(max_speed, this->current_order.max_speed);
 
@@ -3250,14 +3255,6 @@ bool TrainController(Train *v, Vehicle *
 
				}
 
			}
 
		} else {
 
			/* In a tunnel or on a bridge
 
			 * - 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)) {
 
				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)) {
 
				/* Perform look-ahead on tunnel exit. */
 
				if (v->IsFrontEngine()) {
0 comments (0 inline, 0 general)