X11: add new character selection dialog, and obey player_selection:dialog
unix: reduce makefile verbosity by default
win32gui: new player selection dialog
+tty, x11, qt4: compile-time option to allow some prompts remember the input
NetHack Community Patches (or Variation) Included
but it isn't necessary for successful operation of the program */
#define FREE_ALL_MEMORY /* free all memory at exit */
+/* EDIT_GETLIN makes the string input in TTY, Qt4, and X11
+ so some prompts will remember the previously input text
+ (within the same session) */
+/* #define EDIT_GETLIN */
+
/* #define DUMPLOG */ /* End-of-game dump logs */
#ifdef DUMPLOG
if (behavior == BL_TH_VAL_PERCENTAGE
|| behavior == BL_TH_VAL_ABSOLUTE) {
- char inbuf[BUFSZ], buf[BUFSZ];
+ char inbuf[BUFSZ] = DUMMY, buf[BUFSZ];
int val;
boolean skipltgt = FALSE;
boolean gotnum = FALSE;
hilite.rel = TXT_VALUE;
Strcpy(hilite.textmatch, rolelist[rv]);
} else {
- char inbuf[BUFSZ];
+ char inbuf[BUFSZ] = DUMMY;
inbuf[0] = '\0';
getlin(qry_buf, inbuf);
STATIC_PTR int
wiz_level_change(VOID_ARGS)
{
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
int newlevel;
int ret;
wiz_migrate_mons()
{
int mcount = 0;
- char inbuf[BUFSZ];
+ char inbuf[BUFSZ] = DUMMY;
struct permonst *ptr;
struct monst *mtmp;
d_level tolevel;
to give the go-ahead for this query; default is "no" unless the
ParanoidConfirm flag is set in which case there's no default */
if (be_paranoid) {
- char qbuf[QBUFSZ], ans[BUFSZ];
+ char qbuf[QBUFSZ], ans[BUFSZ] = DUMMY;
const char *promptprefix = "", *responsetype = ParanoidConfirm
? "(yes|no)"
: "(yes) [no]";
STATIC_OVL void
do_mname()
{
- char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ];
+ char buf[BUFSZ] = DUMMY, monnambuf[BUFSZ], qbuf[QBUFSZ];
coord cc;
int cx, cy;
struct monst *mtmp = 0;
do_oname(obj)
register struct obj *obj;
{
- char *bufp, buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ];
+ char *bufp, buf[BUFSZ] = DUMMY, bufcpy[BUFSZ], qbuf[QBUFSZ];
const char *aname;
short objtyp;
docall(obj)
struct obj *obj;
{
- char buf[BUFSZ], qbuf[QBUFSZ];
+ char buf[BUFSZ] = DUMMY, qbuf[QBUFSZ];
char **str1;
if (!obj->dknown)
donamelevel()
{
mapseen *mptr;
- char nbuf[BUFSZ]; /* Buffer for response */
+ char nbuf[BUFSZ] = DUMMY; /* Buffer for response */
if (!(mptr = find_mapseen(&u.uz)))
return 0;
+#ifdef EDIT_GETLIN
+ if (mptr->custom) {
+ (void) strncpy(nbuf, mptr->custom, BUFSZ);
+ nbuf[BUFSZ-1] = '\0';
+ }
+#else
if (mptr->custom) {
char tmpbuf[BUFSZ];
Sprintf(tmpbuf, "Replace annotation \"%.30s%s\" with?", mptr->custom,
strlen(mptr->custom) > 30 ? "..." : "");
getlin(tmpbuf, nbuf);
} else
+#endif
getlin("What do you want to call this dungeon level?", nbuf);
if (index(nbuf, '\033'))
return 0;
int oletct, iletct, unpaid, oc_of_sym;
char sym, *ip, olets[MAXOCLASSES + 5], ilets[MAXOCLASSES + 10];
char extra_removeables[3 + 1]; /* uwep,uswapwep,uquiver */
- char buf[BUFSZ], qbuf[QBUFSZ];
+ char buf[BUFSZ] = DUMMY, qbuf[QBUFSZ];
if (!invent) {
You("have nothing to %s.", word);
{
#ifdef SHELL /* can't access mail reader without spawning subprocess */
const char *txt, *cmd;
- char *p, buf[BUFSZ], qbuf[BUFSZ];
+ char *p, buf[BUFSZ] = DUMMY, qbuf[BUFSZ];
int len;
/* there should be a command in OMAILCMD */
bribe(mtmp)
struct monst *mtmp;
{
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
long offer;
long umoney = money_cnt(invent);
/* for debugging: allow control of polymorphed monster */
if (wizard && iflags.mon_polycontrol) {
- char pprompt[BUFSZ], buf[BUFSZ];
+ char pprompt[BUFSZ], buf[BUFSZ] = DUMMY;
int monclass;
Sprintf(pprompt, "Change %s @ %s into what kind of monster?",
do_play_instrument(instr)
struct obj *instr;
{
- char buf[BUFSZ], c = 'y';
+ char buf[BUFSZ] = DUMMY, c = 'y';
char *s;
int x, y;
boolean ok;
fullname = "pickup_types";
if (match_optname(opts, fullname, 8, TRUE)) {
char ocl[MAXOCLASSES + 1], tbuf[MAXOCLASSES + 1], qbuf[QBUFSZ],
- abuf[BUFSZ];
+ abuf[BUFSZ] = DUMMY;
int oc_sym;
boolean badopt = FALSE, compat = (strlen(opts) <= 6), use_menu;
doset() /* changing options via menu by Per Liboriussen */
{
static boolean made_fmtstr = FALSE;
- char buf[BUFSZ], buf2[BUFSZ];
+ char buf[BUFSZ], buf2[BUFSZ] = DUMMY;
const char *name;
int i = 0, pass, boolcount, pick_cnt, pick_idx, opt_indx;
boolean *bool_p;
iflags.menu_headings = mhattr;
} else if (!strcmp("msgtype", optname)) {
int opt_idx, nmt, mttyp;
- char mtbuf[BUFSZ];
+ char mtbuf[BUFSZ] = DUMMY;
msgtypes_again:
nmt = msgtype_count();
}
} else if (!strcmp("menucolors", optname)) {
int opt_idx, nmc, mcclr, mcattr;
- char mcbuf[BUFSZ];
+ char mcbuf[BUFSZ] = DUMMY;
menucolors_again:
nmc = count_menucolors();
}
} else if (!strcmp("autopickup_exception", optname)) {
int opt_idx, pass, totalapes = 0, numapes[2] = { 0, 0 };
- char apebuf[1 + BUFSZ]; /* so &apebuf[1] is BUFSZ long for getlin() */
+ char apebuf[1 + BUFSZ] = DUMMY; /* so &apebuf[1] is BUFSZ long for getlin() */
struct autopickup_exception *ape;
ape_again:
{
boolean quick = (mode == 1); /* use cursor; don't search for "more info" */
boolean clicklook = (mode == 2); /* right mouse-click method */
- char out_str[BUFSZ];
+ char out_str[BUFSZ] = DUMMY;
const char *firstmatch = 0;
struct permonst *pm = 0;
int i = '\0', ans = 0;
boolean here;
int *menu_on_demand;
{
- char ilets[36], inbuf[BUFSZ]; /* FIXME: hardcoded ilets[] length */
+ char ilets[36], inbuf[BUFSZ] = DUMMY; /* FIXME: hardcoded ilets[] length */
int iletct, oclassct;
boolean not_everything, filtered;
char qbuf[QBUFSZ];
polyself(psflags)
int psflags;
{
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
int old_light, new_light, mntmp, class, tryct;
boolean forcecontrol = (psflags == 1), monsterpoly = (psflags == 2),
draconian = (uarm && Is_dragon_armor(uarm)),
do_class_genocide()
{
int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
boolean gameover = FALSE; /* true iff killed self */
for (j = 0;; j++) {
/* 3 = forced genocide of player */
/* 5 (4 | 1) = normal genocide from throne */
{
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
register int i, killplayer = 0;
register int mndx;
register struct permonst *ptr;
boolean
create_particular()
{
- char buf[BUFSZ], *bufp, monclass;
+ char buf[BUFSZ] = DUMMY, *bufp, monclass;
char *tmpp;
int which, tryct, i, firstchoice = NON_PM;
struct permonst *whichpm = NULL;
register int newlev;
d_level newlevel;
const char *escape_by_flying = 0; /* when surviving dest of -N */
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
boolean force_dest = FALSE;
if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz))
guard = findgd();
if (++u.uinvault % VAULT_GUARD_TIME == 0 && !guard) {
/* if time ok and no guard now. */
- char buf[BUFSZ];
+ char buf[BUFSZ] = DUMMY;
register int x, y, dd, gx, gy;
int lx = 0, ly = 0;
long umoney;
register struct obj *pen;
{
register struct obj *paper;
- char namebuf[BUFSZ], *nm, *bp;
+ char namebuf[BUFSZ] = DUMMY, *nm, *bp;
register struct obj *new_obj;
int basecost, actualcost;
int curseval;
void
makewish()
{
- char buf[BUFSZ], promptbuf[BUFSZ];
+ static char buf[BUFSZ] = DUMMY;
+ char promptbuf[BUFSZ];
struct obj *otmp, nothing;
int tries = 0;
resize(fontMetrics().width(prompt.text())*2+50,fontMetrics().height()*4);
}
+#ifdef EDIT_GETLIN
+ input.setText(buffer);
+#endif
centerOnMain(this);
show();
input.setFocus();
slide left hiding some chars at the beginning of the response but
making room to type more. [Prior to 3.6.1, width wasn't specifiable
and answer box always got sized to match the width of the prompt.] */
+#ifdef EDIT_GETLIN
+ SetDialogResponse(getline_dialog, input, 60); /* set default answer */
+#else
SetDialogResponse(getline_dialog, nhStr(""), 60); /* set default answer */
+#endif
positionpopup(getline_popup, TRUE); /* center,bottom */
nh_XtPopup(getline_popup, (int) XtGrabExclusive, getline_dialog);
cw->flags &= ~WIN_STOP;
ttyDisplay->toplin = 3; /* special prompt state */
ttyDisplay->inread++;
+#ifdef EDIT_GETLIN
+ custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s %s", query, bufp);
+ bufp = eos(obufp);
+#else
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s ", query);
*obufp = 0;
+#endif
for (;;) {
(void) fflush(stdout);
Strcat(strcat(strcpy(toplines, query), " "), obufp);