Add readonly to structs

This commit is contained in:
teinarss
2021-01-29 16:56:11 +01:00
committed by abcdefg30
parent 65c796dec7
commit 6b74093c04
83 changed files with 146 additions and 125 deletions

View File

@@ -24,7 +24,7 @@ using OpenRA.Traits;
namespace OpenRA
{
struct BinaryDataHeader
readonly struct BinaryDataHeader
{
public readonly byte Format;
public readonly uint TilesOffset;
@@ -1225,7 +1225,7 @@ namespace OpenRA
return AllEdgeCells.Random(rand);
}
public WDist DistanceToEdge(WPos pos, WVec dir)
public WDist DistanceToEdge(WPos pos, in WVec dir)
{
var projectedPos = pos - new WVec(0, pos.Z, pos.Z);
var x = dir.X == 0 ? int.MaxValue : ((dir.X < 0 ? ProjectedTopLeft.X : ProjectedBottomRight.X) - projectedPos.X) / dir.X;

View File

@@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace OpenRA
{
public struct MapCoordsRegion : IEnumerable<MPos>
public readonly struct MapCoordsRegion : IEnumerable<MPos>
{
public struct MapCoordsEnumerator : IEnumerator<MPos>
{

View File

@@ -22,7 +22,7 @@ namespace OpenRA
public enum RampSplit { Flat, X, Y }
public enum RampCornerHeight { Low = 0, Half = 1, Full = 2 }
public struct CellRamp
public readonly struct CellRamp
{
public readonly int CenterHeightOffset;
public readonly WVec[] Corners;

View File

@@ -11,7 +11,7 @@
namespace OpenRA
{
public struct TerrainTile
public readonly struct TerrainTile
{
public readonly ushort Type;
public readonly byte Index;
@@ -27,7 +27,7 @@ namespace OpenRA
public override string ToString() { return Type + "," + Index; }
}
public struct ResourceTile
public readonly struct ResourceTile
{
public readonly byte Type;
public readonly byte Index;