diff options
author | frosch <frosch@openttd.org> | 2008-02-20 17:49:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-02-20 17:49:50 +0000 |
commit | b7993793c813359ba4963df93d49a80335ddca36 (patch) | |
tree | d325400c42801ac23226ccaf0d71008e4e3598ec /src/yapf | |
parent | 9e651575481dbdd4b587fe22e2d79b998bcbbe15 (diff) | |
download | openttd-b7993793c813359ba4963df93d49a80335ddca36.tar.xz |
(svn r12199) -Codechange: Remove magic around the results of GetTileTrackStatus().
Diffstat (limited to 'src/yapf')
-rw-r--r-- | src/yapf/follow_track.hpp | 5 | ||||
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_road.cpp | 13 | ||||
-rw-r--r-- | src/yapf/yapf_ship.cpp | 2 |
4 files changed, 9 insertions, 13 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index 07a6b15b3..6987c24a4 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -64,7 +64,7 @@ struct CFollowTrackT : public FollowTrack_t m_old_tile = old_tile; m_old_td = old_td; m_err = EC_NONE; - assert(((GetTileTrackStatus(m_old_tile, TT(), m_veh->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(m_old_td)) != 0) || + assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), m_veh->u.road.compatible_roadtypes)) & TrackdirToTrackdirBits(m_old_td)) != 0) || (GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits m_exitdir = TrackdirToExitdir(m_old_td); if (ForcedReverse()) return true; @@ -133,8 +133,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(), m_veh->u.road.compatible_roadtypes); - m_new_td_bits = (TrackdirBits)(ts & TRACKDIR_BIT_MASK); + m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh->u.road.compatible_roadtypes)); if (m_new_td_bits == 0) { /* GetTileTrackStatus() returns 0 for single tram bits. diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 59fa71d0c..7f03f8cec 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, 0) & TRACKDIR_BIT_MASK); + m_destTrackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(v->dest_tile, TRANSPORT_RAIL, 0)); break; } CYapfDestinationRailBase::SetDestination(v); diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp index e07b48d60..eef92e5f7 100644 --- a/src/yapf/yapf_road.cpp +++ b/src/yapf/yapf_road.cpp @@ -268,15 +268,13 @@ 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, v->u.road.compatible_roadtypes); - TrackdirBits src_trackdirs = (TrackdirBits)(ts & TRACKDIR_BIT_MASK); + TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)); // 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, v->u.road.compatible_roadtypes); - TrackdirBits dest_trackdirs = (TrackdirBits)(dest_ts & TRACKDIR_BIT_MASK); + TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)); // set origin and destination nodes Yapf().SetOrigin(src_tile, src_trackdirs); @@ -320,8 +318,7 @@ public: // set destination tile, trackdir // get available trackdirs on the destination tile - uint dest_ts = GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes); - TrackdirBits dst_td_bits = (TrackdirBits)(dest_ts & TRACKDIR_BIT_MASK); + TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)); Yapf().SetDestination(dst_tile, dst_td_bits); // find the best path @@ -345,7 +342,7 @@ public: // set origin (tile, trackdir) TileIndex src_tile = v->tile; Trackdir src_td = GetVehicleTrackdir(v); - if ((GetTileTrackStatus(src_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(src_td)) == 0) { + if ((TrackStatusToTrackdirBits(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 +435,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v) { TileIndex tile = v->tile; Trackdir trackdir = GetVehicleTrackdir(v); - if ((GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes) & TrackdirToTrackdirBits(trackdir)) == 0) + if ((TrackStatusToTrackdirBits(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 f1c456dcd..7a58a765a 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, 0) & TRACKDIR_BIT_MASK); + TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(v->dest_tile, TRANSPORT_WATER, 0)); // create pathfinder instance Tpf pf; |