From 2a6b4f4611156a5a093879b117b8777e89bcc342 Mon Sep 17 00:00:00 2001 From: bittboy Date: Sun, 22 Sep 2019 17:24:54 -0300 Subject: [PATCH] simplifying logic --- simplemenu/control.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/simplemenu/control.c b/simplemenu/control.c index b0687faa..f68faac5 100644 --- a/simplemenu/control.c +++ b/simplemenu/control.c @@ -53,36 +53,30 @@ void scrollUp() { if(CURRENT_SECTION.currentGame == 0) { if (CURRENT_SECTION.currentPage >0) { CURRENT_SECTION.currentPage--; - gamesInPage=countGamesInPage(); - CURRENT_SECTION.currentGame=gamesInPage-1; - return; } else { CURRENT_SECTION.currentPage=totalPages; - gamesInPage=countGamesInPage(); - CURRENT_SECTION.currentGame=gamesInPage; } + gamesInPage=countGamesInPage(); + CURRENT_SECTION.currentGame=gamesInPage-1; + return; } if (CURRENT_SECTION.currentGame > 0) { CURRENT_SECTION.currentGame--; - return; } } void scrollDown() { if(CURRENT_SECTION.currentGame == gamesInPage-1) { if (CURRENT_SECTION.currentPage < totalPages) { - CURRENT_SECTION.currentGame=0; CURRENT_SECTION.currentPage++; - return; } else { - CURRENT_SECTION.currentGame=0; CURRENT_SECTION.currentPage=0; - return; } + CURRENT_SECTION.currentGame=0; + return; } if (CURRENT_SECTION.currentGame < gamesInPage-1) { CURRENT_SECTION.currentGame++; - return; } }