From 6ac86cbc1a32c275fb0ba65db99dc1451990fd08 Mon Sep 17 00:00:00 2001 From: Scott_NZ Date: Mon, 20 Aug 2012 14:57:02 +1200 Subject: [PATCH] Fix UnitsNearActor basing itself off the Soviet WP, instead of the actual actor. Move the power code to the unit building method so the Soviets don't build units completely, even if they have enough money. --- OpenRA.Mods.RA/Missions/Allies02Script.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.RA/Missions/Allies02Script.cs b/OpenRA.Mods.RA/Missions/Allies02Script.cs index 75dd633d59..2fc2879eea 100644 --- a/OpenRA.Mods.RA/Missions/Allies02Script.cs +++ b/OpenRA.Mods.RA/Missions/Allies02Script.cs @@ -68,8 +68,8 @@ namespace OpenRA.Mods.RA.Missions const string InfantryQueueName = "Infantry"; const string VehicleQueueName = "Vehicle"; - static List sovietInfantry = new List { "e1", "e2", "e3" }; - static List sovietVehicles = new List { "3tnk" }; + readonly List sovietInfantry = new List { "e1", "e2", "e3" }; + readonly List sovietVehicles = new List { "3tnk" }; static readonly string[] SovietVehicleAdditions = { "v2rl" }; const int SovietGroupSize = 5; const int SovietVehicleAdditionsTicks = 1500 * 4; @@ -211,11 +211,6 @@ namespace OpenRA.Mods.RA.Missions void AddSovietCashIfRequired() { - var powerManager = soviets.PlayerActor.Trait(); - if (powerManager.ExcessPower < 0) - { - return; - } var resources = soviets.PlayerActor.Trait(); if (resources.Cash < ReinforcementsCash) { @@ -225,6 +220,11 @@ namespace OpenRA.Mods.RA.Missions void BuildSovietUnits() { + var powerManager = soviets.PlayerActor.Trait(); + if (powerManager.ExcessPower < 0) + { + return; + } if (!sovietBarracks.Destroyed) { BuildSovietUnit(InfantryQueueName, sovietInfantry.Random(world.SharedRandom)); @@ -255,7 +255,7 @@ namespace OpenRA.Mods.RA.Missions Actor ClosestAlliedBuilding(Actor actor, int range) { - return BuildingsNearActor(allies2BasePoint, range) + return BuildingsNearActor(actor, range) .Where(a => a.Owner == allies2) .OrderBy(a => (actor.Location - a.Location).LengthSquared) .FirstOrDefault();