diff --git a/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs b/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs index e899e49fe3..183a848f80 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/BuildingUtils.cs @@ -53,8 +53,9 @@ namespace OpenRA.Mods.Common.Traits } } - // Replacements are enabled and the cell contained at least one (not ignored) actor - if (foundActors) + // Replacements are enabled and the cell contained at least one (not ignored) actor or building bib + var building = world.WorldActor.Trait().GetBuildingAt(cell); + if (foundActors || building != null) { // The cell contains at least one actor, and none were replaceable if (acceptedReplacements == null) @@ -68,6 +69,14 @@ namespace OpenRA.Mods.Common.Traits return false; } } + else + { + // HACK: To preserve legacy behaviour, AllowInvalidPlacement should display red placement indicators + // if (and only if) there is a building or bib in the cell + var building = world.WorldActor.Trait().GetBuildingAt(cell); + if (building != null) + return false; + } // Buildings can never be placed on ramps return world.Map.Ramp[cell] == 0 && bi.TerrainTypes.Contains(world.Map.GetTerrainInfo(cell).Type);