aboutsummaryrefslogtreecommitdiff
path: root/unfinished/slide.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-20 17:27:21 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-20 18:39:41 +0100
commitc5e253a9f9d3d651227ccad56e2c7526ee1f3eba (patch)
treed5054843aa49a7ae0d793b6d26f162aead5bbdfd /unfinished/slide.c
parent14e1e05510ac02a5502823bafe46d98c6fab3e5c (diff)
downloadpuzzles-c5e253a9f9d3d651227ccad56e2c7526ee1f3eba.zip
puzzles-c5e253a9f9d3d651227ccad56e2c7526ee1f3eba.tar.gz
puzzles-c5e253a9f9d3d651227ccad56e2c7526ee1f3eba.tar.bz2
puzzles-c5e253a9f9d3d651227ccad56e2c7526ee1f3eba.tar.xz
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.
Diffstat (limited to 'unfinished/slide.c')
-rw-r--r--unfinished/slide.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unfinished/slide.c b/unfinished/slide.c
index f1a057e..e091def 100644
--- a/unfinished/slide.c
+++ b/unfinished/slide.c
@@ -294,7 +294,7 @@ static char *board_text_format(int w, int h, unsigned char *data,
bool *forcefield)
{
int wh = w*h;
- DSF *dsf = snew_dsf(wh);
+ DSF *dsf = dsf_new(wh);
int i, x, y;
int retpos, retlen = (w*2+2)*(h*2+1)+1;
char *ret = snewn(retlen, char);
@@ -670,7 +670,7 @@ static void generate_board(int w, int h, int *rtx, int *rty, int *minmoves,
tried_merge = snewn(wh * wh, bool);
memset(tried_merge, 0, wh*wh * sizeof(bool));
- dsf = snew_dsf(wh);
+ dsf = dsf_new(wh);
/*
* Invent a main piece at one extreme. (FIXME: vary the
@@ -2150,7 +2150,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
* Build a dsf out of that board, so we can conveniently tell
* which edges are connected and which aren't.
*/
- dsf = snew_dsf(wh);
+ dsf = dsf_new(wh);
mainanchor = -1;
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {