Skip to content

Commit ffffe34

Browse files
committed
add proper enum so GameBorderStyle options don't get confused
1 parent cf90b74 commit ffffe34

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

Framework/Intersect.Framework.Core/Config/MapOptions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System.Runtime.Serialization;
22
using Intersect.Framework.Annotations;
3+
using Intersect.Framework.Core.GameObjects.Maps;
34
using Newtonsoft.Json;
5+
using Newtonsoft.Json.Converters;
46

57
namespace Intersect.Config;
68

@@ -45,9 +47,9 @@ public bool EnableDiagonalMovement
4547

4648
/// <summary>
4749
/// The style of the game's border.
48-
/// 0: Smart borders, 1: Non-seamless, 2: Black borders
4950
/// </summary>
50-
public int GameBorderStyle { get; set; }
51+
[JsonConverter(typeof(StringEnumConverter))]
52+
public GameBorderStyle GameBorderStyle { get; set; }
5153

5254
/// <summary>
5355
/// The time, in milliseconds, until item attributes respawn on the map.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Intersect.Framework.Core.GameObjects.Maps;
2+
3+
public enum GameBorderStyle
4+
{
5+
/// <summary>
6+
/// No transitions between adjacent maps but the camera is locked to map boundaries if the map has adjacent maps.
7+
/// </summary>
8+
Seamless = 0,
9+
10+
/// <summary>
11+
/// Camera is clamped to the boundaries of the current map, which causes a transition when moving to adjacent maps.
12+
/// </summary>
13+
/// <remarks>
14+
/// This only applies if the effective resolution (zoom shrinks this) is below the pixel dimensions of the map.
15+
/// </remarks>
16+
Seamed = 1,
17+
18+
/// <summary>
19+
/// No transitions between adjacent maps, and the camera is not locked to map boundaries ("black" borders).
20+
/// </summary>
21+
SeamlessUnbounded = 2,
22+
}

Intersect.Server.Core/Maps/MapController.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Intersect.Compression;
55
using Intersect.Core;
66
using Intersect.Enums;
7+
using Intersect.Framework.Core.GameObjects.Maps;
78
using Intersect.GameObjects;
89
using Intersect.GameObjects.Maps;
910
using Intersect.Network.Packets.Server;
@@ -94,10 +95,10 @@ public int MapGridY
9495
{
9596
switch (Options.Instance.Map.GameBorderStyle)
9697
{
97-
case 1:
98+
case GameBorderStyle.Seamed:
9899
return [true, true, true, true];
99100

100-
case 0:
101+
case GameBorderStyle.Seamless:
101102
var grid = DbInterface.GetGrid(MapGrid);
102103
if (grid != null)
103104
{
@@ -109,8 +110,13 @@ public int MapGridY
109110
grid.XMax - 1 == MapGridX,
110111
];
111112
}
113+
break;
112114

115+
case GameBorderStyle.SeamlessUnbounded:
113116
break;
117+
118+
default:
119+
throw new ArgumentOutOfRangeException();
114120
}
115121

116122
return null;

0 commit comments

Comments
 (0)