aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-01-14 23:07:35 -0500
committerPaul Duncan <pabs@pablotron.org>2019-01-14 23:07:35 -0500
commit7fdd6f36c8181115c60b781dc97b71107fb7da65 (patch)
tree1a04507fdd687ed569da4e21fc8a998cdeb29e53 /src
parentd805435f185c0f00b53d3be17707a41aba14373c (diff)
downloadsok-7fdd6f36c8181115c60b781dc97b71107fb7da65.tar.bz2
sok-7fdd6f36c8181115c60b781dc97b71107fb7da65.zip
s/%zu/%d ... (int)/
Diffstat (limited to 'src')
-rw-r--r--src/sdl/draw.c9
-rw-r--r--src/sdl/main.c10
-rw-r--r--src/test-solve/main.c2
-rw-r--r--src/text/draw.c8
-rw-r--r--src/text/main.c10
5 files changed, 20 insertions, 19 deletions
diff --git a/src/sdl/draw.c b/src/sdl/draw.c
index e275038..99faa19 100644
--- a/src/sdl/draw.c
+++ b/src/sdl/draw.c
@@ -1,5 +1,6 @@
#include <stdbool.h> // bool
#include <math.h> // sinf()
+#include <stdio.h> // snprintf()
#include "util.h" // warn()/die()
#include "color.h" // set_color()
#include "draw.h"
@@ -188,10 +189,10 @@ draw_title_text(
char buf[256];
snprintf(
buf, sizeof(buf),
- " %s: %s (#%zu) ",
+ " %s: %s (#%d) ",
draw_ctx->level->pack,
draw_ctx->level->name,
- *draw_ctx->level_num
+ (int) *draw_ctx->level_num
);
// draw text
@@ -216,8 +217,8 @@ draw_moves_text(
char buf[256];
snprintf(
buf, sizeof(buf),
- " Moves: %zu%s ",
- draw_ctx->ctx->num_moves,
+ " Moves: %d%s ",
+ (int) draw_ctx->ctx->num_moves,
sok_ctx_is_done(draw_ctx->ctx) ? " (Won!)" : ""
);
diff --git a/src/sdl/main.c b/src/sdl/main.c
index 7cbe68f..3a20720 100644
--- a/src/sdl/main.c
+++ b/src/sdl/main.c
@@ -29,7 +29,7 @@ log_moves(
buf[ofs++] = SOK_DIR_TO_CHAR(ctx->moves[i].dir);
}
- SDL_Log("Solution (%zu moves): %s", ctx->num_moves - skip_moves, buf);
+ SDL_Log("Solution (%d moves): %s", (int) (ctx->num_moves - skip_moves), buf);
}
static TTF_Font *
@@ -77,15 +77,15 @@ set_level(
// load level
if (!sok_ctx_set_level(ctx, draw_ctx->level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
// log level title
SDL_Log(
- "Loaded level \"%s: %s\" (#%zu)",
+ "Loaded level \"%s: %s\" (#%d)",
draw_ctx->level->pack,
draw_ctx->level->name,
- level_num
+ (int) level_num
);
}
@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) {
case ACTION_RESET:
// reset level
if (!sok_ctx_set_level(&ctx, draw_ctx.level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
break;
diff --git a/src/test-solve/main.c b/src/test-solve/main.c
index 0e6efe0..2a9ed53 100644
--- a/src/test-solve/main.c
+++ b/src/test-solve/main.c
@@ -27,7 +27,7 @@ int main(int argc, char *argv[]) {
// load level
if (!sok_ctx_set_level(&ctx, level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
// solve level
diff --git a/src/text/draw.c b/src/text/draw.c
index 762fb8f..7c23171 100644
--- a/src/text/draw.c
+++ b/src/text/draw.c
@@ -100,11 +100,11 @@ draw(
// print title, level, and console
printf(
- "%s: %s (#%zu)\n" // set name, level name, and level number
+ "%s: %s (#%d)\n" // set name, level name, and level number
"%s\n" // level
- "%zu%s> ", // console
- level->pack, level->name, level_num,
+ "%d%s> ", // console
+ level->pack, level->name, (int) level_num,
buf,
- ctx->num_moves, sok_ctx_is_done(ctx) ? " (won!)" : ""
+ (int) ctx->num_moves, sok_ctx_is_done(ctx) ? " (won!)" : ""
);
}
diff --git a/src/text/main.c b/src/text/main.c
index 7d6f144..e80e984 100644
--- a/src/text/main.c
+++ b/src/text/main.c
@@ -20,7 +20,7 @@ draw_moves(
const sok_ctx_t * const ctx,
const size_t skip_moves
) {
- printf("Solution (%zu moves): ", ctx->num_moves - skip_moves);
+ printf("Solution (%d moves): ", (int) (ctx->num_moves - skip_moves));
for (size_t i = skip_moves; i < ctx->num_moves; i++) {
if (ctx->moves[i].dir >= SOK_DIR_LAST) {
die("invalid move: %u", ctx->moves[i].dir);
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
sok_ctx_init(&ctx, NULL);
if (!sok_ctx_set_level(&ctx, level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
bool done = false;
@@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
// load next level
if (!sok_ctx_set_level(&ctx, level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
} else {
warn("cannot advance to next level");
@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) {
case ACTION_RESET:
// reset level
if (!sok_ctx_set_level(&ctx, level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
break;
@@ -95,7 +95,7 @@ int main(int argc, char *argv[]) {
// load level
if (!sok_ctx_set_level(&ctx, level->data)) {
- die("Couldn't load level %zu", level_num);
+ die("Couldn't load level %d", (int) level_num);
}
break;