9 | + if (HasTileWaterClass(tile_cur)) {
| 9 | + ret = EnsureNoShipOnDiagDir(tile_cur, ReverseDiagDir(direction));
|
---|
10 | + TrackBits tb = TrackStatusToTrackBits(GetTileTrackStatus(tile_cur, TRANSPORT_WATER, 0));
| 10 | + if (ret.Failed()) return ret;
|
---|
11 | + if (((direction == DIAGDIR_SW && (tb & TRACK_BIT_3WAY_NE) != 0) || (direction == DIAGDIR_NW && (tb & TRACK_BIT_3WAY_SE) != 0) || (direction == DIAGDIR_SE && (tb & TRACK_BIT_3WAY_NW) != 0) || (direction == DIAGDIR_NE && (tb & TRACK_BIT_3WAY_SW) != 0) && !IsShipDepotTile(tile_cur) && IsTileType(tile_cur, MP_WATER) && !IsLock(tile_cur))) {
| | |
---|
12 | + ret = EnsureNoVehicleOnGround(tile_cur);
| | |
---|
13 | + if (ret.Failed()) return ret;
| | |
---|
14 | + }
| | |
---|
15 | + }
| | |
---|
| | 15 | Index: src/vehicle.cpp
|
---|
| | 16 | ===================================================================
|
---|
| | 17 | --- src/vehicle.cpp (revision 27632)
|
---|
| | 18 | +++ src/vehicle.cpp (working copy)
|
---|
| | 19 | @@ -484,6 +484,24 @@
|
---|
| | 20 | return CommandCost();
|
---|
| | 21 | }
|
---|
| | 22 |
|
---|
| | 23 | +/**
|
---|
| | 24 | +* Ensure there is no ship on the water at the given diagonal direction.
|
---|
| | 25 | +* @param tile Position to examine.
|
---|
| | 26 | +* @param diag_dir Diagonal direction
|
---|
| | 27 | +* @return Succeeded command (water is free) or failed command (a ship is found).
|
---|
| | 28 | +*/
|
---|
| | 29 | +CommandCost EnsureNoShipOnDiagDir(TileIndex tile, DiagDirection diag_dir)
|
---|
| | 30 | +{
|
---|
| | 31 | + if (HasTileWaterClass(tile)) {
|
---|
| | 32 | + TrackBits tb = TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0));
|
---|
| | 33 | + if (((diag_dir == DIAGDIR_NE && (tb & TRACK_BIT_3WAY_NE) != 0) || (diag_dir == DIAGDIR_SE && (tb & TRACK_BIT_3WAY_SE) != 0) || (diag_dir == DIAGDIR_NW && (tb & TRACK_BIT_3WAY_NW) != 0) || (diag_dir == DIAGDIR_SW && (tb & TRACK_BIT_3WAY_SW) != 0) && !IsShipDepotTile(tile) && IsTileType(tile, MP_WATER) && !IsLock(tile))) {
|
---|
| | 34 | + CommandCost ret = EnsureNoVehicleOnGround(tile);
|
---|
| | 35 | + if (ret.Failed()) return ret;
|
---|
| | 36 | + }
|
---|
| | 37 | + }
|
---|
| | 38 | + return CommandCost();
|
---|
| | 39 | +}
|
---|
| | 40 | +
|
---|
| | 41 | /** Procedure called for every vehicle found in tunnel/bridge in the hash map */
|
---|
| | 42 | static Vehicle *GetVehicleTunnelBridgeProc(Vehicle *v, void *data)
|
---|
| | 43 | {
|
---|
| | 44 | Index: src/vehicle_func.h
|
---|
| | 45 | ===================================================================
|
---|
| | 46 | --- src/vehicle_func.h (revision 27632)
|
---|
| | 47 | +++ src/vehicle_func.h (working copy)
|
---|
| | 48 | @@ -165,6 +165,7 @@
|
---|
| | 49 |
|
---|
| | 50 | CommandCost EnsureNoVehicleOnGround(TileIndex tile);
|
---|
| | 51 | CommandCost EnsureNoTrainOnTrackBits(TileIndex tile, TrackBits track_bits);
|
---|
| | 52 | +CommandCost EnsureNoShipOnDiagDir(TileIndex tile, DiagDirection diag_dir);
|
---|
| | 53 |
|
---|
| | 54 | extern VehicleID _new_vehicle_id;
|
---|
| | 55 | extern uint16 _returned_refit_capacity;
|
---|
30 | + if (HasTileWaterClass(tc)) {
| 30 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
31 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 31 | + if (ret.Failed()) return ret;
|
---|
32 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 32 | +
|
---|
33 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
34 | + if (ret.Failed()) return ret;
| | |
---|
35 | + }
| | |
---|
36 | + }
| | |
---|
38 | + if (HasTileWaterClass(tc)) {
| 38 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
39 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 39 | + if (ret.Failed()) return ret;
|
---|
40 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 40 | +
|
---|
41 | + ret = EnsureNoVehicleOnGround(tc);
| 41 | + dir_rotate = ReverseDiagDir(dir_rotate);
|
---|
42 | + if (ret.Failed()) return ret;
| | |
---|
43 | + }
| | |
---|
44 | + }
| | |
---|
46 | + if (HasTileWaterClass(tc)) {
| 46 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
47 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 47 | + if (ret.Failed()) return ret;
|
---|
48 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 48 | +
|
---|
49 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
50 | + if (ret.Failed()) return ret;
| | |
---|
51 | + }
| | |
---|
52 | + }
| | |
---|
54 | + if (HasTileWaterClass(tc)) {
| 54 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
55 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 55 | + if (ret.Failed()) return ret;
|
---|
56 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 56 | +
|
---|
57 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
58 | + if (ret.Failed()) return ret;
| | |
---|
59 | + }
| | |
---|
60 | + }
| | |
---|
72 | + if (HasTileWaterClass(tc)) {
| 72 | + CommandCost ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
73 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 73 | + if (ret.Failed()) return ret;
|
---|
74 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 74 | +
|
---|
75 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
76 | + if (ret.Failed()) return ret;
| | |
---|
77 | + }
| | |
---|
78 | + }
| | |
---|
80 | + if (HasTileWaterClass(tc)) {
| 80 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
81 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 81 | + if (ret.Failed()) return ret;
|
---|
82 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 82 | +
|
---|
83 | + ret = EnsureNoVehicleOnGround(tc);
| 83 | + dir_rotate = ReverseDiagDir(dir_rotate);
|
---|
84 | + if (ret.Failed()) return ret;
| | |
---|
85 | + }
| | |
---|
86 | + }
| | |
---|
88 | + if (HasTileWaterClass(tc)) {
| 88 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
89 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 89 | + if (ret.Failed()) return ret;
|
---|
90 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 90 | +
|
---|
91 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
92 | + if (ret.Failed()) return ret;
| | |
---|
93 | + }
| | |
---|
94 | + }
| | |
---|
96 | + if (HasTileWaterClass(tc)) {
| 96 | + ret = EnsureNoShipOnDiagDir(tc, dir_rotate);
|
---|
97 | + tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
| 97 | + if (ret.Failed()) return ret;
|
---|
98 | + if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
| 98 | +
|
---|
99 | + ret = EnsureNoVehicleOnGround(tc);
| | |
---|
100 | + if (ret.Failed()) return ret;
| | |
---|
101 | + }
| | |
---|
102 | + }
| | |
---|