chiark / gitweb /
Re-architecting of the game backend interface. make_move() has been
[sgt-puzzles.git] / nullgame.c
index 9e2ea323d3c4ac66a9a232b3c5b3622fbc23eecf..bc3f64a06b7174127c26634b76e7b94df2601265 100644 (file)
@@ -59,16 +59,11 @@ static game_params *dup_params(game_params *params)
     return ret;
 }
 
-static game_params *decode_params(char const *string)
+static void decode_params(game_params *params, char const *string)
 {
-    game_params *ret = snew(game_params);
-
-    ret->FIXME = 0;
-
-    return ret;
 }
 
-static char *encode_params(game_params *params)
+static char *encode_params(game_params *params, int full)
 {
     return dupstr("FIXME");
 }
@@ -88,17 +83,23 @@ static char *validate_params(game_params *params)
     return NULL;
 }
 
-static char *new_game_seed(game_params *params, random_state *rs)
+static char *new_game_desc(game_params *params, random_state *rs,
+                          game_aux_info **aux, int interactive)
 {
     return dupstr("FIXME");
 }
 
-static char *validate_seed(game_params *params, char *seed)
+static void game_free_aux_info(game_aux_info *aux)
+{
+    assert(!"Shouldn't happen");
+}
+
+static char *validate_desc(game_params *params, char *desc)
 {
     return NULL;
 }
 
-static game_state *new_game(game_params *params, char *seed)
+static game_state *new_game(midend_data *me, game_params *params, char *desc)
 {
     game_state *state = snew(game_state);
 
@@ -121,6 +122,12 @@ static void free_game(game_state *state)
     sfree(state);
 }
 
+static char *solve_game(game_state *state, game_state *currstate,
+                       game_aux_info *aux, char **error)
+{
+    return NULL;
+}
+
 static char *game_text_format(game_state *state)
 {
     return NULL;
@@ -135,8 +142,22 @@ static void free_ui(game_ui *ui)
 {
 }
 
-static game_state *make_move(game_state *from, game_ui *ui, int x, int y,
-                            int button)
+static void game_changed_state(game_ui *ui, game_state *oldstate,
+                               game_state *newstate)
+{
+}
+
+struct game_drawstate {
+    int FIXME;
+};
+
+static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
+                           int x, int y, int button)
+{
+    return NULL;
+}
+
+static game_state *execute_move(game_state *state, char *move)
 {
     return NULL;
 }
@@ -145,11 +166,8 @@ static game_state *make_move(game_state *from, game_ui *ui, int x, int y,
  * Drawing routines.
  */
 
-struct game_drawstate {
-    int FIXME;
-};
-
-static void game_size(game_params *params, int *x, int *y)
+static void game_size(game_params *params, game_drawstate *ds,
+                      int *x, int *y, int expand)
 {
     *x = *y = 200;                     /* FIXME */
 }
@@ -192,13 +210,13 @@ static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
 }
 
 static float game_anim_length(game_state *oldstate, game_state *newstate,
-                             int dir)
+                             int dir, game_ui *ui)
 {
     return 0.0F;
 }
 
 static float game_flash_length(game_state *oldstate, game_state *newstate,
-                              int dir)
+                              int dir, game_ui *ui)
 {
     return 0.0F;
 }
@@ -208,6 +226,11 @@ static int game_wants_statusbar(void)
     return FALSE;
 }
 
+static int game_timing_state(game_state *state)
+{
+    return TRUE;
+}
+
 #ifdef COMBINED
 #define thegame nullgame
 #endif
@@ -222,15 +245,19 @@ const struct game thegame = {
     dup_params,
     FALSE, game_configure, custom_params,
     validate_params,
-    new_game_seed,
-    validate_seed,
+    new_game_desc,
+    game_free_aux_info,
+    validate_desc,
     new_game,
     dup_game,
     free_game,
+    FALSE, solve_game,
     FALSE, game_text_format,
     new_ui,
     free_ui,
-    make_move,
+    game_changed_state,
+    interpret_move,
+    execute_move,
     game_size,
     game_colours,
     game_new_drawstate,
@@ -239,4 +266,6 @@ const struct game thegame = {
     game_anim_length,
     game_flash_length,
     game_wants_statusbar,
+    FALSE, game_timing_state,
+    0,                                /* mouse_priorities */
 };