@@ -660,25 +660,26 @@ static int RoadVehAccelerate(RoadVehicle
int tempmax = v->GetCurrentMaxSpeed();
if (v->cur_speed > tempmax) {
tempmax = v->cur_speed - (v->cur_speed / 10) - 1;
}
/* 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);
int scaled_spd = v->GetAdvanceSpeed(spd);
scaled_spd += v->progress;
@@ -3287,26 +3287,26 @@ static void TrainController(Train *v, Ve
if (HasBit(r, VETS_ENTERED_STATION)) {
/* The new position is the location where we want to stop */
TrainEnterStation(v, r >> VETS_STATION_ID_OFFSET);
} 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)));
CheckNextTrainTile(v);
v->x_pos = gp.x;
v->y_pos = gp.y;
VehicleMove(v, !(v->vehstatus & VS_HIDDEN));
@@ -1553,31 +1553,31 @@ static VehicleEnterTileStatus VehicleEnt
fc == _tunnel_fractcoord_6[dir] ||
fc == _tunnel_fractcoord_7[dir]
) &&
z == 0) {
rv->tile = tile;
rv->state = DiagDirToDiagTrackdir(vdir);
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;
case DIAGDIR_SE: if ((y & 0xF) != TILE_SIZE - 1) return VETSB_CONTINUE; break;
case DIAGDIR_SW: if ((x & 0xF) != TILE_SIZE - 1) return VETSB_CONTINUE; break;
case DIAGDIR_NW: if ((y & 0xF) != 0) return VETSB_CONTINUE; break;
switch (v->type) {
case VEH_TRAIN: {
Status change: