summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-06 16:49:45 +0000
committersmatz <smatz@openttd.org>2009-06-06 16:49:45 +0000
commitc90819ff6d8d49ac25aa9194bdf04e8dfd7149ea (patch)
tree0936b5720d66a13afc6f235c8e3cb13d4a5626da /src/yapf
parent5b497d6b4963303ea77259c5c471ae06fb15c6ca (diff)
downloadopenttd-c90819ff6d8d49ac25aa9194bdf04e8dfd7149ea.tar.xz
(svn r16526) -Fix: don't cast Vehicle to RoadVehicle when it's not a RoadVehicle
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/follow_track.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index 93c4db633..d169733a7 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -106,7 +106,7 @@ struct CFollowTrackT
m_old_tile = old_tile;
m_old_td = old_td;
m_err = EC_NONE;
- assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), m_veh ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
+ assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() && m_veh != NULL ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
(IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits
m_exitdir = TrackdirToExitdir(m_old_td);
if (ForcedReverse()) return true;
@@ -207,7 +207,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 ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0));
+ m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), IsRoadTT() && m_veh != NULL ? ((const RoadVehicle *)m_veh)->compatible_roadtypes : 0));
if (IsTram() && m_new_td_bits == 0) {
/* GetTileTrackStatus() returns 0 for single tram bits.