Changeset - r28720:bd5b95e9800a
[Not reviewed]
master
0 2 0
Loïc Guilloux - 10 months ago 2024-02-09 17:17:08
glx22@users.noreply.github.com
Fix #12014: Remove water when area clearing ship depot (#12030)
2 files changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/landscape.cpp
Show inline comments
 
@@ -712,6 +712,8 @@ std::tuple<CommandCost, Money> CmdClearA
 
	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));
 

	
 
	if (tile != start_tile) flags |= DC_FORCE_CLEAR_TILE;
 

	
 
	std::unique_ptr<TileIterator> iter = TileIterator::Create(tile, start_tile, diagonal);
 
	for (; *iter != INVALID_TILE; ++(*iter)) {
 
		TileIndex t = *iter;
src/water_cmd.cpp
Show inline comments
 
@@ -273,16 +273,19 @@ static CommandCost RemoveShipDepot(TileI
 
		if (ret.Failed()) return ret;
 
	}
 

	
 
	bool do_clear = (flags & DC_FORCE_CLEAR_TILE) != 0;
 

	
 
	if (flags & DC_EXEC) {
 
		delete Depot::GetByTile(tile);
 

	
 
		Company *c = Company::GetIfValid(GetTileOwner(tile));
 
		if (c != nullptr) {
 
			c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR;
 
			if (do_clear && GetWaterClass(tile) == WATER_CLASS_CANAL) c->infrastructure.water--;
 
			DirtyCompanyInfrastructureWindows(c->index);
 
		}
 

	
 
		MakeWaterKeepingClass(tile,  GetTileOwner(tile));
 
		if (!do_clear) MakeWaterKeepingClass(tile,  GetTileOwner(tile));
 
		MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
 
	}
 

	
0 comments (0 inline, 0 general)