removed a bit of duplication

This commit is contained in:
Chris Forbes
2009-10-20 20:51:30 +13:00
parent a4c344523f
commit bca1479a66

View File

@@ -25,18 +25,14 @@ namespace OpenRa.Game.Traits
{
var fp = Rules.Footprint.GetFootprint(self.unitInfo.Name);
var bibOffset = fp.Length - 2;
var hasSmallBib = fp.First().Length == 2;
var size = fp.First().Length;
var startIndex = (size == 2) ? SmallBibStart : LargeBibStart;
if (hasSmallBib)
for (int i = 0; i < 4; i++)
for (int i = 0; i < 2*size; i++)
Game.map.MapTiles[
self.Location.X + i % 2 + Game.map.Offset.X,
self.Location.Y + i / 2 + Game.map.Offset.Y + bibOffset].smudge = (byte)(i + SmallBibStart);
else
for (int i = 0; i < 6; i++)
Game.map.MapTiles[
self.Location.X + i % 3 + Game.map.Offset.X,
self.Location.Y + i / 3 + Game.map.Offset.Y + bibOffset].smudge = (byte)(i + LargeBibStart);
self.Location.X + i % size + Game.map.Offset.X,
self.Location.Y + i / size + Game.map.Offset.Y + bibOffset].smudge = (byte)(i + startIndex);
}
}