* Determines whether train would like to leave the tile * @param v train to test * @return true iff vehicle is NOT entering or inside a depot or tunnel/bridge */
| 3837 | * @return true iff vehicle is NOT entering or inside a depot or tunnel/bridge |
| 3838 | */ |
| 3839 | static bool TrainCanLeaveTile(const Train *v) |
| 3840 | { |
| 3841 | /* Exit if inside a tunnel/bridge or a depot */ |
| 3842 | if (v->track == TRACK_BIT_WORMHOLE || v->track == TRACK_BIT_DEPOT) return false; |
| 3843 | |
| 3844 | TileIndex tile = v->tile; |
| 3845 | |
| 3846 | /* entering a tunnel/bridge? */ |
| 3847 | if (IsTileType(tile, MP_TUNNELBRIDGE)) { |
| 3848 | DiagDirection dir = GetTunnelBridgeDirection(tile); |
| 3849 | if (DiagDirToDir(dir) == v->direction) return false; |
| 3850 | } |
| 3851 | |
| 3852 | /* entering a depot? */ |
| 3853 | if (IsRailDepotTile(tile)) { |
| 3854 | DiagDirection dir = ReverseDiagDir(GetRailDepotDirection(tile)); |
| 3855 | if (DiagDirToDir(dir) == v->direction) return false; |
| 3856 | } |
| 3857 | |
| 3858 | return true; |
| 3859 | } |
| 3860 | |
| 3861 | |
| 3862 | /** |
no test coverage detected