From 5a1092664439a77f87a219e0922a5f202179c1d0 Mon Sep 17 00:00:00 2001 From: keni Date: Sat, 29 Sep 2018 16:43:39 -0400 Subject: [PATCH 1/4] Update Files. Add missing files and missing .lev section. --- Files | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/Files b/Files index 796b9c5bf..7a1a69974 100644 --- a/Files +++ b/Files @@ -43,13 +43,15 @@ tribute wizhelp yendor.des doc: (files for all versions) Guidebook.mn Guidebook.tex Guidebook.txt config.nh dgn_comp.6 -dgn_comp.txt dlb.6 dlb.txt fixes22.0 fixes30.0 -fixes31.1 fixes31.2 fixes31.3 fixes32.0 fixes32.1 -fixes32.2 fixes32.3 fixes33.0 fixes33.1 fixes34.0 -fixes34.1 fixes34.2 fixes34.3 fixes35.0 fixes36.0 -fixes36.1 fixes36.2 lev_comp.6 lev_comp.txt makedefs.6 -makedefs.txt nethack.6 nethack.txt recover.6 recover.txt -tmac.n window.doc +dgn_comp.txt dlb.6 dlb.txt fixes10.0 fixes14.f +fixes22.0 fixes23.e fixes30.0 fixes30.pl01 fixes30.pl02 +fixes30.pl03 fixes30.pl04 fixes30.pl05 fixes30.pl06 fixes30.pl07 +fixes30.pl08 fixes30.pl09 fixes30.pl10 fixes31.1 fixes31.2 +fixes31.3 fixes32.0 fixes32.1 fixes32.2 fixes32.3 +fixes33.0 fixes33.1 fixes34.0 fixes34.1 fixes34.2 +fixes34.3 fixes35.0 fixes36.0 fixes36.1 fixes36.2 +lev_comp.6 lev_comp.txt makedefs.6 makedefs.txt nethack.6 +nethack.txt recover.6 recover.txt tmac.n window.doc include: (files for GEM versions) @@ -217,9 +219,10 @@ snd86unx.shr sys/unix/hints: (files for configuring UNIX NetHack versions) -linux linux-chroot linux-qt4 linux-x11 macosx -macosx.sh macosx10.10 macosx10.5 macosx10.7 macosx10.8 -unix +linux linux-chroot linux-qt4 linux-qt5 +linux-x11 macosx macosx.sh macosx10.10 +macosx10.10-qt macosx10.5 macosx10.7 macosx10.8 +unix sys/vms: (files for VMS version) @@ -376,6 +379,32 @@ dat: (file generated by dgn_comp at playground creation time) dungeon +(files generated by lev_comp at playground creation time) +Arc-fila.lev Arc-filb.lev Arc-goal.lev Arc-loca.lev Arc-strt.lev +Bar-fila.lev Bar-filb.lev Bar-goal.lev Bar-loca.lev Bar-strt.lev +Cav-fila.lev Cav-filb.lev Cav-goal.lev Cav-loca.lev Cav-strt.lev +Hea-fila.lev Hea-filb.lev Hea-goal.lev Hea-loca.lev Hea-strt.lev +Kni-fila.lev Kni-filb.lev Kni-goal.lev Kni-loca.lev Kni-strt.lev +Mon-fila.lev Mon-filb.lev Mon-goal.lev Mon-loca.lev Mon-strt.lev +Pri-fila.lev Pri-filb.lev Pri-goal.lev Pri-loca.lev Pri-strt.lev +Ran-fila.lev Ran-filb.lev Ran-goal.lev Ran-loca.lev Ran-strt.lev +Rog-fila.lev Rog-filb.lev Rog-goal.lev Rog-loca.lev Rog-strt.lev +Sam-fila.lev Sam-filb.lev Sam-goal.lev Sam-loca.lev Sam-strt.lev +Tou-fila.lev Tou-filb.lev Tou-goal.lev Tou-loca.lev Tou-strt.lev +Val-fila.lev Val-filb.lev Val-goal.lev Val-loca.lev Val-strt.lev +Wiz-fila.lev Wiz-filb.lev Wiz-goal.lev Wiz-loca.lev Wiz-strt.lev +air.lev asmodeus.lev astral.lev baalz.lev bigrm-1.lev +bigrm-10.lev bigrm-2.lev bigrm-3.lev bigrm-4.lev bigrm-5.lev +bigrm-6.lev bigrm-7.lev bigrm-8.lev bigrm-9.lev castle.lev +earth.lev fakewiz1.lev fakewiz2.lev fire.lev juiblex.lev +knox.lev medusa-1.lev medusa-2.lev medusa-3.lev medusa-4.lev +minefill.lev minend-1.lev minend-2.lev minend-3.lev minetn-1.lev +minetn-2.lev minetn-3.lev minetn-4.lev minetn-5.lev minetn-6.lev +minetn-7.lev oracle.lev orcus.lev sanctum.lev soko1-1.lev +soko1-2.lev soko2-1.lev soko2-2.lev soko3-1.lev soko3-2.lev +soko4-1.lev soko4-2.lev tower1.lev tower2.lev tower3.lev +valley.lev water.lev wizard1.lev wizard2.lev wizard3.lev + (files generated by makedefs at playground creation time) data dungeon.pdf options oracles quest.dat rumors From d1c5649890b80f692bb5cd95ea585f7085c5d2a9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 29 Sep 2018 22:28:10 -0400 Subject: [PATCH 2/4] revisit display artifact appearing to the right of status line The prior fix for this was a bit flawed. It was only considering the length of the last field, but what it really needed to do was consider the placement of the last character of the last field on the row relative to the placement of the last character of the last field on the row previously. If the new placement of that last character of the last field is left of the previous placement, some clearing must be done. --- doc/fixes36.2 | 5 +++-- include/wintty.h | 2 +- win/tty/wintty.c | 25 ++++++++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index a56ab4b9f..25fd65dc4 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -168,8 +168,9 @@ tty: turn off an optimization that is the suspected cause of Windows reported tty: ensure that current status fields are always copied to prior status values so that comparisons are correct tty: fix an out of bounds error in tty_status_update() for BL_HUNGER case -tty: fix leftover display artifact when last field on the row got smaller - and optimize so only the right-most field requires the cleanup code +tty: fix leftover display artifact when the last field on the row got placed + to the left of where it was previously due to it, or one of the fields + to its left, getting shorter X11: its use of genl_status_update exposed a negative index use that could lead to a segfault diff --git a/include/wintty.h b/include/wintty.h index 9a375145e..009baf69c 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -75,11 +75,11 @@ struct tty_status_fields { int color; int attr; int x, y; + int padright; size_t lth; boolean valid; boolean dirty; boolean redraw; - boolean padright; }; #endif diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 145a535fe..f235f6c91 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3588,7 +3588,7 @@ tty_status_init() tty_status[NOW][i].valid = FALSE; tty_status[NOW][i].dirty = FALSE; tty_status[NOW][i].redraw = FALSE; - tty_status[NOW][i].padright = FALSE; + tty_status[NOW][i].padright = 0; tty_status[BEFORE][i] = tty_status[NOW][i]; } tty_condition_bits = 0L; @@ -3883,11 +3883,17 @@ int *topsz, *bottomsz; /* On a change to the field length, everything further to the right must be updated as well */ - if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth) { + if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth) update_right = TRUE; - if ((tty_status[NOW][idx].lth < tty_status[BEFORE][idx].lth) && - idx == last_on_row[row]) - tty_status[NOW][idx].padright = TRUE; + + if (idx == last_on_row[row]) { + int prevright = tty_status[BEFORE][idx].x + + tty_status[BEFORE][idx].lth, + currright = tty_status[NOW][idx].x + + tty_status[NOW][idx].lth; + + if (currright < prevright) + tty_status[NOW][idx].padright = prevright - currright; } if (!update_right && !forcefields) { @@ -4339,10 +4345,11 @@ render_status(VOID_ARGS) term_end_color(); End_Attr(attridx); } - if (tty_status[NOW][fldidx].padright) { - int cnt = tty_status[BEFORE][fldidx].lth - - tty_status[NOW][fldidx].lth; + if (tty_status[NOW][fldidx].padright > 0) { + int cnt = tty_status[NOW][fldidx].padright; + /* .lth - 1 below because we already did the leading + blank above */ x += (tty_status[NOW][fldidx].lth - 1); while (cnt-- > 0) tty_putstatusfield(nullfield, " ", x++, y); @@ -4352,7 +4359,7 @@ render_status(VOID_ARGS) /* reset .redraw, .dirty, .padright now that they've been rendered */ tty_status[NOW][fldidx].dirty = FALSE; tty_status[NOW][fldidx].redraw = FALSE; - tty_status[NOW][fldidx].padright = FALSE; + tty_status[NOW][fldidx].padright = 0; /* * Make a copy of the entire tty_status struct for comparison From ef199f37636401a8fa1c5766ef7fc8831f11002e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 29 Sep 2018 23:21:11 -0400 Subject: [PATCH 3/4] one more update for the right of the status line This tracks the last character written on each row and clears the previous content from the end independently of which field is actually involved. --- include/wintty.h | 2 +- win/tty/wintty.c | 75 +++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/include/wintty.h b/include/wintty.h index 009baf69c..99b560d82 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -75,11 +75,11 @@ struct tty_status_fields { int color; int attr; int x, y; - int padright; size_t lth; boolean valid; boolean dirty; boolean redraw; + boolean last_on_row; }; #endif diff --git a/win/tty/wintty.c b/win/tty/wintty.c index f235f6c91..1f6c0fd52 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3541,7 +3541,8 @@ static enum statusfields fieldorder[2][MAX_PER_ROW] = { /* 2: two status lines * BL_CAP, BL_CONDITION, BL_FLUSH } }; -static int last_on_row[2]; +static int last_on_row[2]; /* [rows] */ +static int finalx[2][2]; /* [rows][NOW or BEFORE] */ static boolean setlast = FALSE; static boolean windowdata_init = FALSE; static int cond_shrinklvl = 0, cond_width_at_shrink = 0; @@ -3588,7 +3589,7 @@ tty_status_init() tty_status[NOW][i].valid = FALSE; tty_status[NOW][i].dirty = FALSE; tty_status[NOW][i].redraw = FALSE; - tty_status[NOW][i].padright = 0; + tty_status[NOW][i].last_on_row = FALSE; tty_status[BEFORE][i] = tty_status[NOW][i]; } tty_condition_bits = 0L; @@ -3886,15 +3887,8 @@ int *topsz, *bottomsz; if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth) update_right = TRUE; - if (idx == last_on_row[row]) { - int prevright = tty_status[BEFORE][idx].x - + tty_status[BEFORE][idx].lth, - currright = tty_status[NOW][idx].x - + tty_status[NOW][idx].lth; - - if (currright < prevright) - tty_status[NOW][idx].padright = prevright - currright; - } + if (idx == last_on_row[row]) + tty_status[NOW][idx].last_on_row = TRUE; if (!update_right && !forcefields) { /* @@ -4182,22 +4176,22 @@ render_status(VOID_ARGS) for (row = 0; row < 2; ++row) { curs(WIN_STATUS, 1, row); for (i = 0; fieldorder[row][i] != BL_FLUSH; ++i) { - int fldidx = fieldorder[row][i]; + int idx = fieldorder[row][i]; - if (!status_activefields[fldidx]) + if (!status_activefields[idx]) continue; - if ((tty_status[NOW][fldidx].lth || fldidx == BL_CONDITION) - && (tty_status[NOW][fldidx].redraw || !do_field_opt)) { - int coloridx = tty_status[NOW][fldidx].color; - int attridx = tty_status[NOW][fldidx].attr; - int x = tty_status[NOW][fldidx].x; + if ((tty_status[NOW][idx].lth || idx == BL_CONDITION) + && (tty_status[NOW][idx].redraw || !do_field_opt)) { + int coloridx = tty_status[NOW][idx].color; + int attridx = tty_status[NOW][idx].attr; + int x = tty_status[NOW][idx].x; int y = row; - char *text = status_vals[fldidx]; - boolean hitpointbar = (fldidx == BL_TITLE + char *text = status_vals[idx]; + boolean hitpointbar = (idx == BL_TITLE && iflags.wc2_hitpointbar); - if (fldidx == BL_CONDITION) { + if (idx == BL_CONDITION) { /* * +-----------------+ * | Condition Codes | @@ -4241,7 +4235,7 @@ render_status(VOID_ARGS) } tty_curs(WIN_STATUS, x, y); cl_end(); - } else if (fldidx == BL_GOLD) { + } else if (idx == BL_GOLD) { char buf[BUFSZ]; /* * +-----------+ @@ -4318,7 +4312,7 @@ render_status(VOID_ARGS) } tty_putstatusfield(nullfield, "]", x++, y); } else { - tty_putstatusfield(&tty_status[NOW][fldidx], + tty_putstatusfield(&tty_status[NOW][idx], (char *) 0, x, y); } } else { @@ -4338,34 +4332,37 @@ render_status(VOID_ARGS) if (coloridx != NO_COLOR && coloridx != CLR_MAX) term_start_color(coloridx); } - tty_putstatusfield(&tty_status[NOW][fldidx], + tty_putstatusfield(&tty_status[NOW][idx], text, x, y); if (iflags.hilite_delta) { if (coloridx != NO_COLOR && coloridx != CLR_MAX) term_end_color(); End_Attr(attridx); } - if (tty_status[NOW][fldidx].padright > 0) { - int cnt = tty_status[NOW][fldidx].padright; - - /* .lth - 1 below because we already did the leading - blank above */ - x += (tty_status[NOW][fldidx].lth - 1); - while (cnt-- > 0) - tty_putstatusfield(nullfield, " ", x++, y); - } } + if (tty_status[NOW][idx].last_on_row) { + int padright = 0; + + x = tty_status[NOW][idx].x + tty_status[NOW][idx].lth; + finalx[row][NOW] = x - 1; + if (finalx[row][NOW] < finalx[row][BEFORE]) + padright = finalx[row][BEFORE] - finalx[row][NOW]; + while (padright-- > 0) + tty_putstatusfield(nullfield, " ", x++, y); + } } /* reset .redraw, .dirty, .padright now that they've been rendered */ - tty_status[NOW][fldidx].dirty = FALSE; - tty_status[NOW][fldidx].redraw = FALSE; - tty_status[NOW][fldidx].padright = 0; + tty_status[NOW][idx].dirty = FALSE; + tty_status[NOW][idx].redraw = FALSE; + tty_status[NOW][idx].last_on_row = FALSE; /* - * Make a copy of the entire tty_status struct for comparison - * of current and previous. + * For comparison of current and previous, + * - Copy the entire tty_status struct. + * - Copy the last written column number on the line. */ - tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx]; + tty_status[BEFORE][idx] = tty_status[NOW][idx]; + finalx[row][BEFORE] = finalx[row][NOW]; } } if (cond_disp_width[NOW] < cond_width_at_shrink) { From 00dfed5b3ac4ccd8d63eaf6acd2e3e586ac7f1c4 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 29 Sep 2018 23:38:20 -0400 Subject: [PATCH 4/4] move assignment outside inner loop --- win/tty/wintty.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 1f6c0fd52..2794331c8 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -4349,7 +4349,7 @@ render_status(VOID_ARGS) padright = finalx[row][BEFORE] - finalx[row][NOW]; while (padright-- > 0) tty_putstatusfield(nullfield, " ", x++, y); - } + } } /* reset .redraw, .dirty, .padright now that they've been rendered */ tty_status[NOW][idx].dirty = FALSE; @@ -4357,13 +4357,16 @@ render_status(VOID_ARGS) tty_status[NOW][idx].last_on_row = FALSE; /* - * For comparison of current and previous, + * For comparison of current and previous: * - Copy the entire tty_status struct. - * - Copy the last written column number on the line. */ tty_status[BEFORE][idx] = tty_status[NOW][idx]; - finalx[row][BEFORE] = finalx[row][NOW]; } + /* + * For comparison of current and previous: + * - Copy the last written column number on the row. + */ + finalx[row][BEFORE] = finalx[row][NOW]; } if (cond_disp_width[NOW] < cond_width_at_shrink) { cond_shrinklvl = 0; /* reset */