From d24d885aa42b5087d89f12dabad13895051da4e2 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sun, 18 Oct 2009 15:50:30 +0000 Subject: Use wrap-safe TIME_BEFORE/TIME_AFTER macros to compare times with current_time, instead of comparing them directly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23246 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pong.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'apps/plugins/pong.c') diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index a6144d9664..1c6f02eb0d 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c @@ -450,21 +450,21 @@ int keys(struct pong *p) int start = *rb->current_tick; int end = start + time; - while(end > *rb->current_tick) { + while(TIME_BEFORE(*rb->current_tick, end)) { key = rb->button_get_w_tmo(end - *rb->current_tick); #ifdef HAVE_TOUCHSCREEN - short touch_x, touch_y; - if(key & BUTTON_TOUCHSCREEN) - { - touch_x = rb->button_get_data() >> 16; - touch_y = rb->button_get_data() & 0xFFFF; - if(touch_x >= xpos[0] && touch_x <= xpos[0]+(PAD_WIDTH*4)) - padmove(&p->w_pad[0], touch_y-(p->e_pad[0]*2+PAD_HEIGHT)/2); - - if(touch_x >= xpos[1]-(PAD_WIDTH*4) && touch_x <= xpos[1]) - padmove(&p->w_pad[1], touch_y-(p->e_pad[1]*2+PAD_HEIGHT)/2); - } + short touch_x, touch_y; + if(key & BUTTON_TOUCHSCREEN) + { + touch_x = rb->button_get_data() >> 16; + touch_y = rb->button_get_data() & 0xFFFF; + if(touch_x >= xpos[0] && touch_x <= xpos[0]+(PAD_WIDTH*4)) + padmove(&p->w_pad[0], touch_y-(p->e_pad[0]*2+PAD_HEIGHT)/2); + + if(touch_x >= xpos[1]-(PAD_WIDTH*4) && touch_x <= xpos[1]) + padmove(&p->w_pad[1], touch_y-(p->e_pad[1]*2+PAD_HEIGHT)/2); + } #endif #ifdef HAS_BUTTON_HOLD -- cgit v1.2.3