summaryrefslogtreecommitdiff
path: root/src/play.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-05-27 10:34:29 -0700
committerVito Caputo <vcaputo@pengaru.com>2021-05-27 10:34:29 -0700
commit30ea38a28f3abd05c32093c29c67b418c6904235 (patch)
tree53614895bd0f7b0020fc6b5d6a377c70f6fefe87 /src/play.c
parent42977fb0776f8907435d65de7c6b348c45e1a3e9 (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...
Diffstat (limited to 'src/play.c')
-rw-r--r--src/play.c11
1 files changed, 8 insertions, 3 deletions
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;
}
© All Rights Reserved