Minesweeper: Revise the maximum mine limit in custom game settings

After improving the mine field generation method, fields with greater
than 50% mines no longer take too long to generate. So, the mine limit
for a given size can be increased to its maximum possible value.
This commit is contained in:
Arda Cinar 2022-12-08 21:41:56 +03:00 committed by Sam Atkins
parent 71537f4903
commit 352048ce0e
Notes: sideshowbarker 2024-07-17 05:06:13 +09:00

View file

@ -34,9 +34,8 @@ GUI::Dialog::ExecResult CustomGameDialog::show(GUI::Window* parent_window, Field
void CustomGameDialog::set_max_mines()
{
// Generating a field with > 50% mines takes too long.
// FIXME: Allow higher amount of mines to be placed.
m_mines_spinbox->set_max((m_rows_spinbox->value() * m_columns_spinbox->value()) / 2);
// NOTE: this is the maximum number of mines possible in a given minesweeper board
m_mines_spinbox->set_max((m_rows_spinbox->value() * m_columns_spinbox->value()) - 9);
}
CustomGameDialog::CustomGameDialog(Window* parent_window)