cleaning techtree & sidebar; building placement is mostly fixed

This commit is contained in:
Chris Forbes
2009-10-20 22:35:05 +13:00
parent b3aa4bf60b
commit 6c0ced3e9a
8 changed files with 121 additions and 144 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.GameRules;
namespace OpenRa.Game
{
class PlaceBuilding : IOrderGenerator
{
public readonly Player Owner;
public readonly string Name;
public PlaceBuilding(Player owner, string name)
{
Owner = owner;
Name = name;
}
public IEnumerable<Order> Order(int2 xy)
{
// todo: check that space is free
if (Footprint.Tiles(Name, xy).Any(t => !Game.IsCellBuildable(t, UnitMovementType.Wheel)))
yield break;
yield return new PlaceBuildingOrder(this, xy);
}
public void PrepareOverlay(int2 xy)
{
Game.worldRenderer.uiOverlay.SetCurrentOverlay(xy, Name);
}
}
}