4 |
4 |
5 #ifndef FOLLOW_TRACK_HPP |
5 #ifndef FOLLOW_TRACK_HPP |
6 #define FOLLOW_TRACK_HPP |
6 #define FOLLOW_TRACK_HPP |
7 |
7 |
8 #include "yapf.hpp" |
8 #include "yapf.hpp" |
|
9 |
9 |
10 |
10 /** Track follower helper template class (can serve pathfinders and vehicle |
11 /** Track follower helper template class (can serve pathfinders and vehicle |
11 * controllers). See 6 different typedefs below for 3 different transport |
12 * controllers). See 6 different typedefs below for 3 different transport |
12 * types w/ of w/o 90-deg turns allowed */ |
13 * types w/ of w/o 90-deg turns allowed */ |
13 template <TransportType Ttr_type_, bool T90deg_turns_allowed_ = true> |
14 template <TransportType Ttr_type_, bool T90deg_turns_allowed_ = true> |
14 struct CFollowTrackT : public FollowTrack_t |
15 struct CFollowTrackT |
15 { |
16 { |
|
17 enum ErrorCode { |
|
18 EC_NONE, |
|
19 EC_OWNER, |
|
20 EC_RAIL_TYPE, |
|
21 EC_90DEG, |
|
22 EC_NO_WAY, |
|
23 }; |
|
24 |
|
25 const Vehicle* m_veh; ///< moving vehicle |
|
26 TileIndex m_old_tile; ///< the origin (vehicle moved from) before move |
|
27 Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move |
|
28 TileIndex m_new_tile; ///< the new tile (the vehicle has entered) |
|
29 TrackdirBits m_new_td_bits; ///< the new set of available trackdirs |
|
30 DiagDirection m_exitdir; ///< exit direction (leaving the old tile) |
|
31 bool m_is_tunnel; ///< last turn passed tunnel |
|
32 bool m_is_bridge; ///< last turn passed bridge ramp |
|
33 bool m_is_station; ///< last turn passed station |
|
34 int m_tiles_skipped; ///< number of skipped tunnel or station tiles |
|
35 ErrorCode m_err; |
16 CPerformanceTimer* m_pPerf; |
36 CPerformanceTimer* m_pPerf; |
17 |
37 |
18 FORCEINLINE CFollowTrackT(const Vehicle* v = NULL, CPerformanceTimer* pPerf = NULL) |
38 FORCEINLINE CFollowTrackT(const Vehicle* v = NULL, CPerformanceTimer* pPerf = NULL) |
19 { |
39 { |
20 Init(v, pPerf); |
40 Init(v, pPerf); |