From 35f796542ee5d7e775643f526973aa75f483bf20 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 24 Oct 2023 18:52:12 +0100 Subject: [PATCH] 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. --- singles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/singles.c b/singles.c index 98d4b17..07db836 100644 --- a/singles.c +++ b/singles.c @@ -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); } }