Review StyleCop rules.
- Enforce SA1604 ElementDocumentationShouldHaveSummary. - Enforce SA1629 DocumentationTextShouldEndWithAPeriod. - Turn off some rules covered by IDExxxx rules. - Remaining rules are treated as part of OpenRA style.
This commit is contained in:
@@ -41,14 +41,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
/// <summary>
|
||||
/// Called early in the activity tick to allow subclasses to update state.
|
||||
/// Call Cancel(self, true) if it is no longer valid to enter
|
||||
/// Call Cancel(self, true) if it is no longer valid to enter.
|
||||
/// </summary>
|
||||
protected virtual void TickInner(Actor self, in Target target, bool targetIsDeadOrHiddenActor) { }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the actor is ready to transition from approaching to entering the target actor.
|
||||
/// Return true to start entering, or false to wait in the WaitingToEnter state.
|
||||
/// Call Cancel(self, true) before returning false if it is no longer valid to enter
|
||||
/// Call Cancel(self, true) before returning false if it is no longer valid to enter.
|
||||
/// </summary>
|
||||
protected virtual bool TryStartEnter(Actor self, Actor targetActor) { return true; }
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
/// <summary>
|
||||
/// Finds the closest harvestable pos between the current position of the harvester
|
||||
/// and the last order location
|
||||
/// and the last order location.
|
||||
/// </summary>
|
||||
CPos? ClosestHarvestablePos(Actor self)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the three states that a node in the graph can have.
|
||||
/// Based on A* algorithm specification
|
||||
/// Based on A* algorithm specification.
|
||||
/// </summary>
|
||||
public enum CellStatus : byte
|
||||
{
|
||||
|
||||
@@ -219,9 +219,9 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
|
||||
/// <summary>
|
||||
/// This function analyzes the neighbors of the most promising node in the pathfinding graph
|
||||
/// using the A* algorithm (A-star) and returns that node
|
||||
/// using the A* algorithm (A-star) and returns that node.
|
||||
/// </summary>
|
||||
/// <returns>The most promising node of the iteration</returns>
|
||||
/// <returns>The most promising node of the iteration.</returns>
|
||||
CPos Expand()
|
||||
{
|
||||
var currentMinNode = openQueue.Pop().Destination;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common
|
||||
/// <summary>
|
||||
/// Update (Frozen)Actor targets to account for visibility changes or actor replacement.
|
||||
/// If the target actor becomes hidden without a FrozenActor, the target is invalidated.
|
||||
/// /// </summary>
|
||||
/// </summary>
|
||||
public static Target RecalculateInvalidatingHiddenTargets(this Target t, Player viewer)
|
||||
{
|
||||
var updated = t.Recalculate(viewer, out var targetIsHiddenActor);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>Evaluates the attractiveness of a position according to all considerations</summary>
|
||||
/// <summary>Evaluates the attractiveness of a position according to all considerations.</summary>
|
||||
public int GetAttractiveness(WPos pos, Player firedBy)
|
||||
{
|
||||
var answer = 0;
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return answer;
|
||||
}
|
||||
|
||||
/// <summary>Evaluates the attractiveness of a group of actors according to all considerations</summary>
|
||||
/// <summary>Evaluates the attractiveness of a group of actors according to all considerations.</summary>
|
||||
public int GetAttractiveness(IEnumerable<Actor> actors, Player firedBy)
|
||||
{
|
||||
var answer = 0;
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
FieldLoader.Load(this, yaml);
|
||||
}
|
||||
|
||||
/// <summary>Evaluates a single actor according to the rules defined in this consideration</summary>
|
||||
/// <summary>Evaluates a single actor according to the rules defined in this consideration.</summary>
|
||||
public int GetAttractiveness(Actor a, PlayerRelationship stance, Player firedBy)
|
||||
{
|
||||
if (stance != Against)
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int carryConditionToken = Actor.InvalidConditionToken;
|
||||
int carryableConditionToken = Actor.InvalidConditionToken;
|
||||
|
||||
/// <summary>Offset between the carryall's and the carried actor's CenterPositions</summary>
|
||||
/// <summary>Offset between the carryall's and the carried actor's CenterPositions.</summary>
|
||||
public WVec CarryableOffset { get; private set; }
|
||||
|
||||
public Carryall(Actor self, CarryallInfo info)
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
public abstract string Description { get; }
|
||||
|
||||
/// <summary>Defines a transformation that is run on each top-level node in a yaml file set.</summary>
|
||||
/// <returns>An enumerable of manual steps to be run by the user</returns>
|
||||
/// <returns>An enumerable of manual steps to be run by the user.</returns>
|
||||
public delegate IEnumerable<string> TopLevelNodeTransform(ModData modData, MiniYamlNode node);
|
||||
|
||||
/// <summary>Defines a transformation that is run on each widget node in a chrome yaml file set.</summary>
|
||||
/// <returns>An enumerable of manual steps to be run by the user</returns>
|
||||
/// <returns>An enumerable of manual steps to be run by the user.</returns>
|
||||
public delegate IEnumerable<string> ChromeNodeTransform(ModData modData, MiniYamlNode widgetNode);
|
||||
|
||||
public virtual IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { yield break; }
|
||||
|
||||
@@ -315,13 +315,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Checks if node is a removal (has '-' prefix)</summary>
|
||||
/// <summary>Checks if node is a removal (has '-' prefix).</summary>
|
||||
public static bool IsRemoval(this MiniYamlNode node)
|
||||
{
|
||||
return node.Key[0].ToString() == "-";
|
||||
}
|
||||
|
||||
/// <summary>Renames a yaml key preserving any @suffix</summary>
|
||||
/// <summary>Renames a yaml key preserving any @suffix.</summary>
|
||||
public static void RenameKey(this MiniYamlNode node, string newKey, bool preserveSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
var prefix = includeRemovals && node.IsRemoval() ? "-" : "";
|
||||
@@ -370,13 +370,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
node.MoveNode(fromNode, toNode);
|
||||
}
|
||||
|
||||
/// <summary>Removes children with keys equal to [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Removes children with keys equal to [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static int RemoveNodes(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.RemoveAll(n => n.KeyMatches(match, ignoreSuffix, includeRemovals));
|
||||
}
|
||||
|
||||
/// <summary>Returns true if the node is of the form [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Returns true if the node is of the form [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static bool KeyMatches(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
if (node.Key == null)
|
||||
@@ -394,7 +394,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
return atPosition > 0 && node.Key.Substring(0, atPosition) == prefix + match;
|
||||
}
|
||||
|
||||
/// <summary>Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match]</summary>
|
||||
/// <summary>Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match].</summary>
|
||||
public static bool KeyContains(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
if (node.Key == null)
|
||||
@@ -409,13 +409,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Returns children with keys equal to [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Returns children with keys equal to [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static IEnumerable<MiniYamlNode> ChildrenMatching(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.Where(n => n.KeyMatches(match, ignoreSuffix, includeRemovals));
|
||||
}
|
||||
|
||||
/// <summary>Returns children whose keys contain 'match' (optionally in the suffix)</summary>
|
||||
/// <summary>Returns children whose keys contain 'match' (optionally in the suffix).</summary>
|
||||
public static IEnumerable<MiniYamlNode> ChildrenContaining(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.Where(n => n.KeyContains(match, ignoreSuffix, includeRemovals));
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common
|
||||
/// <summary>
|
||||
/// Adds step angle units to facing in the direction that takes it closer to desiredFacing.
|
||||
/// If facing is already within step of desiredFacing then desiredFacing is returned.
|
||||
/// Step is given as an integer to allow negative values (step away from the desired facing)
|
||||
/// Step is given as an integer to allow negative values (step away from the desired facing).
|
||||
/// </summary>
|
||||
public static WAngle TickFacing(WAngle facing, WAngle desiredFacing, WAngle step)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether desiredFacing is clockwise (-1) or anticlockwise (+1) of facing.
|
||||
/// If desiredFacing is equal to facing or directly behind facing we treat it as being anticlockwise
|
||||
/// If desiredFacing is equal to facing or directly behind facing we treat it as being anticlockwise.
|
||||
/// </summary>
|
||||
public static int GetTurnDirection(WAngle facing, WAngle desiredFacing)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the remainder angle after rounding to the nearest whole step / facing
|
||||
/// Returns the remainder angle after rounding to the nearest whole step / facing.
|
||||
/// </summary>
|
||||
public static WAngle AngleDiffToStep(WAngle facing, int numFrames)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common
|
||||
return new WAngle(IndexFacing(facing, facings) * (1024 / facings));
|
||||
}
|
||||
|
||||
/// <summary>Wraps an arbitrary integer facing value into the range 0 - 255</summary>
|
||||
/// <summary>Wraps an arbitrary integer facing value into the range 0 - 255.</summary>
|
||||
public static int NormalizeFacing(int f)
|
||||
{
|
||||
if (f >= 0)
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
public static class Utilities
|
||||
{
|
||||
/// <exception cref="ArgumentNullException">Thrown if manifestPropertySelector is null.</exception>
|
||||
public static MiniYamlNode GetTopLevelNodeByKey(ModData modData, string key,
|
||||
Func<Manifest, string[]> manifestPropertySelector,
|
||||
Func<Map, MiniYaml> mapPropertySelector = null,
|
||||
|
||||
@@ -19,7 +19,7 @@ using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
/// <summary> Contains all functions that are unit-specific. </summary>
|
||||
/// <summary>Contains all functions that are unit-specific.</summary>
|
||||
public class CommandBarLogic : ChromeLogic
|
||||
{
|
||||
readonly World world;
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace OpenRA.Mods.Common
|
||||
/// Finds all the actors of which their health radius is intersected by a line (with a definable width) between two points.
|
||||
/// </summary>
|
||||
/// <param name="world">The engine world the line intersection is to be done in.</param>
|
||||
/// <param name="lineStart">The position the line should start at</param>
|
||||
/// <param name="lineEnd">The position the line should end at</param>
|
||||
/// <param name="lineWidth">How close an actor's health radius needs to be to the line to be considered 'intersected' by the line</param>
|
||||
/// <param name="lineStart">The position the line should start at.</param>
|
||||
/// <param name="lineEnd">The position the line should end at.</param>
|
||||
/// <param name="lineWidth">How close an actor's health radius needs to be to the line to be considered 'intersected' by the line.</param>
|
||||
/// <param name="onlyBlockers">If set, only considers the size of actors that have an <see cref="IBlocksProjectiles"/>
|
||||
/// trait which may improve search performance. However does NOT filter the returned actors on this trait.</param>
|
||||
/// <returns>A list of all the actors intersected by the line</returns>
|
||||
/// <returns>A list of all the actors intersected by the line.</returns>
|
||||
public static IEnumerable<Actor> FindActorsOnLine(this World world, WPos lineStart, WPos lineEnd, WDist lineWidth, bool onlyBlockers = false)
|
||||
{
|
||||
// This line intersection check is done by first just finding all actors within a square that starts at the source, and ends at the target.
|
||||
@@ -84,10 +84,10 @@ namespace OpenRA.Mods.Common
|
||||
/// <summary>
|
||||
/// Find the point (D) on a line (A-B) that is closest to the target point (C).
|
||||
/// </summary>
|
||||
/// <param name="lineStart">The source point (tail) 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>
|
||||
/// <returns>The WPos that is the point on the line that is closest to the target point</returns>
|
||||
/// <param name="lineStart">The source point (tail) 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>
|
||||
/// <returns>The WPos that is the point on the line that is closest to the target point.</returns>
|
||||
public static WPos MinimumPointLineProjection(this WPos lineStart, WPos lineEnd, WPos point)
|
||||
{
|
||||
var squaredLength = (lineEnd - lineStart).HorizontalLengthSquared;
|
||||
|
||||
Reference in New Issue
Block a user