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