diff options
author | rubidium <rubidium@openttd.org> | 2007-05-24 22:41:50 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-05-24 22:41:50 +0000 |
commit | 440d723d842db2f246428de2e404091e074ed254 (patch) | |
tree | 4ec491716328387ce65a5c1f45b836b6f5f57ce2 /src/yapf | |
parent | b82676be2a39adeb883f9dd5c67125eec12f2753 (diff) | |
download | openttd-440d723d842db2f246428de2e404091e074ed254.tar.xz |
(svn r9914) -Codechange: prepare GTTS and the pathfinders to handle multiple road types on a single tile.
Diffstat (limited to 'src/yapf')
-rw-r--r-- | src/yapf/follow_track.hpp | 4 | ||||
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_road.cpp | 10 | ||||
-rw-r--r-- | src/yapf/yapf_ship.cpp | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index 0e522a00f..ea02a9330 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -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); diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 10233cda1..3a65ba8cc 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -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); diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp index ba7934c99..125e7c822 100644 --- a/src/yapf/yapf_road.cpp +++ b/src/yapf/yapf_road.cpp @@ -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 diff --git a/src/yapf/yapf_ship.cpp b/src/yapf/yapf_ship.cpp index 867a85e9e..06d7ffb67 100644 --- a/src/yapf/yapf_ship.cpp +++ b/src/yapf/yapf_ship.cpp @@ -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; |