5 | @@ -419,6 +419,7 @@
| 5 | @@ -123,6 +123,8 @@
|
---|
| | 6 | CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]);
|
---|
| | 7 |
|
---|
| | 8 | bool add_cost = !IsWaterTile(tile);
|
---|
| | 9 | + bool river1 = HasBit(_me[tile].m6, 0);
|
---|
| | 10 | + bool river2 = HasBit(_me[tile2].m6, 0);
|
---|
| | 11 | CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
|
---|
| | 12 | if (ret.Failed()) return ret;
|
---|
| | 13 | if (add_cost) {
|
---|
| | 14 | @@ -145,7 +147,8 @@
|
---|
| | 15 | }
|
---|
| | 16 | Company::Get(_current_company)->infrastructure.water += 2 * LOCK_DEPOT_TILE_FACTOR;
|
---|
| | 17 | DirtyCompanyInfrastructureWindows(_current_company);
|
---|
| | 18 | -
|
---|
| | 19 | + if (river1) SB(_me[tile].m6, 0, 1, 1);
|
---|
| | 20 | + if (river2) SB(_me[tile2].m6, 0, 1, 1);
|
---|
| | 21 | MakeShipDepot(tile, _current_company, depot->index, DEPOT_PART_NORTH, axis, wc1);
|
---|
| | 22 | MakeShipDepot(tile2, _current_company, depot->index, DEPOT_PART_SOUTH, axis, wc2);
|
---|
| | 23 | MarkTileDirtyByTile(tile);
|
---|
| | 24 | @@ -209,13 +212,16 @@
|
---|
| | 25 |
|
---|
| | 26 | static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
|
---|
| | 27 | {
|
---|
| | 28 | + TileIndex tile2 = GetOtherShipDepotTile(tile);
|
---|
| | 29 | + bool river1 = HasBit(_me[tile].m6, 0);
|
---|
| | 30 | + bool river2 = HasBit(_me[tile2].m6, 0);
|
---|
| | 31 | if (!IsShipDepot(tile)) return CMD_ERROR;
|
---|
| | 32 |
|
---|
| | 33 | CommandCost ret = CheckTileOwnership(tile);
|
---|
| | 34 | if (ret.Failed()) return ret;
|
---|
| | 35 |
|
---|
| | 36 | - TileIndex tile2 = GetOtherShipDepotTile(tile);
|
---|
| | 37 |
|
---|
| | 38 | +
|
---|
| | 39 | /* do not check for ship on tile when company goes bankrupt */
|
---|
| | 40 | if (!(flags & DC_BANKRUPT)) {
|
---|
| | 41 | CommandCost ret = EnsureNoVehicleOnGround(tile);
|
---|
| | 42 | @@ -231,7 +237,8 @@
|
---|
| | 43 | c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR;
|
---|
| | 44 | DirtyCompanyInfrastructureWindows(c->index);
|
---|
| | 45 | }
|
---|
| | 46 | -
|
---|
| | 47 | + if (river1) SB(_me[tile].m6, 0, 1, 1);
|
---|
| | 48 | + if (river2) SB(_me[tile2].m6, 0, 1, 1);
|
---|
| | 49 | MakeWaterKeepingClass(tile, GetTileOwner(tile));
|
---|
| | 50 | MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
|
---|
| | 51 | }
|
---|
| | 52 | @@ -264,7 +271,7 @@
|
---|
| | 53 |
|
---|
| | 54 | /* lower tile */
|
---|
| | 55 | WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
|
---|
| | 56 | -
|
---|
| | 57 | +
|
---|
| | 58 | if (!IsWaterTile(tile - delta)) {
|
---|
| | 59 | ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
---|
| | 60 | if (ret.Failed()) return ret;
|
---|
| | 61 | @@ -277,7 +284,7 @@
|
---|
| | 62 |
|
---|
| | 63 | /* upper tile */
|
---|
| | 64 | WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL;
|
---|
| | 65 | -
|
---|
| | 66 | +
|
---|
| | 67 | if (!IsWaterTile(tile + delta)) {
|
---|
| | 68 | ret = DoCommand(tile + delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
---|
| | 69 | if (ret.Failed()) return ret;
|
---|
| | 70 | @@ -291,7 +298,8 @@
|
---|
| | 71 | if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) {
|
---|
| | 72 | return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
---|
| | 73 | }
|
---|
| | 74 | -
|
---|
| | 75 | + bool river_lower = HasBit(_me[tile - delta].m6, 0);
|
---|
| | 76 | + bool river_upper = HasBit(_me[tile + delta].m6, 0);
|
---|
| | 77 | if (flags & DC_EXEC) {
|
---|
| | 78 | /* Update company infrastructure counts. */
|
---|
| | 79 | Company *c = Company::GetIfValid(_current_company);
|
---|
| | 80 | @@ -303,7 +311,8 @@
|
---|
| | 81 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
|
---|
| | 82 | DirtyCompanyInfrastructureWindows(_current_company);
|
---|
| | 83 | }
|
---|
| | 84 | -
|
---|
| | 85 | + if (river_lower) SB(_me[tile - delta].m6, 0, 1, 1);
|
---|
| | 86 | + if (river_upper) SB(_me[tile + delta].m6, 0, 1, 1);
|
---|
| | 87 | MakeLock(tile, _current_company, dir, wc_lower, wc_upper, wc_middle);
|
---|
| | 88 | MarkTileDirtyByTile(tile);
|
---|
| | 89 | MarkTileDirtyByTile(tile - delta);
|
---|
| | 90 | @@ -336,7 +345,8 @@
|
---|
| | 91 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta);
|
---|
| | 92 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta);
|
---|
| | 93 | if (ret.Failed()) return ret;
|
---|
| | 94 | -
|
---|
| | 95 | + bool river_lower = HasBit(_me[tile - delta].m6, 0);
|
---|
| | 96 | + bool river_upper = HasBit(_me[tile + delta].m6, 0);
|
---|
| | 97 | if (flags & DC_EXEC) {
|
---|
| | 98 | /* Remove middle part from company infrastructure count. */
|
---|
| | 99 | Company *c = Company::GetIfValid(GetTileOwner(tile));
|
---|
| | 100 | @@ -352,6 +362,8 @@
|
---|
| | 101 | }
|
---|
| | 102 | MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta));
|
---|
| | 103 | MakeWaterKeepingClass(tile - delta, GetTileOwner(tile - delta));
|
---|
| | 104 | + if (river_lower) SB(_me[tile - delta].m6, 0, 1, 1);
|
---|
| | 105 | + if (river_upper) SB(_me[tile + delta].m6, 0, 1, 1);
|
---|
| | 106 | MarkCanalsAndRiversAroundDirty(tile);
|
---|
| | 107 | MarkCanalsAndRiversAroundDirty(tile - delta);
|
---|
| | 108 | MarkCanalsAndRiversAroundDirty(tile + delta);
|
---|
| | 109 | @@ -419,6 +431,7 @@
|
---|