mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Fix: Prevent train reversing when wholly inside a train depot (#9557)
Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
This commit is contained in:
parent
18247bb3b8
commit
7acdaaaf2f
@ -1809,6 +1809,14 @@ static void AdvanceWagonsAfterSwap(Train *v)
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsWholeTrainInsideDepot(const Train *v)
|
||||
{
|
||||
for (const Train *u = v; u != nullptr; u = u->Next()) {
|
||||
if (u->track != TRACK_BIT_DEPOT || u->tile != v->tile) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a train around.
|
||||
* @param v %Train to turn around.
|
||||
@ -1816,6 +1824,7 @@ static void AdvanceWagonsAfterSwap(Train *v)
|
||||
void ReverseTrainDirection(Train *v)
|
||||
{
|
||||
if (IsRailDepotTile(v->tile)) {
|
||||
if (IsWholeTrainInsideDepot(v)) return;
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user