diff --git a/OpenRA.Server/Class1.cs b/OpenRA.Server/Class1.cs index dab8fd96c3..050ca7cd64 100644 --- a/OpenRA.Server/Class1.cs +++ b/OpenRA.Server/Class1.cs @@ -16,8 +16,13 @@ namespace OpenRA.Server var right = new TcpListener(1235); right.Start(); - var l = left.AcceptTcpClient().GetStream(); - var r = right.AcceptTcpClient().GetStream(); + var lc = left.AcceptTcpClient(); + lc.NoDelay = true; + var l = lc.GetStream(); + + var rc = right.AcceptTcpClient(); + rc.NoDelay = true; + var r = rc.GetStream(); var ll = new Thread(RW(l, r)); var rr = new Thread(RW(r, l)); diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 8c8d9606a0..c1c6fd0b5f 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -65,7 +65,7 @@ namespace OpenRa.Game DrawBuildPalette("Building"); } - static string[] groups = new string[] { "Building", "Vehicle", "Ship", "Infantry", "Plane" }; + static string[] groups = new string[] { "Building", "Defense", "Vehicle", "Ship", "Infantry", "Plane" }; Dictionary sprites; void DrawBuildPalette(string queueName) @@ -75,7 +75,9 @@ namespace OpenRa.Game var y = 0; var buildableItems = Rules.TechTree.BuildableItems(Game.LocalPlayer, queueName).ToArray(); - foreach (var item in Rules.TechTree.AllItems(Game.LocalPlayer, queueName)) + var allItems = Rules.TechTree.AllItems(Game.LocalPlayer, queueName) + .OrderBy( a => Rules.UnitInfo[a].TechLevel ); + foreach (var item in allItems) { if (Rules.UnitInfo[item].TechLevel == -1) continue; var rect = new Rectangle(Game.viewport.Width - (3 - x) * 64 - 20, 32 + 48 * y, 64, 48); diff --git a/OpenRa.Game/GameRules/Rules.cs b/OpenRa.Game/GameRules/Rules.cs index 4b305b8c2d..a4f5a2909b 100755 --- a/OpenRa.Game/GameRules/Rules.cs +++ b/OpenRa.Game/GameRules/Rules.cs @@ -10,7 +10,7 @@ namespace OpenRa.Game static class Rules { public static IniFile AllRules; - public static Dictionary> Categories = new Dictionary>(); + public static Dictionary> Categories = new Dictionary>(); public static Dictionary UnitCategory; public static InfoLoader UnitInfo; public static InfoLoader WeaponInfo; @@ -19,41 +19,43 @@ namespace OpenRa.Game public static GeneralInfo General; public static TechTree TechTree; - public static void LoadRules( string mapFileName ) + public static void LoadRules(string mapFileName) { AllRules = new IniFile( - FileSystem.Open( mapFileName ), - FileSystem.Open( "rules.ini" ), - FileSystem.Open( "units.ini" ), - FileSystem.Open( "campaignUnits.ini" ) ); + FileSystem.Open(mapFileName), + FileSystem.Open("rules.ini"), + FileSystem.Open("units.ini"), + FileSystem.Open("campaignUnits.ini")); General = new GeneralInfo(); FieldLoader.Load(General, AllRules.GetSection("General")); LoadCategories( "Building", + "Defense", "Infantry", "Vehicle", "Ship", - "Plane" ); - UnitCategory = Categories.SelectMany( x => x.Value.Select( y => new KeyValuePair( y, x.Key ) ) ).ToDictionary( x => x.Key, x => x.Value ); + "Plane"); + UnitCategory = Categories.SelectMany(x => x.Value.Select(y => new KeyValuePair(y, x.Key))).ToDictionary(x => x.Key, x => x.Value); UnitInfo = new InfoLoader( - Pair.New>( "Building", s => new UnitInfo.BuildingInfo(s)), - Pair.New>( "Infantry", s => new UnitInfo.InfantryInfo(s)), - Pair.New>( "Vehicle", s => new UnitInfo.VehicleInfo(s)), - Pair.New>( "Ship", s => new UnitInfo.VehicleInfo(s)), - Pair.New>( "Plane", s => new UnitInfo.VehicleInfo(s))); + Pair.New>("Building", s => new UnitInfo.BuildingInfo(s)), + Pair.New>("Defense", s => new UnitInfo.BuildingInfo(s)), + Pair.New>("Infantry", s => new UnitInfo.InfantryInfo(s)), + Pair.New>("Vehicle", s => new UnitInfo.VehicleInfo(s)), + Pair.New>("Ship", s => new UnitInfo.VehicleInfo(s)), + Pair.New>("Plane", s => new UnitInfo.VehicleInfo(s))); LoadCategories( "Weapon", "Warhead", - "Projectile" ); + "Projectile"); WeaponInfo = new InfoLoader( - Pair.New>("Weapon", _ => new WeaponInfo())); + Pair.New>("Weapon", _ => new WeaponInfo())); WarheadInfo = new InfoLoader( - Pair.New>("Warhead", _ => new WarheadInfo())); + Pair.New>("Warhead", _ => new WarheadInfo())); ProjectileInfo = new InfoLoader( Pair.New>("Projectile", _ => new ProjectileInfo())); @@ -61,10 +63,10 @@ namespace OpenRa.Game TechTree = new TechTree(); } - static void LoadCategories( params string[] types ) + static void LoadCategories(params string[] types) { - foreach( var t in types ) - Categories[ t ] = AllRules.GetSection( t + "Types" ).Select( x => x.Key.ToLowerInvariant() ).ToList(); + foreach (var t in types) + Categories[t] = AllRules.GetSection(t + "Types").Select(x => x.Key.ToLowerInvariant()).ToList(); } } } diff --git a/units.ini b/units.ini index 5fd9cd1c0a..06210f5211 100755 --- a/units.ini +++ b/units.ini @@ -143,27 +143,30 @@ Traits=Mobile, RenderUnitRotor -[BuildingTypes] +[DefenseTypes] IRON -ATEK PDOX -WEAP -SYRD -SPEN PBOX HBOX TSLA GUN AGUN FTUR +GAP +SAM +MSLO + + +[BuildingTypes] +ATEK +WEAP +SYRD +SPEN FACT PROC SILO HPAD DOME -GAP -SAM -MSLO AFLD POWR APWR