diff --git a/DalamudMinesweeper.json b/DalamudMinesweeper.json index e21da75..e41209c 100644 --- a/DalamudMinesweeper.json +++ b/DalamudMinesweeper.json @@ -3,8 +3,8 @@ "Author": "hunter2_", "Name": "Minesweeper", "InternalName": "DalamudMinesweeper", - "AssemblyVersion": "1.0.1.0", - "Description": "Logic puzzle in which you find and flag hidden mines. \nLeft click to uncover a square, right click to place a flag. \nClick a number that has the right amount of adjacent flags to reveal adjacent tiles. \nThe game ends when all mines are flagged and all safe squares have been uncovered. \nClick the smiley face to start a new game.", + "AssemblyVersion": "1.0.1.1", + "Description": "Logic puzzle in which you find and flag hidden mines.\n\nLeft click to uncover a square, right click to place a flag.\nClick a number that has the right amount of adjacent flags to reveal adjacent tiles.\nThe game ends when all mines are flagged and all safe squares have been uncovered.\nClick the smiley face to start a new game.", "ApplicableVersion": "any", "Tags": [ "minesweeper", @@ -18,9 +18,9 @@ "LoadPriority": 0, "Punchline": "Classic puzzle game.", "AcceptsFeedback": true, - "DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.0.1.0/latest.zip", - "DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.0.1.0/latest.zip", + "DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.0.1.1/latest.zip", + "DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/1.0.1.1/latest.zip", "IconUrl": "https://raw.githubusercontent.com/hunter2actual/DalamudMinesweeper/master/images/icon.png", - "Changelog": "Added no-guess mode" + "Changelog": "Safeguards on config window to prevent bad state." } ] \ No newline at end of file diff --git a/DalamudMinesweeper/DalamudMinesweeper.csproj b/DalamudMinesweeper/DalamudMinesweeper.csproj index 96f7bb8..d0963b3 100644 --- a/DalamudMinesweeper/DalamudMinesweeper.csproj +++ b/DalamudMinesweeper/DalamudMinesweeper.csproj @@ -3,7 +3,7 @@ - 1.0.1.0 + 1.0.1.1 A logic puzzle featuring hidden mines. https://github.com/hunter2actual/DalamudMinesweeper AGPL-3.0-or-later diff --git a/DalamudMinesweeper/Windows/ConfigWindow.cs b/DalamudMinesweeper/Windows/ConfigWindow.cs index ec347ea..9a4d742 100644 --- a/DalamudMinesweeper/Windows/ConfigWindow.cs +++ b/DalamudMinesweeper/Windows/ConfigWindow.cs @@ -49,7 +49,9 @@ public override void Draw() { if (width < 5) width = 5; if (width > 99) width = 99; - _configuration.BoardWidth = width; + _configuration.BoardWidth = width; + + _configuration.NumMines = Math.Min(MaxMines, _configuration.NumMines); } var height = _configuration.BoardHeight; @@ -57,14 +59,16 @@ public override void Draw() { if (height < 5) height = 5; if (height > 99) height = 99; - _configuration.BoardHeight = height; + _configuration.BoardHeight = height; + + _configuration.NumMines = Math.Min(MaxMines, _configuration.NumMines); } var numMines = _configuration.NumMines; if (ImGui.InputInt("Number of mines", ref numMines)) { if (numMines <= 1) numMines = 1; - numMines = Math.Min(_configuration.BoardWidth*_configuration.BoardHeight - 9, numMines); + numMines = Math.Min(MaxMines, numMines); _configuration.NumMines = numMines; } @@ -118,4 +122,6 @@ public override void Draw() IsOpen = false; } } + + private int MaxMines => _configuration.BoardWidth * _configuration.BoardHeight - 9; }