local player buildings influence map, incrementally updated.

This commit is contained in:
Chris Forbes
2009-10-13 18:13:22 +13:00
parent e255a48645
commit 0f0b4230c7
6 changed files with 81 additions and 25 deletions

View File

@@ -23,7 +23,8 @@ namespace OpenRa.Game
public readonly Dictionary<int, Player> players = new Dictionary<int, Player>();
public Player LocalPlayer { get { return players[localPlayerIndex]; } }
public Player LocalPlayer { get { return players[localPlayerIndex]; } }
public BuildingInfluenceMap LocalPlayerBuildings;
public Game(string mapName, Renderer renderer, int2 clientSize)
{
@@ -46,7 +47,9 @@ namespace OpenRa.Game
pathFinder = new PathFinder(map, terrain.tileSet);
network = new Network();
network = new Network();
LocalPlayerBuildings = new BuildingInfluenceMap(world, LocalPlayer);
controller = new Controller(this); // CAREFUL THERES AN UGLY HIDDEN DEPENDENCY HERE STILL
worldRenderer = new WorldRenderer(renderer, this);
@@ -62,11 +65,13 @@ namespace OpenRa.Game
public bool IsCellBuildable(int2 a)
{
if (LocalPlayerBuildings[a] != null) return false;
a += map.Offset;
return map.IsInMap(a.X, a.Y) &&
TerrainCosts.Cost(UnitMovementType.Wheel,
terrain.tileSet.GetWalkability(map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
TerrainCosts.Cost(UnitMovementType.Wheel,
terrain.tileSet.GetWalkability(map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
}
public IEnumerable<Actor> FindUnits(float2 a, float2 b)