From 29f507bda85e0eacd5b57cedb42838c2b35820d9 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 18 Oct 2009 13:10:45 +0000 Subject: [PATCH] Add a watching-menu command to start watching a random game. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@489 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 8 ++++++++ examples/dgl_menu_watchmenu_help.txt | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index b32a270..cbfe52f 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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(""); + srand(time(0)); + create_config(); /* signal handlers */ diff --git a/examples/dgl_menu_watchmenu_help.txt b/examples/dgl_menu_watchmenu_help.txt index 339c0ee..0719e82 100644 --- a/examples/dgl_menu_watchmenu_help.txt +++ b/examples/dgl_menu_watchmenu_help.txt @@ -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. -- 2.47.3