From b57983ec5646456273d417525a25ddc6c7b4a1e3 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 14 Jan 2008 22:06:32 +0000 Subject: [PATCH] Add new config-file commands for quit, watch_menu, ask_login and ask_register git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@422 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- TODO | 29 ++++++++++++++++++++++++----- config.l | 4 ++++ dgamelaunch.h | 4 ++++ dgl-common.c | 13 +++++++++++++ examples/dgamelaunch.conf | 5 +++++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index e83c6e4..c43275f 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,10 @@ -add new config file commands: x -chpasswd (change user's password) - -chmail (change user's email address) - -watch_menu (go to the watching menu) - -login (login user) - -newuser (register new user) - -quit (quit from dgl) + x -chmail (change user's email address) + x -watch_menu (go to the watching menu) + x -login (login user) + x -newuser (register new user) + x -quit (quit from dgl) -game_menu "x" (go to game menu "x") -return (return to main menu) -start_game (start the selected game) @@ -95,6 +95,23 @@ and maybe allow changing the watching-screen layout too? + struct dg_menuoption + { + char *keys; + struct dg_cmdpart *cmdqueue; + struct dg_menuoption *next; + }; + + struct dg_menu + { + char *banner_fn; + int cursor_x, cursor_y; /* coord to put cursor after drawing banner */ + struct dg_menuoption *options; + }; + + + + -add commandline parameters to dgamelaunch: dgamelaunch --chpasswd "nick" "newpass" @@ -104,6 +121,8 @@ -some games (robotfindskitten?) are not worth saving into ttyrecs, make it configurable. -allow configuring ttyplay.c; some games may use different clear-screen commands. (see for example crawl) +-allow configuring the gfx stripping. (number of chars, types of stripping, + include unicode stripping from crawl dgl, etc) -public (no-password) accounts? (a per-user flag) what happens when someone is playing on the account and someone else logins and we start playing? -change the watching screen not to show the 'press 'm' to mail user' diff --git a/config.l b/config.l index 0de9362..7c77b81 100644 --- a/config.l +++ b/config.l @@ -94,6 +94,10 @@ setenv { yylval.i = DGLCMD_SETENV; return TYPE_DGLCMD2; } exec { yylval.i = DGLCMD_EXEC; return TYPE_DGLCMD2; } chpasswd { yylval.i = DGLCMD_CHPASSWD; return TYPE_DGLCMD0; } chmail { yylval.i = DGLCMD_CHMAIL; return TYPE_DGLCMD0; } +watch_menu { yylval.i = DGLCMD_WATCH_MENU; return TYPE_DGLCMD0; } +ask_login { yylval.i = DGLCMD_LOGIN; return TYPE_DGLCMD0; } +ask_register { yylval.i = DGLCMD_REGISTER; return TYPE_DGLCMD0; } +quit { yylval.i = DGLCMD_QUIT; return TYPE_DGLCMD0; } DEFINE { return TYPE_DEFINE_GAME; } diff --git a/dgamelaunch.h b/dgamelaunch.h index c409ace..7feca6d 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -104,6 +104,10 @@ typedef enum DGLCMD_UNLINK, /* unlink foo */ DGLCMD_EXEC, /* exec foo bar */ DGLCMD_SETENV, /* setenv foo bar */ + DGLCMD_WATCH_MENU, /* watch_menu */ + DGLCMD_LOGIN, /* ask_login */ + DGLCMD_REGISTER, /* ask_register */ + DGLCMD_QUIT, /* quit */ DGLCMD_CHMAIL, /* chmail */ DGLCMD_CHPASSWD /* chpasswd */ } dglcmd_actions; diff --git a/dgl-common.c b/dgl-common.c index 8cf41e9..a7f8137 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -203,6 +203,19 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me) case DGLCMD_CHMAIL: if (loggedin) change_email(); break; + case DGLCMD_WATCH_MENU: + inprogressmenu(game); + break; + case DGLCMD_LOGIN: + if (!loggedin) loginprompt(0); + break; + case DGLCMD_REGISTER: + if (!loggedin && globalconfig.allow_registration) newuser(); + break; + case DGLCMD_QUIT: + endwin(); + graceful_exit(0); + /* break; */ } free(p1); free(p2); diff --git a/examples/dgamelaunch.conf b/examples/dgamelaunch.conf index 5fd52d8..d20e5ea 100644 --- a/examples/dgamelaunch.conf +++ b/examples/dgamelaunch.conf @@ -77,6 +77,11 @@ lockfile = "/dgl-lock" # exec "foo" "bar" = execute "foo" with "bar" as it's param # chpasswd = do the change password prompting, if logged in # chmail = do the change email prompting, if logged in +# watch_menu = go to the watching menu +# quit = quit dgl +# ask_login = do the login prompting, if not logged in +# ask_register = do register new user prompting, if not logged in and +# registration of new nicks is allowed. # # The commands will be done inside the chroot and with the uid and gid # defined above.