Always draw the whole banner.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@621 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2011-10-11 15:50:59 +00:00
parent 228be4b554
commit 85d39473fb
4 changed files with 26 additions and 24 deletions

9
TODO
View File

@ -1,4 +1,9 @@
-occasionally dgl crashes, leaving the shmem semaphore in a state
where the shmem block has to be freed.
-configure option --ncurses and --ncursesw
< kerio> paxed: it would also be cool to have %g and %s work within a game definition too
< kerio> paxed: is this intended behavior? i can't set two different spooldirs for two different games
@ -45,8 +50,6 @@
key not defined in other commands):
commands[default] = ...
-change dgl-banner handling; we only use the top line of it nowadays...
(maybe make that info config line: bannerline = "## $SERVERID" or something)
-allow the admin to config the watching menu:
-top banner
-bottom banner
@ -74,6 +77,8 @@
into a menu def. auto=try to detect it from file extension.
would be useful to be able to define a program to run that
generates the banner? (eg. nethack hiscore list via nethack itself)
to output raw escape codes under ncurses, use write(1, "foo", strlen("foo"))
(must restore cursor position after printing or ncurses is confoosed)
-BUG: cannot quit watching until caught up with the stream.
-allow configuring the watching, new user registration,
email/passwd change, etc. screens.

View File

@ -540,17 +540,14 @@ loadbanner (char *fname, struct dg_banner *ban)
}
void
drawbanner (struct dg_banner *ban, unsigned int start_line, unsigned int howmany)
drawbanner (struct dg_banner *ban)
{
unsigned int i;
if (!ban) return;
if (howmany > ban->len || howmany == 0)
howmany = ban->len;
for (i = 0; i < howmany; i++)
mvaddstr (start_line + i, 1, ban->lines[i]);
for (i = 0; i < ban->len; i++)
mvaddstr (1 + i, 1, ban->lines[i]);
}
void
@ -965,7 +962,7 @@ inprogressmenu (int gameid)
offset = 0;
erase ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
if (len > 0) {
while (offset >= len) { offset -= max_height; }
@ -1340,7 +1337,7 @@ change_email ()
clear();
if (me->flags & DGLACCT_EMAIL_LOCK) {
drawbanner(&banner, 1, 1);
drawbanner(&banner);
mvprintw(5, 1, "Sorry, you cannot change the email.--More--");
dgl_getch();
return;
@ -1348,7 +1345,7 @@ change_email ()
for (;;)
{
drawbanner(&banner, 1,1);
drawbanner(&banner);
mvprintw(3, 1, "Your current email is: %s", me->email);
mvaddstr(4, 1, "Please enter a new one (max 80 chars; blank line aborts)");
@ -1405,7 +1402,7 @@ changepw (int dowrite)
if (me->flags & DGLACCT_PASSWD_LOCK) {
clear();
drawbanner(&banner, 1, 1);
drawbanner(&banner);
mvprintw(5, 1, "Sorry, you cannot change the password.--More--");
dgl_getch();
return 0;
@ -1416,7 +1413,7 @@ changepw (int dowrite)
char repeatbuf[DGL_PASSWDLEN+1];
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvprintw (5, 1,
"Please enter a%s password. Remember that this is sent over the net",
@ -1554,7 +1551,7 @@ domailuser (char *username)
/* print the enter your message line */
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvprintw (5, 1,
"Enter your message here. It is to be one line only and %i characters or less.",
DGL_MAILMSGLEN);
@ -1706,7 +1703,7 @@ loginprompt (int from_ttyplay)
{
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
if (from_ttyplay == 1)
mvaddstr (4, 1, "This operation requires you to be logged in.");
@ -1742,7 +1739,7 @@ loginprompt (int from_ttyplay)
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvaddstr (5, 1, "Please enter your password.");
mvaddstr (7, 1, "=> ");
@ -1796,7 +1793,7 @@ newuser ()
{
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvaddstr (5, 1, "Sorry, too many users have registered now.");
mvaddstr (6, 1, "You might email the server administrator.");
@ -1818,7 +1815,7 @@ newuser ()
sprintf(buf, "%i character max.", globalconfig.max_newnick_len);
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvaddstr (5, 1, "Welcome new user. Please enter a username.");
mvaddstr (6, 1,
@ -1886,7 +1883,7 @@ newuser ()
{
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
mvaddstr (5, 1, "Please enter your email address.");
mvaddstr (6, 1, "This is sent _nowhere_ but will be used if you ask"
@ -2425,7 +2422,7 @@ purge_stale_locks (int game)
if (firsttime)
{
clear ();
drawbanner (&banner, 1, 1);
drawbanner (&banner);
#define HUP_WAIT 10 /* seconds before HUPPING */
mvprintw (3, 1,
@ -2521,7 +2518,7 @@ runmenuloop(struct dg_menu *menu)
if (globalconfig.utf8esc) write(1, "\033%G", 3);
clear();
}
drawbanner(&ban, 1, 0);
drawbanner(&ban);
if (menu->cursor_x >= 0 && menu->cursor_y >= 0)
mvprintw(menu->cursor_y, menu->cursor_x, "");
refresh();

View File

@ -280,7 +280,7 @@ extern char *gen_ttyrec_filename(void);
extern char *gen_inprogress_lock(int game, pid_t pid, char *ttyrec_filename);
extern void catch_sighup(int signum);
extern void loadbanner(char *fname, struct dg_banner *ban);
extern void drawbanner(struct dg_banner *ban, unsigned int start_line, unsigned int howmany);
extern void drawbanner(struct dg_banner *ban);
extern void banner_var_add(char *name, char *value);
extern char *banner_var_value(char *name);
extern void banner_var_free(void);

View File

@ -51,9 +51,9 @@ bannervars = [ "$MOTDTIME" = "2011.10.08",
"$SERVERID" = "nethack.alt.org - http://nethack.alt.org/"
]
# From inside the jail, location of a banner file, the topmost line will be
# From inside the jail, location of a banner file, which is
# shown in submenus that cannot be defined separately.
# Some string substitution is done for the file:
# Some string substitution is done for every banner file contents:
# - bannervars from above
# - $VERSION replaced with "dgamelaunch v" + dgl version number.
# - $USERNAME replaced with logged-in user's name, or with "[Anonymous]"