diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-10 00:50:12 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-10 00:51:14 (EDT) |
commit | 2f375aa5aeafb3cb31546c9d5a060aceff03dce9 (patch) | |
tree | 279299ee135bea7cfd92291c6a362d709e1bd204 /src/char | |
parent | c349527f46ec00cd88be4d0383648e4c9aef5efd (diff) | |
download | mazefight-2f375aa5aeafb3cb31546c9d5a060aceff03dce9.zip mazefight-2f375aa5aeafb3cb31546c9d5a060aceff03dce9.tar.gz mazefight-2f375aa5aeafb3cb31546c9d5a060aceff03dce9.tar.bz2 |
char/char: Decrement travel before step method
Also fix some assignment alignment.
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/char/char.c b/src/char/char.c index b19e750..0ab7145 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -69,12 +69,12 @@ mf_char_update(struct mf_char *c) /* Reached next cell */ c->cur_x = c->new_x; c->cur_y = c->new_y; + c->travel -= c->cell_width; if (c->step(c) < 0) { return -1; } if (c->cur_dir == c->new_dir) { /* Want to continue straight */ - c->travel -= c->cell_width; } else { /* Want to stop or turn */ c->travel = 0; @@ -104,7 +104,7 @@ mf_char_update(struct mf_char *c) case MF_CHAR_DIR_D_: dx = 0; dy = 1; break; case MF_CHAR_DIR_L_: dx = -1; dy = 0; break; case MF_CHAR_DIR_R_: dx = 1; dy = 0; break; - default: dx = 0; dy = 0; break; + default: dx = 0; dy = 0; break; } c->new_dir = MF_CHAR_DIR_N_; if (mf_maze_is_wall(c->maze, c->cur_x, c->cur_y, |