bugfix ("MovementType: Track" is actually in the emitted yaml now!) and some slight changes to how the optimizer works.

This commit is contained in:
Bob
2010-01-13 00:53:28 +13:00
parent ac9e58cf73
commit 35a4308476
4 changed files with 63 additions and 160 deletions

View File

@@ -30,6 +30,7 @@ namespace RulesConverter
public static IEnumerable<string> ToLines( this MiniYaml y, string name )
{
yield return name + ": " + y.Value;
if( y.Nodes != null )
foreach( var line in y.Nodes.ToLines( false ) )
yield return "\t" + line;
}
@@ -39,6 +40,8 @@ namespace RulesConverter
foreach( var key in y.Keys.ToList() )
{
var node = y[ key ];
try
{
MiniYaml inherits;
node.Nodes.TryGetValue( "Inherits", out inherits );
if( inherits == null || string.IsNullOrEmpty( inherits.Value ) )
@@ -53,6 +56,11 @@ namespace RulesConverter
if( y[ key ] == null )
y.Remove( key );
}
catch
{
node.Nodes.Remove( "Inherits" );
}
}
}
public static MiniYamlNodes Diff( MiniYamlNodes a, MiniYamlNodes b )
@@ -92,7 +100,7 @@ namespace RulesConverter
return a;
var diff = Diff( a.Nodes, b.Nodes );
if( diff == null )
if( diff == null && a.Value == b.Value )
return null;
return new MiniYaml( a.Value, diff );
}

View File

@@ -5,6 +5,8 @@ STNK:
Armor: heavy
Sight: 5
Speed: 10
Mobile:
MovementType: Track
Turreted:
AttackTurreted:
PrimaryWeapon: APTusk
@@ -27,6 +29,8 @@ TTNK:
Crewed: yes
Sight: 7
Speed: 8
Mobile:
MovementType: Track
AttackBase:
PrimaryWeapon: TTankZap
RenderUnitSpinner:
@@ -45,6 +49,8 @@ CTNK:
Armor: light
Sight: 5
Speed: 5
Mobile:
MovementType: Track
AttackBase:
PrimaryWeapon: APTusk
RenderUnit:
@@ -84,6 +90,8 @@ QTNK:
Crewed: no
Sight: 6
Speed: 3
Mobile:
MovementType: Track
RenderUnit:
MSUB:

View File

@@ -25,3 +25,9 @@ DefaultShip:
DefaultPlane:
Unit:
Selectable:
DefaultBuilding:
Selectable:
Priority: 3
Building:

167
ra.yaml
View File

@@ -14,6 +14,8 @@ V2RL:
Crewed: yes
Sight: 5
Speed: 7
Mobile:
MovementType: Track
AttackBase:
PrimaryWeapon: SCUD
RenderUnitReload:
@@ -35,6 +37,8 @@ V2RL:
Crewed: yes
Sight: 4
Speed: 9
Mobile:
MovementType: Track
Turreted:
AttackTurreted:
PrimaryWeapon: 75mm
@@ -58,6 +62,8 @@ V2RL:
Crewed: yes
Sight: 5
Speed: 8
Mobile:
MovementType: Track
Turreted:
AttackTurreted:
PrimaryWeapon: 90mm
@@ -81,6 +87,8 @@ V2RL:
Crewed: yes
Sight: 5
Speed: 7
Mobile:
MovementType: Track
Turreted:
AttackTurreted:
PrimaryWeapon: 105mm
@@ -104,6 +112,8 @@ V2RL:
Crewed: yes
Sight: 6
Speed: 4
Mobile:
MovementType: Track
Turreted:
AttackTurreted:
PrimaryWeapon: 120mm
@@ -131,6 +141,8 @@ MRJ:
Crewed: yes
Sight: 7
Speed: 9
Mobile:
MovementType: Track
RenderUnitSpinner:
Offset: 0,4,0,-6
@@ -169,8 +181,11 @@ ARTY:
HP: 75
Armor: light
Crewed: yes
ROT: 2
Sight: 5
Speed: 6
Mobile:
MovementType: Track
AttackBase:
PrimaryWeapon: 155mm
RenderUnit:
@@ -196,6 +211,8 @@ HARV:
Crewed: yes
Sight: 4
Speed: 6
Mobile:
MovementType: Track
RenderUnit:
MCV:
@@ -233,6 +250,7 @@ JEEP:
HP: 150
Armor: light
Crewed: yes
ROT: 10
Sight: 6
Speed: 10
Turreted:
@@ -258,6 +276,8 @@ APC:
Armor: heavy
Sight: 5
Speed: 10
Mobile:
MovementType: Track
AttackBase:
PrimaryWeapon: M60mg
PrimaryOffset: 0,0,0,-4
@@ -286,6 +306,8 @@ MNLY.AP:
Crewed: yes
Sight: 5
Speed: 9
Mobile:
MovementType: Track
RenderUnit:
Image: MNLY
Minelayer:
@@ -311,6 +333,8 @@ MNLY.AT:
Crewed: yes
Sight: 5
Speed: 9
Mobile:
MovementType: Track
RenderUnit:
Image: MNLY
Minelayer:
@@ -908,8 +932,6 @@ ATEK:
Description: Allied Tech Center
LongDesc: Provides Allied advanced technologies.\n Special Ability: GPS Satellite
AlternateName: @Tech Center
Selectable:
Priority: 3
Building:
Power: -200
Footprint: xx xx
@@ -934,8 +956,6 @@ WEAP:
Cost: 2000
Description: War Factory
LongDesc: Produces tanks & light vehicles.
Selectable:
Priority: 3
Building:
Power: -30
Footprint: xxx xxx
@@ -963,8 +983,6 @@ SYRD:
Cost: 650
Description: Shipyard
LongDesc: Produces and repairs ships
Selectable:
Priority: 3
Building:
Power: -30
Footprint: xxx xxx xxx
@@ -990,8 +1008,6 @@ SPEN:
Cost: 650
Description: Sub Pen
LongDesc: Produces and repairs submarines and \ntransports
Selectable:
Priority: 3
Building:
Power: -30
Footprint: xxx xxx xxx
@@ -1009,8 +1025,6 @@ SPEN:
FACT:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Power: 0
Footprint: xxx xxx xxx
@@ -1037,8 +1051,6 @@ PROC:
Cost: 2000
Description: Ore Refinery
LongDesc: Converts Ore and Gems into money
Selectable:
Priority: 3
Building:
Power: -30
Footprint: _x_ xxx x==
@@ -1066,8 +1078,6 @@ SILO:
Cost: 150
Description: Silo
LongDesc: Stores excess harvested Ore
Selectable:
Priority: 3
Building:
Power: -10
Footprint: x
@@ -1092,8 +1102,6 @@ HPAD:
Cost: 1500
Description: Helipad
LongDesc: Produces and reloads helicopters
Selectable:
Priority: 3
Building:
Power: -10
Footprint: xx xx
@@ -1122,8 +1130,6 @@ DOME:
Cost: 1000
Description: Radar Dome
LongDesc: Provides an overview of the battlefield.\n Requires power to operate.
Selectable:
Priority: 3
Building:
Power: -40
RequiresPower: true
@@ -1149,8 +1155,6 @@ AFLD:
Cost: 600
Description: Airstrip
LongDesc: Produces and reloads planes\n Special Ability: Paratroopers\n Special Ability: Spy Plane
Selectable:
Priority: 3
Building:
Power: -30
Footprint: xxx xxx
@@ -1176,8 +1180,6 @@ POWR:
Cost: 300
Description: Power Plant
LongDesc: Provides power for other structures
Selectable:
Priority: 3
Building:
Power: 100
Footprint: xx xx
@@ -1201,8 +1203,6 @@ APWR:
Cost: 500
Description: Advanced Power Plant
LongDesc: Provides more power, cheaper than the \nstandard Power Plant
Selectable:
Priority: 3
Building:
Power: 200
Footprint: ___ xxx xxx
@@ -1227,8 +1227,6 @@ STEK:
Description: Soviet Tech Center
LongDesc: Provides Soviet advanced technologies
AlternateName: @Tech Center
Selectable:
Priority: 3
Building:
Power: -100
Footprint: xxx xxx
@@ -1252,8 +1250,6 @@ BARR:
Cost: 300
Description: Soviet Barracks
LongDesc: Produces infantry
Selectable:
Priority: 3
Building:
Power: -20
Footprint: xx xx
@@ -1280,8 +1276,6 @@ TENT:
Cost: 300
Description: Allied Barracks
LongDesc: Produces infantry
Selectable:
Priority: 3
Building:
Power: -20
Footprint: xx xx
@@ -1308,8 +1302,6 @@ KENN:
Cost: 200
Description: Kennel
LongDesc: Produces attack dogs
Selectable:
Priority: 3
Building:
Power: -10
Footprint: x
@@ -1332,8 +1324,6 @@ FIX:
Cost: 1200
Description: Service Depot
LongDesc: Repairs vehicles, reloads minelayers, and \nallows the construction of additional bases.
Selectable:
Priority: 3
Building:
Power: -30
Footprint: _x_ xxx _x_
@@ -1357,8 +1347,6 @@ FACF:
Cost: 50
Description: Fake Construction Yard
LongDesc: Looks like a Construction Yard.
Selectable:
Priority: 3
Building:
Power: -2
Footprint: xxx xxx xxx
@@ -1383,8 +1371,6 @@ WEAF:
Cost: 50
Description: Fake War Factory
LongDesc: Looks like a War Factory.
Selectable:
Priority: 3
Building:
Power: -2
Footprint: xxx xxx
@@ -1410,8 +1396,6 @@ SYRF:
Cost: 50
Description: Fake Shipyard
LongDesc: Looks like a Shipyard
Selectable:
Priority: 3
Building:
Power: -2
Footprint: xxx xxx xxx
@@ -1428,8 +1412,6 @@ SYRF:
SPEF:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Power: -2
Footprint: xxx xxx xxx
@@ -1454,8 +1436,6 @@ DOMF:
Cost: 50
Description: Fake Radar Dome
LongDesc: Looks like a Radar Dome
Selectable:
Priority: 3
Building:
Power: -2
Footprint: xx xx
@@ -1470,7 +1450,6 @@ DOMF:
Fake:
MINP:
Inherits: DefaultBuilding
Unit:
HP: 1
RenderUnit:
@@ -1479,7 +1458,6 @@ MINP:
InvisibleToOthers:
MINV:
Inherits: DefaultBuilding
Unit:
HP: 1
RenderUnit:
@@ -1488,147 +1466,126 @@ MINV:
InvisibleToOthers:
T01:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T02:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T03:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T05:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T06:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T07:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T08:
Inherits: DefaultBuilding
Building:
Footprint: x_
Dimensions: 2,1
RenderBuilding:
T10:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T11:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T12:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T13:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T14:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T15:
Inherits: DefaultBuilding
Building:
Footprint: xx xx
Dimensions: 2,2
RenderBuilding:
T16:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
T17:
Inherits: DefaultBuilding
Building:
Footprint: x_ x_
Dimensions: 2,2
RenderBuilding:
TC01:
Inherits: DefaultBuilding
Building:
Footprint: xx_ xx_
Dimensions: 3,2
RenderBuilding:
TC02:
Inherits: DefaultBuilding
Building:
Footprint: xx_ xx_
Dimensions: 3,2
RenderBuilding:
TC03:
Inherits: DefaultBuilding
Building:
Footprint: xx_ xx_
Dimensions: 3,2
RenderBuilding:
TC04:
Inherits: DefaultBuilding
Building:
Footprint: xxx_ xxx_ xxx_
Dimensions: 4,3
RenderBuilding:
TC05:
Inherits: DefaultBuilding
Building:
Footprint: xxx_ xxx_ xxx_
Dimensions: 4,3
RenderBuilding:
MINE:
Inherits: DefaultBuilding
Building:
Footprint: x
Dimensions: 1,1
@@ -1637,8 +1594,6 @@ MINE:
FCOM:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Power: -200
Footprint: xx xx
@@ -1653,8 +1608,6 @@ FCOM:
V01:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx xx
Dimensions: 2,2
@@ -1666,8 +1619,6 @@ V01:
V02:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx xx
Dimensions: 2,2
@@ -1678,8 +1629,6 @@ V02:
V03:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx xx
Dimensions: 2,2
@@ -1690,8 +1639,6 @@ V03:
V04:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx xx
Dimensions: 2,2
@@ -1702,8 +1649,6 @@ V04:
V05:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx
Dimensions: 2,1
@@ -1714,8 +1659,6 @@ V05:
V06:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx
Dimensions: 2,1
@@ -1726,8 +1669,6 @@ V06:
V07:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: xx
Dimensions: 2,1
@@ -1738,8 +1679,6 @@ V07:
V08:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1750,8 +1689,6 @@ V08:
V09:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1762,8 +1699,6 @@ V09:
V10:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1774,8 +1709,6 @@ V10:
V11:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1786,8 +1719,6 @@ V11:
V12:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1798,8 +1729,6 @@ V12:
V13:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1810,8 +1739,6 @@ V13:
V14:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1822,8 +1749,6 @@ V14:
V15:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1834,8 +1759,6 @@ V15:
V16:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1846,8 +1769,6 @@ V16:
V17:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1858,8 +1779,6 @@ V17:
V18:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1870,8 +1789,6 @@ V18:
V19:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Footprint: x
Dimensions: 1,1
@@ -1882,8 +1799,6 @@ V19:
V20:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1893,8 +1808,6 @@ V20:
V21:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1904,8 +1817,6 @@ V21:
V22:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1915,8 +1826,6 @@ V22:
V23:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1926,8 +1835,6 @@ V23:
V24:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1937,8 +1844,6 @@ V24:
V25:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1948,8 +1853,6 @@ V25:
V26:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1959,8 +1862,6 @@ V26:
V27:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1970,8 +1871,6 @@ V27:
V28:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1981,8 +1880,6 @@ V28:
V29:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -1992,8 +1889,6 @@ V29:
V30:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2003,8 +1898,6 @@ V30:
V31:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2014,8 +1907,6 @@ V31:
V32:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2025,8 +1916,6 @@ V32:
V33:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2036,8 +1925,6 @@ V33:
V34:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2047,8 +1934,6 @@ V34:
V35:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2058,8 +1943,6 @@ V35:
V36:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400
@@ -2069,8 +1952,6 @@ V36:
V37:
Inherits: DefaultBuilding
Selectable:
Priority: 3
Building:
Repairable: false
HP: 400