From 715108f70db21df487f15a18af8ae789be9331e8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 23 Aug 2008 12:39:01 +0000 Subject: [PATCH] Fix a bug where users couldn't exit from dgl. Found by blindcoder. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@449 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 11 ++++++----- dgamelaunch.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index 8ea882b..669525e 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -1717,14 +1717,14 @@ purge_stale_locks (int game) } -void +int runmenuloop(struct dg_menu *menu) { struct dg_banner ban; struct dg_menuoption *tmpopt; int userchoice = 0; - if (!menu) return; + if (!menu) return 1; ban.lines = NULL; ban.len = 0; @@ -1736,7 +1736,7 @@ runmenuloop(struct dg_menu *menu) mvprintw(menu->cursor_y, menu->cursor_x, ""); refresh(); userchoice = getch(); - if (userchoice == ERR) return; + if (userchoice == ERR) return 1; tmpopt = menu->options; while (tmpopt) { if (strchr(tmpopt->keys, userchoice)) { @@ -1749,7 +1749,7 @@ runmenuloop(struct dg_menu *menu) if (return_from_submenu) { return_from_submenu = 0; - return; + return 0; } if (check_retard(0)) { @@ -2004,7 +2004,8 @@ main (int argc, char** argv) initcurses (); while (1) { - runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon")); + if (runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon"))) + break; } /* NOW we can safely kill this */ diff --git a/dgamelaunch.h b/dgamelaunch.h index 29afbfd..d1b78fc 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -191,7 +191,7 @@ extern struct dg_game **populate_games(int game, int *l); extern struct dg_game **sort_games(struct dg_game **games, int len, dg_sortmode sortmode); -void runmenuloop(struct dg_menu *menu); +int runmenuloop(struct dg_menu *menu); extern void inprogressmenu(int gameid); extern void change_email(void);