diff options
author | peter1138 <peter1138@openttd.org> | 2019-03-11 10:37:47 +0000 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-06-30 16:46:32 +0200 |
commit | f538179878370b3bec8bf1575dc30c1377461ebc (patch) | |
tree | 890738c37245a49eb2a8ad52f4afb805baaa9d42 /src/tunnelbridge_cmd.cpp | |
parent | f1c39153413b07a964dfde8fd9d6310f0da4987b (diff) | |
download | openttd-f538179878370b3bec8bf1575dc30c1377461ebc.tar.xz |
Feature: Multi-tile docks and docking points.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 83cec4fd3..fce0855d2 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -41,6 +41,7 @@ #include "object_base.h" #include "water.h" #include "company_gui.h" +#include "station_func.h" #include "table/strings.h" #include "table/bridge_land.h" @@ -533,6 +534,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (is_new_owner && c != nullptr) c->infrastructure.water += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; MakeAqueductBridgeRamp(tile_start, owner, dir); MakeAqueductBridgeRamp(tile_end, owner, ReverseDiagDir(dir)); + CheckForDockingTile(tile_start); + CheckForDockingTile(tile_end); break; default: @@ -944,6 +947,9 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) if (v != nullptr) FreeTrainTrackReservation(v); } + bool removetile = false; + bool removeendtile = false; + /* Update company infrastructure counts. */ if (rail) { if (Company::IsValidID(owner)) Company::Get(owner)->infrastructure.rail[GetRailType(tile)] -= len * TUNNELBRIDGE_TRACKBIT_FACTOR; @@ -953,11 +959,16 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) UpdateCompanyRoadInfrastructure(GetRoadTypeTram(tile), GetRoadOwner(tile, RTT_TRAM), -(int)(len * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR)); } else { // Aqueduct if (Company::IsValidID(owner)) Company::Get(owner)->infrastructure.water -= len * TUNNELBRIDGE_TRACKBIT_FACTOR; + removetile = IsDockingTile(tile); + removeendtile = IsDockingTile(endtile); } DirtyCompanyInfrastructureWindows(owner); DoClearSquare(tile); DoClearSquare(endtile); + + if (removetile) RemoveDockingTile(tile); + if (removeendtile) RemoveDockingTile(endtile); for (TileIndex c = tile + delta; c != endtile; c += delta) { /* do not let trees appear from 'nowhere' after removing bridge */ if (IsNormalRoadTile(c) && GetRoadside(c) == ROADSIDE_TREES) { |