Singles: fix error highlighting when grid is disconnected.

The loop that selects one of the disconnected regions (represented as
equivalence classes in a dsf) to _not_ highlight as an error was
failing to call dsf_canonify() to get the canonical element of the
class.

Instead, it was relying on having met the canonical element of the
class first, because it iterates up the array in order, and in the old
dsf implementation, canonical elements were always minimal ones. But
the DSF refactoring made that untrue, so now we have to explicitly
canonify each value we come to.

Thanks to Steffen Bauer for the diagnosis and suggested fix.
This commit is contained in:
Simon Tatham
2023-10-24 18:52:12 +01:00
parent 2d9e414ee3
commit 35f796542e

View File

@ -547,7 +547,7 @@ static bool check_complete(game_state *state, unsigned flags)
int size = dsf_size(dsf, i);
if (largest < size) {
largest = size;
canonical = i;
canonical = dsf_canonify(dsf, i);
}
}