]> skyeroc.xyz Git - dgamelaunch/commitdiff
Add a watching-menu command to start watching a random game.
authorPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 13:10:45 +0000 (13:10 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 18 Oct 2009 13:10:45 +0000 (13:10 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@489 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c
examples/dgl_menu_watchmenu_help.txt

index b32a27020544e191f7d7445c2c090457fbc3c7f6..cbfe52f5cf635abd2b993860fa52b04d7e6961d2 100644 (file)
@@ -487,6 +487,12 @@ inprogressmenu (int gameid)
 
       switch ((menuchoice = getch ()))
         {
+       case '*':
+           if (len > 0) {
+               idx = random() % len;
+               goto watchgame;
+           }
+           break;
        case '?':
            (void) runmenuloop(dgl_find_menu("watchmenu_help"));
            break;
@@ -2035,6 +2041,8 @@ main (int argc, char** argv)
   }
   setproctitle("<Anonymous>");
 
+  srand(time(0));
+
   create_config();
 
   /* signal handlers */
index 339c0ee5017dd096f170e4b3cfe52bb55ceb309a..0719e82ee2d8c45eefeccd72d969560785bf2958 100644 (file)
@@ -2,12 +2,13 @@
 
  Help for watching-menu
  ----------------------
- ?        shows this help.
+ ?        show this help.
  > <      next/previous page.
- .        changes sorting method.
+ .        change sorting method.
  q Q      return to main menu.
- a-zA-Z   selects the game entry.
- enter    starts showing the selected game.
+ a-zA-Z   select a game entry.
+ enter    start showing the selected game.
+ *        start showing a randomly selected game.
 
 
  While watching a game
@@ -18,4 +19,4 @@
 
 
 
- Press 'q' or space to return to the watching menu.
\ No newline at end of file
+ Press 'q' or space to return to the watching menu.