author | frosch |
Thu, 11 Sep 2008 19:44:30 +0000 | |
changeset 10108 | 0f63f81e09f0 |
parent 9899 | 03a2d32a2c05 |
child 10160 | 8608d357e0dd |
permissions | -rw-r--r-- |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
1 |
/* $Id$ */ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
2 |
|
6121
2aae24b0881f
(svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents:
6012
diff
changeset
|
3 |
/** @file follow_track.hpp Template function for track followers */ |
2aae24b0881f
(svn r8857) -Documentation: Added some doxygen @file tags, repaired others (the @file tag MUST be found before any line of code, that includes preprocessor directives).
celestar
parents:
6012
diff
changeset
|
4 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
5 |
#ifndef FOLLOW_TRACK_HPP |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
6 |
#define FOLLOW_TRACK_HPP |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
7 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
8 |
#include "yapf.hpp" |
8962
1b263c69799d
(svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents:
8954
diff
changeset
|
9 |
#include "../depot_map.h" |
8636
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
10 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
11 |
/** Track follower helper template class (can serve pathfinders and vehicle |
4549
106ed18a7675
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4407
diff
changeset
|
12 |
* controllers). See 6 different typedefs below for 3 different transport |
9802
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
13 |
* types w/ or w/o 90-deg turns allowed */ |
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
14 |
template <TransportType Ttr_type_, bool T90deg_turns_allowed_ = true, bool Tmask_reserved_tracks = false> |
8636
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
15 |
struct CFollowTrackT |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
16 |
{ |
8636
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
17 |
enum ErrorCode { |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
18 |
EC_NONE, |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
19 |
EC_OWNER, |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
20 |
EC_RAIL_TYPE, |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
21 |
EC_90DEG, |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
22 |
EC_NO_WAY, |
9802
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
23 |
EC_RESERVED, |
8636
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
24 |
}; |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
25 |
|
9439 | 26 |
const Vehicle *m_veh; ///< moving vehicle |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
27 |
Owner m_veh_owner; ///< owner of the vehicle |
8636
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
28 |
TileIndex m_old_tile; ///< the origin (vehicle moved from) before move |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
29 |
Trackdir m_old_td; ///< the trackdir (the vehicle was on) before move |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
30 |
TileIndex m_new_tile; ///< the new tile (the vehicle has entered) |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
31 |
TrackdirBits m_new_td_bits; ///< the new set of available trackdirs |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
32 |
DiagDirection m_exitdir; ///< exit direction (leaving the old tile) |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
33 |
bool m_is_tunnel; ///< last turn passed tunnel |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
34 |
bool m_is_bridge; ///< last turn passed bridge ramp |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
35 |
bool m_is_station; ///< last turn passed station |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
36 |
int m_tiles_skipped; ///< number of skipped tunnel or station tiles |
9dc7e26247b7
(svn r12252) -Fix [FS#1801]: Broken FollowTrack_t related functions (thanks michi_cc).
KUDr
parents:
8616
diff
changeset
|
37 |
ErrorCode m_err; |
9439 | 38 |
CPerformanceTimer *m_pPerf; |
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
39 |
RailTypes m_railtypes; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
40 |
|
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
41 |
FORCEINLINE CFollowTrackT(const Vehicle *v = NULL, RailTypes railtype_override = INVALID_RAILTYPES, CPerformanceTimer *pPerf = NULL) |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
42 |
{ |
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
43 |
Init(v, railtype_override, pPerf); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
44 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
45 |
|
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
46 |
FORCEINLINE CFollowTrackT(Owner o, RailTypes railtype_override = INVALID_RAILTYPES, CPerformanceTimer *pPerf = NULL) |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
47 |
{ |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
48 |
m_veh = NULL; |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
49 |
Init(o, railtype_override, pPerf); |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
50 |
} |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
51 |
|
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
52 |
FORCEINLINE void Init(const Vehicle *v, RailTypes railtype_override, CPerformanceTimer *pPerf) |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
53 |
{ |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6154
diff
changeset
|
54 |
assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN)); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
55 |
m_veh = v; |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
56 |
Init(v != NULL ? v->owner : INVALID_OWNER, railtype_override == INVALID_RAILTYPES ? v->u.rail.compatible_railtypes : railtype_override, pPerf); |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
57 |
} |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
58 |
|
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
59 |
FORCEINLINE void Init(Owner o, RailTypes railtype_override, CPerformanceTimer *pPerf) |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
60 |
{ |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
61 |
assert((!IsRoadTT() || m_veh != NULL) && (!IsRailTT() || railtype_override != INVALID_RAILTYPES)); |
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
62 |
m_veh_owner = o; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
63 |
m_pPerf = pPerf; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
64 |
// don't worry, all is inlined so compiler should remove unnecessary initializations |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
65 |
m_new_tile = INVALID_TILE; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
66 |
m_new_td_bits = TRACKDIR_BIT_NONE; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
67 |
m_exitdir = INVALID_DIAGDIR; |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
68 |
m_is_station = m_is_bridge = m_is_tunnel = false; |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
69 |
m_tiles_skipped = 0; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
70 |
m_err = EC_NONE; |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
71 |
m_railtypes = railtype_override; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
72 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
73 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
74 |
FORCEINLINE static TransportType TT() {return Ttr_type_;} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
75 |
FORCEINLINE static bool IsWaterTT() {return TT() == TRANSPORT_WATER;} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
76 |
FORCEINLINE static bool IsRailTT() {return TT() == TRANSPORT_RAIL;} |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
77 |
FORCEINLINE bool IsTram() {return IsRoadTT() && HasBit(m_veh->u.road.compatible_roadtypes, ROADTYPE_TRAM);} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
78 |
FORCEINLINE static bool IsRoadTT() {return TT() == TRANSPORT_ROAD;} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
79 |
FORCEINLINE static bool Allow90degTurns() {return T90deg_turns_allowed_;} |
9899
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
80 |
FORCEINLINE static bool DoTrackMasking() {return IsRailTT() && Tmask_reserved_tracks;} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
81 |
|
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
82 |
/** Tests if a tile is a road tile with a single tramtrack (tram can reverse) */ |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
83 |
FORCEINLINE DiagDirection GetSingleTramBit(TileIndex tile) |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
84 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8491
diff
changeset
|
85 |
if (IsTram() && IsNormalRoadTile(tile)) { |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
86 |
RoadBits rb = GetRoadBits(tile, ROADTYPE_TRAM); |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
87 |
switch (rb) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
88 |
case ROAD_NW: return DIAGDIR_NW; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
89 |
case ROAD_SW: return DIAGDIR_SW; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
90 |
case ROAD_SE: return DIAGDIR_SE; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
91 |
case ROAD_NE: return DIAGDIR_NE; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
92 |
default: break; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
93 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
94 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
95 |
return INVALID_DIAGDIR; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
96 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
97 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
98 |
/** main follower routine. Fills all members and return true on success. |
4549
106ed18a7675
(svn r6381) -Cleanup: make the '/* */' comments that span multiple lines more uniform.
rubidium
parents:
4407
diff
changeset
|
99 |
* Otherwise returns false if track can't be followed. */ |
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
100 |
inline bool Follow(TileIndex old_tile, Trackdir old_td) |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
101 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
102 |
m_old_tile = old_tile; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
103 |
m_old_td = old_td; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
104 |
m_err = EC_NONE; |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
105 |
assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), m_veh ? m_veh->u.road.compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) || |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
106 |
(GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR)); // Disable the assertion for single tram bits |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
107 |
m_exitdir = TrackdirToExitdir(m_old_td); |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
108 |
if (ForcedReverse()) return true; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
109 |
if (!CanExitOldTile()) return false; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
110 |
FollowTileExit(); |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
111 |
if (!QueryNewTileTrackStatus()) return TryReverse(); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
112 |
if (!CanEnterNewTile()) return false; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
113 |
m_new_td_bits &= DiagdirReachesTrackdirs(m_exitdir); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
114 |
if (m_new_td_bits == TRACKDIR_BIT_NONE) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
115 |
m_err = EC_NO_WAY; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
116 |
return false; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
117 |
} |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
118 |
if (!Allow90degTurns()) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
119 |
m_new_td_bits &= (TrackdirBits)~(int)TrackdirCrossesTrackdirs(m_old_td); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
120 |
if (m_new_td_bits == TRACKDIR_BIT_NONE) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
121 |
m_err = EC_90DEG; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
122 |
return false; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
123 |
} |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
124 |
} |
9899
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
125 |
return true; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
126 |
} |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
127 |
|
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
128 |
inline bool MaskReservedTracks() |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
129 |
{ |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
130 |
if (!DoTrackMasking()) return true; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
131 |
|
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
132 |
if (m_is_station) { |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
133 |
/* Check skipped station tiles as well. */ |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
134 |
TileIndexDiff diff = TileOffsByDiagDir(m_exitdir); |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
135 |
for (TileIndex tile = m_new_tile - diff * m_tiles_skipped; tile != m_new_tile; tile += diff) { |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
136 |
if (GetRailwayStationReservation(tile)) { |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
137 |
m_new_td_bits = TRACKDIR_BIT_NONE; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
138 |
m_err = EC_RESERVED; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
139 |
return false; |
9873
c09e1a4de035
(svn r14019) -Fix [FS#2205]: game crash after order skip while waiting for free path (michi_cc).
rubidium
parents:
9803
diff
changeset
|
140 |
} |
c09e1a4de035
(svn r14019) -Fix [FS#2205]: game crash after order skip while waiting for free path (michi_cc).
rubidium
parents:
9803
diff
changeset
|
141 |
} |
9899
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
142 |
} |
9873
c09e1a4de035
(svn r14019) -Fix [FS#2205]: game crash after order skip while waiting for free path (michi_cc).
rubidium
parents:
9803
diff
changeset
|
143 |
|
9899
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
144 |
TrackBits reserved = GetReservedTrackbits(m_new_tile); |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
145 |
/* Mask already reserved trackdirs. */ |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
146 |
m_new_td_bits &= ~TrackBitsToTrackdirBits(reserved); |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
147 |
/* Mask out all trackdirs that conflict with the reservation. */ |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
148 |
uint bits = (uint)TrackdirBitsToTrackBits(m_new_td_bits); |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
149 |
int i; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
150 |
FOR_EACH_SET_BIT(i, bits) { |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
151 |
if (TracksOverlap(reserved | TrackToTrackBits((Track)i))) m_new_td_bits &= ~TrackToTrackdirBits((Track)i); |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
152 |
} |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
153 |
if (m_new_td_bits == TRACKDIR_BIT_NONE) { |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
154 |
m_err = EC_RESERVED; |
03a2d32a2c05
(svn r14048) -Fix (r14019) [FS#2222]: Redo the check for reserved tracks properly this time. (michi_cc)
rubidium
parents:
9873
diff
changeset
|
155 |
return false; |
9802
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
156 |
} |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
157 |
return true; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
158 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
159 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
160 |
protected: |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
161 |
/** Follow the m_exitdir from m_old_tile and fill m_new_tile and m_tiles_skipped */ |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
162 |
FORCEINLINE void FollowTileExit() |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
163 |
{ |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
164 |
m_is_station = m_is_bridge = m_is_tunnel = false; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
165 |
m_tiles_skipped = 0; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
166 |
|
8398
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
167 |
// extra handling for tunnels and bridges in our direction |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
168 |
if (IsTileType(m_old_tile, MP_TUNNELBRIDGE)) { |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
169 |
DiagDirection enterdir = GetTunnelBridgeDirection(m_old_tile); |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
170 |
if (enterdir == m_exitdir) { |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
171 |
// we are entering the tunnel / bridge |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
172 |
if (IsTunnel(m_old_tile)) { |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
173 |
m_is_tunnel = true; |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
174 |
m_new_tile = GetOtherTunnelEnd(m_old_tile); |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
175 |
} else { // IsBridge(m_old_tile) |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
176 |
m_is_bridge = true; |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
177 |
m_new_tile = GetOtherBridgeEnd(m_old_tile); |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
178 |
} |
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
179 |
m_tiles_skipped = GetTunnelBridgeLength(m_new_tile, m_old_tile); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
180 |
return; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
181 |
} |
8398
1e181e2e4e15
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
smatz
parents:
8390
diff
changeset
|
182 |
assert(ReverseDiagDir(enterdir) == m_exitdir); |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
183 |
} |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
184 |
|
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
185 |
// normal or station tile, do one step |
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4549
diff
changeset
|
186 |
TileIndexDiff diff = TileOffsByDiagDir(m_exitdir); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
187 |
m_new_tile = TILE_ADD(m_old_tile, diff); |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
188 |
|
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
189 |
// special handling for stations |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
190 |
if (IsRailTT() && IsRailwayStationTile(m_new_tile)) { |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
191 |
m_is_station = true; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
192 |
} else if (IsRoadTT() && IsRoadStopTile(m_new_tile)) { |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
193 |
m_is_station = true; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
194 |
} else { |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
195 |
m_is_station = false; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
196 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
197 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
198 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
199 |
/** stores track status (available trackdirs) for the new tile into m_new_td_bits */ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
200 |
FORCEINLINE bool QueryNewTileTrackStatus() |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
201 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
202 |
CPerfStart perf(*m_pPerf); |
3912
08c70885ec45
(svn r5013) -Fix: [YAPF] RVs trying to plan route through railway.
KUDr
parents:
3900
diff
changeset
|
203 |
if (IsRailTT() && GetTileType(m_new_tile) == MP_RAILWAY && IsPlainRailTile(m_new_tile)) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
204 |
m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101); |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
205 |
} else { |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
206 |
m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? m_veh->u.road.compatible_roadtypes : 0)); |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
207 |
|
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
208 |
if (m_new_td_bits == 0) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
209 |
/* GetTileTrackStatus() returns 0 for single tram bits. |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
210 |
* As we cannot change it there (easily) without breaking something, change it here */ |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
211 |
switch (GetSingleTramBit(m_new_tile)) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
212 |
case DIAGDIR_NE: |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
213 |
case DIAGDIR_SW: |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
214 |
m_new_td_bits = TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
215 |
break; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
216 |
|
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
217 |
case DIAGDIR_NW: |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
218 |
case DIAGDIR_SE: |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
219 |
m_new_td_bits = TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_Y_SE; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
220 |
break; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
221 |
|
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
222 |
default: break; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
223 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
224 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
225 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
226 |
return (m_new_td_bits != TRACKDIR_BIT_NONE); |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
227 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
228 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
229 |
/** return true if we can leave m_old_tile in m_exitdir */ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
230 |
FORCEINLINE bool CanExitOldTile() |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
231 |
{ |
6012
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
232 |
// road stop can be left at one direction only unless it's a drive-through stop |
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
233 |
if (IsRoadTT() && IsStandardRoadStopTile(m_old_tile)) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
234 |
DiagDirection exitdir = GetRoadStopDir(m_old_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
235 |
if (exitdir != m_exitdir) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
236 |
m_err = EC_NO_WAY; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
237 |
return false; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
238 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
239 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
240 |
|
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
241 |
/* single tram bits can only be left in one direction */ |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
242 |
DiagDirection single_tram = GetSingleTramBit(m_old_tile); |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
243 |
if (single_tram != INVALID_DIAGDIR && single_tram != m_exitdir) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
244 |
m_err = EC_NO_WAY; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
245 |
return false; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
246 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
247 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
248 |
// road depots can be also left in one direction only |
8954
3993bae3bfb8
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
8636
diff
changeset
|
249 |
if (IsRoadTT() && IsDepotTypeTile(m_old_tile, TT())) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
250 |
DiagDirection exitdir = GetRoadDepotDirection(m_old_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
251 |
if (exitdir != m_exitdir) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
252 |
m_err = EC_NO_WAY; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
253 |
return false; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
254 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
255 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
256 |
return true; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
257 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
258 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
259 |
/** return true if we can enter m_new_tile from m_exitdir */ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
260 |
FORCEINLINE bool CanEnterNewTile() |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
261 |
{ |
6012
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
262 |
if (IsRoadTT() && IsStandardRoadStopTile(m_new_tile)) { |
065d7234a7a9
(svn r8735) -Feature: drive-through road stops made possible by the hard work of mart3p.
rubidium
parents:
5998
diff
changeset
|
263 |
// road stop can be entered from one direction only unless it's a drive-through stop |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
264 |
DiagDirection exitdir = GetRoadStopDir(m_new_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
265 |
if (ReverseDiagDir(exitdir) != m_exitdir) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
266 |
m_err = EC_NO_WAY; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
267 |
return false; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
268 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
269 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
270 |
|
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
271 |
/* single tram bits can only be entered from one direction */ |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
272 |
DiagDirection single_tram = GetSingleTramBit(m_new_tile); |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
273 |
if (single_tram != INVALID_DIAGDIR && single_tram != ReverseDiagDir(m_exitdir)) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
274 |
m_err = EC_NO_WAY; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
275 |
return false; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
276 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
277 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
278 |
// road and rail depots can also be entered from one direction only |
8954
3993bae3bfb8
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
8636
diff
changeset
|
279 |
if (IsRoadTT() && IsDepotTypeTile(m_new_tile, TT())) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
280 |
DiagDirection exitdir = GetRoadDepotDirection(m_new_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
281 |
if (ReverseDiagDir(exitdir) != m_exitdir) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
282 |
m_err = EC_NO_WAY; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
283 |
return false; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
284 |
} |
4407
685c613f3fec
(svn r6160) -Fix [ 1519167 ] Bus trying to service in depot of other company (mart3p)
KUDr
parents:
3977
diff
changeset
|
285 |
// don't try to enter other player's depots |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
286 |
if (GetTileOwner(m_new_tile) != m_veh_owner) { |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
287 |
m_err = EC_OWNER; |
4407
685c613f3fec
(svn r6160) -Fix [ 1519167 ] Bus trying to service in depot of other company (mart3p)
KUDr
parents:
3977
diff
changeset
|
288 |
return false; |
685c613f3fec
(svn r6160) -Fix [ 1519167 ] Bus trying to service in depot of other company (mart3p)
KUDr
parents:
3977
diff
changeset
|
289 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
290 |
} |
8954
3993bae3bfb8
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
8636
diff
changeset
|
291 |
if (IsRailTT() && IsDepotTypeTile(m_new_tile, TT())) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
292 |
DiagDirection exitdir = GetRailDepotDirection(m_new_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
293 |
if (ReverseDiagDir(exitdir) != m_exitdir) { |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
294 |
m_err = EC_NO_WAY; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
295 |
return false; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
296 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
297 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
298 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
299 |
// rail transport is possible only on tiles with the same owner as vehicle |
9803
cb1362dac242
(svn r13945) -Codechange [YAPP]: Extend CFollowTrackT to not require a Vehicle when following rail. (michi_cc)
rubidium
parents:
9802
diff
changeset
|
300 |
if (IsRailTT() && GetTileOwner(m_new_tile) != m_veh_owner) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
301 |
// different owner |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
302 |
m_err = EC_NO_WAY; |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
303 |
return false; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
304 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
305 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
306 |
// rail transport is possible only on compatible rail types |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
307 |
if (IsRailTT()) { |
6154 | 308 |
RailType rail_type = GetTileRailType(m_new_tile); |
9797
3b2e6f55e7d0
(svn r13939) -Add [YAPP]: Extend YAPF with the possibility to override the railtype info of the vehicle. (michi_cc)
rubidium
parents:
9490
diff
changeset
|
309 |
if (!HasBit(m_railtypes, rail_type)) { |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
310 |
// incompatible rail type |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
311 |
m_err = EC_RAIL_TYPE; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
312 |
return false; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
313 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
314 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
315 |
|
5420
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
316 |
// tunnel holes and bridge ramps can be entered only from proper direction |
9490
01c07bde5e84
(svn r13464) -Codechange: support NewGRF Action 0x05, type 12.
rubidium
parents:
9439
diff
changeset
|
317 |
if (IsTileType(m_new_tile, MP_TUNNELBRIDGE)) { |
5420
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
318 |
if (IsTunnel(m_new_tile)) { |
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
319 |
if (!m_is_tunnel) { |
8083
ad22eade501f
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
smatz
parents:
7928
diff
changeset
|
320 |
DiagDirection tunnel_enterdir = GetTunnelBridgeDirection(m_new_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
321 |
if (tunnel_enterdir != m_exitdir) { |
7214
529dee3b770b
(svn r10492) -Fix [YAPF, r10491]: commands with no effect (glx)
KUDr
parents:
7211
diff
changeset
|
322 |
m_err = EC_NO_WAY; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
323 |
return false; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
324 |
} |
5420
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
325 |
} |
8390
f88f515e6557
(svn r11960) -Cleanup: simplify some IsTunnel(Tile) / IsBridge(Tile) conditions
smatz
parents:
8083
diff
changeset
|
326 |
} else { // IsBridge(m_new_tile) |
5420
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
327 |
if (!m_is_bridge) { |
8083
ad22eade501f
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
smatz
parents:
7928
diff
changeset
|
328 |
DiagDirection ramp_enderdir = GetTunnelBridgeDirection(m_new_tile); |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
329 |
if (ramp_enderdir != m_exitdir) { |
7214
529dee3b770b
(svn r10492) -Fix [YAPF, r10491]: commands with no effect (glx)
KUDr
parents:
7211
diff
changeset
|
330 |
m_err = EC_NO_WAY; |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
331 |
return false; |
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
332 |
} |
5420
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
333 |
} |
265af7def3aa
(svn r7623) - Fix: [YAPF] trains/roadvehs trying to enter the bridge ramp from under bridge rail/road (introduced by bridge merge r7573)
KUDr
parents:
5385
diff
changeset
|
334 |
} |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
335 |
} |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
336 |
|
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
337 |
// special handling for rail stations - get to the end of platform |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
338 |
if (IsRailTT() && m_is_station) { |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
339 |
// entered railway station |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
340 |
// get platform length |
5998
2bfbade143ac
(svn r8709) -Fix/Codechange: Rename the function GetStationPlatforms into GetPlatformLength because that is what it really does. Overload it because there is already a GetPlatformLength (one gives the length of the whole platform, the other gives the remaining length in a given direction). Turned both functions into methods of Station. While messing around with it, fix a problem where loading times for overhanging trains are miscomputed.
celestar
parents:
5826
diff
changeset
|
341 |
uint length = GetStationByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td)); |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
342 |
// how big step we must do to get to the last platform tile; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
343 |
m_tiles_skipped = length - 1; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
344 |
// move to the platform end |
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4549
diff
changeset
|
345 |
TileIndexDiff diff = TileOffsByDiagDir(m_exitdir); |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
346 |
diff *= m_tiles_skipped; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
347 |
m_new_tile = TILE_ADD(m_new_tile, diff); |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
348 |
return true; |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
349 |
} |
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
350 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
351 |
return true; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
352 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
353 |
|
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
354 |
/** return true if we must reverse (in depots and single tram bits) */ |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
355 |
FORCEINLINE bool ForcedReverse() |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
356 |
{ |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
357 |
// rail and road depots cause reversing |
8954
3993bae3bfb8
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
8636
diff
changeset
|
358 |
if (!IsWaterTT() && IsDepotTypeTile(m_old_tile, TT())) { |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
359 |
DiagDirection exitdir = IsRailTT() ? GetRailDepotDirection(m_old_tile) : GetRoadDepotDirection(m_old_tile); |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
360 |
if (exitdir != m_exitdir) { |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
361 |
// reverse |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
362 |
m_new_tile = m_old_tile; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
363 |
m_new_td_bits = TrackdirToTrackdirBits(ReverseTrackdir(m_old_td)); |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
364 |
m_exitdir = exitdir; |
3931
b946fc6e7188
(svn r5066) -Feature: [YAPF] Train selects the best station platform by length
KUDr
parents:
3915
diff
changeset
|
365 |
m_tiles_skipped = 0; |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
366 |
m_is_tunnel = m_is_bridge = m_is_station = false; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
367 |
return true; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
368 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
369 |
} |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
370 |
|
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
371 |
// single tram bits cause reversing |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
372 |
if (GetSingleTramBit(m_old_tile) == ReverseDiagDir(m_exitdir)) { |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
373 |
// reverse |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
374 |
m_new_tile = m_old_tile; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
375 |
m_new_td_bits = TrackdirToTrackdirBits(ReverseTrackdir(m_old_td)); |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
376 |
m_exitdir = ReverseDiagDir(m_exitdir); |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
377 |
m_tiles_skipped = 0; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
378 |
m_is_tunnel = m_is_bridge = m_is_station = false; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
379 |
return true; |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
380 |
} |
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
381 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
382 |
return false; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
383 |
} |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
384 |
|
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
385 |
/** return true if we successfully reversed at end of road/track */ |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
386 |
FORCEINLINE bool TryReverse() |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
387 |
{ |
8465
349d2e76eeef
(svn r12035) -Fix [FS#1702]: Teach YAPF where trams can reverse, and where not.
frosch
parents:
8398
diff
changeset
|
388 |
if (IsRoadTT() && !IsTram()) { |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
389 |
// if we reached the end of road, we can reverse the RV and continue moving |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
390 |
m_exitdir = ReverseDiagDir(m_exitdir); |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
391 |
// new tile will be the same as old one |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
392 |
m_new_tile = m_old_tile; |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
393 |
// set new trackdir bits to all reachable trackdirs |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
394 |
QueryNewTileTrackStatus(); |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
395 |
m_new_td_bits &= DiagdirReachesTrackdirs(m_exitdir); |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
396 |
if (m_new_td_bits != TRACKDIR_BIT_NONE) { |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
397 |
// we have some trackdirs reachable after reversal |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
398 |
return true; |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
399 |
} |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
400 |
} |
7211
ebabbe55f70e
(svn r10489) -Codechange [YAPF]: FollowTrack_t now has new data member - m_err. It indicates the reason why the given track/trackdir can't be followed when method CFollowTrackT<>::Follow() returned false.
KUDr
parents:
7037
diff
changeset
|
401 |
m_err = EC_NO_WAY; |
3976
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
402 |
return false; |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
403 |
} |
6135bc445350
(svn r5153) - Fix: [YAPF] RVs can now plan path reversing in depot or end of road
KUDr
parents:
3933
diff
changeset
|
404 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
405 |
public: |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
406 |
/** Helper for pathfinders - get min/max speed on the m_old_tile/m_old_td */ |
7037
64249224bb74
(svn r10301) -Fix [FS#901, YAPF]: another assert violation in some special cases (immeR)
KUDr
parents:
6683
diff
changeset
|
407 |
int GetSpeedLimit(int *pmin_speed = NULL) const |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
408 |
{ |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
409 |
int min_speed = 0; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
410 |
int max_speed = INT_MAX; // no limit |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
411 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
412 |
// for now we handle only on-bridge speed limit |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
413 |
if (!IsWaterTT() && IsBridgeTile(m_old_tile)) { |
8491
97fcf662c3c3
(svn r12066) -Codechange: Rename GetBridge for the more common GetBridgeSpec
belugas
parents:
8465
diff
changeset
|
414 |
int spd = GetBridgeSpec(GetBridgeType(m_old_tile))->speed; |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
415 |
if (IsRoadTT()) spd *= 2; |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
4559
diff
changeset
|
416 |
if (max_speed > spd) max_speed = spd; |
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
417 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
418 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
419 |
// if min speed was requested, return it |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
420 |
if (pmin_speed) *pmin_speed = min_speed; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
421 |
return max_speed; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
422 |
} |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
423 |
}; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
424 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
425 |
typedef CFollowTrackT<TRANSPORT_WATER, true > CFollowTrackWater; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
426 |
typedef CFollowTrackT<TRANSPORT_ROAD , true > CFollowTrackRoad; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
427 |
typedef CFollowTrackT<TRANSPORT_RAIL , true > CFollowTrackRail; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
428 |
|
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
429 |
typedef CFollowTrackT<TRANSPORT_WATER, false> CFollowTrackWaterNo90; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
430 |
typedef CFollowTrackT<TRANSPORT_ROAD , false> CFollowTrackRoadNo90; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
431 |
typedef CFollowTrackT<TRANSPORT_RAIL , false> CFollowTrackRailNo90; |
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
432 |
|
9802
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
433 |
typedef CFollowTrackT<TRANSPORT_RAIL , true , true> CFollowTrackFreeRail; |
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
434 |
typedef CFollowTrackT<TRANSPORT_RAIL , false, true> CFollowTrackFreeRailNo90; |
6589c004f0d9
(svn r13944) -Add [YAPP]: Add YAPF provider to find a safe tile and reserve a path. (michi_cc)
rubidium
parents:
9797
diff
changeset
|
435 |
|
3900
2c84ed52709d
(svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents:
diff
changeset
|
436 |
#endif /* FOLLOW_TRACK_HPP */ |