Old revision #pv8ckd8ru | New revision #pft3rt0m2 | ||
---|---|---|---|
42 | if (!IsWaterTile(tile + delta)) c->infrastructure.water++; | 42 | if (!IsWaterTile(tile + delta)) c->infrastructure.water++; |
43 | /* Count for the lock itself. */ | 43 | /* Count for the lock itself. */ |
44 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles. | 44 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles. |
45 | @@ -348,6 +353,9 @@ | 45 | @@ -324,6 +329,8 @@ |
46 | */ | ||
47 | static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags) | ||
48 | { | ||
49 | + CommandCost cost(EXPENSES_CONSTRUCTION); | ||
50 | + | ||
51 | if (GetTileOwner(tile) != OWNER_NONE) { | ||
52 | CommandCost ret = CheckTileOwnership(tile); | ||
53 | if (ret.Failed()) return ret; | ||
54 | @@ -336,7 +343,7 @@ | ||
55 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta); | ||
56 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta); | ||
57 | if (ret.Failed()) return ret; | ||
58 | - | ||
59 | + if (GetWaterClass(tile) != WATER_CLASS_RIVER) cost.AddCost(_price[PR_CLEAR_CANAL]); | ||
60 | if (flags & DC_EXEC) { | ||
61 | /* Remove middle part from company infrastructure count. */ | ||
62 | Company *c = Company::GetIfValid(GetTileOwner(tile)); | ||
63 | @@ -348,6 +355,9 @@ | ||
46 | if (GetWaterClass(tile) == WATER_CLASS_RIVER) { | 64 | if (GetWaterClass(tile) == WATER_CLASS_RIVER) { |
47 | MakeRiver(tile, Random()); | 65 | MakeRiver(tile, Random()); |
48 | } else { | 66 | } else { | … | … |
52 | DoClearSquare(tile); | 70 | DoClearSquare(tile); |
53 | } | 71 | } |
54 | MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta)); | 72 | MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta)); |
55 | @@ -1276,8 +1284,14 @@ | 73 | @@ -357,7 +367,9 @@ |
74 | MarkCanalsAndRiversAroundDirty(tile + delta); | ||
75 | } | ||
76 | |||
77 | - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_LOCK]); | ||
78 | + cost.AddCost(_price[PR_CLEAR_LOCK]); | ||
79 | + return cost; | ||
80 | + | ||
81 | } | ||
82 | |||
83 | /** | ||
84 | @@ -1276,8 +1288,14 @@ | ||
56 | 85 | ||
57 | /* No need to dirty company windows here, we'll redraw the whole screen anyway. */ | 86 | /* No need to dirty company windows here, we'll redraw the whole screen anyway. */ |
58 | if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. | 87 | if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts. |