examples/snake: Fix up build.

This commit is contained in:
Ryan C. Gordon
2024-07-30 13:39:35 -04:00
parent dbb4e05c28
commit bc8b768b9a
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -34,8 +34,8 @@ static void new_food_pos_(SnakeContext *ctx, RandFunc rand)
char x;
char y;
for (;;) {
x = rand(SNAKE_GAME_WIDTH);
y = rand(SNAKE_GAME_HEIGHT);
x = (char) rand(SNAKE_GAME_WIDTH);
y = (char) rand(SNAKE_GAME_HEIGHT);
if (snake_cell_at(ctx, x, y) == SNAKE_CELL_NOTHING) {
put_cell_at_(ctx, x, y, SNAKE_CELL_FOOD);
break;
+1 -1
View File
@@ -41,7 +41,7 @@ typedef struct
unsigned occupied_cells;
} SnakeContext;
typedef int (*RandFunc)(int n);
typedef Sint32 SDLCALL (*RandFunc)(Sint32 n);
void snake_initialize(SnakeContext *ctx, RandFunc rand);
void snake_redir(SnakeContext *ctx, SnakeDirection dir);