( ((x) - (BORDER + GUTTER + TILE_SIZE * TLBORDER(d))) / TILE_SIZE )
#define SIZE(d) (2*BORDER + GUTTER + TILE_SIZE * (TLBORDER(d) + (d)))
-#define GETTILESIZE(d, w) (w / (2 + TLBORDER(d) + (d)))
+#define GETTILESIZE(d, w) ((double)w / (2.0 + (double)TLBORDER(d) + (double)(d)))
#define TOCOORD(d, x) (BORDER + GUTTER + TILE_SIZE * (TLBORDER(d) + (x)))
assert(desc[desclen-1] == '/');
desc[desclen-1] = '\0';
sfree(rowdata);
+ sfree(grid);
return desc;
}
sfree(ui);
}
-char *encode_ui(game_ui *ui)
+static char *encode_ui(game_ui *ui)
{
return NULL;
}
-void decode_ui(game_ui *ui, char *encoding)
+static void decode_ui(game_ui *ui, char *encoding)
{
}
if (move_needed) {
char buf[80];
sprintf(buf, "%c%d,%d,%d,%d",
- (ui->state == GRID_FULL ? 'F' :
- ui->state == GRID_EMPTY ? 'E' : 'U'),
+ (char)(ui->state == GRID_FULL ? 'F' :
+ ui->state == GRID_EMPTY ? 'E' : 'U'),
x1, y1, x2-x1+1, y2-y1+1);
return dupstr(buf);
} else
static void game_size(game_params *params, game_drawstate *ds,
int *x, int *y, int expand)
{
- int ts;
+ double ts;
ts = min(GETTILESIZE(params->w, *x), GETTILESIZE(params->h, *y));
if (expand)
- ds->tilesize = ts;
+ ds->tilesize = (int)(ts + 0.5);
else
- ds->tilesize = min(ts, PREFERRED_TILE_SIZE);
+ ds->tilesize = min((int)ts, PREFERRED_TILE_SIZE);
*x = SIZE(params->w);
*y = SIZE(params->h);
int align, int colour, char *text) {}
void draw_rect(frontend *fe, int x, int y, int w, int h, int colour) {}
void draw_line(frontend *fe, int x1, int y1, int x2, int y2, int colour) {}
-void draw_polygon(frontend *fe, int *coords, int npoints,
- int fill, int colour) {}
void clip(frontend *fe, int x, int y, int w, int h) {}
void unclip(frontend *fe) {}
void start_draw(frontend *fe) {}