diff --git a/src/train.h b/src/train.h index b303523cc5..b5c34f1152 100644 --- a/src/train.h +++ b/src/train.h @@ -191,7 +191,6 @@ struct Train FINAL : public GroundVehicle { }; private: - int GetAtcMaxSpeed() const; MaxSpeedInfo GetCurrentMaxSpeedInfoInternal(bool update_state) const; public: diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a06a6a1bd4..f674ab7350 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -993,18 +993,6 @@ static void AdvanceLookAheadPosition(Train *v) } } -/** - * Calculates the maximum speed based on any train in front of this train. - */ -int32 Train::GetAtcMaxSpeed() const -{ - if (!(this->vehstatus & VS_CRASHED) && this->signal_speed_restriction != 0) { - return std::max(25, this->signal_speed_restriction); - } - - return INT32_MAX; -} - /** * Calculates the maximum speed information of the vehicle under its current conditions. * @return Maximum speed information of the vehicle. @@ -1015,8 +1003,6 @@ Train::MaxSpeedInfo Train::GetCurrentMaxSpeedInfoInternal(bool update_state) con this->gcache.cached_max_track_speed : std::min(this->tcache.cached_max_curve_speed, this->gcache.cached_max_track_speed); - if (_settings_game.vehicle.train_speed_adaptation) max_speed = std::min(max_speed, GetAtcMaxSpeed()); - if (this->current_order.IsType(OT_LOADING_ADVANCE)) max_speed = std::min(max_speed, 15); int advisory_max_speed = max_speed; @@ -1080,6 +1066,9 @@ Train::MaxSpeedInfo Train::GetCurrentMaxSpeedInfoInternal(bool update_state) con if (this->speed_restriction != 0) { advisory_max_speed = std::min(advisory_max_speed, this->speed_restriction); } + if (this->signal_speed_restriction != 0 && _settings_game.vehicle.train_speed_adaptation) { + advisory_max_speed = std::min(advisory_max_speed, this->signal_speed_restriction); + } if (this->reverse_distance > 1) { advisory_max_speed = std::min(advisory_max_speed, ReversingDistanceTargetSpeed(this)); }