unit influence blocks building
This commit is contained in:
@@ -31,48 +31,50 @@ namespace OpenRa.Game
|
||||
public static Dictionary<int, Player> players = new Dictionary<int, Player>();
|
||||
|
||||
public static Player LocalPlayer { get { return players[localPlayerIndex]; } }
|
||||
public static BuildingInfluenceMap BuildingInfluence;
|
||||
public static BuildingInfluenceMap BuildingInfluence;
|
||||
public static UnitInfluenceMap UnitInfluence;
|
||||
|
||||
static ISoundEngine soundEngine;
|
||||
|
||||
public static void Initialize(string mapName, Renderer renderer, int2 clientSize, int localPlayer)
|
||||
{
|
||||
Rules.LoadRules( mapName );
|
||||
|
||||
for( int i = 0 ; i < 8 ; i++ )
|
||||
players.Add(i, new Player(i, string.Format("Multi{0}", i), Race.Soviet));
|
||||
|
||||
localPlayerIndex = localPlayer;
|
||||
|
||||
var mapFile = new IniFile( FileSystem.Open( mapName ) );
|
||||
map = new Map( mapFile );
|
||||
FileSystem.Mount(new Package(map.Theater + ".mix"));
|
||||
|
||||
viewport = new Viewport(clientSize, map.Size, renderer);
|
||||
|
||||
terrain = new TerrainRenderer(renderer, map, viewport);
|
||||
world = new World();
|
||||
treeCache = new TreeCache(map);
|
||||
|
||||
foreach( TreeReference treeReference in map.Trees )
|
||||
world.Add( new Actor( treeReference, treeCache, map.Offset ) );
|
||||
|
||||
BuildingInfluence = new BuildingInfluenceMap(world, 8);
|
||||
|
||||
LoadMapBuildings( mapFile );
|
||||
LoadMapUnits( mapFile );
|
||||
|
||||
pathFinder = new PathFinder(map, terrain.tileSet, BuildingInfluence);
|
||||
|
||||
network = new Network();
|
||||
|
||||
controller = new Controller();
|
||||
worldRenderer = new WorldRenderer(renderer);
|
||||
|
||||
soundEngine = new ISoundEngine();
|
||||
sounds = new Cache<string, ISoundSource>(LoadSound);
|
||||
|
||||
PlaySound("intro.aud", false);
|
||||
static ISoundEngine soundEngine;
|
||||
|
||||
public static void Initialize(string mapName, Renderer renderer, int2 clientSize, int localPlayer)
|
||||
{
|
||||
Rules.LoadRules(mapName);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
players.Add(i, new Player(i, string.Format("Multi{0}", i), Race.Soviet));
|
||||
|
||||
localPlayerIndex = localPlayer;
|
||||
|
||||
var mapFile = new IniFile(FileSystem.Open(mapName));
|
||||
map = new Map(mapFile);
|
||||
FileSystem.Mount(new Package(map.Theater + ".mix"));
|
||||
|
||||
viewport = new Viewport(clientSize, map.Size, renderer);
|
||||
|
||||
terrain = new TerrainRenderer(renderer, map, viewport);
|
||||
world = new World();
|
||||
treeCache = new TreeCache(map);
|
||||
|
||||
foreach (TreeReference treeReference in map.Trees)
|
||||
world.Add(new Actor(treeReference, treeCache, map.Offset));
|
||||
|
||||
BuildingInfluence = new BuildingInfluenceMap(8);
|
||||
UnitInfluence = new UnitInfluenceMap();
|
||||
|
||||
LoadMapBuildings(mapFile);
|
||||
LoadMapUnits(mapFile);
|
||||
|
||||
pathFinder = new PathFinder(map, terrain.tileSet, BuildingInfluence);
|
||||
|
||||
network = new Network();
|
||||
|
||||
controller = new Controller();
|
||||
worldRenderer = new WorldRenderer(renderer);
|
||||
|
||||
soundEngine = new ISoundEngine();
|
||||
sounds = new Cache<string, ISoundSource>(LoadSound);
|
||||
|
||||
PlaySound("intro.aud", false);
|
||||
}
|
||||
|
||||
static void LoadMapBuildings( IniFile mapfile )
|
||||
@@ -122,14 +124,16 @@ namespace OpenRa.Game
|
||||
public static void Tick()
|
||||
{
|
||||
var stuffFromOtherPlayers = network.Tick(); // todo: actually use the orders!
|
||||
world.Update();
|
||||
world.Update();
|
||||
UnitInfluence.Tick();
|
||||
|
||||
viewport.DrawRegions();
|
||||
}
|
||||
|
||||
public static bool IsCellBuildable(int2 a, UnitMovementType umt)
|
||||
{
|
||||
if (BuildingInfluence.GetBuildingAt(a) != null) return false;
|
||||
if (BuildingInfluence.GetBuildingAt(a) != null) return false;
|
||||
if (UnitInfluence.GetUnitAt(a) != null) return false;
|
||||
|
||||
a += map.Offset;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user