Changeset - r6141:c62fa95eacc3
[Not reviewed]
master
0 4 0
tron - 18 years ago 2007-02-24 18:44:30
tron@openttd.org
(svn r8884) -Fix

Replace SetSpeedLimitOnBridge() by something simpler
4 files changed with 13 insertions and 18 deletions:
0 comments (0 inline, 0 general)
src/bridge.h
Show inline comments
 
@@ -28,6 +28,11 @@ extern const Bridge orig_bridge[MAX_BRID
 
extern Bridge _bridge[MAX_BRIDGES];
 

	
 
uint GetBridgeFoundation(Slope tileh, Axis axis);
 
uint SetSpeedLimitOnBridge(Vehicle *);
 

	
 
static inline const Bridge *GetBridge(uint i)
 
{
 
	assert(i < lengthof(_bridge));
 
	return &_bridge[i];
 
}
 

	
 
#endif /* BRIDGE_H */
src/roadveh_cmd.cpp
Show inline comments
 
@@ -880,7 +880,9 @@ static bool RoadVehAccelerate(Vehicle *v
 

	
 
	// Clamp
 
	spd = min(spd, v->max_speed);
 
	if (v->u.road.state == RVSB_WORMHOLE) spd = min(spd, SetSpeedLimitOnBridge(v));
 
	if (v->u.road.state == RVSB_WORMHOLE && !(v->vehstatus & VS_HIDDEN)) {
 
		spd = min(spd, GetBridge(GetBridgeType(v->tile))->speed * 2);
 
	}
 

	
 
	//updates statusbar only if speed have changed to save CPU time
 
	if (spd != v->cur_speed) {
src/train_cmd.cpp
Show inline comments
 
@@ -3136,7 +3136,10 @@ static void TrainController(Vehicle *v, 
 
			/* In tunnel or on a bridge */
 
			GetNewVehiclePos(v, &gp);
 

	
 
			SetSpeedLimitOnBridge(v);
 
			if (!(v->vehstatus & VS_HIDDEN)) {
 
				v->cur_speed =
 
					min(v->cur_speed, GetBridge(GetBridgeType(v->tile))->speed);
 
			}
 

	
 
			if (!(IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) || !HASBIT(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
 
				v->x_pos = gp.x;
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -1051,21 +1051,6 @@ void DrawBridgeMiddle(const TileInfo* ti
 
}
 

	
 

	
 
uint SetSpeedLimitOnBridge(Vehicle *v)
 
{
 
	uint bridge_speed;
 
	if (v->vehstatus & VS_HIDDEN) return v->max_speed; /* in tunnel */
 

	
 
	bridge_speed = _bridge[GetBridgeType(v->tile)].speed;
 

	
 
	if (v->type == VEH_Road) bridge_speed *= 2; /* XXX give vehicles proper speeds */
 

	
 
	if (v->cur_speed > bridge_speed) v->cur_speed = bridge_speed;
 
	return bridge_speed;
 
}
 

	
 

	
 

	
 
static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y)
 
{
 
	uint z;
0 comments (0 inline, 0 general)