untangling a few things

This commit is contained in:
Chris Forbes
2009-10-12 21:23:09 +13:00
parent 8a5e84e265
commit 711b419ed0
9 changed files with 92 additions and 241 deletions

View File

@@ -20,7 +20,7 @@ namespace OpenRa.Game
buildBlocked = SynthesizeTile(0xe6);
}
Sprite SynthesizeTile(byte paletteIndex)
static Sprite SynthesizeTile(byte paletteIndex)
{
byte[] data = new byte[24 * 24];
@@ -36,15 +36,6 @@ namespace OpenRa.Game
if (!hasOverlay)
return;
Func<int2, bool> passableAt = a =>
{
a += game.map.Offset;
return game.map.IsInMap(a.X, a.Y) &&
TerrainCosts.Cost(UnitMovementType.Wheel,
game.terrain.tileSet.GetWalkability(game.map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
};
var footprint = Rules.Footprint.GetFootprint(name);
var j = 0;
foreach (var row in footprint)
@@ -53,7 +44,9 @@ namespace OpenRa.Game
foreach (var c in row)
{
if (c != '_')
spriteRenderer.DrawSprite(passableAt(position + new int2(i, j)) ? buildOk : buildBlocked,
spriteRenderer.DrawSprite(
game.IsCellBuildable(position + new int2(i, j))
? buildOk : buildBlocked,
24 * (position + new int2(i, j)), 0);
++i;
}