]> skyeroc.xyz Git - dgamelaunch/commitdiff
Fix a bug where users couldn't exit from dgl. Found by blindcoder.
authorPasi Kallinen <paxed@alt.org>
Sat, 23 Aug 2008 12:39:01 +0000 (12:39 +0000)
committerPasi Kallinen <paxed@alt.org>
Sat, 23 Aug 2008 12:39:01 +0000 (12:39 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@449 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c
dgamelaunch.h

index 8ea882b63bd997c29f1b2d93ad55c55fe7e100fd..669525e7f6ca5c5cca52cb1a11b3837ac818ed65 100644 (file)
@@ -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 */
index 29afbfd4a52406f36b4e38d3faba39442c891ed0..d1b78fc2ea752d6033f5e34b6c9d67772fc91bce 100644 (file)
@@ -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);