@@ -666,13 +666,14 @@ static int RoadVehAccelerate(RoadVehicle
/* Force a minimum speed of 1 km/h when realistic acceleration is on. */
int min_speed = (_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL) ? 0 : 4;
v->cur_speed = spd = Clamp(v->cur_speed + ((int)spd >> 8), min_speed, tempmax);
/* 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 */
if (oldspeed != v->cur_speed) {
if (_settings_client.gui.vehicle_speed) {
SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@@ -3293,14 +3293,14 @@ static void TrainController(Train *v, Ve
} 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)) {
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)) {
/* Perform look-ahead on tunnel exit. */
if (v->IsFrontEngine()) {
TryReserveRailTrack(gp.new_tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(gp.new_tile)));
@@ -1559,19 +1559,19 @@ static VehicleEnterTileStatus VehicleEnt
rv->frame = _road_exit_tunnel_frame[dir];
rv->vehstatus &= ~VS_HIDDEN;
return VETSB_ENTERED_WORMHOLE;
} 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) {
switch (dir) {
default: NOT_REACHED();
case DIAGDIR_NE: if ((x & 0xF) != 0) return VETSB_CONTINUE; break;
Status change: