(svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
This commit is contained in:
@@ -45,7 +45,7 @@ struct CFollowTrackT : public FollowTrack_t
|
||||
{
|
||||
m_old_tile = old_tile;
|
||||
m_old_td = old_td;
|
||||
assert((GetTileTrackStatus(m_old_tile, TT()) & TrackdirToTrackdirBits(m_old_td)) != 0);
|
||||
assert((GetTileTrackStatus(m_old_tile, TT(), m_veh->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(m_old_td)) != 0);
|
||||
m_exitdir = TrackdirToExitdir(m_old_td);
|
||||
if (EnteredDepot()) return true;
|
||||
if (!CanExitOldTile()) return false;
|
||||
@@ -114,7 +114,7 @@ protected:
|
||||
if (IsRailTT() && GetTileType(m_new_tile) == MP_RAILWAY && IsPlainRailTile(m_new_tile)) {
|
||||
m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101);
|
||||
} else {
|
||||
uint32 ts = GetTileTrackStatus(m_new_tile, TT());
|
||||
uint32 ts = GetTileTrackStatus(m_new_tile, TT(), m_veh->u.road.compatible_roadtypes);
|
||||
m_new_td_bits = (TrackdirBits)(ts & TRACKDIR_BIT_MASK);
|
||||
}
|
||||
return (m_new_td_bits != TRACKDIR_BIT_NONE);
|
||||
|
@@ -113,7 +113,7 @@ public:
|
||||
default:
|
||||
m_destTile = v->dest_tile;
|
||||
m_dest_station_id = INVALID_STATION;
|
||||
m_destTrackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_RAIL) & TRACKDIR_BIT_MASK);
|
||||
m_destTrackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_RAIL, 0) & TRACKDIR_BIT_MASK);
|
||||
break;
|
||||
}
|
||||
CYapfDestinationRailBase::SetDestination(v);
|
||||
|
@@ -268,14 +268,14 @@ public:
|
||||
// our source tile will be the next vehicle tile (should be the given one)
|
||||
TileIndex src_tile = tile;
|
||||
// get available trackdirs on the start tile
|
||||
uint ts = GetTileTrackStatus(tile, TRANSPORT_ROAD);
|
||||
uint ts = GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes);
|
||||
TrackdirBits src_trackdirs = (TrackdirBits)(ts & TRACKDIR_BIT_MASK);
|
||||
// select reachable trackdirs only
|
||||
src_trackdirs &= DiagdirReachesTrackdirs(enterdir);
|
||||
|
||||
// get available trackdirs on the destination tile
|
||||
TileIndex dest_tile = v->dest_tile;
|
||||
uint dest_ts = GetTileTrackStatus(dest_tile, TRANSPORT_ROAD);
|
||||
uint dest_ts = GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes);
|
||||
TrackdirBits dest_trackdirs = (TrackdirBits)(dest_ts & TRACKDIR_BIT_MASK);
|
||||
|
||||
// set origin and destination nodes
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
|
||||
// set destination tile, trackdir
|
||||
// get available trackdirs on the destination tile
|
||||
uint dest_ts = GetTileTrackStatus(dst_tile, TRANSPORT_ROAD);
|
||||
uint dest_ts = GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes);
|
||||
TrackdirBits dst_td_bits = (TrackdirBits)(dest_ts & TRACKDIR_BIT_MASK);
|
||||
Yapf().SetDestination(dst_tile, dst_td_bits);
|
||||
|
||||
@@ -345,7 +345,7 @@ public:
|
||||
// set origin (tile, trackdir)
|
||||
TileIndex src_tile = v->tile;
|
||||
Trackdir src_td = GetVehicleTrackdir(v);
|
||||
if ((GetTileTrackStatus(src_tile, TRANSPORT_ROAD) & TrackdirToTrackdirBits(src_td)) == 0) {
|
||||
if ((GetTileTrackStatus(src_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(src_td)) == 0) {
|
||||
// sometimes the roadveh is not on the road (it resides on non-existing track)
|
||||
// how should we handle that situation?
|
||||
return false;
|
||||
@@ -438,7 +438,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
|
||||
{
|
||||
TileIndex tile = v->tile;
|
||||
Trackdir trackdir = GetVehicleTrackdir(v);
|
||||
if ((GetTileTrackStatus(tile, TRANSPORT_ROAD) & TrackdirToTrackdirBits(trackdir)) == 0)
|
||||
if ((GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(trackdir)) == 0)
|
||||
return NULL;
|
||||
|
||||
// handle the case when our vehicle is already in the depot tile
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
// convert origin trackdir to TrackdirBits
|
||||
TrackdirBits trackdirs = TrackdirToTrackdirBits(trackdir);
|
||||
// get available trackdirs on the destination tile
|
||||
TrackdirBits dest_trackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_WATER) & TRACKDIR_BIT_MASK);
|
||||
TrackdirBits dest_trackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_WATER, 0) & TRACKDIR_BIT_MASK);
|
||||
|
||||
// create pathfinder instance
|
||||
Tpf pf;
|
||||
|
Reference in New Issue
Block a user