mirror of https://github.com/OpenTTD/OpenTTD
Add: Allow trains to reverse when leaving an extended depot.
parent
d4e89ad573
commit
0e34a5afe2
|
@ -2444,6 +2444,19 @@ bool HandleTrainEnterDepot(Train *v)
|
||||||
return true;
|
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?
|
* Will the train stay in the depot the next tick?
|
||||||
* @param v %Train to check.
|
* @param v %Train to check.
|
||||||
|
@ -2463,6 +2476,8 @@ static bool CheckTrainStayInDepot(Train *v)
|
||||||
v->UpdatePosition();
|
v->UpdatePosition();
|
||||||
v->UpdateViewport(true, true);
|
v->UpdateViewport(true, true);
|
||||||
v->UpdateAcceleration();
|
v->UpdateAcceleration();
|
||||||
|
ProcessOrders(v);
|
||||||
|
if (CheckReverseTrain(v)) ReverseTrainDirection(v);
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, depot_id);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, depot_id);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} 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.
|
* Get the location of the next station to visit.
|
||||||
* @param station Next station to visit.
|
* @param station Next station to visit.
|
||||||
|
|
Loading…
Reference in New Issue