From 30ea38a28f3abd05c32093c29c67b418c6904235 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 27 May 2021 10:34:29 -0700 Subject: 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... --- src/play.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/play.c') diff --git a/src/play.c b/src/play.c index 22ae6d9..c15a26f 100644 --- a/src/play.c +++ b/src/play.c @@ -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; } -- cgit v1.2.3