Fix building objects, trees and buoys on water/shore not clearing neighbour flooding states
This commit is contained in:
@@ -115,6 +115,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
|
|||||||
assert(o->town != nullptr);
|
assert(o->town != nullptr);
|
||||||
|
|
||||||
TILE_AREA_LOOP(t, ta) {
|
TILE_AREA_LOOP(t, ta) {
|
||||||
|
if (IsWaterTile(t)) ClearNeighbourNonFloodingStates(t);
|
||||||
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
|
WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID);
|
||||||
/* Update company infrastructure counts for objects build on canals owned by nobody. */
|
/* Update company infrastructure counts for objects build on canals owned by nobody. */
|
||||||
if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, OWNER_WATER))) {
|
if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, OWNER_WATER))) {
|
||||||
|
@@ -99,6 +99,7 @@ static void PlantTreesOnTile(TileIndex tile, TreeType treetype, uint count, uint
|
|||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_WATER:
|
case MP_WATER:
|
||||||
ground = TREE_GROUND_SHORE;
|
ground = TREE_GROUND_SHORE;
|
||||||
|
ClearNeighbourNonFloodingStates(tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_CLEAR:
|
case MP_CLEAR:
|
||||||
|
@@ -24,6 +24,7 @@ enum FloodingBehaviour {
|
|||||||
};
|
};
|
||||||
|
|
||||||
FloodingBehaviour GetFloodingBehaviour(TileIndex tile);
|
FloodingBehaviour GetFloodingBehaviour(TileIndex tile);
|
||||||
|
void ClearNeighbourNonFloodingStates(TileIndex tile);
|
||||||
|
|
||||||
void TileLoop_Water(TileIndex tile);
|
void TileLoop_Water(TileIndex tile);
|
||||||
bool FloodHalftile(TileIndex t);
|
bool FloodHalftile(TileIndex t);
|
||||||
|
@@ -88,7 +88,7 @@ static void MarkCanalsAndRiversAroundDirty(TileIndex tile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearNeighbourNonFloodingStates(TileIndex tile)
|
void ClearNeighbourNonFloodingStates(TileIndex tile)
|
||||||
{
|
{
|
||||||
for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) {
|
for (Direction dir = DIR_BEGIN; dir < DIR_END; dir++) {
|
||||||
TileIndex dest = tile + TileOffsByDir(dir);
|
TileIndex dest = tile + TileOffsByDir(dir);
|
||||||
|
@@ -346,6 +346,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|||||||
MakeBuoy(tile, wp->index, GetWaterClass(tile));
|
MakeBuoy(tile, wp->index, GetWaterClass(tile));
|
||||||
CheckForDockingTile(tile);
|
CheckForDockingTile(tile);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
ClearNeighbourNonFloodingStates(tile);
|
||||||
|
|
||||||
wp->UpdateVirtCoord();
|
wp->UpdateVirtCoord();
|
||||||
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
|
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
|
||||||
|
Reference in New Issue
Block a user