diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 340f3d02fe..b3671ddf33 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -6,7 +6,7 @@ using System.Text; using IjwFramework.Types; using OpenRa.FileFormats; using OpenRa.Game.GameRules; -using OpenRa.Game.Graphics; +using OpenRa.Game.Graphics; using System.Drawing; namespace OpenRa.Game @@ -142,16 +142,16 @@ namespace OpenRa.Game .Select( x => x.Order( this, game, xy ) ) .Where( x => x != null ) .FirstOrDefault(); - } - - public RectangleF Bounds - { - get - { - var size = SelectedSize; - var loc = CenterLocation - 0.5f * size; - return new RectangleF(loc.X, loc.Y, size.X, size.Y); - } + } + + public RectangleF Bounds + { + get + { + var size = SelectedSize; + var loc = CenterLocation - 0.5f * size; + return new RectangleF(loc.X, loc.Y, size.X, size.Y); + } } } diff --git a/OpenRa.Game/BuildingInfluenceMap.cs b/OpenRa.Game/BuildingInfluenceMap.cs index 4804af4cfa..18efbe568f 100644 --- a/OpenRa.Game/BuildingInfluenceMap.cs +++ b/OpenRa.Game/BuildingInfluenceMap.cs @@ -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; } diff --git a/OpenRa.Game/GameRules/Footprint.cs b/OpenRa.Game/GameRules/Footprint.cs index 0e3cde75c5..77986fcfc3 100644 --- a/OpenRa.Game/GameRules/Footprint.cs +++ b/OpenRa.Game/GameRules/Footprint.cs @@ -53,5 +53,23 @@ namespace OpenRa.Game.GameRules ++j; } } + + public static IEnumerable 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; + } + } } } diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index cd5ba8c2a1..1b87aaa0ca 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -95,10 +95,10 @@ namespace OpenRa.Game Button = e.Button, Event = MouseInputEvent.Move, Location = new int2(e.Location) - }); - - if (game.controller.orderGenerator != null) - game.controller.orderGenerator.PrepareOverlay(game, + }); + + if (game.controller.orderGenerator != null) + game.controller.orderGenerator.PrepareOverlay(game, ((1 / 24f) * (new float2(e.Location) + game.viewport.Location)).ToInt2()); } diff --git a/footprint.txt b/footprint.txt index 2c9f6b4dab..69900d848c 100644 --- a/footprint.txt +++ b/footprint.txt @@ -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