From c5e253a9f9d3d651227ccad56e2c7526ee1f3eba Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 20 Apr 2023 17:27:21 +0100 Subject: Reorganise the dsf API into three kinds of dsf. This is preparing to separate out the auxiliary functionality, and perhaps leave space for making more of it in future. The previous name 'edsf' was too vague: the 'e' stood for 'extended', and didn't say anything about _how_ it was extended. It's now called a 'flip dsf', since it tracks whether elements in the same class are flipped relative to each other. More importantly, clients that are going to use the flip tracking must say so when they allocate the dsf. And Keen's need to track the minimal element of an equivalence class is going to become a non-default feature, so there needs to be a new kind of dsf that specially tracks those, and Keen will have to call it. While I'm here, I've renamed the three dsf creation functions so that they start with 'dsf_' like all the rest of the dsf API. --- tracks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tracks.c') diff --git a/tracks.c b/tracks.c index 6759c21..1e46c9d 100644 --- a/tracks.c +++ b/tracks.c @@ -1374,7 +1374,7 @@ static int solve_check_loop(game_state *state) /* TODO eventually we should pull this out into a solver struct and keep it updated as we connect squares. For now we recreate it every time we try this particular solver step. */ - dsf = snew_dsf(w*h); + dsf = dsf_new(w*h); /* Work out the connectedness of the current loop set. */ for (x = 0; x < w; x++) { @@ -1465,7 +1465,7 @@ static int solve_bridge_sub(game_state *state, int x, int y, int d, assert(d == D || d == R); if (!sc->dsf) - sc->dsf = snew_dsf(wh); + sc->dsf = dsf_new(wh); dsf_reinit(sc->dsf); for (xi = 0; xi < w; xi++) { @@ -1879,7 +1879,7 @@ static bool check_completion(game_state *state, bool mark) } } - dsf = snew_dsf(w*h); + dsf = dsf_new(w*h); for (x = 0; x < w; x++) { for (y = 0; y < h; y++) { -- cgit v1.1