Fix CA1854
This commit is contained in:
@@ -322,8 +322,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Does this building have initial delay, if so have we passed it?
|
||||
if (baseBuilder.Info.BuildingDelays != null &&
|
||||
baseBuilder.Info.BuildingDelays.ContainsKey(name) &&
|
||||
baseBuilder.Info.BuildingDelays[name] > world.WorldTick)
|
||||
baseBuilder.Info.BuildingDelays.TryGetValue(name, out var delay) &&
|
||||
delay > world.WorldTick)
|
||||
continue;
|
||||
|
||||
// Can we build this structure?
|
||||
@@ -341,7 +341,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (count * 100 > frac.Value * playerBuildings.Length)
|
||||
continue;
|
||||
|
||||
if (baseBuilder.Info.BuildingLimits.ContainsKey(name) && baseBuilder.Info.BuildingLimits[name] <= count)
|
||||
if (baseBuilder.Info.BuildingLimits.TryGetValue(name, out var limit) && limit <= count)
|
||||
continue;
|
||||
|
||||
// If we're considering to build a naval structure, check whether there is enough water inside the base perimeter
|
||||
|
||||
@@ -79,9 +79,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// If we have recently tried and failed to find a use location for a power, then do not try again until later
|
||||
var isDelayed = waitingPowers[sp] > 0;
|
||||
if (sp.Ready && !isDelayed && powerDecisions.ContainsKey(sp.Info.OrderName))
|
||||
if (sp.Ready && !isDelayed && powerDecisions.TryGetValue(sp.Info.OrderName, out var powerDecision))
|
||||
{
|
||||
var powerDecision = powerDecisions[sp.Info.OrderName];
|
||||
if (powerDecision == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} couldn't find powerDecision for {1}", player.PlayerName, sp.Info.OrderName);
|
||||
|
||||
@@ -121,13 +121,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
if (Info.UnitDelays != null &&
|
||||
Info.UnitDelays.ContainsKey(name) &&
|
||||
Info.UnitDelays[name] > world.WorldTick)
|
||||
Info.UnitDelays.TryGetValue(name, out var delay) &&
|
||||
delay > world.WorldTick)
|
||||
return;
|
||||
|
||||
if (Info.UnitLimits != null &&
|
||||
Info.UnitLimits.ContainsKey(name) &&
|
||||
world.Actors.Count(a => a.Owner == player && a.Info.Name == name) >= Info.UnitLimits[name])
|
||||
Info.UnitLimits.TryGetValue(name, out var limit) &&
|
||||
world.Actors.Count(a => a.Owner == player && a.Info.Name == name) >= limit)
|
||||
return;
|
||||
|
||||
bot.QueueOrder(Order.StartProduction(queue.Actor, name, 1));
|
||||
|
||||
Reference in New Issue
Block a user