diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-08 19:41:12 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-08 19:41:12 (EDT) |
commit | 3b50da3523dcd6bc05964498732c56c2aae9509e (patch) | |
tree | b7e50e76c436ccb1bbd727b7a5fc377ae723bd30 /src/char | |
parent | 9080d731d73b8ffbb1598f622e3bdd05e8f1938e (diff) | |
download | mazefight-3b50da3523dcd6bc05964498732c56c2aae9509e.zip mazefight-3b50da3523dcd6bc05964498732c56c2aae9509e.tar.gz mazefight-3b50da3523dcd6bc05964498732c56c2aae9509e.tar.bz2 |
char: Notify update method if completed step
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char/char.h | 2 | ||||
-rw-r--r-- | src/char/player.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/char/char.c b/src/char/char.c index 09aa6bd..206dfdf 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -59,6 +59,7 @@ mf_char_get_vector(struct mf_char *c, int *x, int *y, int *travel, int mf_char_update(struct mf_char *c) { + int stepped = SDL_FALSE; int dx; int dy; @@ -69,6 +70,7 @@ mf_char_update(struct mf_char *c) /* Reached next cell */ c->cur_x = c->new_x; c->cur_y = c->new_y; + stepped = SDL_TRUE; if (c->cur_dir == c->new_dir) { /* Want to continue straight */ c->travel -= c->cell_width; @@ -115,7 +117,7 @@ mf_char_update(struct mf_char *c) } end: - return c->update(c); + return c->update(c, stepped); } int diff --git a/src/char/char.h b/src/char/char.h index f6c6b9f..ad0a74d 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -51,7 +51,7 @@ struct mf_char { SDL_Color head_color; SDL_Color smil_color; SDL_Color eyes_color; - int (*update)(struct mf_char *); + int (*update)(struct mf_char *, int); int (*render)(struct mf_char *, SDL_Renderer *); void (*destroy)(struct mf_char *); }; diff --git a/src/char/player.c b/src/char/player.c index 9f6123d..5230734 100644 --- a/src/char/player.c +++ b/src/char/player.c @@ -31,7 +31,7 @@ struct mf_player { }; static int -_mf_player_update(struct mf_char *c) +_mf_player_update(struct mf_char *c, int stepped __attribute__((__unused__))) { int dx; int dy; |