Fix CA1854

This commit is contained in:
RoosterDragon
2023-11-15 19:46:36 +00:00
committed by Pavel Penev
parent c2568ebd1f
commit c8efc5fdd7
19 changed files with 44 additions and 48 deletions

View File

@@ -308,11 +308,9 @@ namespace OpenRA.Mods.Common.Traits
clientActor, lookup.Keys, clientActor.Location, BlockedByActor.None,
location =>
{
if (!lookup.ContainsKey(location))
if (!lookup.TryGetValue(location, out var dock))
return 0;
var dock = lookup[location];
// Prefer docks with less occupancy (multiplier is to offset distance cost):
// TODO: add custom wieghts. E.g. owner vs allied.
return dock.Trait.ReservationCount * client.OccupancyCostModifier;