Add readonly to structs
This commit is contained in:
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.minRange = minRange;
|
||||
}
|
||||
|
||||
public static void FlyTick(Actor self, Aircraft aircraft, WAngle desiredFacing, WDist desiredAltitude, WVec moveOverride, bool idleTurn = false)
|
||||
public static void FlyTick(Actor self, Aircraft aircraft, WAngle desiredFacing, WDist desiredAltitude, in WVec moveOverride, bool idleTurn = false)
|
||||
{
|
||||
var dat = self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition);
|
||||
var move = aircraft.Info.CanSlide ? aircraft.FlyStep(desiredFacing) : aircraft.FlyStep(aircraft.Facing);
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public Land(Actor self, in Target target, WDist landRange, WAngle? facing = null, Color? targetLineColor = null)
|
||||
: this(self, target, landRange, WVec.Zero, facing, targetLineColor: targetLineColor) { }
|
||||
|
||||
public Land(Actor self, in Target target, WVec offset, WAngle? facing = null, Color? targetLineColor = null)
|
||||
public Land(Actor self, in Target target, in WVec offset, WAngle? facing = null, Color? targetLineColor = null)
|
||||
: this(self, target, WDist.Zero, offset, facing, targetLineColor: targetLineColor) { }
|
||||
|
||||
public Land(Actor self, in Target target, WDist landRange, WVec offset, WAngle? facing = null, CPos[] clearCells = null, Color? targetLineColor = null)
|
||||
public Land(Actor self, in Target target, WDist landRange, in WVec offset, WAngle? facing = null, CPos[] clearCells = null, Color? targetLineColor = null)
|
||||
{
|
||||
aircraft = self.Trait<Aircraft>();
|
||||
this.target = target;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
protected DockingState dockingState;
|
||||
|
||||
public HarvesterDockSequence(Actor self, Actor refinery, WAngle dockAngle, bool isDragRequired, WVec dragOffset, int dragLength)
|
||||
public HarvesterDockSequence(Actor self, Actor refinery, WAngle dockAngle, bool isDragRequired, in WVec dragOffset, int dragLength)
|
||||
{
|
||||
dockingState = DockingState.Turn;
|
||||
Refinery = refinery;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WithDockingAnimationInfo wda;
|
||||
protected bool dockAnimPlayed;
|
||||
|
||||
public SpriteHarvesterDockSequence(Actor self, Actor refinery, WAngle dockAngle, bool isDragRequired, WVec dragOffset, int dragLength)
|
||||
public SpriteHarvesterDockSequence(Actor self, Actor refinery, WAngle dockAngle, bool isDragRequired, in WVec dragOffset, int dragLength)
|
||||
: base(self, refinery, dockAngle, isDragRequired, dragOffset, dragLength)
|
||||
{
|
||||
wsb = self.Trait<WithSpriteBody>();
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
struct CellResource
|
||||
readonly struct CellResource
|
||||
{
|
||||
public readonly CPos Cell;
|
||||
public readonly ResourceTile ResourceTile;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
Next = 0x2
|
||||
}
|
||||
|
||||
struct FileGroup
|
||||
readonly struct FileGroup
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly uint FirstFile;
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
struct CabDescriptor
|
||||
readonly struct CabDescriptor
|
||||
{
|
||||
public readonly long FileTableOffset;
|
||||
public readonly uint FileTableSize;
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
struct DirectoryDescriptor
|
||||
readonly struct DirectoryDescriptor
|
||||
{
|
||||
public readonly string Name;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
struct FileDescriptor
|
||||
readonly struct FileDescriptor
|
||||
{
|
||||
public readonly uint Index;
|
||||
public readonly CABFlags Flags;
|
||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
struct CommonHeader
|
||||
readonly struct CommonHeader
|
||||
{
|
||||
public const long Size = 16;
|
||||
public readonly uint Version;
|
||||
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
struct VolumeHeader
|
||||
readonly struct VolumeHeader
|
||||
{
|
||||
public readonly uint DataOffset;
|
||||
public readonly uint DataOffsetHigh;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.FileSystem
|
||||
{
|
||||
public sealed class InstallShieldPackage : IReadOnlyPackage
|
||||
{
|
||||
public struct Entry
|
||||
public readonly struct Entry
|
||||
{
|
||||
public readonly uint Offset;
|
||||
public readonly uint Length;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
readonly WDist width;
|
||||
readonly Color color;
|
||||
|
||||
public BeamRenderable(WPos pos, int zOffset, WVec length, BeamRenderableShape shape, WDist width, Color color)
|
||||
public BeamRenderable(WPos pos, int zOffset, in WVec length, BeamRenderableShape shape, WDist width, Color color)
|
||||
{
|
||||
this.pos = pos;
|
||||
this.zOffset = zOffset;
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, shape, width, color); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new CircleAnnotationRenderable(centerPosition, radius, width, color, filled); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -50,7 +50,14 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, (WPos[])trail.Clone(), width, next, length, skip, color, newOffset); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), width, next, length, skip, color, zOffset); }
|
||||
|
||||
public IRenderable OffsetBy(in WVec vec)
|
||||
{
|
||||
// Lambdas can't use 'in' variables, so capture a copy for later
|
||||
var offset = vec;
|
||||
return new ContrailRenderable(world, trail.Select(pos => pos + offset).ToArray(), width, next, length, skip, color, zOffset);
|
||||
}
|
||||
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||
}
|
||||
|
||||
public IRenderable OffsetBy(WVec vec)
|
||||
public IRenderable OffsetBy(in WVec vec)
|
||||
{
|
||||
return new DetectionCircleAnnotationRenderable(centerPosition + vec, radius, zOffset,
|
||||
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
void DrawExtraBars(WorldRenderer wr)
|
||||
|
||||
@@ -34,14 +34,14 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
readonly Polygon bounds;
|
||||
readonly Color color;
|
||||
|
||||
public IsometricSelectionBoxAnnotationRenderable(Actor actor, Polygon bounds, Color color)
|
||||
public IsometricSelectionBoxAnnotationRenderable(Actor actor, in Polygon bounds, Color color)
|
||||
{
|
||||
pos = actor.CenterPosition;
|
||||
this.bounds = bounds;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public IsometricSelectionBoxAnnotationRenderable(WPos pos, Polygon bounds, Color color)
|
||||
public IsometricSelectionBoxAnnotationRenderable(WPos pos, in Polygon bounds, Color color)
|
||||
{
|
||||
this.pos = pos;
|
||||
this.bounds = bounds;
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new LineAnnotationRenderable(start, end, width, startColor, endColor); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
readonly WVec offset;
|
||||
readonly int zOffset;
|
||||
|
||||
public ModelPreview(ModelAnimation[] components, WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw,
|
||||
public ModelPreview(ModelAnimation[] components, in WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw,
|
||||
float[] lightAmbientColor, float[] lightDiffuseColor, WAngle cameraPitch,
|
||||
PaletteReference colorPalette, PaletteReference normalsPalette, PaletteReference shadowPalette)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
palette, normalsPalette, shadowPalette, alpha, tint, tintModifiers);
|
||||
}
|
||||
|
||||
public IRenderable OffsetBy(WVec vec)
|
||||
public IRenderable OffsetBy(in WVec vec)
|
||||
{
|
||||
return new ModelRenderable(
|
||||
models, pos + vec, zOffset, camera, scale,
|
||||
|
||||
@@ -35,7 +35,14 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new PolygonAnnotationRenderable(vertices, effectivePos, width, color); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new PolygonAnnotationRenderable(vertices.Select(v => v + vec).ToArray(), effectivePos + vec, width, color); }
|
||||
|
||||
public IRenderable OffsetBy(in WVec vec)
|
||||
{
|
||||
// Lambdas can't use 'in' variables, so capture a copy for later
|
||||
var offset = vec;
|
||||
return new PolygonAnnotationRenderable(vertices.Select(v => v + offset).ToArray(), effectivePos + vec, width, color);
|
||||
}
|
||||
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new RailgunHelixRenderable(pos, newOffset, railgun, info, ticks); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, width, borderColor, borderWidth); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
void DrawExtraBars(WorldRenderer wr, float2 start, float2 end)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
}
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return this; }
|
||||
public IRenderable OffsetBy(in WVec vec) { return this; }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
static readonly float[] GroundNormal = { 0, 0, 1, 1 };
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new UITextRenderable(font, effectiveWorldPos, screenPos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
OuterRadius = Radius + new WDist(Math.Max(PointA.Length, PointB.Length));
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WVec v)
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var p = new int2(v.X, v.Y);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
throw new YamlException("VerticalTopOffset must be equal to or higher than VerticalBottomOffset.");
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WVec v)
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
return new WDist(Math.Max(0, v.Length - Radius.Length));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
WDist OuterRadius { get; }
|
||||
|
||||
WDist DistanceFromEdge(WVec v);
|
||||
WDist DistanceFromEdge(in WVec v);
|
||||
WDist DistanceFromEdge(WPos pos, WPos origin, WRot orientation);
|
||||
|
||||
void Initialize();
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
return (ac - ap).LengthSquared;
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WVec v)
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var p = new int2(v.X, v.Y);
|
||||
var z = Math.Abs(v.Z);
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
};
|
||||
}
|
||||
|
||||
public WDist DistanceFromEdge(WVec v)
|
||||
public WDist DistanceFromEdge(in WVec v)
|
||||
{
|
||||
var r = new WVec(
|
||||
Math.Max(Math.Abs(v.X - center.X) - quadrantSize.X, 0),
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
/// <summary>
|
||||
/// Stores information about nodes in the pathfinding graph
|
||||
/// </summary>
|
||||
public struct CellInfo
|
||||
public readonly struct CellInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The cost to move from the start up to this node
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
Actor Actor { get; }
|
||||
}
|
||||
|
||||
public struct GraphConnection
|
||||
public readonly struct GraphConnection
|
||||
{
|
||||
public static readonly CostComparer ConnectionCostComparer = CostComparer.Instance;
|
||||
|
||||
|
||||
@@ -739,7 +739,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
return desiredVFacing;
|
||||
}
|
||||
|
||||
WVec HomingTick(World world, WVec tarDistVec, int relTarHorDist)
|
||||
WVec HomingTick(World world, in WVec tarDistVec, int relTarHorDist)
|
||||
{
|
||||
int predClfHgt = 0;
|
||||
int predClfDist = 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
readonly List<Triggerable>[] triggerables = Exts.MakeArray(Enum.GetValues(typeof(Trigger)).Length, _ => new List<Triggerable>());
|
||||
|
||||
struct Triggerable : IDisposable
|
||||
readonly struct Triggerable : IDisposable
|
||||
{
|
||||
public readonly LuaFunction Function;
|
||||
public readonly ScriptContext Context;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Fudge the coordinate system angles to simulate non-top-down perspective in mods with square cells.")]
|
||||
public readonly bool UseClassicPerspectiveFudge = true;
|
||||
|
||||
public WVec LocalToWorld(WVec vec)
|
||||
public WVec LocalToWorld(in WVec vec)
|
||||
{
|
||||
// Rotate by 90 degrees
|
||||
if (!UseClassicPerspectiveFudge)
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public WAngle CameraPitch => info.CameraPitch;
|
||||
|
||||
public WVec LocalToWorld(WVec vec)
|
||||
public WVec LocalToWorld(in WVec vec)
|
||||
{
|
||||
return info.LocalToWorld(vec);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class ExternalCondition : ITick, INotifyCreated
|
||||
{
|
||||
struct TimedToken
|
||||
readonly struct TimedToken
|
||||
{
|
||||
public readonly int Expires;
|
||||
public readonly int Token;
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
WVec CalculateTargetableOffset(Actor self, WVec offset)
|
||||
WVec CalculateTargetableOffset(Actor self, in WVec offset)
|
||||
{
|
||||
var localOffset = offset;
|
||||
var quantizedBodyOrientation = orientation.QuantizeOrientation(self, self.Orientation);
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
struct ActorsAtEnumerable : IEnumerable<Actor>
|
||||
readonly struct ActorsAtEnumerable : IEnumerable<Actor>
|
||||
{
|
||||
readonly InfluenceNode node;
|
||||
public ActorsAtEnumerable(InfluenceNode node) { this.node = node; }
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class Locomotor : IWorldLoaded
|
||||
{
|
||||
struct CellCache
|
||||
readonly struct CellCache
|
||||
{
|
||||
public readonly LongBitSet<PlayerBitMask> Immovable;
|
||||
public readonly LongBitSet<PlayerBitMask> Crushable;
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public ResourceType GetRenderedResourceType(CPos cell) { return RenderContent[cell].Type; }
|
||||
|
||||
public struct RendererCellContents
|
||||
public readonly struct RendererCellContents
|
||||
{
|
||||
public readonly string Variant;
|
||||
public readonly ResourceType Type;
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
All = Top | Right | Bottom | Left
|
||||
}
|
||||
|
||||
struct TileInfo
|
||||
readonly struct TileInfo
|
||||
{
|
||||
public readonly float3 ScreenPosition;
|
||||
public readonly byte Variant;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class WeatherOverlay : ITick, IRenderAboveWorld, INotifyViewportZoomExtentsChanged
|
||||
{
|
||||
struct Particle
|
||||
readonly struct Particle
|
||||
{
|
||||
public readonly float2 Pos;
|
||||
public readonly int Size;
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
TailColor = Color.FromArgb(info.LineTailAlphaValue, Color.R, Color.G, Color.B);
|
||||
}
|
||||
|
||||
Particle(Particle source)
|
||||
Particle(in Particle source)
|
||||
{
|
||||
Pos = source.Pos;
|
||||
Size = source.Size;
|
||||
@@ -117,13 +117,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
TailColor = source.TailColor;
|
||||
}
|
||||
|
||||
public Particle(Particle source, float2 pos)
|
||||
public Particle(in Particle source, float2 pos)
|
||||
: this(source)
|
||||
{
|
||||
Pos = pos;
|
||||
}
|
||||
|
||||
public Particle(Particle source, float2 pos, int swingDirection, float swingOffset)
|
||||
public Particle(in Particle source, float2 pos, int swingDirection, float swingOffset)
|
||||
: this(source)
|
||||
{
|
||||
Pos = pos;
|
||||
|
||||
Reference in New Issue
Block a user