From a6aeb54ad50465c8366ae48a325174bd5ca7b3ca Mon Sep 17 00:00:00 2001 From: Chris Ridley Date: Fri, 26 Jan 2018 11:49:43 -0600 Subject: [PATCH] Code cleanup. Moved BearingOfLine function to Direction, and ensured that it takes into account the YIncreasesUpwards flag appropriately. This fixes issue #5. Updated documentation. --- GoRogue-PerformanceTests/App.config | 6 +- .../GoRogue-PerformanceTests.csproj | 2 + GoRogue-PerformanceTests/PathingTests.cs | 2 +- GoRogue-PerformanceTests/Program.cs | 2 - .../Properties/AssemblyInfo.cs | 3 +- GoRogue-UnitTests/EffectTests.cs | 7 +- GoRogue-UnitTests/GoRogue-UnitTests.csproj | 2 + GoRogue-UnitTests/MapAreaTests.cs | 2 +- GoRogue-UnitTests/MapGenTests.cs | 2 +- GoRogue-UnitTests/MathHelperTests.cs | 3 +- GoRogue-UnitTests/MultiSpatialMapTests.cs | 6 +- GoRogue-UnitTests/Properties/AssemblyInfo.cs | 5 +- GoRogue-UnitTests/RadiusFOVSyncTests.cs | 8 +- GoRogue-UnitTests/SpatialMapTests.cs | 4 +- GoRogue/ArrayMapOf.cs | 1 + GoRogue/Coord.cs | 310 ++++++++--------- GoRogue/Direction.cs | 19 ++ GoRogue/Distance.cs | 4 + GoRogue/Effect.cs | 13 +- GoRogue/EffectTrigger.cs | 17 +- GoRogue/GoRogue.csproj | 7 +- GoRogue/IMapOf.cs | 6 +- GoRogue/IReadOnlySpatialMap.cs | 8 + GoRogue/ISettableMapOf.cs | 2 +- GoRogue/ISpatialMap.cs | 16 +- GoRogue/LOS.cs | 2 +- .../CenterBoundsConnectionPointSelector.cs | 2 +- .../Connectors/ClosestMapAreaConnector.cs | 4 +- .../Connectors/DirectLineTunnelCreator.cs | 4 +- .../HorizontalVerticalTunnelCreator.cs | 3 +- .../IAreaConnectionPointSelector.cs | 2 +- .../Connectors/ITunnelCreator.cs | 2 +- .../Connectors/OrderedMapAreaConnector.cs | 6 +- .../RandomConnectionPointSelector.cs | 6 +- .../Generators/CellularAutomataGenerator.cs | 311 +++++++++--------- .../Generators/RandomRoomsGenerator.cs | 7 +- .../Generators/RectangleMapGenerator.cs | 2 +- GoRogue/MapGeneration/MapArea.cs | 1 + GoRogue/MapGeneration/MapAreaFinder.cs | 2 + GoRogue/MathHelpers.cs | 2 +- GoRogue/MultiSpatialMap.cs | 12 +- GoRogue/Radius.cs | 5 + GoRogue/RadiusAreaProvider.cs | 2 + GoRogue/Rectangle.cs | 4 +- GoRogue/SenseMapping/SenseMap.cs | 1 + GoRogue/SenseMapping/SenseSource.cs | 4 + GoRogue/SpatialMap.cs | 6 +- GoRogue/Utility.cs | 5 +- docs/annotated.html | 2 +- docs/class_go_rogue_1_1_coord-members.html | 53 ++- docs/class_go_rogue_1_1_coord.html | 183 ++++------- .../class_go_rogue_1_1_direction-members.html | 71 ++-- docs/class_go_rogue_1_1_direction.html | 49 +++ docs/class_go_rogue_1_1_distance-members.html | 2 +- docs/class_go_rogue_1_1_distance.html | 16 +- ...ectors_1_1_direct_line_tunnel_creator.html | 8 +- ...ass_go_rogue_1_1_radius_area_provider.html | 2 +- docs/functions_b.html | 2 +- docs/functions_c.html | 2 +- docs/functions_e.html | 8 +- docs/functions_func_b.html | 2 +- docs/functions_func_c.html | 2 +- docs/functions_func_e.html | 4 +- docs/functions_func_p.html | 2 +- docs/functions_func_t.html | 2 +- docs/functions_p.html | 2 +- docs/functions_t.html | 2 +- docs/functions_vars.html | 4 +- docs/hierarchy.html | 2 +- docs/namespace_go_rogue.html | 4 +- ...gue_1_1_map_generation_1_1_connectors.html | 2 +- docs/search/all_1.js | 2 +- docs/search/all_11.js | 2 +- docs/search/all_2.js | 2 +- docs/search/all_4.js | 4 +- docs/search/all_e.js | 2 +- docs/search/enumvalues_2.js | 2 +- docs/search/functions_1.js | 2 +- docs/search/functions_11.js | 2 +- docs/search/functions_2.js | 2 +- docs/search/functions_4.js | 2 +- docs/search/functions_e.js | 2 +- docs/search/variables_3.js | 2 +- 83 files changed, 679 insertions(+), 625 deletions(-) diff --git a/GoRogue-PerformanceTests/App.config b/GoRogue-PerformanceTests/App.config index 8d234373..b4198625 100644 --- a/GoRogue-PerformanceTests/App.config +++ b/GoRogue-PerformanceTests/App.config @@ -1,6 +1,6 @@ - - + + - + \ No newline at end of file diff --git a/GoRogue-PerformanceTests/GoRogue-PerformanceTests.csproj b/GoRogue-PerformanceTests/GoRogue-PerformanceTests.csproj index 269375b3..2ae84281 100644 --- a/GoRogue-PerformanceTests/GoRogue-PerformanceTests.csproj +++ b/GoRogue-PerformanceTests/GoRogue-PerformanceTests.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + RECS0145; AnyCPU @@ -31,6 +32,7 @@ TRACE prompt 4 + RECS0145; diff --git a/GoRogue-PerformanceTests/PathingTests.cs b/GoRogue-PerformanceTests/PathingTests.cs index 25e2bc61..bd33c415 100644 --- a/GoRogue-PerformanceTests/PathingTests.cs +++ b/GoRogue-PerformanceTests/PathingTests.cs @@ -1,8 +1,8 @@ using GoRogue; -using Generators = GoRogue.MapGeneration.Generators; using GoRogue.Pathing; using System; using System.Diagnostics; +using Generators = GoRogue.MapGeneration.Generators; namespace GoRogue_PerformanceTests { diff --git a/GoRogue-PerformanceTests/Program.cs b/GoRogue-PerformanceTests/Program.cs index 2833dc57..d8f1210d 100644 --- a/GoRogue-PerformanceTests/Program.cs +++ b/GoRogue-PerformanceTests/Program.cs @@ -1,5 +1,4 @@ using GoRogue; -using GoRogue.MapGeneration; using GoRogue.SenseMapping; using System; @@ -59,7 +58,6 @@ private static void Main() Console.WriteLine($"Time for {ITERATIONS_FOR_TIMING} paths of Jump Point Search, on {MAP_WIDTH}x{MAP_HEIGHT} map:"); Console.WriteLine($"\t{timeJumpPoint}"); */ - } } } \ No newline at end of file diff --git a/GoRogue-PerformanceTests/Properties/AssemblyInfo.cs b/GoRogue-PerformanceTests/Properties/AssemblyInfo.cs index d2bcf95a..6f329f86 100644 --- a/GoRogue-PerformanceTests/Properties/AssemblyInfo.cs +++ b/GoRogue-PerformanceTests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/GoRogue-UnitTests/EffectTests.cs b/GoRogue-UnitTests/EffectTests.cs index 9320a254..dd0504ab 100644 --- a/GoRogue-UnitTests/EffectTests.cs +++ b/GoRogue-UnitTests/EffectTests.cs @@ -1,6 +1,6 @@ -using System; +using GoRogue; using Microsoft.VisualStudio.TestTools.UnitTesting; -using GoRogue; +using System; namespace GoRogue_UnitTests { @@ -23,6 +23,7 @@ protected override void OnTrigger(EffectArgs e) e.CancelTrigger = true; } } + [TestClass] public class EffectTests { @@ -125,4 +126,4 @@ public void EffectTriggerEffects() Assert.AreEqual(1, secEffectTrigger.Effects[0].Duration); // Must have cancelled } } -} +} \ No newline at end of file diff --git a/GoRogue-UnitTests/GoRogue-UnitTests.csproj b/GoRogue-UnitTests/GoRogue-UnitTests.csproj index 8d2ab55f..479a3849 100644 --- a/GoRogue-UnitTests/GoRogue-UnitTests.csproj +++ b/GoRogue-UnitTests/GoRogue-UnitTests.csproj @@ -29,6 +29,7 @@ DEBUG;TRACE prompt 4 + RECS0145; pdbonly @@ -37,6 +38,7 @@ TRACE prompt 4 + RECS0145; diff --git a/GoRogue-UnitTests/MapAreaTests.cs b/GoRogue-UnitTests/MapAreaTests.cs index 94ffba61..89fee1ec 100644 --- a/GoRogue-UnitTests/MapAreaTests.cs +++ b/GoRogue-UnitTests/MapAreaTests.cs @@ -1,8 +1,8 @@ using GoRogue; using GoRogue.MapGeneration; -using Generators = GoRogue.MapGeneration.Generators; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Generators = GoRogue.MapGeneration.Generators; namespace GoRogue_UnitTests { diff --git a/GoRogue-UnitTests/MapGenTests.cs b/GoRogue-UnitTests/MapGenTests.cs index a6e35870..390a846e 100644 --- a/GoRogue-UnitTests/MapGenTests.cs +++ b/GoRogue-UnitTests/MapGenTests.cs @@ -1,9 +1,9 @@ using GoRogue; using GoRogue.MapGeneration; -using Generators = GoRogue.MapGeneration.Generators; using GoRogue.Random; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Generators = GoRogue.MapGeneration.Generators; namespace GoRogue_UnitTests { diff --git a/GoRogue-UnitTests/MathHelperTests.cs b/GoRogue-UnitTests/MathHelperTests.cs index 137d00e2..1a7ef552 100644 --- a/GoRogue-UnitTests/MathHelperTests.cs +++ b/GoRogue-UnitTests/MathHelperTests.cs @@ -1,5 +1,4 @@ using GoRogue; -using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GoRogue_UnitTests @@ -23,4 +22,4 @@ public void RoundToMultiple() Assert.AreEqual(0, result); } } -} +} \ No newline at end of file diff --git a/GoRogue-UnitTests/MultiSpatialMapTests.cs b/GoRogue-UnitTests/MultiSpatialMapTests.cs index 5c9d8948..57447521 100644 --- a/GoRogue-UnitTests/MultiSpatialMapTests.cs +++ b/GoRogue-UnitTests/MultiSpatialMapTests.cs @@ -1,5 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using GoRogue; +using GoRogue; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace GoRogue_UnitTests { @@ -153,4 +153,4 @@ public void MultiSpatialMapRemove() Assert.AreEqual(0, count); } } -} +} \ No newline at end of file diff --git a/GoRogue-UnitTests/Properties/AssemblyInfo.cs b/GoRogue-UnitTests/Properties/AssemblyInfo.cs index 72984130..05e5fe11 100644 --- a/GoRogue-UnitTests/Properties/AssemblyInfo.cs +++ b/GoRogue-UnitTests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("GoRogue-UnitTests")] @@ -10,11 +9,9 @@ [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] - [assembly: ComVisible(false)] - [assembly: Guid("d421d454-9249-48cf-9f19-d17690615019")] // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/GoRogue-UnitTests/RadiusFOVSyncTests.cs b/GoRogue-UnitTests/RadiusFOVSyncTests.cs index d75e7c8c..e453a344 100644 --- a/GoRogue-UnitTests/RadiusFOVSyncTests.cs +++ b/GoRogue-UnitTests/RadiusFOVSyncTests.cs @@ -1,8 +1,8 @@ -using System; -using GoRogue; -using Generators = GoRogue.MapGeneration.Generators; +using GoRogue; using GoRogue.SenseMapping; using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using Generators = GoRogue.MapGeneration.Generators; namespace GoRogue_UnitTests { @@ -178,4 +178,4 @@ private void printArray(bool[,] arr) } } } -} +} \ No newline at end of file diff --git a/GoRogue-UnitTests/SpatialMapTests.cs b/GoRogue-UnitTests/SpatialMapTests.cs index 6a34ad74..02123df2 100644 --- a/GoRogue-UnitTests/SpatialMapTests.cs +++ b/GoRogue-UnitTests/SpatialMapTests.cs @@ -3,7 +3,7 @@ namespace GoRogue_UnitTests { - class MyIDImpl : IHasID + internal class MyIDImpl : IHasID { private static IDGenerator idGen = new IDGenerator(); public uint ID { get; private set; } @@ -156,4 +156,4 @@ public void SpatialMapRemove() Assert.AreEqual(0, count); } } -} +} \ No newline at end of file diff --git a/GoRogue/ArrayMapOf.cs b/GoRogue/ArrayMapOf.cs index cbcae17c..2eb66026 100644 --- a/GoRogue/ArrayMapOf.cs +++ b/GoRogue/ArrayMapOf.cs @@ -12,6 +12,7 @@ public class ArrayMapOf : ISettableMapOf, ICloneable /// The width of the array. /// public int Width { get => array.GetLength(0); } + /// /// The height of the array. /// diff --git a/GoRogue/Coord.cs b/GoRogue/Coord.cs index d4fc4ce7..83b72bd5 100644 --- a/GoRogue/Coord.cs +++ b/GoRogue/Coord.cs @@ -38,89 +38,17 @@ static Coord() POOL[i, j] = new Coord(i - 3, j - 3); } - /// - /// Returns the proper Coord instance for the given x and y values. Will return the one in the array if the values are in the appropriate range, - /// otherwise will create a new one and return that one. - /// - /// The x-value for the coordinate. - /// The y-value for the coordinate. - /// The Coord representing the given x-value and y-value. - public static Coord Get(int x, int y) - { - if (x >= -3 && y >= -3 && x < POOL.GetLength(0) - 3 && y < POOL.GetLength(1) - 3) - return POOL[x + 3, y + 3]; - else return new Coord(x, y); - } - - /// - /// Calculates degree bearing of the line (from => to), where 0 is up (north). - /// - /// Coordinate of line starting point. - /// Coordinate of line ending point. - /// The degree bearing of the line specified by the two given points. - public static double BearingOfLine(Coord from, Coord to) + private Coord() { - int x = to.X - from.X; - int y = to.Y - from.Y; - double angle = Math.Atan2(y, x); - double degree = MathHelpers.ToDegree(angle); - degree += 450; // Rotate to all positive such that 0 is up - degree %= 360; // Normalize - return degree; + X = 0; + Y = 0; } - /// - /// Gets an IEnumerable of every position, in order, on the most direct line between the two points specified - /// (assuming 8-way connectivity). This will include the start and end points themselves. This is simply - /// an implementation of Brensham's line algorithm, from https://www.roguebasin.com/index.php?title=Brensham%27s_Line_Algorithm. - /// - /// Starting point. - /// Ending point. - /// IEnumerable of all positions on a line between the two points, including the start and end points. - public static IEnumerable PositionsOnLine(Coord start, Coord end) + private Coord(int x, int y) { - int x0 = start.X; - int y0 = start.Y; - int x1 = end.X; - int y1 = end.Y; - - - bool steep = Math.Abs(y1 - y0) > Math.Abs(x1 - x0); - if (steep) - { - Utility.Swap(ref x0, ref y0); - Utility.Swap(ref x1, ref y1); - } - - if (x0 > x1) - { - Utility.Swap(ref x0, ref x1); - Utility.Swap(ref y0, ref y1); - } - - int dx = x1 - x0; - int dy = Math.Abs(y1 - y0); - - int err = dx / 2; - int yStep = (y0 < y1 ? 1 : -1); - int y = y0; - - for (int x = x0; x <= x1; x++) - { - if (steep) - yield return Coord.Get(y, x); - else - yield return Coord.Get(x, y); - - err -= dy; - if (err < 0) - { - y += yStep; - err += dx; - } - } + X = x; + Y = y; } - /// /// Gets an IEnumerable of every position, in order, on the most direct line between the two points specified @@ -143,15 +71,6 @@ public static IEnumerable CardinalPositionsOnLine(Coord start, Coord end) } } - /// - /// Returns the midpoint between the two points. - /// - /// The first point. - /// The second point. - /// The midpoint between c1 and c2 - public static Coord Midpoint(Coord c1, Coord c2) => - Get((int)Math.Round((c1.X + c2.X) / 2.0f, MidpointRounding.AwayFromZero), (int)Math.Round((c1.Y + c2.Y) / 2.0f, MidpointRounding.AwayFromZero)); - /// /// Returns the result of the euclidean distance formula, without the square root -- eg., (c2.X - c1.X) * (c2.X - c1.X) + (c2.Y - c1.Y) * (c2.Y - c1.Y). /// Use this if you only care about the magnitude of the distance -- eg., if you're trying to compare two distances. Omitting the square root provides @@ -163,28 +82,27 @@ public static Coord Midpoint(Coord c1, Coord c2) => public static double EuclideanDistanceMagnitude(Coord c1, Coord c2) => (c2.X - c1.X) * (c2.X - c1.X) + (c2.Y - c1.Y) * (c2.Y - c1.Y); /// - /// + operator. Returns the coordinate (c1.X + c2.X, c1.Y + c2.Y). - /// - /// The first coordinate. - /// The coordinate to add to c1. - /// c1 + c2, eg. (c1.X + c2.X, c1.Y + c2.Y) - public static Coord operator +(Coord c1, Coord c2) => Get(c1.X + c2.X, c1.Y + c2.Y); - - /// - /// + operator. Adds scalar i to the x and y values of c; eg., returns (c.X + i, c.Y + i). + /// Returns the proper Coord instance for the given x and y values. Will return the one in the array if the values are in the appropriate range, + /// otherwise will create a new one and return that one. /// - /// Coordinate to add scalar to. - /// Scalar to add to coordinate. - /// Coordinate resulting from adding scalar i to x-value and y-value of c1. - public static Coord operator +(Coord c, int i) => Get(c.X + i, c.Y + i); + /// The x-value for the coordinate. + /// The y-value for the coordinate. + /// The Coord representing the given x-value and y-value. + public static Coord Get(int x, int y) + { + if (x >= -3 && y >= -3 && x < POOL.GetLength(0) - 3 && y < POOL.GetLength(1) - 3) + return POOL[x + 3, y + 3]; + else return new Coord(x, y); + } /// - /// + operator. Translates the given coordinate by the given direction, eg. returns (c.X + d.DeltaX, c.Y + d.DeltaY). + /// Returns the midpoint between the two points. /// - /// The coordinate to translate by the given direction. - /// The direction to translate the coordinate by. - /// The coordinate translated by the given direction, eg. (c.X + d.DeltaX, c.Y + d.DeltaY - public static Coord operator +(Coord c, Direction d) => Get(c.X + d.DeltaX, c.Y + d.DeltaY); + /// The first point. + /// The second point. + /// The midpoint between c1 and c2 + public static Coord Midpoint(Coord c1, Coord c2) => + Get((int)Math.Round((c1.X + c2.X) / 2.0f, MidpointRounding.AwayFromZero), (int)Math.Round((c1.Y + c2.Y) / 2.0f, MidpointRounding.AwayFromZero)); /// /// - operator. Returns the coordinate (c1.X - c2.X, c1.Y - c2.Y) @@ -202,6 +120,14 @@ public static Coord Midpoint(Coord c1, Coord c2) => /// public static Coord operator -(Coord c, int i) => Get(c.X - i, c.Y - i); + /// + /// True if either the x-values or y-values are not equal. + /// + /// First coordinate to compare. + /// Second coordinate to compare. + /// True if either the x-values or y-values are not equal, false if they are both equal. + public static bool operator !=(Coord c1, Coord c2) => !(c1 == c2); + /// /// * operator. Multiplies the x-value and y-value of c by i, eg. returns (c.X * i, c.Y * i) /// @@ -239,6 +165,30 @@ public static Coord Midpoint(Coord c1, Coord c2) => public static Coord operator /(Coord c, double i) => Get((int)Math.Round(c.X / i, MidpointRounding.AwayFromZero), (int)Math.Round(c.Y / i, MidpointRounding.AwayFromZero)); + /// + /// + operator. Returns the coordinate (c1.X + c2.X, c1.Y + c2.Y). + /// + /// The first coordinate. + /// The coordinate to add to c1. + /// c1 + c2, eg. (c1.X + c2.X, c1.Y + c2.Y) + public static Coord operator +(Coord c1, Coord c2) => Get(c1.X + c2.X, c1.Y + c2.Y); + + /// + /// + operator. Adds scalar i to the x and y values of c; eg., returns (c.X + i, c.Y + i). + /// + /// Coordinate to add scalar to. + /// Scalar to add to coordinate. + /// Coordinate resulting from adding scalar i to x-value and y-value of c1. + public static Coord operator +(Coord c, int i) => Get(c.X + i, c.Y + i); + + /// + /// + operator. Translates the given coordinate by the given direction, eg. returns (c.X + d.DeltaX, c.Y + d.DeltaY). + /// + /// The coordinate to translate by the given direction. + /// The direction to translate the coordinate by. + /// The coordinate translated by the given direction, eg. (c.X + d.DeltaX, c.Y + d.DeltaY + public static Coord operator +(Coord c, Direction d) => Get(c.X + d.DeltaX, c.Y + d.DeltaY); + /// /// True if c1.X == c2.X and c1.Y == c2.Y. /// @@ -257,12 +207,88 @@ public static Coord Midpoint(Coord c1, Coord c2) => } /// - /// True if either the x-values or y-values are not equal. + /// Gets an IEnumerable of every position, in order, on the most direct line between the two points specified + /// (assuming 8-way connectivity). This will include the start and end points themselves. This is simply + /// an implementation of Brensham's line algorithm, from https://www.roguebasin.com/index.php?title=Brensham%27s_Line_Algorithm. /// - /// First coordinate to compare. - /// Second coordinate to compare. - /// True if either the x-values or y-values are not equal, false if they are both equal. - public static bool operator !=(Coord c1, Coord c2) => !(c1 == c2); + /// Starting point. + /// Ending point. + /// IEnumerable of all positions on a line between the two points, including the start and end points. + public static IEnumerable PositionsOnLine(Coord start, Coord end) + { + int x0 = start.X; + int y0 = start.Y; + int x1 = end.X; + int y1 = end.Y; + + bool steep = Math.Abs(y1 - y0) > Math.Abs(x1 - x0); + if (steep) + { + Utility.Swap(ref x0, ref y0); + Utility.Swap(ref x1, ref y1); + } + + if (x0 > x1) + { + Utility.Swap(ref x0, ref x1); + Utility.Swap(ref y0, ref y1); + } + + int dx = x1 - x0; + int dy = Math.Abs(y1 - y0); + + int err = dx / 2; + int yStep = (y0 < y1 ? 1 : -1); + int y = y0; + + for (int x = x0; x <= x1; x++) + { + if (steep) + yield return Coord.Get(y, x); + else + yield return Coord.Get(x, y); + + err -= dy; + if (err < 0) + { + y += yStep; + err += dx; + } + } + } + + /// + /// Reverses the ToIndex function, returning the Coord represented by a given index. + /// + /// The index in 1D form. + /// The number of rows. + /// The Coord represented by the 1D index given. + public static Coord ToCoord(int index, int rowCount) => Get(index % rowCount, index / rowCount); + + /// + /// Returns y * rowCount + x. Same as Coord.ToIndex(int rowCount), just takes x and y instead. + /// + /// X-value of the coordinate. + /// Y-value of the coordinate. + /// The number of rows, used to do math to calculate index. + /// The 1D index of this Coord. + public static int ToIndex(int x, int y, int rowCount) => y * rowCount + x; + + /// + /// Reverses the ToIndex function, returning only the X-value for the given index. + /// + /// The index in 1D form. + /// The number of rows. + /// The X-value for the location represented by the given index. + public static int ToXValue(int index, int rowCount) => index % rowCount; + + /// + /// Reverses the ToIndex function, returning only the Y-value for the given index. + /// + /// The index in 1D form. + /// The number of rows. + /// The Y-value for the location represented by the given index. + public static int ToYValue(int index, int rowCount) => index / rowCount; /// /// Same as operator == in this case; returns false if o is not a Coord. @@ -271,7 +297,6 @@ public static Coord Midpoint(Coord c1, Coord c2) => /// True if o is a Coord instance, and the two coordinates are equal, false otherwise. public override bool Equals(object obj) => this == (obj as Coord); // If cast is null, operator== will take care of it. - // TODO: Test consistancy, and what it returns when compared to java squidlib version, to ensure equivalency. /// /// Returns a hash code for the Coord. The important parts: it should be fairly fast and it does not collide often. /// The details: it uses a seperate bit-mixing algorithm for X and Y, with X and Y each multiplied by a differet @@ -286,33 +311,6 @@ public override int GetHashCode() return (int)(((uint)(x2 ^ y2) >> ((x2 & 7) + (y2 & 7))) * 0x85157AF5); } - /// - /// Returns representation (X, Y). - /// - /// String (X, Y) - public override string ToString() => $"({X},{Y})"; - - private Coord() - { - X = 0; - Y = 0; - } - - private Coord(int x, int y) - { - X = x; - Y = y; - } - - /// - /// Returns the coordinate resulting from adding dx to the X-value of the coordinate, and dy to the Y-value of - /// the coordinate, eg. (X + dx, Y + dy). Provided for convenience. - /// - /// Delta x to add to coordinate. - /// Delta y to add to coordinate. - /// The coordinate (X + dx, Y + dy) - public Coord Translate(int dx, int dy) => Get(X + dx, Y + dy); - /// /// Returns a value that can be used to index this location in a 2D array that is actually encoded in a 1D array. Actual value is Y * rowCount + X. /// The 2D array being represented should have [width, height] of [rowCount, dontCare] for this index to be valid. Note that, when this method is used, @@ -324,36 +322,18 @@ private Coord(int x, int y) public int ToIndex(int rowCount) => Y * rowCount + X; /// - /// Returns y * rowCount + x. Same as Coord.ToIndex(int rowCount), just takes x and y instead. - /// - /// X-value of the coordinate. - /// Y-value of the coordinate. - /// The number of rows, used to do math to calculate index. - /// The 1D index of this Coord. - public static int ToIndex(int x, int y, int rowCount) => y * rowCount + x; - - /// - /// Reverses the ToIndex function, returning the Coord represented by a given index. - /// - /// The index in 1D form. - /// The number of rows. - /// The Coord represented by the 1D index given. - public static Coord ToCoord(int index, int rowCount) => Get(index % rowCount, index / rowCount); - - /// - /// Reverses the ToIndex function, returning only the X-value for the given index. + /// Returns representation (X, Y). /// - /// The index in 1D form. - /// The number of rows. - /// The X-value for the location represented by the given index. - public static int ToXValue(int index, int rowCount) => index % rowCount; + /// String (X, Y) + public override string ToString() => $"({X},{Y})"; /// - /// Reverses the ToIndex function, returning only the Y-value for the given index. + /// Returns the coordinate resulting from adding dx to the X-value of the coordinate, and dy to the Y-value of + /// the coordinate, eg. (X + dx, Y + dy). Provided for convenience. /// - /// The index in 1D form. - /// The number of rows. - /// The Y-value for the location represented by the given index. - public static int ToYValue(int index, int rowCount) => index / rowCount; + /// Delta x to add to coordinate. + /// Delta y to add to coordinate. + /// The coordinate (X + dx, Y + dy) + public Coord Translate(int dx, int dy) => Get(X + dx, Y + dy); } } \ No newline at end of file diff --git a/GoRogue/Direction.cs b/GoRogue/Direction.cs index df56cf09..0873de03 100644 --- a/GoRogue/Direction.cs +++ b/GoRogue/Direction.cs @@ -406,6 +406,25 @@ public static IEnumerable Outwards() yield return DOWN_RIGHT; } + /// + /// Calculates degree bearing of the line (from => to), where 0 is the direction UP. + /// + /// Coordinate of line starting point. + /// Coordinate of line ending point. + /// The degree bearing of the line specified by the two given points. + public static double BearingOfLine(Coord from, Coord to) + { + int x = to.X - from.X; + int y = to.Y - from.Y; + y *= yMult; + + double angle = Math.Atan2(y, x); + double degree = MathHelpers.ToDegree(angle); + degree += 450; // Rotate to all positive such that 0 is up + degree %= 360; // Normalize + return degree; + } + /// /// Returns the direction that most closely matches the angle given by a line from (0, 0) to the input. Straight up is degree 0, straight down is 180 degrees, etc. /// If the angle happens to be right on the border between 2 angles, it rounds "up", eg., we take the closest angle in the clockwise direction. diff --git a/GoRogue/Distance.cs b/GoRogue/Distance.cs index b7af97ec..0ae50c7d 100644 --- a/GoRogue/Distance.cs +++ b/GoRogue/Distance.cs @@ -11,10 +11,12 @@ public enum DistanceType /// Enum type for Distance.MANHATTAN. /// MANHATTAN, + /// /// Enum type for Distance.EUCLIDEAN. /// EUCLIDEAN, + /// /// Enum type for Distance.CHEBYSHEV. /// @@ -41,10 +43,12 @@ public class Distance /// MANHATTAN distance (equivalent to 4-way, cardinal-only movement). /// public static Distance MANHATTAN = new Distance(DistanceType.MANHATTAN); + /// /// EUCLIDEAN distance (equivalent to 8-way movement with extra cost for diagonals). /// public static Distance EUCLIDEAN = new Distance(DistanceType.EUCLIDEAN); + /// /// CHEBYSHEV distance (equivalent to 8-way movement with no extra cost for diagonals). /// diff --git a/GoRogue/Effect.cs b/GoRogue/Effect.cs index 22f9b634..b225d692 100644 --- a/GoRogue/Effect.cs +++ b/GoRogue/Effect.cs @@ -28,25 +28,25 @@ public class EffectArgs /// a stat. /// /// - /// Effectively, the class is nothing more than an interface for the concept of something + /// Effectively, the class is nothing more than an interface for the concept of something /// that happens, potentially instantaneously or potentially one or more times on a /// certain event (beginning of a turn, end of a turn, on taking damage, etc). The /// standard way to use the Effect class is to create a subclass /// of Effect, that at the very least implements the OnTrigger function, which should /// accomplish whatever the effect should do when it is triggered. - /// + /// /// The subclass can /// specify what parameter(s) it needs to take in via the class's type parameter. /// If multiple arguments are needed, one should create a class that subclasses EffectArgs /// that contains all the parameters, and the effect subclass should then take an /// instance of that EffectArgs subclass as the single parameter. If no arguments /// are needed, then one may pass null as the parameter to Trigger. - /// + /// /// The concept of a duration is also built in to the interface (see EffectTrigger class /// for details on Effect durations. The duration is to be interpreted as the number of /// times the effect's Trigger function will be called before it will be removed /// from an EffectTrigger. - /// + /// /// If the effect is /// instantaneous, eg. it happens only when Trigger is called, on no /// particular event (such as a simple instant physical damage effect), then the duration @@ -59,18 +59,21 @@ public class EffectArgs abstract public class Effect where TriggerArgs : EffectArgs { #pragma warning disable RECS0108 + /// /// The value one should specify as the effect duration for /// an infinite effect, eg. an effect that will never expire /// and be automatically removed from an EffectTrigger. /// public static readonly int INFINITE = -1; + /// /// The value one should specify as the effect duaration for an /// instantaneous effect, eg. an effect that only occurs when Trigger /// is manually called, and thus cannot be added to an EffectTrigger. /// public static readonly int INSTANT = 0; + #pragma warning restore RECS0108 /// @@ -130,4 +133,4 @@ public override string ToString() return $"{Name}: {durationStr} duration remaining"; } } -} +} \ No newline at end of file diff --git a/GoRogue/EffectTrigger.cs b/GoRogue/EffectTrigger.cs index 315893e8..5515c6c3 100644 --- a/GoRogue/EffectTrigger.cs +++ b/GoRogue/EffectTrigger.cs @@ -11,20 +11,20 @@ namespace GoRogue /// EffectTrigger's primary purpose is to represent an event that can trigger one or more /// effects automatically, and manage the automatic removal of those effects when /// their duration reaches 0. - /// + /// /// Each EffectTrigger instance can have one or more non-instantaneous effects added to it. /// All Effects must take the same type of argument to their Trigger function, as specified /// by this class's TriggerArgs type parameter. - /// + /// /// Each time the EffectTrigger's TriggerEffects function is called, every added Effect /// has its Trigger function called (provided its duration is not 0). Each Effect may, /// via the TriggerArgs CancelTrigger member, stop the effect from being sent to subsequent /// Effects in the EffectTrigger's list. - /// - /// Once all effects have had Trigger called as applicable, or some effect has cancelled + /// + /// Once all effects have had Trigger called as applicable, or some effect has cancelled /// the trigger, any effect whose duration has reached 0 is removed from the EffectTrigger /// automatically. - /// + /// /// Typically, one instance of this class is created per "event" that can trigger /// effects, and then the instance's TriggerEffects function is called whenever that /// event happens. For example, in a typical roguelike, all damageable creatures might @@ -33,7 +33,7 @@ namespace GoRogue /// EffectTrigger. The TakeDamage function of that creature would then need to call /// OnDamageTaken.TriggerEffects(...). In this way, all effects added to the OnDamageTaken /// EffectTrigger would be triggered automatically whenever the creature takes damage. - /// + /// /// For some complex game mechanics, it may be desireable to control how effects stack, /// the order they appear in the Effects list of EffectTriggers, etc. In these cases, /// subclassing EffectTrigger and overriding add/remove can allow this functionality. @@ -43,6 +43,7 @@ namespace GoRogue public class EffectTrigger where TriggerArgs : EffectArgs { private List> _effects; + /// /// List of all effects that are part of this EffectTrigger. /// @@ -89,7 +90,7 @@ public virtual void Add(Effect effect) /// will be broken and no subsequent effects in the list will have Trigger called. /// After either this occurs or all effects have had Trigger called, any effect /// in the list that has a duration of 0 is automatically removed from the list. - /// + /// /// It is valid to pass null as the argument to this function, if the effects /// need no actual parameters. /// @@ -116,4 +117,4 @@ public void TriggerEffects(TriggerArgs args) indicesForRemoval.Clear(); } } -} +} \ No newline at end of file diff --git a/GoRogue/GoRogue.csproj b/GoRogue/GoRogue.csproj index 21e35e18..bfc9d7be 100644 --- a/GoRogue/GoRogue.csproj +++ b/GoRogue/GoRogue.csproj @@ -17,16 +17,15 @@ bin\Release\netstandard2.0\GoRogue.xml bin\Release\ + 1701;1702;1705;RECS0145; bin\Debug\ + 1701;1702;1705;RECS0145; - + diff --git a/GoRogue/IMapOf.cs b/GoRogue/IMapOf.cs index be75c000..2895d9bf 100644 --- a/GoRogue/IMapOf.cs +++ b/GoRogue/IMapOf.cs @@ -11,13 +11,13 @@ /// tile is passable with respect to pathing. This boolean value might be determined by a number of things - /// terrain type, monster positions, etc. Thus, in practice, maintaining an actual 2D array of boolean values /// that such an algorithm could take as input can be significant work. - /// + /// /// IMapOf solves this problem by providing an interface that all such algorithms can take as input -- pathfinding, /// for instance, would take an IMapOf<bool> instance, rather than a 2D array of booleans. A user of that algorithm /// might create a class that implements the indexers below to check the terrain type, if there is a monster at the /// position, etc., and returns the correct value. This prevents the need to maintain an actual 2D array in code /// that pathfinding can use, if such an array does not fit with your game architecture. - /// + /// /// If an actual 2D array is desired, a class ArrayMapOf is provided that implements IMapOf, and acts much like /// an actual 2D array. /// @@ -28,6 +28,7 @@ public interface IMapOf /// The width of the map being represented. /// int Width { get; } + /// /// The height of the map being represented. /// @@ -40,6 +41,7 @@ public interface IMapOf /// Y-value of location. /// The "value" associated with that location. T this[int x, int y] { get; } + /// /// Given a Coord, should return the "value" associated with that location. /// diff --git a/GoRogue/IReadOnlySpatialMap.cs b/GoRogue/IReadOnlySpatialMap.cs index 65f55105..2338afab 100644 --- a/GoRogue/IReadOnlySpatialMap.cs +++ b/GoRogue/IReadOnlySpatialMap.cs @@ -12,6 +12,7 @@ public interface ISpatialTuple /// The item associated with this pair. /// T Item { get; } + /// /// The position associated with this pair. /// @@ -31,6 +32,7 @@ public interface IReadOnlySpatialMap : IEnumerable> /// The number of items in the data structure. /// int Count { get; } + /// /// Enumerable of the items stored in the data structure: for use to iterate over all items, eg: /// @@ -41,36 +43,42 @@ public interface IReadOnlySpatialMap : IEnumerable> /// /// IEnumerable Items { get; } + /// /// Enumerable of all positions that contain items. Likely this won't be used as much, since most objects that are /// contained in a spatial map implementation will record their position as a member, however in case that is not /// the case for a particular use, or just as a convenience if you only care about the coordinates, this is provided. /// IEnumerable Positions { get; } + /// /// Returns whether or not the data structure contains the given item. /// /// The item to check for. /// True if the given item is in the data structure, false if not. bool Contains(T item); + /// /// Returns if there is an item in the data structure at the given position or not. /// /// The position to check for. /// True if there is some item at the given position, false if not. bool Contains(Coord position); + /// /// Gets the position associated with the item in the data structure, or null if that item is not found. /// /// The item to get the position for. /// The position associated with the given item, if it exists in the data structure, or null if the item does not exist. Coord GetPosition(T item); + /// /// Gets the item(s) associated with the given position if there are any items, or returns nothing if there is nothing at that position. /// /// The position to return the item(s) for. /// The item(s) at the given position if there are any items, or nothing if there is nothing at that position. IEnumerable GetItems(Coord position); + /// /// Returns a read-only reference to the data structure. Convenient for "safely" exposing the structure as a property. /// diff --git a/GoRogue/ISettableMapOf.cs b/GoRogue/ISettableMapOf.cs index cedaf31a..1ca370b1 100644 --- a/GoRogue/ISettableMapOf.cs +++ b/GoRogue/ISettableMapOf.cs @@ -7,7 +7,7 @@ /// See IMapOf documentation. Algorithms such as map generation may need to modify their inputs. Again, creating an actual /// 2D array can be tedious, depending on the application. As such, this interface extends IMapOf to provide the capability /// to "set" values. - /// + /// /// Again, in case an actual 2D array is desired, ArrayMapOf implements this interface and provides a similar interface. /// /// The type of value being returned/set by the indexer functions. diff --git a/GoRogue/ISpatialMap.cs b/GoRogue/ISpatialMap.cs index 719b9f63..fa550477 100644 --- a/GoRogue/ISpatialMap.cs +++ b/GoRogue/ISpatialMap.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using System; +using System; +using System.Collections.Generic; namespace GoRogue { @@ -13,6 +13,7 @@ public class ItemEventArgs : EventArgs /// Item being represented. /// public T Item { get; private set; } + /// /// Current position of that item at time of event. /// @@ -40,10 +41,12 @@ public class ItemMovedEventArgs : EventArgs /// Item being represented. /// public T Item { get; private set; } + /// /// Position of item before it was moved. /// public Coord OldPosition { get; private set; } + /// /// Position of item after it has been moved. /// @@ -78,10 +81,12 @@ public interface ISpatialMap : IReadOnlySpatialMap /// Fired directly after an item has been added to the data structure. /// event EventHandler> ItemAdded; + /// /// Fired directly after an item has been removed from the data structure. /// event EventHandler> ItemRemoved; + /// /// Fired directly after an item in the data structure has been moved. /// @@ -95,6 +100,7 @@ public interface ISpatialMap : IReadOnlySpatialMap /// Position to add item to. /// True if item was successfully added, false otherwise. bool Add(T newItem, Coord position); + /// /// Moves the given item from its current location to the specified one. Returns true if the item was successfully /// moved, false otherwise. @@ -103,6 +109,7 @@ public interface ISpatialMap : IReadOnlySpatialMap /// Location to move item to. /// True if item was successfully moved, false otherwise. bool Move(T item, Coord target); + /// /// Moves any items at the specified location to the target one. Returns any items that were moved. /// @@ -110,21 +117,24 @@ public interface ISpatialMap : IReadOnlySpatialMap /// Location to move items to. /// Any items that were moved, nothing if no items were moved. IEnumerable Move(Coord current, Coord target); + /// /// Removes the given item from the data structure, returning true if the item was removed or false otherwise. /// /// The item to remove. /// True if item was removed, false otherwise. bool Remove(T item); + /// /// Removes any items at the specified location from the data structure. Returns any items that were removed. /// /// Position to remove items from. /// Any items that were removed, or nothing if no items were removed. IEnumerable Remove(Coord position); + /// /// Clears all items out of the data structure. /// void Clear(); } -} +} \ No newline at end of file diff --git a/GoRogue/LOS.cs b/GoRogue/LOS.cs index d4b806ce..0d3af32b 100644 --- a/GoRogue/LOS.cs +++ b/GoRogue/LOS.cs @@ -18,6 +18,7 @@ public class LOS : IMapOf /// Width of LOS map. /// public int Width { get => resMap.Width; } + /// /// Height of LOS map. /// @@ -75,7 +76,6 @@ public LOS(IMapOf resMap) /// effectively infinite. public void Calculate(Coord start, int radius = int.MaxValue) => Calculate(start.X, start.Y, radius, Radius.CIRCLE); - /// /// Calculates LOS, given an origin point of (startX, startY), with the given radius and radius calculation strategy. /// diff --git a/GoRogue/MapGeneration/Connectors/CenterBoundsConnectionPointSelector.cs b/GoRogue/MapGeneration/Connectors/CenterBoundsConnectionPointSelector.cs index 82d49f37..a60e0c2f 100644 --- a/GoRogue/MapGeneration/Connectors/CenterBoundsConnectionPointSelector.cs +++ b/GoRogue/MapGeneration/Connectors/CenterBoundsConnectionPointSelector.cs @@ -16,4 +16,4 @@ public class CenterBoundsConnectionPointSelector : IAreaConnectionPointSelector /// public Tuple SelectConnectionPoints(MapArea area1, MapArea area2) => new Tuple(area1.Bounds.Center, area2.Bounds.Center); } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/ClosestMapAreaConnector.cs b/GoRogue/MapGeneration/Connectors/ClosestMapAreaConnector.cs index 76e04021..82a7225f 100644 --- a/GoRogue/MapGeneration/Connectors/ClosestMapAreaConnector.cs +++ b/GoRogue/MapGeneration/Connectors/ClosestMapAreaConnector.cs @@ -11,7 +11,7 @@ namespace GoRogue.MapGeneration.Connectors /// Then, we iterate through each area, find the closest area that is not already conencted to the current area, /// and create a tunnel between the two. Distance between to areas is measured as the distance between the center /// point of the bounding boxes of those areas. - /// + /// /// Points to connect two areas, as well as method used to create a tunnel between those two points, are selected via specified parameters. /// static public class ClosestMapAreaConnector @@ -83,4 +83,4 @@ static private int findNearestMapArea(IList mapAreas, Distance distance return closestIndex; } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/DirectLineTunnelCreator.cs b/GoRogue/MapGeneration/Connectors/DirectLineTunnelCreator.cs index 59d52fe1..f67617df 100644 --- a/GoRogue/MapGeneration/Connectors/DirectLineTunnelCreator.cs +++ b/GoRogue/MapGeneration/Connectors/DirectLineTunnelCreator.cs @@ -11,7 +11,7 @@ public class DirectLineTunnelCreator : ITunnelCreator private Distance distanceCalc; /// - /// Constructor. Takes the shape that defines a radius, which is used to determine the proper distnace calculation. + /// Constructor. Takes the shape that defines a radius, which is used to determine the proper distance calculation. /// /// The shape defining a radius, which determines the distance calculation to use. public DirectLineTunnelCreator(Radius shape) @@ -51,4 +51,4 @@ public void CreateTunnel(ISettableMapOf map, Coord start, Coord end) } } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/HorizontalVerticalTunnelCreator.cs b/GoRogue/MapGeneration/Connectors/HorizontalVerticalTunnelCreator.cs index 14819ee9..2783d3a7 100644 --- a/GoRogue/MapGeneration/Connectors/HorizontalVerticalTunnelCreator.cs +++ b/GoRogue/MapGeneration/Connectors/HorizontalVerticalTunnelCreator.cs @@ -10,6 +10,7 @@ namespace GoRogue.MapGeneration.Connectors public class HorizontalVerticalTunnelCreator : ITunnelCreator { private IRandom rng; + /// /// Constructor. Takes rng to use -- if null is specified, the default RNG is used. /// @@ -56,4 +57,4 @@ static private void createVTunnel(ISettableMapOf map, int yStart, int yEnd map[xPos, y] = true; } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/IAreaConnectionPointSelector.cs b/GoRogue/MapGeneration/Connectors/IAreaConnectionPointSelector.cs index d131004a..f67d5ab3 100644 --- a/GoRogue/MapGeneration/Connectors/IAreaConnectionPointSelector.cs +++ b/GoRogue/MapGeneration/Connectors/IAreaConnectionPointSelector.cs @@ -17,4 +17,4 @@ public interface IAreaConnectionPointSelector /// Coord in area2. Tuple SelectConnectionPoints(MapArea area1, MapArea area2); } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/ITunnelCreator.cs b/GoRogue/MapGeneration/Connectors/ITunnelCreator.cs index a4df0b5b..6a5858e2 100644 --- a/GoRogue/MapGeneration/Connectors/ITunnelCreator.cs +++ b/GoRogue/MapGeneration/Connectors/ITunnelCreator.cs @@ -13,4 +13,4 @@ public interface ITunnelCreator /// End position to connect. void CreateTunnel(ISettableMapOf map, Coord start, Coord end); } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/OrderedMapAreaConnector.cs b/GoRogue/MapGeneration/Connectors/OrderedMapAreaConnector.cs index a42d9f93..985809dd 100644 --- a/GoRogue/MapGeneration/Connectors/OrderedMapAreaConnector.cs +++ b/GoRogue/MapGeneration/Connectors/OrderedMapAreaConnector.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using GoRogue.Random; +using GoRogue.Random; +using System.Collections.Generic; namespace GoRogue.MapGeneration.Connectors { @@ -78,4 +78,4 @@ static public void Connect(ISettableMapOf map, IList mapAreas, IA } } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Connectors/RandomConnectionPointSelector.cs b/GoRogue/MapGeneration/Connectors/RandomConnectionPointSelector.cs index 1d0bd4d7..a744f404 100644 --- a/GoRogue/MapGeneration/Connectors/RandomConnectionPointSelector.cs +++ b/GoRogue/MapGeneration/Connectors/RandomConnectionPointSelector.cs @@ -1,5 +1,5 @@ -using System; -using GoRogue.Random; +using GoRogue.Random; +using System; namespace GoRogue.MapGeneration.Connectors { @@ -32,4 +32,4 @@ public RandomConnectionPointSelector(IRandom rng = null) public Tuple SelectConnectionPoints(MapArea area1, MapArea area2) => new Tuple(area1.Positions.RandomItem(rng), area2.Positions.RandomItem(rng)); } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Generators/CellularAutomataGenerator.cs b/GoRogue/MapGeneration/Generators/CellularAutomataGenerator.cs index d0d62fda..26631418 100644 --- a/GoRogue/MapGeneration/Generators/CellularAutomataGenerator.cs +++ b/GoRogue/MapGeneration/Generators/CellularAutomataGenerator.cs @@ -1,157 +1,158 @@ -using System; -using GoRogue.Random; +using GoRogue.Random; +using System; + namespace GoRogue.MapGeneration.Generators { - /// - /// Implements a cellular automata genereation algorithm to generate a cave-like map. - /// - /// - /// Generates a map by randomly filling the map surface with floor or wall values (true and false respectively) based on a probability - /// given, then iteratively smoothing it via the process outlined in the cited roguebasin article. - /// - /// After generate is called, the passed in map will have had a value of true set to all floor tiles, and a value of false set to all wall tiles. - /// - /// Like RandomRoomsMapGenerator, it is recommended to use ArrayMapOf as the SettableMapOf instance passed in, as this class must - /// call set for each location very likely more than one time, overwriting any previous values(thus doing significant processing on each - /// call to set is inadvisable). It will likely be faster to take the resulting ArrayMapOf after completion, and process it to do any required - /// translation. - /// - /// Based on the C# roguelike library RogueSharp's implementation, and the roguebasin article below: - /// http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels. - /// - static public class CellularAutomataGenerator - { - /// - /// Generates the map. Floor tiles will be set to true in the provided map, and wall tiles will be - /// set to false. - /// - /// The map to fill with values when generate is called. - /// The RNG to use to initially fill the map. If null is specified, the default RNG is used. - /// Represents the percent chance that a given cell will be a floor cell - /// when the map is initially randomly filled. Recommended to be in range [40, 60] (40 is used in - /// the roguebasin article). - /// Total number of times the cellular automata-based smoothing algorithm - /// is executed. Recommended to be in range [2, 10] (7 is used on roguebasin article). - /// Total number of times the cellular automata smoothing variation - /// that is more likely to result in "breaking up" large areas will be run before switching to the - /// more standard nearest neighbors version. Recommended to be in range [2, 7] (4 is used in roguebasin - /// article). - /// Whether or not to ensure all areas generated are connected. If this is true, ClosestMapAreaConnector.Connect - /// will be used to connect the areas, with Distance.MANHATTAN distance used, the RNG given, a RandomConnectionPointSelector that uses the RNG - /// specified to this function, and default values for all other optional parameters of ClosestMapAreaConnector.Connect. - static public void Generate(ISettableMapOf map, IRandom rng = null, int fillProbability = 40, int totalIterations = 7, int cutoffBigAreaFill = 4, - bool connectUsingDefault = true) - { - if (rng == null) rng = SingletonRandom.DefaultRNG; - - randomlyFillCells(map, rng, fillProbability); - - for (int i = 0; i < totalIterations; i++) - { - if (i < cutoffBigAreaFill) - cellAutoBigAreaAlgo(map); - else - cellAutoNearestNeighborsAlgo(map); - } - - // Ensure it's enclosed before we try to connect, so we can't possibly connect a path that ruins the enclosure. - // Doing this before connection ensures that filling it can't kill the path to an area. - fillToRectangle(map); - - if (connectUsingDefault) - Connectors.ClosestMapAreaConnector.Connect(map, Distance.MANHATTAN, new Connectors.RandomConnectionPointSelector(rng)); - } - - static private void randomlyFillCells(ISettableMapOf map, IRandom rng, int fillProbability) - { - for (int x = 0; x < map.Width; x++) - for (int y = 0; y < map.Height; y++) - { - if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) // Borders are always walls - map[x, y] = false; - else if (rng.Next(99) < fillProbability) - map[x, y] = true; - else - map[x, y] = false; - } - } - - static private void fillToRectangle(ISettableMapOf map) - { - for (int x = 0; x < map.Width; x++) - { - map[x, 0] = false; - map[x, map.Height - 1] = false; - } - - for (int y = 0; y < map.Height; y++) - { - map[0, y] = false; - map[map.Width - 1, y] = false; - } - } - - static private void cellAutoBigAreaAlgo(ISettableMapOf map) - { - var oldMap = new ArrayMapOf(map.Width, map.Height); - - for (int x = 0; x < map.Width; x++) - for (int y = 0; y < map.Height; y++) - oldMap[x, y] = map[x, y]; - - for (int x = 0; x < map.Width; x++) - for (int y = 0; y < map.Height; y++) - { - if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) - continue; - - if (countWallsNear(oldMap, x, y, 1) >= 5 || countWallsNear(oldMap, x, y, 2) <= 2) - map[x, y] = false; - else - map[x, y] = true; - } - } - - static private void cellAutoNearestNeighborsAlgo(ISettableMapOf map) - { - var oldMap = new ArrayMapOf(map.Width, map.Height); - - for (int x = 0; x < map.Width; x++) - for (int y = 0; y < map.Height; y++) - oldMap[x, y] = map[x, y]; - - for (int x = 0; x < map.Width; x++) - for (int y = 0; y < map.Height; y++) - { - if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) - continue; - - if (countWallsNear(oldMap, x, y, 1) >= 5) - map[x, y] = false; - else - map[x, y] = true; - } - } - - static private int countWallsNear(ISettableMapOf mapToUse, int posX, int posY, int distance) - { - int count = 0; - int xMin = Math.Max(posX - distance, 0); - int xMax = Math.Min(posX + distance, mapToUse.Width - 1); - int yMin = Math.Max(posY - distance, 0); - int yMax = Math.Min(posY + distance, mapToUse.Height - 1); - - for (int x = xMin; x <= xMax; x++) - for (int y = yMin; y <= yMax; y++) - { - if (x == posX && y == posY) - continue; - - if (!mapToUse[x, y]) - ++count; - } - - return count; - } - } -} + /// + /// Implements a cellular automata genereation algorithm to generate a cave-like map. + /// + /// + /// Generates a map by randomly filling the map surface with floor or wall values (true and false respectively) based on a probability + /// given, then iteratively smoothing it via the process outlined in the cited roguebasin article. + /// + /// After generate is called, the passed in map will have had a value of true set to all floor tiles, and a value of false set to all wall tiles. + /// + /// Like RandomRoomsMapGenerator, it is recommended to use ArrayMapOf as the SettableMapOf instance passed in, as this class must + /// call set for each location very likely more than one time, overwriting any previous values(thus doing significant processing on each + /// call to set is inadvisable). It will likely be faster to take the resulting ArrayMapOf after completion, and process it to do any required + /// translation. + /// + /// Based on the C# roguelike library RogueSharp's implementation, and the roguebasin article below: + /// http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels. + /// + static public class CellularAutomataGenerator + { + /// + /// Generates the map. Floor tiles will be set to true in the provided map, and wall tiles will be + /// set to false. + /// + /// The map to fill with values when generate is called. + /// The RNG to use to initially fill the map. If null is specified, the default RNG is used. + /// Represents the percent chance that a given cell will be a floor cell + /// when the map is initially randomly filled. Recommended to be in range [40, 60] (40 is used in + /// the roguebasin article). + /// Total number of times the cellular automata-based smoothing algorithm + /// is executed. Recommended to be in range [2, 10] (7 is used on roguebasin article). + /// Total number of times the cellular automata smoothing variation + /// that is more likely to result in "breaking up" large areas will be run before switching to the + /// more standard nearest neighbors version. Recommended to be in range [2, 7] (4 is used in roguebasin + /// article). + /// Whether or not to ensure all areas generated are connected. If this is true, ClosestMapAreaConnector.Connect + /// will be used to connect the areas, with Distance.MANHATTAN distance used, the RNG given, a RandomConnectionPointSelector that uses the RNG + /// specified to this function, and default values for all other optional parameters of ClosestMapAreaConnector.Connect. + static public void Generate(ISettableMapOf map, IRandom rng = null, int fillProbability = 40, int totalIterations = 7, int cutoffBigAreaFill = 4, + bool connectUsingDefault = true) + { + if (rng == null) rng = SingletonRandom.DefaultRNG; + + randomlyFillCells(map, rng, fillProbability); + + for (int i = 0; i < totalIterations; i++) + { + if (i < cutoffBigAreaFill) + cellAutoBigAreaAlgo(map); + else + cellAutoNearestNeighborsAlgo(map); + } + + // Ensure it's enclosed before we try to connect, so we can't possibly connect a path that ruins the enclosure. + // Doing this before connection ensures that filling it can't kill the path to an area. + fillToRectangle(map); + + if (connectUsingDefault) + Connectors.ClosestMapAreaConnector.Connect(map, Distance.MANHATTAN, new Connectors.RandomConnectionPointSelector(rng)); + } + + static private void randomlyFillCells(ISettableMapOf map, IRandom rng, int fillProbability) + { + for (int x = 0; x < map.Width; x++) + for (int y = 0; y < map.Height; y++) + { + if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) // Borders are always walls + map[x, y] = false; + else if (rng.Next(99) < fillProbability) + map[x, y] = true; + else + map[x, y] = false; + } + } + + static private void fillToRectangle(ISettableMapOf map) + { + for (int x = 0; x < map.Width; x++) + { + map[x, 0] = false; + map[x, map.Height - 1] = false; + } + + for (int y = 0; y < map.Height; y++) + { + map[0, y] = false; + map[map.Width - 1, y] = false; + } + } + + static private void cellAutoBigAreaAlgo(ISettableMapOf map) + { + var oldMap = new ArrayMapOf(map.Width, map.Height); + + for (int x = 0; x < map.Width; x++) + for (int y = 0; y < map.Height; y++) + oldMap[x, y] = map[x, y]; + + for (int x = 0; x < map.Width; x++) + for (int y = 0; y < map.Height; y++) + { + if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) + continue; + + if (countWallsNear(oldMap, x, y, 1) >= 5 || countWallsNear(oldMap, x, y, 2) <= 2) + map[x, y] = false; + else + map[x, y] = true; + } + } + + static private void cellAutoNearestNeighborsAlgo(ISettableMapOf map) + { + var oldMap = new ArrayMapOf(map.Width, map.Height); + + for (int x = 0; x < map.Width; x++) + for (int y = 0; y < map.Height; y++) + oldMap[x, y] = map[x, y]; + + for (int x = 0; x < map.Width; x++) + for (int y = 0; y < map.Height; y++) + { + if (x == 0 || y == 0 || x == map.Width - 1 || y == map.Height - 1) + continue; + + if (countWallsNear(oldMap, x, y, 1) >= 5) + map[x, y] = false; + else + map[x, y] = true; + } + } + + static private int countWallsNear(ISettableMapOf mapToUse, int posX, int posY, int distance) + { + int count = 0; + int xMin = Math.Max(posX - distance, 0); + int xMax = Math.Min(posX + distance, mapToUse.Width - 1); + int yMin = Math.Max(posY - distance, 0); + int yMax = Math.Min(posY + distance, mapToUse.Height - 1); + + for (int x = xMin; x <= xMax; x++) + for (int y = yMin; y <= yMax; y++) + { + if (x == posX && y == posY) + continue; + + if (!mapToUse[x, y]) + ++count; + } + + return count; + } + } +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Generators/RandomRoomsGenerator.cs b/GoRogue/MapGeneration/Generators/RandomRoomsGenerator.cs index 69cc630a..8a2564a2 100644 --- a/GoRogue/MapGeneration/Generators/RandomRoomsGenerator.cs +++ b/GoRogue/MapGeneration/Generators/RandomRoomsGenerator.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using GoRogue.Random; +using GoRogue.Random; +using System.Collections.Generic; namespace GoRogue.MapGeneration.Generators { @@ -84,6 +84,7 @@ static private bool checkOverlap(Rectangle room, List existingRooms) return false; } + static private void createRoom(ISettableMapOf map, Rectangle room) { for (int x = room.X + 1; x < room.MaxX; x++) @@ -91,4 +92,4 @@ static private void createRoom(ISettableMapOf map, Rectangle room) map[x, y] = true; } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/Generators/RectangleMapGenerator.cs b/GoRogue/MapGeneration/Generators/RectangleMapGenerator.cs index 9abcb338..9eb061b4 100644 --- a/GoRogue/MapGeneration/Generators/RectangleMapGenerator.cs +++ b/GoRogue/MapGeneration/Generators/RectangleMapGenerator.cs @@ -27,4 +27,4 @@ static public void Generate(ISettableMapOf map) } } } -} +} \ No newline at end of file diff --git a/GoRogue/MapGeneration/MapArea.cs b/GoRogue/MapGeneration/MapArea.cs index 748b84a7..aaff7f34 100644 --- a/GoRogue/MapGeneration/MapArea.cs +++ b/GoRogue/MapGeneration/MapArea.cs @@ -30,6 +30,7 @@ public Rectangle Bounds } private List _positions; + /// /// List of all (unique) positions in the list. /// diff --git a/GoRogue/MapGeneration/MapAreaFinder.cs b/GoRogue/MapGeneration/MapAreaFinder.cs index 6539372a..cd2e9fa7 100644 --- a/GoRogue/MapGeneration/MapAreaFinder.cs +++ b/GoRogue/MapGeneration/MapAreaFinder.cs @@ -22,6 +22,7 @@ public class MapAreaFinder private bool[,] visited; private Distance _distanceCalc; + /// /// The calculation used to determine distance between two points. /// @@ -117,6 +118,7 @@ private MapArea visit(Coord position) /// /// An IEnumerable of each (unique) map area. static public IEnumerable MapAreasFor(IMapOf map, Radius shape) => MapAreasFor(map, (Distance)shape); + /// /// Convenience function that creates an MapAreaFinder and returns the result of that MapAreaFinder's MapAreas function. /// Intended to be used for cases in which the area finder will never be re-used. diff --git a/GoRogue/MathHelpers.cs b/GoRogue/MathHelpers.cs index 904e8f43..8f03a5c5 100644 --- a/GoRogue/MathHelpers.cs +++ b/GoRogue/MathHelpers.cs @@ -38,7 +38,7 @@ public static class MathHelpers /// be between [0, wrapTo - 1], inclusive. /// The wrapped result, as outlined in function description. Guaranteed to lie in range [0, wrapTo - 1], inclusive. public static int WrapAround(int num, int wrapTo) => (num % wrapTo + wrapTo) % wrapTo; - + /// /// Rounds the given number up (toward highest number), to the nearest multiple of the specified value. /// diff --git a/GoRogue/MultiSpatialMap.cs b/GoRogue/MultiSpatialMap.cs index efe4dd02..116d33f6 100644 --- a/GoRogue/MultiSpatialMap.cs +++ b/GoRogue/MultiSpatialMap.cs @@ -1,6 +1,6 @@ using System; -using System.Collections.Generic; using System.Collections; +using System.Collections.Generic; namespace GoRogue { @@ -15,7 +15,7 @@ namespace GoRogue /// first place, this implementation may be particularly useful for situations such as inventory items, where multiple /// items may be desired at one location. If one is implementing something akin to "buckets", one may also subclass /// this implementation and provide handlers to the various events it exposes to keep track of the object on top, etc. - /// + /// /// The two implementations could also in many cases be used in combination as necessary, since they both implement /// the ISpatialMap interface. /// @@ -29,6 +29,7 @@ public class MultiSpatialMap : ISpatialMap where T : IHasID /// See IReadOnlySpatialMap.Count. /// public int Count { get => itemMapping.Count; } + /// /// See IReadOnlySpatialMap.Items. /// @@ -40,6 +41,7 @@ public IEnumerable Items yield return item.Item; } } + /// /// See IReadOnlySpatialMap.Positions. /// @@ -56,10 +58,12 @@ public IEnumerable Positions /// See ISpatialMap.ItemAdded. /// public event EventHandler> ItemAdded; + /// /// See ISpatialMap.ItemRemoved. /// public event EventHandler> ItemRemoved; + /// /// See ISpatialMap.ItemMoved. /// @@ -207,10 +211,12 @@ public IEnumerable Remove(Coord position) /// See IReadOnlySpatialMap.Contains. /// public bool Contains(T item) => itemMapping.ContainsKey(item.ID); + /// /// See IReadOnlySpatialMap.Contains. /// public bool Contains(Coord position) => positionMapping.ContainsKey(position); + /// /// See IReadOnlySpatialMap.GetPosition. /// @@ -263,4 +269,4 @@ public IEnumerator> GetEnumerator() /// The current SpatialMap, as a "read-only" reference. public IReadOnlySpatialMap AsReadOnly() => (IReadOnlySpatialMap)this; } -} +} \ No newline at end of file diff --git a/GoRogue/Radius.cs b/GoRogue/Radius.cs index 86d16082..892a0b88 100644 --- a/GoRogue/Radius.cs +++ b/GoRogue/Radius.cs @@ -9,22 +9,27 @@ public enum RadiusType /// Type for Radius.SQUARE. /// SQUARE, + /// /// Type for Radius.DIAMOND. /// DIAMOND, + /// /// Type for Radius.CIRCLE. /// CIRCLE, + /// /// Type for Radius.CUBE. /// CUBE, + /// /// Type for Radius.OCTAHEDRON. /// OCTAHEDRON, + /// /// Type for Radius.SPHERE. /// diff --git a/GoRogue/RadiusAreaProvider.cs b/GoRogue/RadiusAreaProvider.cs index 62b78a6b..dd17d5fd 100644 --- a/GoRogue/RadiusAreaProvider.cs +++ b/GoRogue/RadiusAreaProvider.cs @@ -64,6 +64,7 @@ public int Radius } private Distance _distanceCalc; + /// /// The distance calculation that defines the concept of radius. /// @@ -81,6 +82,7 @@ public Distance DistanceCalc /// The shape of the radius. /// public Radius RadiusShape { get => (Radius)_distanceCalc; set => DistanceCalc = (Distance)value; } + /// /// The bounds to constrain the returned Coords to. Set to Rectangle.EMPTY /// to indicate that there are no bounds. diff --git a/GoRogue/Rectangle.cs b/GoRogue/Rectangle.cs index 9d08b5cd..9e9f4a54 100644 --- a/GoRogue/Rectangle.cs +++ b/GoRogue/Rectangle.cs @@ -16,6 +16,7 @@ public struct Rectangle : IEquatable /// Minimum X-coordinate of the rectangle. /// public int X { get; set; } + /// /// Minimum Y-coordinate that is included in the rectangle. /// @@ -34,6 +35,7 @@ public Coord MinCorner /// The width of the rectangle, in grid squares. /// public int Width { get; set; } + /// /// The height of the rectangle, in grid squares. /// @@ -217,7 +219,7 @@ public bool Equals(Rectangle other) } /// - /// See Equals. + /// See Equals. /// /// First rectangle. /// Second rectangle. diff --git a/GoRogue/SenseMapping/SenseMap.cs b/GoRogue/SenseMapping/SenseMap.cs index 10a94947..f01773d3 100644 --- a/GoRogue/SenseMapping/SenseMap.cs +++ b/GoRogue/SenseMapping/SenseMap.cs @@ -32,6 +32,7 @@ public class SenseMap : IEnumerable, IMapOf /// Width of sense map. /// public int Width { get => resMap.Width; } + /// /// Height of sense map. /// diff --git a/GoRogue/SenseMapping/SenseSource.cs b/GoRogue/SenseMapping/SenseSource.cs index ae4437a8..d2244981 100644 --- a/GoRogue/SenseMapping/SenseSource.cs +++ b/GoRogue/SenseMapping/SenseSource.cs @@ -12,19 +12,23 @@ public enum SourceType /// Performs calculation by pushing values out from the source location. Source values spread around corners a bit. /// RIPPLE, + /// /// Similar to RIPPLE but with different spread mechanics. Values spread around edges like smoke or water, but maintains /// a tendency to curl towards the start position as it goes around edges. /// RIPPLE_LOOSE, + /// /// Similar to RIPPLE, but values spread around corners only very slightly. /// RIPPLE_TIGHT, + /// /// Similar to RIPPLE, but values spread around corners a lot. /// RIPPLE_VERY_LOOSE, + /// /// Uses a Shadowcasting algorithm. All partially resistant grid locations are treated as being fully /// transparent (it's on-off blocking, where 1.0 in the resistance map blocks, and all lower values don't). diff --git a/GoRogue/SpatialMap.cs b/GoRogue/SpatialMap.cs index 10c49f4c..dd027b16 100644 --- a/GoRogue/SpatialMap.cs +++ b/GoRogue/SpatialMap.cs @@ -72,16 +72,17 @@ public IEnumerable Positions /// See ISpatialMap.ItemAdded. /// public event EventHandler> ItemAdded; + /// /// See ISpatialMap.ItemRemoved. /// public event EventHandler> ItemRemoved; + /// /// See ISpatialMap.ItemMoved. /// public event EventHandler> ItemMoved; - /// /// Constructor. Creates an empty SpatialMap. /// @@ -206,10 +207,12 @@ public IEnumerable Remove(Coord position) /// See IReadOnlySpatialMap.Contains. /// public bool Contains(T item) => itemMapping.ContainsKey(item.ID); + /// /// See IReadOnlySpatialMap.Contains. /// public bool Contains(Coord position) => positionMapping.ContainsKey(position); + /// /// See IReadOnlySpatialMap.GetPosition. /// @@ -283,6 +286,7 @@ public IEnumerator> GetEnumerator() /// /// Enumerator to ISpatialTuple instances. IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + /// /// See IReadOnlySpatialMap.AsReadOnly. /// diff --git a/GoRogue/Utility.cs b/GoRogue/Utility.cs index 921c8e62..334add1b 100644 --- a/GoRogue/Utility.cs +++ b/GoRogue/Utility.cs @@ -1,6 +1,5 @@ -using System; +using GoRogue.Random; using System.Collections.Generic; -using GoRogue.Random; namespace GoRogue { @@ -95,4 +94,4 @@ static public int RandomIndex(this IList list, IRandom rng = null) /// A list containing all the items referenced by the IEnumerable value it is called on. static public List ToList(this IEnumerable enumerable) => new List(enumerable); } -} +} \ No newline at end of file diff --git a/docs/annotated.html b/docs/annotated.html index ec64d9f5..07a911d7 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -85,7 +85,7 @@  NConnectors  CCenterBoundsConnectionPointSelectorSelects the center points of the bounding boxes of each map area. On concave map areas, because the center point of the bounding box is not actually guaranteed to be among the MapArea's walkable tiles, connecting these two points is not guaranteed to actually connect the entirety of the two areas.  CClosestMapAreaConnectorImplements a connection algorithm that connects all unique map areas in the given map by connecting each area with the one closest to it. - CDirectLineTunnelCreatorImplements a tunnel creation algorithm that sets as walkable a direct line between the two points. In the case that MAHNATTAN distance is being used, the line is calculated via the Coord.CardinalPositionOnLine function. Otherwise, the line is calculated using Coord.PositionsOnLine (brensham's). + CDirectLineTunnelCreatorImplements a tunnel creation algorithm that sets as walkable a direct line between the two points. In the case that MAHNATTAN distance is being used, the line is calculated via the Coord.CardinalPositionOnLine function. Otherwise, the line is calculated using Coord.PositionsOnLine (brensham's).  CHorizontalVerticalTunnelCreatorImplements a tunnel creation algorithm that creates a tunnel that performs all needed vertical movement before horizontal movement, or vice versa (depending on rng).  CIAreaConnectionPointSelectorInterface for implementing an algorithm for selecting the Coords to connect in order to connect two given map areas.  CITunnelCreatorInterface for implementing an algorithm for creating a tunnel between two positions on a walkability map. diff --git a/docs/class_go_rogue_1_1_coord-members.html b/docs/class_go_rogue_1_1_coord-members.html index 2c97afba..016ee96a 100644 --- a/docs/class_go_rogue_1_1_coord-members.html +++ b/docs/class_go_rogue_1_1_coord-members.html @@ -70,34 +70,33 @@

This is the complete list of members for GoRogue.Coord, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + +
BearingOfLine(Coord from, Coord to)GoRogue.Coordstatic
CardinalPositionsOnLine(Coord start, Coord end)GoRogue.Coordstatic
Equals(object obj)GoRogue.Coord
EuclidianDistanceMagnitude(Coord c1, Coord c2)GoRogue.Coordstatic
Get(int x, int y)GoRogue.Coordstatic
GetHashCode()GoRogue.Coord
Midpoint(Coord c1, Coord c2)GoRogue.Coordstatic
operator!=(Coord c1, Coord c2)GoRogue.Coordstatic
operator*(Coord c, int i)GoRogue.Coordstatic
operator*(Coord c, double i)GoRogue.Coordstatic
operator+(Coord c1, Coord c2)GoRogue.Coordstatic
operator+(Coord c, int i)GoRogue.Coordstatic
operator+(Coord c, Direction d)GoRogue.Coordstatic
operator-(Coord c1, Coord c2)GoRogue.Coordstatic
operator-(Coord c, int i)GoRogue.Coordstatic
operator/(Coord c, int i)GoRogue.Coordstatic
operator/(Coord c, double i)GoRogue.Coordstatic
operator==(Coord c1, Coord c2)GoRogue.Coordstatic
PositionsOnLine(Coord start, Coord end)GoRogue.Coordstatic
ToCoord(int index, int rowCount)GoRogue.Coordstatic
ToIndex(int rowCount)GoRogue.Coord
CardinalPositionsOnLine(Coord start, Coord end)GoRogue.Coordstatic
Equals(object obj)GoRogue.Coord
EuclideanDistanceMagnitude(Coord c1, Coord c2)GoRogue.Coordstatic
Get(int x, int y)GoRogue.Coordstatic
GetHashCode()GoRogue.Coord
Midpoint(Coord c1, Coord c2)GoRogue.Coordstatic
operator!=(Coord c1, Coord c2)GoRogue.Coordstatic
operator*(Coord c, int i)GoRogue.Coordstatic
operator*(Coord c, double i)GoRogue.Coordstatic
operator+(Coord c1, Coord c2)GoRogue.Coordstatic
operator+(Coord c, int i)GoRogue.Coordstatic
operator+(Coord c, Direction d)GoRogue.Coordstatic
operator-(Coord c1, Coord c2)GoRogue.Coordstatic
operator-(Coord c, int i)GoRogue.Coordstatic
operator/(Coord c, int i)GoRogue.Coordstatic
operator/(Coord c, double i)GoRogue.Coordstatic
operator==(Coord c1, Coord c2)GoRogue.Coordstatic
PositionsOnLine(Coord start, Coord end)GoRogue.Coordstatic
ToCoord(int index, int rowCount)GoRogue.Coordstatic
ToIndex(int x, int y, int rowCount)GoRogue.Coordstatic
ToString()GoRogue.Coord
ToXValue(int index, int rowCount)GoRogue.Coordstatic
ToYValue(int index, int rowCount)GoRogue.Coordstatic
Translate(int dx, int dy)GoRogue.Coord
XGoRogue.Coord
YGoRogue.Coord
ToIndex(int rowCount)GoRogue.Coord
ToString()GoRogue.Coord
ToXValue(int index, int rowCount)GoRogue.Coordstatic
ToYValue(int index, int rowCount)GoRogue.Coordstatic
Translate(int dx, int dy)GoRogue.Coord
XGoRogue.Coord
YGoRogue.Coord