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

@@ -1052,6 +1052,17 @@ public:
return this->Next();
}
inline uint GetEnginePartsCount() const
{
uint count = 1;
const Vehicle *v = this->Next();
while (v != nullptr && v->IsArticulatedPart()) {
count++;
v = v->Next();
}
return count;
}
/**
* Get the first part of an articulated engine.
* @return First part of the engine.