diff options
author | smatz <smatz@openttd.org> | 2009-06-06 16:54:22 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-06-06 16:54:22 +0000 |
commit | 0c10006907b7d149f91d277a0c28a79b40eaa4c0 (patch) | |
tree | dc8cb6a7a9315a10688af00187db94be8911acef /src/yapf/yapf_destrail.hpp | |
parent | c90819ff6d8d49ac25aa9194bdf04e8dfd7149ea (diff) | |
download | openttd-0c10006907b7d149f91d277a0c28a79b40eaa4c0.tar.xz |
(svn r16527) -Codechange: use static member functions instead of simple casts when converting Vehicle to specialised vehicle types. Includes safety check
Diffstat (limited to 'src/yapf/yapf_destrail.hpp')
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 498cc5975..08b1da070 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -13,8 +13,8 @@ protected: public: void SetDestination(const Vehicle *v, bool override_rail_type = false) { - m_compatible_railtypes = ((const Train *)v)->compatible_railtypes; - if (override_rail_type) m_compatible_railtypes |= GetRailTypeInfo(((const Train *)v)->railtype)->compatible_railtypes; + m_compatible_railtypes = Train::From(v)->compatible_railtypes; + if (override_rail_type) m_compatible_railtypes |= GetRailTypeInfo(Train::From(v)->railtype)->compatible_railtypes; } bool IsCompatibleRailType(RailType rt) @@ -91,8 +91,8 @@ public: FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td) { return - IsSafeWaitingPosition((const Train *)Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) && - IsWaitingPositionFree((const Train *)Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns()); + IsSafeWaitingPosition(Train::From(Yapf().GetVehicle()), tile, td, true, !TrackFollower::Allow90degTurns()) && + IsWaitingPositionFree(Train::From(Yapf().GetVehicle()), tile, td, !TrackFollower::Allow90degTurns()); } /** Called by YAPF to calculate cost estimate. Calculates distance to the destination |