diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-05-27 10:34:29 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-05-27 10:34:29 -0700 |
commit | 30ea38a28f3abd05c32093c29c67b418c6904235 (patch) | |
tree | 53614895bd0f7b0020fc6b5d6a377c70f6fefe87 | |
parent | 42977fb0776f8907435d65de7c6b348c45e1a3e9 (diff) |
play: always return 0 from play_ticks_reset()
Callers manually resetting timers often need to assign
the reset ticks count somewhere, this makes it so they can
just assign it directly from the reset call.
Otherwise this can be ignored...
-rw-r--r-- | src/play.c | 11 | ||||
-rw-r--r-- | src/play.h | 2 |
2 files changed, 9 insertions, 4 deletions
@@ -238,8 +238,11 @@ unsigned play_ticks(play_t *play, play_ticks_t timer) } -/* reset ticks counter to begin counting from now */ -void play_ticks_reset(play_t *play, play_ticks_t timer) +/* reset ticks counter to begin counting from now + * always returns 0 for convenience/ergonomic reasons to use as + * a new post-reset ticks value. + */ +unsigned play_ticks_reset(play_t *play, play_ticks_t timer) { assert(play); assert(timer < PLAY_TICKS_CNT); @@ -247,6 +250,8 @@ void play_ticks_reset(play_t *play, play_ticks_t timer) ticks_active(play); play->tick_offsets[timer] = SDL_GetTicks(); + + return 0; } @@ -272,7 +277,7 @@ int play_ticks_elapsed(play_t *play, play_ticks_t timer, unsigned duration) assert(timer < PLAY_TICKS_CNT); if (play_ticks(play, timer) >= duration) { - play_ticks_reset(play, timer); + (void) play_ticks_reset(play, timer); return 1; } @@ -65,7 +65,7 @@ void play_music_resume(play_t *play); void play_context_enter(play_t *play, int context); void * play_context(play_t *play, int context); unsigned play_ticks(play_t *play, play_ticks_t timer); -void play_ticks_reset(play_t *play, play_ticks_t timer); +unsigned play_ticks_reset(play_t *play, play_ticks_t timer); void play_ticks_pause(play_t *play); int play_ticks_elapsed(play_t *play, play_ticks_t timer, unsigned duration); void play_quit(play_t *play); |