Cache cell ramps to avoid repeated tileset lookups.

This commit is contained in:
Paul Chote
2020-05-04 00:20:48 +01:00
committed by atlimit8
parent 1354ffc32e
commit 4614f6febe
9 changed files with 37 additions and 56 deletions

View File

@@ -109,15 +109,7 @@ namespace OpenRA.Mods.Common.Traits
if (!rt.Info.AllowUnderBuildings && buildingInfluence.GetBuildingAt(cell) != null)
return false;
if (!rt.Info.AllowOnRamps)
{
var tile = world.Map.Tiles[cell];
var tileInfo = world.Map.Rules.TileSet.GetTileInfo(tile);
if (tileInfo != null && tileInfo.RampType > 0)
return false;
}
return true;
return rt.Info.AllowOnRamps || world.Map.Ramp[cell] == 0;
}
public bool CanSpawnResourceAt(ResourceType newResourceType, CPos cell)