finished building *Infos
This commit is contained in:
@@ -6,12 +6,12 @@ namespace OpenRa.Game.GameRules
|
||||
{
|
||||
static class Footprint
|
||||
{
|
||||
public static IEnumerable<int2> Tiles( BuildingInfo buildingInfo, int2 position )
|
||||
public static IEnumerable<int2> Tiles( LegacyBuildingInfo buildingInfo, int2 position )
|
||||
{
|
||||
return Tiles(buildingInfo, position, true);
|
||||
}
|
||||
|
||||
public static IEnumerable<int2> Tiles( BuildingInfo buildingInfo, int2 position, bool adjustForPlacement )
|
||||
public static IEnumerable<int2> Tiles( LegacyBuildingInfo buildingInfo, int2 position, bool adjustForPlacement )
|
||||
{
|
||||
var dim = buildingInfo.Dimensions;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRa.Game.GameRules
|
||||
return Tiles( building.unitInfo, a.Location, false );
|
||||
}
|
||||
|
||||
public static IEnumerable<int2> UnpathableTiles( BuildingInfo buildingInfo, int2 position )
|
||||
public static IEnumerable<int2> UnpathableTiles( LegacyBuildingInfo buildingInfo, int2 position )
|
||||
{
|
||||
var footprint = buildingInfo.Footprint.Where( x => !char.IsWhiteSpace( x ) ).ToArray();
|
||||
foreach( var tile in TilesWhere( buildingInfo.Name, buildingInfo.Dimensions, footprint, a => a == 'x' ) )
|
||||
@@ -52,7 +52,7 @@ namespace OpenRa.Game.GameRules
|
||||
yield return new int2( x, y );
|
||||
}
|
||||
|
||||
public static int2 AdjustForBuildingSize( BuildingInfo unitInfo )
|
||||
public static int2 AdjustForBuildingSize( LegacyBuildingInfo unitInfo )
|
||||
{
|
||||
var dim = unitInfo.Dimensions;
|
||||
return new int2( dim.X / 2, dim.Y > 1 ? ( dim.Y + 1 ) / 2 : 0 );
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace OpenRa.Game
|
||||
UnitCategory = Categories.SelectMany(x => x.Value.Select(y => new KeyValuePair<string, string>(y, x.Key))).ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
UnitInfo = new InfoLoader<LegacyUnitInfo>(
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Building", s => new BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Defense", s => new BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Building", s => new LegacyBuildingInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Defense", s => new LegacyBuildingInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Infantry", s => new InfantryInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Vehicle", s => new VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, LegacyUnitInfo>>("Ship", s => new VehicleInfo(s)),
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace OpenRa.Game.GameRules
|
||||
{
|
||||
foreach( var b in Rules.Categories[ "Building" ] )
|
||||
{
|
||||
var info = (BuildingInfo)Rules.UnitInfo[ b ];
|
||||
var info = (LegacyBuildingInfo)Rules.UnitInfo[ b ];
|
||||
foreach( var p in info.Produces )
|
||||
producesIndex[ p ].Add( info );
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace OpenRa.Game.GameRules
|
||||
public Cache<string, List<Actor>> GatherBuildings( Player player )
|
||||
{
|
||||
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info is BuildingInfo ) )
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info is LegacyBuildingInfo ) )
|
||||
ret[ b.Info.Name ].Add( b );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRa.Game.GameRules
|
||||
public VehicleInfo(string name) : base(name) { }
|
||||
}
|
||||
|
||||
public class BuildingInfo : LegacyUnitInfo
|
||||
public class LegacyBuildingInfo : LegacyUnitInfo
|
||||
{
|
||||
public readonly int2 Dimensions = new int2(1, 1);
|
||||
public readonly string Footprint = "x";
|
||||
@@ -112,6 +112,6 @@ namespace OpenRa.Game.GameRules
|
||||
public readonly int[] RallyPoint = { 1, 3 };
|
||||
public readonly float[] SpawnOffset = null;
|
||||
|
||||
public BuildingInfo(string name) : base(name) { }
|
||||
public LegacyBuildingInfo(string name) : base(name) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user