Watching menu shows what game the players are playing
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@354 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
71cbbcbd04
commit
1feff8677b
1
config.l
1
config.l
|
@ -62,6 +62,7 @@ COMMENT ^#.*
|
|||
|
||||
"chroot_path" { return TYPE_PATH_CHROOT; }
|
||||
"game_name" { return TYPE_NAME_GAME; }
|
||||
"short_name" { return TYPE_GAME_SHORT_NAME; }
|
||||
"game_path" { return TYPE_PATH_GAME; }
|
||||
"chdir" { return TYPE_PATH_CHDIR; }
|
||||
"dglroot" { return TYPE_PATH_DGLDIR; }
|
||||
|
|
9
config.y
9
config.y
|
@ -31,7 +31,7 @@ static const char* lookup_token (int t);
|
|||
}
|
||||
|
||||
%token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
|
||||
%token TYPE_PATH_CHDIR
|
||||
%token TYPE_PATH_CHDIR TYPE_GAME_SHORT_NAME
|
||||
%token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
|
||||
%token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT TYPE_GAMENUM
|
||||
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_SAVEFILEFMT
|
||||
|
@ -139,6 +139,11 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
|||
myconfig[ncnf]->game_name = strdup($3);
|
||||
break;
|
||||
|
||||
case TYPE_GAME_SHORT_NAME:
|
||||
if (myconfig[ncnf]->shortname) free (myconfig[ncnf]->shortname);
|
||||
myconfig[ncnf]->shortname = strdup($3);
|
||||
break;
|
||||
|
||||
case TYPE_PATH_CHDIR:
|
||||
if (myconfig[ncnf]->chdir) free(myconfig[ncnf]->chdir);
|
||||
myconfig[ncnf]->chdir = strdup ($3);
|
||||
|
@ -297,6 +302,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
|
|||
| TYPE_PATH_CHROOT { $$ = TYPE_PATH_CHROOT; }
|
||||
| TYPE_PATH_GAME { $$ = TYPE_PATH_GAME; }
|
||||
| TYPE_NAME_GAME { $$ = TYPE_NAME_GAME; }
|
||||
| TYPE_GAME_SHORT_NAME { $$ = TYPE_GAME_SHORT_NAME; }
|
||||
| TYPE_PATH_CHDIR { $$ = TYPE_PATH_CHDIR; }
|
||||
| TYPE_PATH_DGLDIR { $$ = TYPE_PATH_DGLDIR; }
|
||||
| TYPE_PATH_SPOOL { $$ = TYPE_PATH_SPOOL; }
|
||||
|
@ -327,6 +333,7 @@ const char* lookup_token (int t)
|
|||
case TYPE_PATH_CHDIR: return "chdir";
|
||||
case TYPE_PATH_GAME: return "game_path";
|
||||
case TYPE_NAME_GAME: return "game_name";
|
||||
case TYPE_GAME_SHORT_NAME: return "short_name";
|
||||
case TYPE_PATH_DGLDIR: return "dglroot";
|
||||
case TYPE_PATH_SPOOL: return "spooldir";
|
||||
case TYPE_PATH_BANNER: return "banner";
|
||||
|
|
|
@ -367,8 +367,8 @@ inprogressmenu (int gameid)
|
|||
snprintf (gametype, sizeof gametype, "%3dx%3d",
|
||||
games[i + offset]->ws_col, games[i + offset]->ws_row);
|
||||
|
||||
mvprintw (7 + i, 1, "%c) %-15s (%s) %s %s (%ldm %lds idle)",
|
||||
i + 97, games[i + offset]->name, gametype,
|
||||
mvprintw (7 + i, 1, "%c) %-15s %-5s (%s) %s %s (%ldm %lds idle)",
|
||||
i + 97, games[i + offset]->name, myconfig[games[i + offset]->gamenum]->shortname, gametype,
|
||||
games[i + offset]->date, games[i + offset]->time,
|
||||
(time (&ctime) - games[i + offset]->idle_time) / 60,
|
||||
(time (&ctime) - games[i + offset]->idle_time) % 60);
|
||||
|
|
|
@ -39,12 +39,14 @@ struct dg_game
|
|||
char *time;
|
||||
time_t idle_time;
|
||||
int ws_row, ws_col; /* Window size */
|
||||
int gamenum;
|
||||
};
|
||||
|
||||
struct dg_config
|
||||
{
|
||||
char* game_path;
|
||||
char* game_name;
|
||||
char* shortname;
|
||||
char* chdir;
|
||||
char* rcfile;
|
||||
char* spool;
|
||||
|
|
|
@ -21,6 +21,7 @@ struct dg_config defconfig = {
|
|||
/* chroot = */ /*"/var/lib/dgamelaunch/",*/
|
||||
/* game_path = */ "/bin/nethack",
|
||||
/* game_name = */ "NetHack",
|
||||
/* shortname = */ "NH",
|
||||
/* chdir = */ NULL,
|
||||
/* dglroot = *//* "/dgldir/",*/
|
||||
/* lockfile = */ /*"/dgl-lock",*/
|
||||
|
@ -189,6 +190,8 @@ populate_games (int xgame, int *l)
|
|||
|
||||
games[len]->idle_time = pstat.st_mtime;
|
||||
|
||||
games[len]->gamenum = game;
|
||||
|
||||
n = read(fd, pidws, sizeof(pidws) - 1);
|
||||
if (n > 0)
|
||||
{
|
||||
|
@ -326,6 +329,7 @@ create_config ()
|
|||
|
||||
if (!myconfig[tmp]->game_path) myconfig[tmp]->game_path = defconfig.game_path;
|
||||
if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name;
|
||||
if (!myconfig[tmp]->shortname) myconfig[tmp]->shortname = defconfig.shortname;
|
||||
if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile;
|
||||
if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool;
|
||||
if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt;
|
||||
|
|
|
@ -57,7 +57,10 @@ lockfile = "/dgl-lock"
|
|||
|
||||
# From inside the jail, the location of the binary to be launched.
|
||||
game_path = "/bin/nethackstub"
|
||||
# Full name of the game
|
||||
game_name = "NetHack stub"
|
||||
# Short name, used in the watching menu
|
||||
short_name = "NHstb"
|
||||
|
||||
# arguments for when we exec the binary
|
||||
game_args = "/bin/nethackstub"
|
||||
|
@ -95,6 +98,7 @@ game_num = 1
|
|||
|
||||
game_path = "/bin/nethack"
|
||||
game_name = "NetHack 3.4.3"
|
||||
short_name = "NH343"
|
||||
|
||||
game_args = "/bin/nethack"
|
||||
game_args = "-u"
|
||||
|
@ -118,6 +122,7 @@ inprogressdir = "inprogress-nethack/"
|
|||
game_num = 2
|
||||
game_path = "/bin/crawl"
|
||||
game_name = "Crawl Stone Soup 0.1.7"
|
||||
short_name = "Crawl"
|
||||
|
||||
chdir = "/crawl/"
|
||||
|
||||
|
|
Loading…
Reference in New Issue