mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
parent
10bcf0172e
commit
b68d263d5f
@ -712,6 +712,8 @@ std::tuple<CommandCost, Money> CmdClearArea(DoCommandFlag flags, TileIndex tile,
|
|||||||
const Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? nullptr : Company::GetIfValid(_current_company);
|
const Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? nullptr : Company::GetIfValid(_current_company);
|
||||||
int limit = (c == nullptr ? INT32_MAX : GB(c->clear_limit, 16, 16));
|
int limit = (c == nullptr ? INT32_MAX : GB(c->clear_limit, 16, 16));
|
||||||
|
|
||||||
|
if (tile != start_tile) flags |= DC_FORCE_CLEAR_TILE;
|
||||||
|
|
||||||
std::unique_ptr<TileIterator> iter = TileIterator::Create(tile, start_tile, diagonal);
|
std::unique_ptr<TileIterator> iter = TileIterator::Create(tile, start_tile, diagonal);
|
||||||
for (; *iter != INVALID_TILE; ++(*iter)) {
|
for (; *iter != INVALID_TILE; ++(*iter)) {
|
||||||
TileIndex t = *iter;
|
TileIndex t = *iter;
|
||||||
|
@ -273,16 +273,19 @@ static CommandCost RemoveShipDepot(TileIndex tile, DoCommandFlag flags)
|
|||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool do_clear = (flags & DC_FORCE_CLEAR_TILE) != 0;
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
delete Depot::GetByTile(tile);
|
delete Depot::GetByTile(tile);
|
||||||
|
|
||||||
Company *c = Company::GetIfValid(GetTileOwner(tile));
|
Company *c = Company::GetIfValid(GetTileOwner(tile));
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR;
|
c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR;
|
||||||
|
if (do_clear && GetWaterClass(tile) == WATER_CLASS_CANAL) c->infrastructure.water--;
|
||||||
DirtyCompanyInfrastructureWindows(c->index);
|
DirtyCompanyInfrastructureWindows(c->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeWaterKeepingClass(tile, GetTileOwner(tile));
|
if (!do_clear) MakeWaterKeepingClass(tile, GetTileOwner(tile));
|
||||||
MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
|
MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user