mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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.
This commit is contained in:
@ -228,7 +228,7 @@ static struct solver_scratch *solver_scratch_new(int w, int h, int k)
|
||||
sc->h = h;
|
||||
sc->k = k;
|
||||
|
||||
sc->dsf = snew_dsf(wh);
|
||||
sc->dsf = dsf_new(wh);
|
||||
sc->size = snewn(wh, int);
|
||||
sc->contents = snewn(wh * k, int);
|
||||
sc->disconnect = snewn(wh*wh, bool);
|
||||
|
@ -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++) {
|
||||
|
Reference in New Issue
Block a user