Fix Concrete placement on invalid terrain.

This commit is contained in:
Paul Chote
2021-01-30 13:10:28 +00:00
committed by abcdefg30
parent f767c24601
commit e830d1e9c2

View File

@@ -93,7 +93,8 @@ namespace OpenRA.Mods.D2k.Traits.Buildings
// Fill the footprint with random variants
foreach (var c in info.Tiles(self.Location))
{
if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue)
// Only place on allowed terrain types
if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue || !info.TerrainTypes.Contains(map.GetTerrainInfo(c).Type))
continue;
// Don't place under other buildings (or their bib)
@@ -109,7 +110,9 @@ namespace OpenRA.Mods.D2k.Traits.Buildings
for (var i = 0; i < template.TilesCount; i++)
{
var c = self.Location + new CVec(i % template.Size.X, i / template.Size.X);
if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue)
// Only place on allowed terrain types
if (!map.Contains(c) || map.CustomTerrain[c] != byte.MaxValue || !info.TerrainTypes.Contains(map.GetTerrainInfo(c).Type))
continue;
// Don't place under other buildings (or their bib)