Merge branch 'master' into jgrpp
# Conflicts: # src/company_cmd.cpp # src/core/overflowsafe_type.hpp # src/economy.cpp # src/engine_base.h # src/ground_vehicle.cpp # src/group_gui.cpp # src/industry_cmd.cpp # src/industry_gui.cpp # src/newgrf_commons.cpp # src/newgrf_engine.cpp # src/newgrf_industries.cpp # src/newgrf_object.cpp # src/newgrf_roadstop.cpp # src/newgrf_station.cpp # src/rail_gui.cpp # src/road_cmd.h # src/road_gui.cpp # src/saveload/afterload.cpp # src/script/api/script_log.cpp # src/script/api/script_log.hpp # src/settings_gui.cpp # src/settingsgen/settingsgen.cpp # src/station_cmd.cpp # src/station_cmd.h # src/station_gui.cpp # src/strgen/strgen.cpp # src/string_func.h # src/string_type.h # src/table/settings/network_private_settings.ini # src/tests/math_func.cpp # src/textfile_gui.cpp # src/timetable_gui.cpp # src/town_cmd.cpp # src/vehicle.cpp # src/waypoint_cmd.cpp # src/waypoint_cmd.h # src/widgets/dropdown.cpp
This commit is contained in:
@@ -269,13 +269,13 @@ GroundVehicleAcceleration GroundVehicle<T, Type>::GetAcceleration()
|
||||
/* Assume that every part of a train is braked, not just the engine.
|
||||
* Exceptionally heavy freight trains should still have a sensible braking distance.
|
||||
* The total braking force is generally larger than the total tractive force. */
|
||||
braking_accel = ClampToI32((-braking_force - resistance - (Train::From(this)->tcache.cached_braking_length * (int64)RBC_BRAKE_FORCE_PER_LENGTH)) / (mass * 4));
|
||||
braking_accel = ClampTo<int32>((-braking_force - resistance - (Train::From(this)->tcache.cached_braking_length * (int64)RBC_BRAKE_FORCE_PER_LENGTH)) / (mass * 4));
|
||||
|
||||
/* Defensive driving: prevent ridiculously fast deceleration.
|
||||
* -130 corresponds to a braking distance of about 6.2 tiles from 160 km/h. */
|
||||
braking_accel = std::max(braking_accel, -(GetTrainRealisticBrakingTargetDecelerationLimit(acceleration_type) + 10));
|
||||
} else {
|
||||
braking_accel = ClampToI32(std::min<int64>(-braking_force - resistance, -10000) / mass);
|
||||
braking_accel = ClampTo<int32>(std::min<int64>(-braking_force - resistance, -10000) / mass);
|
||||
}
|
||||
|
||||
if (mode == AS_ACCEL) {
|
||||
@@ -287,7 +287,7 @@ GroundVehicleAcceleration GroundVehicle<T, Type>::GetAcceleration()
|
||||
* down hill will never slow down enough, and a vehicle that came up
|
||||
* a hill will never speed up enough to (eventually) get back to the
|
||||
* same (maximum) speed. */
|
||||
int accel = ClampToI32((force - resistance) / (mass * 4));
|
||||
int accel = ClampTo<int32>((force - resistance) / (mass * 4));
|
||||
accel = force < resistance ? std::min(-1, accel) : std::max(1, accel);
|
||||
if (this->type == VEH_TRAIN) {
|
||||
if(_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL &&
|
||||
|
Reference in New Issue
Block a user