Merge branch 'master' into jgrpp

# Conflicts:
#	src/ai/ai_gui.cpp
#	src/build_vehicle_gui.cpp
#	src/genworld_gui.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/korean.txt
#	src/newgrf_sound.cpp
#	src/roadveh.h
#	src/sound.cpp
#	src/station_cmd.cpp
#	src/train.h
#	src/train_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehicle_gui.cpp
This commit is contained in:
Jonathan G Rennison
2022-11-26 23:04:04 +00:00
100 changed files with 1304 additions and 825 deletions

View File

@@ -4572,3 +4572,29 @@ void ShiftVehicleDates(int interval)
extern void AdjustAllSignalSpeedRestrictionTickValues(DateTicksScaled delta);
AdjustAllSignalSpeedRestrictionTickValues(interval * DAY_TICKS * _settings_game.economy.day_length_factor);
}
/**
* Calculates the maximum weight of the ground vehicle when loaded.
* @return Weight in tonnes
*/
uint32 Vehicle::GetDisplayMaxWeight() const
{
uint32 max_weight = 0;
for (const Vehicle* u = this; u != nullptr; u = u->Next()) {
max_weight += u->GetMaxWeight();
}
return max_weight;
}
/**
* Calculates the minimum power-to-weight ratio using the maximum weight of the ground vehicle
* @return power-to-weight ratio in 10ths of hp(I) per tonne
*/
uint32 Vehicle::GetDisplayMinPowerToWeight() const
{
uint32 max_weight = GetDisplayMaxWeight();
if (max_weight == 0) return 0;
return GetGroundVehicleCache()->cached_power * 10u / max_weight;
}