Move most of face_text_pos() into grid.c, leaving in loopy.c only the
[sgt/puzzles] / magnets.c
index c970eee..1df2caf 100644 (file)
--- a/magnets.c
+++ b/magnets.c
@@ -386,7 +386,7 @@ static char n2c(int num) { /* XXX cloned from singles.c */
 }
 
 static int c2n(char c) { /* XXX cloned from singles.c */
-    if (isdigit(c))
+    if (isdigit((unsigned char)c))
         return (int)(c - '0');
     else if (c >= 'a' && c <= 'z')
         return (int)(c - 'a' + 10);
@@ -1809,8 +1809,10 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
             movech = ' ';
         else
             movech = '.';
-    } else
+    } else {
         assert(!"unknown action");
+       movech = 0;                    /* placate optimiser */
+    }
 
     sprintf(buf, "%c%d,%d", movech, gx, gy);
 
@@ -2233,6 +2235,11 @@ static float game_flash_length(game_state *oldstate, game_state *newstate,
     return 0.0F;
 }
 
+static int game_is_solved(game_state *state)
+{
+    return state->completed;
+}
+
 static int game_timing_state(game_state *state, game_ui *ui)
 {
     return TRUE;
@@ -2372,6 +2379,7 @@ const struct game thegame = {
     game_redraw,
     game_anim_length,
     game_flash_length,
+    game_is_solved,
     TRUE, FALSE, game_print_size, game_print,
     FALSE,                            /* wants_statusbar */
     FALSE, game_timing_state,
@@ -2550,7 +2558,6 @@ int main(int argc, const char *argv[])
     err = validate_desc(p, desc);
     if (err) {
         fprintf(stderr, "%s: %s\nDescription: %s\n", quis, err, desc);
-        free_params(p);
         goto done;
     }
     s = new_game(NULL, p, desc);