diff options
| author | Simon Tatham <anakin@pobox.com> | 2021-03-29 18:13:38 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2021-03-29 18:22:20 +0100 |
| commit | 72b28b5e71b05e7775d14b1e3e2e00b82af4d87a (patch) | |
| tree | 0f7f553b993d006bb35781ac02d9e717ab662f39 | |
| parent | 84cb4c6701e027090ff3fd955ce08065e20121b2 (diff) | |
| download | puzzles-72b28b5e71b05e7775d14b1e3e2e00b82af4d87a.zip puzzles-72b28b5e71b05e7775d14b1e3e2e00b82af4d87a.tar.gz puzzles-72b28b5e71b05e7775d14b1e3e2e00b82af4d87a.tar.bz2 puzzles-72b28b5e71b05e7775d14b1e3e2e00b82af4d87a.tar.xz | |
Fix bit rot in the 'unfinished' subdir.
Several of the source files here won't quite compile any more, because
of minor things like const-correctness and the UI_UPDATE change. Now
they should all build again (without prejudice to how useful they are
once they have built).
The biggest change was to remove the fatal() implementation from the
standalone path.c, because my new plan is that basically everything
that's not linked against a true puzzle frontend will be linked
against nullfe.c, which provides that function anyway.
| -rw-r--r-- | unfinished/numgame.c | 4 | ||||
| -rw-r--r-- | unfinished/path.c | 23 | ||||
| -rw-r--r-- | unfinished/slide.c | 4 |
3 files changed, 7 insertions, 24 deletions
diff --git a/unfinished/numgame.c b/unfinished/numgame.c index d444b22..e6dc03a 100644 --- a/unfinished/numgame.c +++ b/unfinished/numgame.c @@ -146,7 +146,7 @@ struct operation { * Text display of the operator, in expressions and for * debugging respectively. */ - char *text, *dbgtext; + const char *text, *dbgtext; /* * Flags dictating when the operator can be applied. @@ -1020,7 +1020,7 @@ void print_recurse_inner(struct sets *s, struct set *ss, * operand, then write the operator, then the second * operand, and finally close the paren. */ - char *op; + const char *op; int parens, thispri, thisassoc; /* diff --git a/unfinished/path.c b/unfinished/path.c index fe5a47f..2515ed0 100644 --- a/unfinished/path.c +++ b/unfinished/path.c @@ -4,6 +4,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <assert.h> #include "puzzles.h" @@ -530,7 +531,7 @@ if (ctx->sparegrid3[ctx->pathends[i*2]] != i || ctx->sparepathends[i*2] = first; ctx->sparepathends[i*2+1] = last; -//printf("new ends of path %d: %d,%d\n", i, first, last); +/* printf("new ends of path %d: %d,%d\n", i, first, last); */ ctx->pathspare[i] = 2; /* fixed */ } } @@ -839,7 +840,7 @@ static int *gridgen(int w, int h, random_state *rs) int main(void) { int w = 10, h = 8; - random_state *rs = random_init("12345", 5); + random_state *rs = random_new("12345", 5); int x, y, i, *grid; for (i = 0; i < 10; i++) { @@ -863,21 +864,3 @@ int main(void) return 0; } #endif - -#ifdef TEST_GENERAL -#include <stdarg.h> - -void fatal(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "fatal error: "); - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - - fprintf(stderr, "\n"); - exit(1); -} -#endif diff --git a/unfinished/slide.c b/unfinished/slide.c index c7a3dce..8c25340 100644 --- a/unfinished/slide.c +++ b/unfinished/slide.c @@ -899,7 +899,7 @@ static const char *validate_desc(const game_params *params, const char *desc) int *link; int mains = 0; int i, tx, ty, minmoves; - char *ret; + const char *ret; active = snewn(wh, bool); link = snewn(wh, int); @@ -1395,7 +1395,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, sprintf(data, "M%d-%d", ui->drag_anchor, ui->drag_currpos); str = dupstr(data); } else - str = ""; /* null move; just update the UI */ + str = UI_UPDATE; ui->dragging = false; ui->drag_anchor = ui->drag_currpos = -1; |