summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/follow_track.hpp5
-rw-r--r--src/yapf/yapf_road.cpp11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index 531e548a6..f69e4c190 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -7,6 +7,7 @@
#include "yapf.hpp"
#include "../depot_map.h"
+#include "../roadveh.h"
/** Track follower helper template class (can serve pathfinders and vehicle
* controllers). See 6 different typedefs below for 3 different transport
@@ -74,7 +75,7 @@ struct CFollowTrackT
FORCEINLINE static TransportType TT() {return Ttr_type_;}
FORCEINLINE static bool IsWaterTT() {return TT() == TRANSPORT_WATER;}
FORCEINLINE static bool IsRailTT() {return TT() == TRANSPORT_RAIL;}
- FORCEINLINE bool IsTram() {return IsRoadTT() && HasBit(m_veh->u.road.compatible_roadtypes, ROADTYPE_TRAM);}
+ FORCEINLINE bool IsTram() {return IsRoadTT() && HasBit(((RoadVehicle *)m_veh)->compatible_roadtypes, ROADTYPE_TRAM);}
FORCEINLINE static bool IsRoadTT() {return TT() == TRANSPORT_ROAD;}
FORCEINLINE static bool Allow90degTurns() {return T90deg_turns_allowed_;}
FORCEINLINE static bool DoTrackMasking() {return IsRailTT() && Tmask_reserved_tracks;}
@@ -205,7 +206,7 @@ protected:
if (IsRailTT() && IsPlainRailTile(m_new_tile)) {
m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101);
} else {
- m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? m_veh->u.road.compatible_roadtypes : 0));
+ m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? ((RoadVehicle *)m_veh)->compatible_roadtypes : 0));
if (IsTram() && m_new_td_bits == 0) {
/* GetTileTrackStatus() returns 0 for single tram bits.
diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp
index facfec14a..75dbc9e27 100644
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -4,6 +4,7 @@
#include "../stdafx.h"
#include "../depot_base.h"
+#include "../roadveh.h"
#include "yapf.hpp"
#include "yapf_node_road.hpp"
@@ -298,13 +299,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 */
- TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
+ TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
/* select reachable trackdirs only */
src_trackdirs &= DiagdirReachesTrackdirs(enterdir);
/* get available trackdirs on the destination tile */
TileIndex dest_tile = v->dest_tile;
- TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
+ TrackdirBits dest_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(dest_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
/* set origin and destination nodes */
Yapf().SetOrigin(src_tile, src_trackdirs);
@@ -348,7 +349,7 @@ public:
/* set destination tile, trackdir
* get available trackdirs on the destination tile */
- TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
+ TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes));
Yapf().SetDestination(dst_tile, dst_td_bits);
/* if path not found - return distance = UINT_MAX */
@@ -373,7 +374,7 @@ public:
/* set origin (tile, trackdir) */
TileIndex src_tile = v->tile;
Trackdir src_td = v->GetVehicleTrackdir();
- if ((TrackStatusToTrackdirBits(GetTileTrackStatus(src_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)) & TrackdirToTrackdirBits(src_td)) == 0) {
+ if ((TrackStatusToTrackdirBits(GetTileTrackStatus(src_tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->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;
@@ -470,7 +471,7 @@ Depot *YapfFindNearestRoadDepot(const Vehicle *v)
{
TileIndex tile = v->tile;
Trackdir trackdir = v->GetVehicleTrackdir();
- if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0) {
+ if ((TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ((RoadVehicle *)v)->compatible_roadtypes)) & TrackdirToTrackdirBits(trackdir)) == 0) {
return NULL;
}