(svn r16521) -Fix [FS#2946] (r13945): Do not access 'compatible_railtypes' for road vehicles. (causing invalid reads since r16391/16392)

This commit is contained in:
frosch 2009-06-05 21:19:38 +00:00
parent a2c5c2651a
commit a75f564af4

View File

@ -55,7 +55,7 @@ struct CFollowTrackT
{ {
assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN)); assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN));
m_veh = v; m_veh = v;
Init(v != NULL ? v->owner : INVALID_OWNER, railtype_override == INVALID_RAILTYPES ? ((const Train *)v)->compatible_railtypes : railtype_override, pPerf); Init(v != NULL ? v->owner : INVALID_OWNER, IsRailTT() && railtype_override == INVALID_RAILTYPES ? ((const Train *)v)->compatible_railtypes : railtype_override, pPerf);
} }
FORCEINLINE void Init(Owner o, RailTypes railtype_override, CPerformanceTimer *pPerf) FORCEINLINE void Init(Owner o, RailTypes railtype_override, CPerformanceTimer *pPerf)