mirror of https://github.com/OpenTTD/OpenTTD.git
Change: [YAPF] All compatible depots are targets for 'any depot' orders
This commit is contained in:
parent
a9a21e784d
commit
227626b0b7
|
@ -118,6 +118,7 @@ protected:
|
|||
TileIndex m_destTile;
|
||||
TrackdirBits m_destTrackdirs;
|
||||
StationID m_dest_station_id;
|
||||
bool m_any_depot;
|
||||
|
||||
/** to access inherited path finder */
|
||||
Tpf& Yapf()
|
||||
|
@ -128,6 +129,7 @@ protected:
|
|||
public:
|
||||
void SetDestination(const Train *v)
|
||||
{
|
||||
m_any_depot = false;
|
||||
switch (v->current_order.GetType()) {
|
||||
case OT_GOTO_WAYPOINT:
|
||||
if (!Waypoint::Get(v->current_order.GetDestination())->IsSingleTile()) {
|
||||
|
@ -146,6 +148,12 @@ public:
|
|||
m_destTrackdirs = INVALID_TRACKDIR_BIT;
|
||||
break;
|
||||
|
||||
case OT_GOTO_DEPOT:
|
||||
if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
||||
m_any_depot = true;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
default:
|
||||
m_destTile = v->dest_tile;
|
||||
m_dest_station_id = INVALID_STATION;
|
||||
|
@ -170,6 +178,10 @@ public:
|
|||
&& (GetRailStationTrack(tile) == TrackdirToTrack(td));
|
||||
}
|
||||
|
||||
if (m_any_depot) {
|
||||
return IsRailDepotTile(tile);
|
||||
}
|
||||
|
||||
return (tile == m_destTile) && HasTrackdir(m_destTrackdirs, td);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue