Convert extension in real extension

This commit is contained in:
Eduardo Cáceres
2022-05-02 13:13:15 +02:00
committed by atlimit8
parent 2677e9c013
commit b71402f64d
8 changed files with 9 additions and 9 deletions

View File

@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc.FileFormats
var dataLength = frameOffsets[CurrentFrameIndex + 1] - frameOffsets[CurrentFrameIndex]; var dataLength = frameOffsets[CurrentFrameIndex + 1] - frameOffsets[CurrentFrameIndex];
var rawData = StreamExts.ReadBytes(stream, (int)dataLength); var rawData = stream.ReadBytes((int)dataLength);
var intermediateData = new byte[Width * Height]; var intermediateData = new byte[Width * Height];
// Format80 decompression // Format80 decompression

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Cnc.VideoLoaders
if (flags == 1) if (flags == 1)
{ {
var palette = StreamExts.ReadBytes(s, 768); var palette = s.ReadBytes(768);
for (var i = 0; i < offsets.Length; i++) for (var i = 0; i < offsets.Length; i++)
offsets[i] += 768; offsets[i] += 768;
} }

View File

@@ -204,7 +204,7 @@ namespace OpenRA.Mods.Common.Activities
return null; return null;
} }
var containsTemporaryBlocker = WorldUtils.ContainsTemporaryBlocker(self.World, nextCell, self); var containsTemporaryBlocker = self.World.ContainsTemporaryBlocker(nextCell, self);
// Next cell in the move is blocked by another actor // Next cell in the move is blocked by another actor
if (containsTemporaryBlocker || !mobile.CanEnterCell(nextCell, ignoreActor)) if (containsTemporaryBlocker || !mobile.CanEnterCell(nextCell, ignoreActor))

View File

@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Effects
if (clockFraction != null) if (clockFraction != null)
{ {
clock = new Animation(owner.World, posterCollection); clock = new Animation(owner.World, posterCollection);
clock.PlayFetchIndex(clockSequence, () => Exts.Clamp((int)(clockFraction() * (clock.CurrentSequence.Length - 1)), 0, clock.CurrentSequence.Length - 1)); clock.PlayFetchIndex(clockSequence, () => ((int)(clockFraction() * (clock.CurrentSequence.Length - 1))).Clamp(0, clock.CurrentSequence.Length - 1));
} }
} }
} }

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Orders
protected virtual bool IsValidTrait(T t) protected virtual bool IsValidTrait(T t)
{ {
return Exts.IsTraitEnabled(t); return t.IsTraitEnabled();
} }
protected IEnumerable<Order> OrderInner(World world, MouseInput mi) protected IEnumerable<Order> OrderInner(World world, MouseInput mi)

View File

@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
if (blockers.Count == 0) if (blockers.Count == 0)
continue; continue;
var hitPos = WorldExtensions.MinimumPointLineProjection(start, end, a.CenterPosition); var hitPos = start.MinimumPointLineProjection(end, a.CenterPosition);
var dat = world.Map.DistanceAboveTerrain(hitPos); var dat = world.Map.DistanceAboveTerrain(hitPos);
if ((hitPos - start).Length < length && blockers.Any(t => t.BlockingHeight > dat)) if ((hitPos - start).Length < length && blockers.Any(t => t.BlockingHeight > dat))
{ {

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
var warheads = objectCreator.GetTypesImplementing<IWarhead>().OrderBy(t => t.Namespace); var warheads = objectCreator.GetTypesImplementing<IWarhead>().OrderBy(t => t.Namespace);
var projectiles = objectCreator.GetTypesImplementing<IProjectileInfo>().OrderBy(t => t.Namespace); var projectiles = objectCreator.GetTypesImplementing<IProjectileInfo>().OrderBy(t => t.Namespace);
var weaponTypes = Enumerable.Concat(weaponInfo, Enumerable.Concat(projectiles, warheads)); var weaponTypes = weaponInfo.Concat(projectiles.Concat(warheads));
foreach (var t in weaponTypes) foreach (var t in weaponTypes)
{ {
// skip helpers like TraitInfo<T> // skip helpers like TraitInfo<T>

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common
if (shapes.Any()) if (shapes.Any())
actorWidth = shapes.Max(h => h.Info.Type.OuterRadius.Length); actorWidth = shapes.Max(h => h.Info.Type.OuterRadius.Length);
var projection = MinimumPointLineProjection(lineStart, lineEnd, currActor.CenterPosition); var projection = lineStart.MinimumPointLineProjection(lineEnd, currActor.CenterPosition);
var distance = (currActor.CenterPosition - projection).HorizontalLength; var distance = (currActor.CenterPosition - projection).HorizontalLength;
var maxReach = actorWidth + lineWidth.Length; var maxReach = actorWidth + lineWidth.Length;
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common
/// <param name="lineEnd">The target point (head) of the line</param> /// <param name="lineEnd">The target point (head) of the line</param>
/// <param name="point">The target point that the minimum distance should be found to</param> /// <param name="point">The target point that the minimum distance should be found to</param>
/// <returns>The WPos that is the point on the line that is closest to the target point</returns> /// <returns>The WPos that is the point on the line that is closest to the target point</returns>
public static WPos MinimumPointLineProjection(WPos lineStart, WPos lineEnd, WPos point) public static WPos MinimumPointLineProjection(this WPos lineStart, WPos lineEnd, WPos point)
{ {
var squaredLength = (lineEnd - lineStart).HorizontalLengthSquared; var squaredLength = (lineEnd - lineStart).HorizontalLengthSquared;