1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-25 23:49:09 +00:00

Add: Allow trains to reverse when leaving an extended depot.

This commit is contained in:
J0anJosep
2021-01-16 20:44:46 +01:00
parent d4e89ad573
commit 0e34a5afe2

View File

@@ -2444,6 +2444,19 @@ bool HandleTrainEnterDepot(Train *v)
return true;
}
bool CheckReverseTrain(const Train *v)
{
if (_settings_game.difficulty.line_reverse_mode != 0 ||
v->track == TRACK_BIT_DEPOT || v->track == TRACK_BIT_WORMHOLE ||
!(v->direction & 1)) {
return false;
}
assert(v->track != TRACK_BIT_NONE);
return YapfTrainCheckReverse(v);
}
/**
* Will the train stay in the depot the next tick?
* @param v %Train to check.
@@ -2463,6 +2476,8 @@ static bool CheckTrainStayInDepot(Train *v)
v->UpdatePosition();
v->UpdateViewport(true, true);
v->UpdateAcceleration();
ProcessOrders(v);
if (CheckReverseTrain(v)) ReverseTrainDirection(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, depot_id);
return false;
} else {
@@ -3112,19 +3127,6 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay)
}
static bool CheckReverseTrain(const Train *v)
{
if (_settings_game.difficulty.line_reverse_mode != 0 ||
v->track == TRACK_BIT_DEPOT || v->track == TRACK_BIT_WORMHOLE ||
!(v->direction & 1)) {
return false;
}
assert(v->track != TRACK_BIT_NONE);
return YapfTrainCheckReverse(v);
}
/**
* Get the location of the next station to visit.
* @param station Next station to visit.