Fix CA1851

This commit is contained in:
RoosterDragon
2023-07-13 20:08:36 +01:00
committed by abcdefg30
parent 88f830a9e5
commit 3275875ae5
63 changed files with 349 additions and 267 deletions

View File

@@ -11,7 +11,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Eluant;
using Eluant.ObjectBinding;
using OpenRA.Scripting;
@@ -139,20 +138,21 @@ namespace OpenRA
{
public static WPos Average(this IEnumerable<WPos> source)
{
var length = source.Count();
if (length == 0)
return WPos.Zero;
var length = 0;
var x = 0L;
var y = 0L;
var z = 0L;
foreach (var pos in source)
{
length++;
x += pos.X;
y += pos.Y;
z += pos.Z;
}
if (length == 0)
return WPos.Zero;
x /= length;
y /= length;
z /= length;