~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ahem. Seed validation was completely broken.
[sgt/puzzles]
/
cube.c
diff --git
a/cube.c
b/cube.c
index
6c2658f
..
2ce7a4f
100644
(file)
--- a/
cube.c
+++ b/
cube.c
@@
-160,7
+160,7
@@
enum {
enum { LEFT, RIGHT, UP, DOWN, UP_LEFT, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT };
#define GRID_SCALE 48.0F
enum { LEFT, RIGHT, UP, DOWN, UP_LEFT, UP_RIGHT, DOWN_LEFT, DOWN_RIGHT };
#define GRID_SCALE 48.0F
-#define ROLLTIME 0.1F
+#define ROLLTIME 0.1
3
F
#define SQ(x) ( (x) * (x) )
#define SQ(x) ( (x) * (x) )
@@
-560,7
+560,7
@@
static void classify_grid_square_callback(void *ctx, struct grid_square *sq)
data->squareindex++;
}
data->squareindex++;
}
-char *new_game_seed(game_params *params)
+char *new_game_seed(game_params *params
, random_state *rs
)
{
struct grid_data data;
int i, j, k, m, area, facesperclass;
{
struct grid_data data;
int i, j, k, m, area, facesperclass;
@@
-605,7
+605,7
@@
char *new_game_seed(game_params *params)
for (i = 0; i < data.nclasses; i++) {
for (j = 0; j < facesperclass; j++) {
for (i = 0; i < data.nclasses; i++) {
for (j = 0; j < facesperclass; j++) {
- int n = rand
_upto(
data.nsquares[i]);
+ int n = rand
om_upto(rs,
data.nsquares[i]);
assert(!flags[data.gridptrs[i][n]]);
flags[data.gridptrs[i][n]] = TRUE;
assert(!flags[data.gridptrs[i][n]]);
flags[data.gridptrs[i][n]] = TRUE;
@@
-653,7
+653,7
@@
char *new_game_seed(game_params *params)
/*
* Choose a non-blue square for the polyhedron.
*/
/*
* Choose a non-blue square for the polyhedron.
*/
- sprintf(p, ":%d", data.gridptrs[0][rand
_upto(
m)]);
+ sprintf(p, ":%d", data.gridptrs[0][rand
om_upto(rs,
m)]);
sfree(data.gridptrs[0]);
sfree(flags);
sfree(data.gridptrs[0]);
sfree(flags);
@@
-950,7
+950,16
@@
void free_game(game_state *state)
sfree(state);
}
sfree(state);
}
-game_state *make_move(game_state *from, int x, int y, int button)
+game_ui *new_ui(game_state *state)
+{
+ return NULL;
+}
+
+void free_ui(game_ui *ui)
+{
+}
+
+game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button)
{
int direction;
int pkey[2], skey[2], dkey[2];
{
int direction;
int pkey[2], skey[2], dkey[2];
@@
-1309,7
+1318,8
@@
void game_free_drawstate(game_drawstate *ds)
}
void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
}
void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
- game_state *state, float animtime, float flashtime)
+ game_state *state, game_ui *ui,
+ float animtime, float flashtime)
{
int i, j;
struct bbox bb = find_bbox(&state->params);
{
int i, j;
struct bbox bb = find_bbox(&state->params);