summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/nullgame.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/nullgame.c')
-rw-r--r--apps/plugins/puzzles/src/nullgame.c313
1 files changed, 0 insertions, 313 deletions
diff --git a/apps/plugins/puzzles/src/nullgame.c b/apps/plugins/puzzles/src/nullgame.c
deleted file mode 100644
index d923bc8710..0000000000
--- a/apps/plugins/puzzles/src/nullgame.c
+++ /dev/null
@@ -1,313 +0,0 @@
1/*
2 * nullgame.c [FIXME]: Template defining the null game (in which no
3 * moves are permitted and nothing is ever drawn). This file exists
4 * solely as a basis for constructing new game definitions - it
5 * helps to have something which will compile from the word go and
6 * merely doesn't _do_ very much yet.
7 *
8 * Parts labelled FIXME actually want _removing_ (e.g. the dummy
9 * field in each of the required data structures, and this entire
10 * comment itself) when converting this source file into one
11 * describing a real game.
12 */
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include <assert.h>
18#include <ctype.h>
19#include <math.h>
20
21#include "puzzles.h"
22
23enum {
24 COL_BACKGROUND,
25 NCOLOURS
26};
27
28struct game_params {
29 int FIXME;
30};
31
32struct game_state {
33 int FIXME;
34};
35
36static game_params *default_params(void)
37{
38 game_params *ret = snew(game_params);
39
40 ret->FIXME = 0;
41
42 return ret;
43}
44
45static bool game_fetch_preset(int i, char **name, game_params **params)
46{
47 return false;
48}
49
50static void free_params(game_params *params)
51{
52 sfree(params);
53}
54
55static game_params *dup_params(const game_params *params)
56{
57 game_params *ret = snew(game_params);
58 *ret = *params; /* structure copy */
59 return ret;
60}
61
62static void decode_params(game_params *params, char const *string)
63{
64}
65
66static char *encode_params(const game_params *params, bool full)
67{
68 return dupstr("FIXME");
69}
70
71static config_item *game_configure(const game_params *params)
72{
73 return NULL;
74}
75
76static game_params *custom_params(const config_item *cfg)
77{
78 return NULL;
79}
80
81static const char *validate_params(const game_params *params, bool full)
82{
83 return NULL;
84}
85
86static char *new_game_desc(const game_params *params, random_state *rs,
87 char **aux, bool interactive)
88{
89 return dupstr("FIXME");
90}
91
92static const char *validate_desc(const game_params *params, const char *desc)
93{
94 return NULL;
95}
96
97static game_state *new_game(midend *me, const game_params *params,
98 const char *desc)
99{
100 game_state *state = snew(game_state);
101
102 state->FIXME = 0;
103
104 return state;
105}
106
107static game_state *dup_game(const game_state *state)
108{
109 game_state *ret = snew(game_state);
110
111 ret->FIXME = state->FIXME;
112
113 return ret;
114}
115
116static void free_game(game_state *state)
117{
118 sfree(state);
119}
120
121static char *solve_game(const game_state *state, const game_state *currstate,
122 const char *aux, const char **error)
123{
124 return NULL;
125}
126
127static bool game_can_format_as_text_now(const game_params *params)
128{
129 return true;
130}
131
132static char *game_text_format(const game_state *state)
133{
134 return NULL;
135}
136
137static game_ui *new_ui(const game_state *state)
138{
139 return NULL;
140}
141
142static void free_ui(game_ui *ui)
143{
144}
145
146static char *encode_ui(const game_ui *ui)
147{
148 return NULL;
149}
150
151static void decode_ui(game_ui *ui, const char *encoding)
152{
153}
154
155static void game_changed_state(game_ui *ui, const game_state *oldstate,
156 const game_state *newstate)
157{
158}
159
160struct game_drawstate {
161 int tilesize;
162 int FIXME;
163};
164
165static char *interpret_move(const game_state *state, game_ui *ui,
166 const game_drawstate *ds,
167 int x, int y, int button)
168{
169 return NULL;
170}
171
172static game_state *execute_move(const game_state *state, const char *move)
173{
174 return NULL;
175}
176
177/* ----------------------------------------------------------------------
178 * Drawing routines.
179 */
180
181static void game_compute_size(const game_params *params, int tilesize,
182 int *x, int *y)
183{
184 *x = *y = 10 * tilesize; /* FIXME */
185}
186
187static void game_set_size(drawing *dr, game_drawstate *ds,
188 const game_params *params, int tilesize)
189{
190 ds->tilesize = tilesize;
191}
192
193static float *game_colours(frontend *fe, int *ncolours)
194{
195 float *ret = snewn(3 * NCOLOURS, float);
196
197 frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
198
199 *ncolours = NCOLOURS;
200 return ret;
201}
202
203static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state)
204{
205 struct game_drawstate *ds = snew(struct game_drawstate);
206
207 ds->tilesize = 0;
208 ds->FIXME = 0;
209
210 return ds;
211}
212
213static void game_free_drawstate(drawing *dr, game_drawstate *ds)
214{
215 sfree(ds);
216}
217
218static void game_redraw(drawing *dr, game_drawstate *ds,
219 const game_state *oldstate, const game_state *state,
220 int dir, const game_ui *ui,
221 float animtime, float flashtime)
222{
223 /*
224 * The initial contents of the window are not guaranteed and
225 * can vary with front ends. To be on the safe side, all games
226 * should start by drawing a big background-colour rectangle
227 * covering the whole window.
228 */
229 draw_rect(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize, COL_BACKGROUND);
230 draw_update(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize);
231}
232
233static float game_anim_length(const game_state *oldstate,
234 const game_state *newstate, int dir, game_ui *ui)
235{
236 return 0.0F;
237}
238
239static float game_flash_length(const game_state *oldstate,
240 const game_state *newstate, int dir, game_ui *ui)
241{
242 return 0.0F;
243}
244
245static void game_get_cursor_location(const game_ui *ui,
246 const game_drawstate *ds,
247 const game_state *state,
248 const game_params *params,
249 int *x, int *y, int *w, int *h)
250{
251}
252
253static int game_status(const game_state *state)
254{
255 return 0;
256}
257
258static bool game_timing_state(const game_state *state, game_ui *ui)
259{
260 return true;
261}
262
263static void game_print_size(const game_params *params, float *x, float *y)
264{
265}
266
267static void game_print(drawing *dr, const game_state *state, int tilesize)
268{
269}
270
271#ifdef COMBINED
272#define thegame nullgame
273#endif
274
275const struct game thegame = {
276 "Null Game", NULL, NULL,
277 default_params,
278 game_fetch_preset, NULL,
279 decode_params,
280 encode_params,
281 free_params,
282 dup_params,
283 false, game_configure, custom_params,
284 validate_params,
285 new_game_desc,
286 validate_desc,
287 new_game,
288 dup_game,
289 free_game,
290 false, solve_game,
291 false, game_can_format_as_text_now, game_text_format,
292 new_ui,
293 free_ui,
294 encode_ui,
295 decode_ui,
296 NULL, /* game_request_keys */
297 game_changed_state,
298 interpret_move,
299 execute_move,
300 20 /* FIXME */, game_compute_size, game_set_size,
301 game_colours,
302 game_new_drawstate,
303 game_free_drawstate,
304 game_redraw,
305 game_anim_length,
306 game_flash_length,
307 game_get_cursor_location,
308 game_status,
309 false, false, game_print_size, game_print,
310 false, /* wants_statusbar */
311 false, game_timing_state,
312 0, /* flags */
313};