Fix SA1414

This commit is contained in:
RoosterDragon
2023-04-05 19:41:28 +01:00
committed by Pavel Penev
parent a167f9680f
commit 14c0d011ea
10 changed files with 9 additions and 12 deletions

View File

@@ -598,9 +598,6 @@ dotnet_diagnostic.SA1633.severity = none # FileMustHaveHeader
dotnet_diagnostic.SA1642.severity = none # ConstructorSummaryDocumentationShouldBeginWithStandardText dotnet_diagnostic.SA1642.severity = none # ConstructorSummaryDocumentationShouldBeginWithStandardText
dotnet_diagnostic.SA1649.severity = none # FileNameMustMatchTypeName dotnet_diagnostic.SA1649.severity = none # FileNameMustMatchTypeName
# Requires C# 8/9 - TODO Consider enabling
dotnet_diagnostic.SA1414.severity = none # TupleTypesInSignaturesShouldHaveElementNames
#### Code Quality Rules #### Code Quality Rules
#### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ #### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Graphics
void ResolveSprites(SpriteCache cache); void ResolveSprites(SpriteCache cache);
Sprite GetSprite(int frame); Sprite GetSprite(int frame);
Sprite GetSprite(int frame, WAngle facing); Sprite GetSprite(int frame, WAngle facing);
(Sprite, WAngle) GetSpriteWithRotation(int frame, WAngle facing); (Sprite Sprite, WAngle Rotation) GetSpriteWithRotation(int frame, WAngle facing);
Sprite GetShadow(int frame, WAngle facing); Sprite GetShadow(int frame, WAngle facing);
float GetAlpha(int frame); float GetAlpha(int frame);
} }

View File

@@ -272,7 +272,7 @@ namespace OpenRA.Traits
public interface IMapPreviewSignatureInfo : ITraitInfoInterface public interface IMapPreviewSignatureInfo : ITraitInfoInterface
{ {
void PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer); void PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos Uv, Color Color)> destinationBuffer);
} }
public interface IOccupySpaceInfo : ITraitInfoInterface public interface IOccupySpaceInfo : ITraitInfoInterface

View File

@@ -76,7 +76,7 @@ namespace OpenRA
(Roll, Pitch, Yaw) = QuaternionToEuler(x, y, z, w); (Roll, Pitch, Yaw) = QuaternionToEuler(x, y, z, w);
} }
static (WAngle, WAngle, WAngle) QuaternionToEuler(int x, int y, int z, int w) static (WAngle Roll, WAngle Pitch, WAngle Yaw) QuaternionToEuler(int x, int y, int z, int w)
{ {
// Theoretically 1024 squared, but may differ slightly due to rounding // Theoretically 1024 squared, but may differ slightly due to rounding
var lsq = x * x + y * y + z * z + w * w; var lsq = x * x + y * y + z * z + w * w;

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Actor types that should be treated as veins for adjacency.")] [Desc("Actor types that should be treated as veins for adjacency.")]
public readonly HashSet<string> VeinholeActors = new() { }; public readonly HashSet<string> VeinholeActors = new() { };
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer) void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos Uv, Color Color)> destinationBuffer)
{ {
var resourceLayer = ai.TraitInfoOrDefault<IResourceLayerInfo>(); var resourceLayer = ai.TraitInfoOrDefault<IResourceLayerInfo>();
if (resourceLayer == null) if (resourceLayer == null)

View File

@@ -192,7 +192,7 @@ namespace OpenRA.Mods.Common.Widgets
readonly Queue<EditorActorPreview> addedActorPreviews = new(); readonly Queue<EditorActorPreview> addedActorPreviews = new();
public CopyPasteEditorAction(MapCopyFilters copyFilters, Map map, public CopyPasteEditorAction(MapCopyFilters copyFilters, Map map,
Dictionary<CPos, (TerrainTile, ResourceTile, byte)> tiles, Dictionary<string, ActorReference> previews, Dictionary<CPos, (TerrainTile Tile, ResourceTile Resource, byte Height)> tiles, Dictionary<string, ActorReference> previews,
EditorActorLayer editorLayer, CellRegion dest) EditorActorLayer editorLayer, CellRegion dest)
{ {
this.copyFilters = copyFilters; this.copyFilters = copyFilters;

View File

@@ -543,7 +543,7 @@ namespace OpenRA.Mods.Common.Graphics
return GetSprite(frame, WAngle.Zero); return GetSprite(frame, WAngle.Zero);
} }
public (Sprite, WAngle) GetSpriteWithRotation(int frame, WAngle facing) public (Sprite Sprite, WAngle Rotation) GetSpriteWithRotation(int frame, WAngle facing)
{ {
var rotation = WAngle.Zero; var rotation = WAngle.Zero;
if (interpolatedFacings != null) if (interpolatedFacings != null)

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
"Overrides `Color` if both set.")] "Overrides `Color` if both set.")]
public readonly string Terrain = null; public readonly string Terrain = null;
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer) void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos Uv, Color Color)> destinationBuffer)
{ {
Color color; Color color;
if (!string.IsNullOrEmpty(Terrain)) if (!string.IsNullOrEmpty(Terrain))

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
return ret; return ret;
} }
void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos, Color)> destinationBuffer) void IMapPreviewSignatureInfo.PopulateMapPreviewSignatureCells(Map map, ActorInfo ai, ActorReference s, List<(MPos Uv, Color Color)> destinationBuffer)
{ {
var resourceLayer = ai.TraitInfoOrDefault<IResourceLayerInfo>(); var resourceLayer = ai.TraitInfoOrDefault<IResourceLayerInfo>();
if (resourceLayer == null) if (resourceLayer == null)

View File

@@ -275,7 +275,7 @@ namespace OpenRA.Mods.Common.Traits
return info.UseExtendedIndex ? edges ^ ucorner : edges & Edges.AllCorners; return info.UseExtendedIndex ? edges ^ ucorner : edges & Edges.AllCorners;
} }
(Edges, Edges) GetEdges(PPos puv) (Edges EdgesShroud, Edges EdgesFog) GetEdges(PPos puv)
{ {
var cv = cellVisibility(puv); var cv = cellVisibility(puv);