Distribute articulated vehicle weight evenly between articulated parts

Instead of allocating it all to the first part
This improves realistic braking behaviour for long articulated consists
This commit is contained in:
Jonathan G Rennison
2021-04-03 22:04:37 +01:00
parent 26a123b708
commit 95fb222852
5 changed files with 59 additions and 5 deletions

View File

@@ -312,6 +312,10 @@ protected: // These functions should not be called outside acceleration code.
return 0;
}
/**
* Allows to know the weight value that this vehicle will use (excluding cargo).
* @return Weight value from the engine in tonnes.
*/
inline uint16 GetWeightWithoutCargo() const
{
uint16 weight = 0;
@@ -329,13 +333,22 @@ protected: // These functions should not be called outside acceleration code.
return weight;
}
/**
* Allows to know the weight value that this vehicle will use (cargo only).
* @return Weight value from the engine in tonnes.
*/
inline uint16 GetCargoWeight() const
{
return this->GetCargoWeight(this->cargo.StoredCount());
}
/**
* Allows to know the weight value that this vehicle will use.
* @return Weight value from the engine in tonnes.
*/
inline uint16 GetWeight() const
{
return this->GetWeightWithoutCargo() + this->GetCargoWeight(this->cargo.StoredCount());
return this->GetWeightWithoutCargo() + this->GetCargoWeight();
}
/**