Fix CA1854
This commit is contained in:
@@ -91,8 +91,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (speed > 0)
|
||||
{
|
||||
var nodesDict = t.Value.ToDictionary();
|
||||
var cost = nodesDict.ContainsKey("PathingCost")
|
||||
? FieldLoader.GetValue<short>("cost", nodesDict["PathingCost"].Value)
|
||||
var cost = nodesDict.TryGetValue("PathingCost", out var entry)
|
||||
? FieldLoader.GetValue<short>("cost", entry.Value)
|
||||
: 10000 / speed;
|
||||
ret.Add(t.Key, new TerrainInfo(speed, (short)cost));
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// Existing smudge; make it deeper
|
||||
// A null Sequence indicates a deleted smudge.
|
||||
var tile = dirty.ContainsKey(loc) && dirty[loc].Sequence != null ? dirty[loc] : tiles[loc];
|
||||
var tile = dirty.TryGetValue(loc, out var d) && d.Sequence != null ? d : tiles[loc];
|
||||
var maxDepth = smudges[tile.Type].Length;
|
||||
if (tile.Depth < maxDepth - 1)
|
||||
tile.Depth++;
|
||||
@@ -180,7 +180,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!world.Map.Contains(loc))
|
||||
return;
|
||||
|
||||
var tile = dirty.ContainsKey(loc) ? dirty[loc] : default;
|
||||
var tile = dirty.TryGetValue(loc, out var d) ? d : default;
|
||||
|
||||
// Setting Sequence to null to indicate a deleted smudge.
|
||||
tile.Sequence = null;
|
||||
|
||||
Reference in New Issue
Block a user