IOrderGenerator now renders itself (Removed various cast and is fails.). - Fixed silly bug in prev.
This commit is contained in:
@@ -41,30 +41,28 @@ namespace OpenRa.Game
|
||||
for (var i = 0; i < 128; i++)
|
||||
if (Game.UnitInfluence.GetUnitAt(new int2(i, j)) != null)
|
||||
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
||||
}
|
||||
|
||||
var placeBuilding = Game.controller.orderGenerator as PlaceBuilding;
|
||||
if (placeBuilding == null) return;
|
||||
|
||||
public void DrawBuildingGrid( UnitInfo.BuildingInfo bi )
|
||||
{
|
||||
var position = Game.controller.MousePosition.ToInt2();
|
||||
|
||||
var bi = placeBuilding.Building;
|
||||
|
||||
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
|
||||
|
||||
if (ShowBuildDebug)
|
||||
for (var j = 0; j < 128; j++)
|
||||
for (var i = 0; i < 128; i++)
|
||||
if (Game.GetDistanceToBase(new int2(i, j), Game.LocalPlayer) < maxDistance)
|
||||
if (Game.IsCellBuildable(new int2(i, j), bi.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel))
|
||||
if (!Game.map.ContainsResource(new int2(i,j)))
|
||||
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
||||
|
||||
var tooFarFromBase = !Footprint.Tiles(bi, position).Any(
|
||||
t => Game.GetDistanceToBase(t, Game.LocalPlayer) < maxDistance);
|
||||
if( ShowBuildDebug )
|
||||
for( var j = 0 ; j < 128 ; j++ )
|
||||
for( var i = 0 ; i < 128 ; i++ )
|
||||
if( Game.GetDistanceToBase( new int2( i, j ), Game.LocalPlayer ) < maxDistance )
|
||||
if( Game.IsCellBuildable( new int2( i, j ), bi.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel ) )
|
||||
if( !Game.map.ContainsResource( new int2( i, j ) ) )
|
||||
spriteRenderer.DrawSprite( unitDebug, Game.CellSize * new float2( i, j ), 0 );
|
||||
|
||||
var tooFarFromBase = !Footprint.Tiles( bi, position ).Any(
|
||||
t => Game.GetDistanceToBase( t, Game.LocalPlayer ) < maxDistance );
|
||||
|
||||
foreach( var t in Footprint.Tiles( bi, position ) )
|
||||
spriteRenderer.DrawSprite( (!tooFarFromBase && Game.IsCellBuildable( t, bi.WaterBound
|
||||
? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.map.ContainsResource(t))
|
||||
spriteRenderer.DrawSprite( ( !tooFarFromBase && Game.IsCellBuildable( t, bi.WaterBound
|
||||
? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.map.ContainsResource( t ) )
|
||||
? buildOk : buildBlocked, Game.CellSize * t, 0 );
|
||||
|
||||
spriteRenderer.Flush();
|
||||
|
||||
Reference in New Issue
Block a user