Some parts of some buildings are pathable.

- not handling WEAP/FIX yet; that's special-case logic.
This commit is contained in:
Bob
2009-10-13 19:11:32 +13:00
parent c6e739d162
commit 9ba0a632e2
5 changed files with 40 additions and 21 deletions

View File

@@ -20,14 +20,14 @@ namespace OpenRa.Game
void AddInfluence(Actor a)
{
foreach (var t in Footprint.Tiles(a.unitInfo.Name, a.Location))
foreach (var t in Footprint.UnpathableTiles(a.unitInfo.Name, a.Location))
if (IsValid(t))
influence[t.X, t.Y] = a;
}
void RemoveInfluence(Actor a)
{
foreach (var t in Footprint.Tiles(a.unitInfo.Name, a.Location))
foreach (var t in Footprint.UnpathableTiles(a.unitInfo.Name, a.Location))
if (IsValid(t))
influence[t.X, t.Y] = null;
}

View File

@@ -53,5 +53,23 @@ namespace OpenRa.Game.GameRules
++j;
}
}
public static IEnumerable<int2> UnpathableTiles( string name, int2 position )
{
var footprint = Rules.Footprint.GetFootprint( name );
var j = 0;
foreach( var row in footprint )
{
var i = 0;
foreach( var c in row )
{
if( c == 'x' )
yield return position + new int2( i, j );
++i;
}
++j;
}
}
}
}

View File

@@ -6,10 +6,11 @@
x : ftur sbag brik fenc gun pbox hbox silo gap kenn *
_ x : tsla agun
xx xx xx : powr dome barr tent domf hpad atek
xxx xxx xxx : fact facf syrf syrd weap weaf spen spef apwr stek
xx xx == : powr dome barr tent domf hpad atek
xxx xxx === : fact facf weap weaf apwr stek
xxx xxx xxx : syrf syrd spen spef
xx : sam mslo
_x_ xxx xxx xxx : proc
_x_ xxx x== === : proc
xxx xxx : afld
_x_ xxx _x_ : fix
__ xx : iron
xx xx : iron