]> git.deb.at Git - rhonda/impostor.git/commitdiff
Add MapTypes
authorAlexejheroYTB <alexejhero@gmail.com>
Thu, 12 Nov 2020 07:49:36 +0000 (09:49 +0200)
committerAlexejheroYTB <alexejhero@gmail.com>
Thu, 12 Nov 2020 07:49:36 +0000 (09:49 +0200)
src/Impostor.Api/Innersloth/GameOptionsData.cs
src/Impostor.Api/Innersloth/MapId.cs
src/Impostor.Api/Innersloth/MapTypes.cs [new file with mode: 0644]
src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/DoorsSystemType.cs

index 98e0a1a9d86a0ff4c7b9b9c135c415b2d1c1910a..95ef288ebd26f34701b063639f1b28c8941721f7 100644 (file)
@@ -33,6 +33,15 @@ namespace Impostor.Api.Innersloth
         /// Skeld = 0, MiraHQ = 1, Polus = 2.
         /// </remarks>
         public byte MapId { get; set; }
+        
+        /// <summary>
+        /// Gets or sets the map selected for this lobby
+        /// </summary>
+        public MapTypes Map 
+        {
+            get => (MapTypes)MapId;
+            set => MapId = (byte)value;
+        }
 
         /// <summary>
         /// Gets or sets the Player speed modifier.
index c075d73e012e3173332e41e5c3a9d216645bc202..711a88623871d5a0bab3bf8ed9c246ad90f2c576 100644 (file)
@@ -1,8 +1,10 @@
-namespace Impostor.Api.Innersloth
+using System;
+
+namespace Impostor.Api.Innersloth
 {
+    [Obsolete("Use Map property instead of MapId, and compare with MapTypes enum.")]
     public static class MapId
     {
-        // TODO: Not sure if correct, check
         public const int Skeld = 0;
         public const int MiraHQ = 1;
         public const int Polus = 2;
diff --git a/src/Impostor.Api/Innersloth/MapTypes.cs b/src/Impostor.Api/Innersloth/MapTypes.cs
new file mode 100644 (file)
index 0000000..8dc07b5
--- /dev/null
@@ -0,0 +1,9 @@
+namespace Impostor.Api.Innersloth
+{
+    public enum MapTypes
+    {
+        Skeld = 0,
+        MiraHQ = 1,
+        Polus = 2,
+    }
+}
\ No newline at end of file
index fc0157817b23ddaae6b5a2365b5dc8286127a086..712b00afce514aea20dee2dc3dd570b288b87397 100644 (file)
@@ -14,11 +14,11 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus
         public DoorsSystemType(IGame game)
         {
             // TODO: Check
-            var doorCount = game.Options.MapId switch
+            var doorCount = game.Options.Map switch
             {
-                MapId.Skeld => 13,
-                MapId.MiraHQ => 2,
-                MapId.Polus => 12,
+                MapTypes.Skeld => 13,
+                MapTypes.MiraHQ => 2,
+                MapTypes.Polus => 12,
                 _ => throw new ArgumentOutOfRangeException()
             };