Merge remote-tracking branch 'origin/NetHack-3.6.0'

This commit is contained in:
keni
2018-03-22 16:27:26 -04:00
18 changed files with 259 additions and 76 deletions
+14 -1
View File
@@ -226,11 +226,24 @@ mdgrep.pl panic.c recover.c
dgn_comp.l dgn_comp.y lev_comp.l lev_comp.y dgn_comp.l dgn_comp.y lev_comp.l lev_comp.y
win/Qt: win/Qt:
(files for the Qt widget library - X11, Windows, Mac OS X, or Qtopia) (files for the Qt 3 widget library - X11, Windows, Mac OS X, or Qtopia)
Info.plist Install.Qt knethack.lnk knh-mini.xpm knh.xpm Info.plist Install.Qt knethack.lnk knh-mini.xpm knh.xpm
nhicns.uu nhsplash.xpm qt_clust.cpp qt_win.cpp qttableview.cpp nhicns.uu nhsplash.xpm qt_clust.cpp qt_win.cpp qttableview.cpp
tileedit.cpp tileedit.h qpe-nethack.control tileedit.cpp tileedit.h qpe-nethack.control
win/Qt4:
(files for the Qt 4 widget library - X11, Windows, Mac OS X)
qt4bind.cpp qt4bind.h qt4click.cpp qt4click.h qt4clust.cpp
qt4clust.h qt4delay.cpp qt4delay.h qt4glyph.cpp qt4glyph.h
qt4icon.cpp qt4icon.h qt4inv.cpp qt4inv.h qt4kde0.h
qt4key.cpp qt4key.h qt4line.cpp qt4line.h qt4main.cpp
qt4main.h qt4map.cpp qt4map.h qt4menu.cpp qt4menu.h
qt4msg.cpp qt4msg.h qt4plsel.cpp qt4plsel.h qt4rip.cpp
qt4rip.h qt4set.cpp qt4set.h qt4stat.cpp qt4stat.h
qt4str.cpp qt4streq.cpp qt4streq.h qt4str.h qt4svsel.cpp
qt4svsel.h qt4win.cpp qt4win.h qt4xcmd.cpp qt4xcmd.h
qt4yndlg.cpp qt4yndlg.h
win/X11: win/X11:
(files for X versions) (files for X versions)
Install.X11 NetHack.ad Window.c dialogs.c ibm.bdf Install.X11 NetHack.ad Window.c dialogs.c ibm.bdf
+13 -1
View File
@@ -521,6 +521,17 @@ prayer boon of 'fix all troubles' could get stuck in an infinite loop for
TROUBLE_STUCK_IN_WALL if there was no spot to teleport into available TROUBLE_STUCK_IN_WALL if there was no spot to teleport into available
It shouldn't be considered hypocrisy if you speed up your pet while standing It shouldn't be considered hypocrisy if you speed up your pet while standing
on Elbereth on Elbereth
fix 'object lost' panic if hero with lycanthropy but in human form is wielding
a potion of unholy water which gets boiled/exploded by fire, causing
were-transformation and drop of wielded weapon
prevent segfault if pline() is called recursively (which could happen if the
interface code issues a debugpline() while processing putstr())
open at yourself is the same as #loot
when #force reports that a chest's lock is already broken or already unlocked,
force it to be described as "a chest", even when its lock state is
already known, rather than as "a broken chest" or "an unlocked chest"
honor wish for "locked", "unlocked", or "broken" chest or box
honor wish for "empty" container including statue, bag-o-tricks, horn-o-plenty
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
@@ -602,6 +613,7 @@ when clairvoyance lets you move the cursor to examine the map (if it occurs
monster), the "for instructions type '?'" prompt could be confusing monster), the "for instructions type '?'" prompt could be confusing
prevent Mjollnir from being auto-quivered if it's been thrown without return prevent Mjollnir from being auto-quivered if it's been thrown without return
and then picked back up while quiver slot is empty and then picked back up while quiver slot is empty
plural of "fox" is not "foxen"
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
@@ -735,7 +747,7 @@ swallowers can't re-engulf hero immediately after spitting him/her out
werejackals can summon foxes and coyotes; werewolves can summon wargs werejackals can summon foxes and coyotes; werewolves can summon wargs
allow taming monkeys and apes with bananas allow taming monkeys and apes with bananas
GENERICUSERS is now a sysconf statement instead of compile-time option GENERICUSERS is now a sysconf statement instead of compile-time option
fountains are bright blue fountains are bright blue, graves are white
ray bounceback chance depends on the wall type ray bounceback chance depends on the wall type
undead #turning takes less time at higher experience level undead #turning takes less time at higher experience level
peacefuls may react when you attack other peacefuls peacefuls may react when you attack other peacefuls
+1 -1
View File
@@ -166,7 +166,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '<', "ladder up", C(CLR_BROWN) }, /* upladder */ { '<', "ladder up", C(CLR_BROWN) }, /* upladder */
{ '>', "ladder down", C(CLR_BROWN) }, /* dnladder */ { '>', "ladder down", C(CLR_BROWN) }, /* dnladder */
{ '_', "altar", C(CLR_GRAY) }, /* altar */ { '_', "altar", C(CLR_GRAY) }, /* altar */
{ '|', "grave", C(CLR_GRAY) }, /* grave */ { '|', "grave", C(CLR_WHITE) }, /* grave */
{ '\\', "opulent throne", C(HI_GOLD) }, /* throne */ { '\\', "opulent throne", C(HI_GOLD) }, /* throne */
/*30*/ { '#', "sink", C(CLR_GRAY) }, /* sink */ /*30*/ { '#', "sink", C(CLR_GRAY) }, /* sink */
{ '{', "fountain", C(CLR_BRIGHT_BLUE) }, /* fountain */ { '{', "fountain", C(CLR_BRIGHT_BLUE) }, /* fountain */
+4 -2
View File
@@ -1301,7 +1301,8 @@ int how;
for normal end of game, genocide doesn't either */ for normal end of game, genocide doesn't either */
if (how <= GENOCIDED) { if (how <= GENOCIDED) {
dump_redirect(TRUE); dump_redirect(TRUE);
genl_outrip(0, how, endtime); if (iflags.in_dumplog)
genl_outrip(0, how, endtime);
dump_redirect(FALSE); dump_redirect(FALSE);
} }
#endif #endif
@@ -1382,7 +1383,8 @@ int how;
artifact_score(invent, FALSE, endwin); /* list artifacts */ artifact_score(invent, FALSE, endwin); /* list artifacts */
#ifdef DUMPLOG #ifdef DUMPLOG
dump_redirect(TRUE); dump_redirect(TRUE);
artifact_score(invent, FALSE, 0); if (iflags.in_dumplog)
artifact_score(invent, FALSE, 0);
dump_redirect(FALSE); dump_redirect(FALSE);
#endif #endif
+10 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1446955300 2015/11/08 04:01:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.67 $ */ /* NetHack 3.6 lock.c $NHDT-Date: 1521499715 2018/03/19 22:48:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -549,8 +549,13 @@ doforce()
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (Is_box(otmp)) { if (Is_box(otmp)) {
if (otmp->obroken || !otmp->olocked) { if (otmp->obroken || !otmp->olocked) {
There("is %s here, but its lock is already %s.", doname(otmp), /* force doname() to omit known "broken" or "unlocked"
otmp->obroken ? "broken" : "unlocked"); prefix so that the message isn't worded redundantly;
since we're about to set lknown, there's no need to
remember and then reset its current value */
otmp->lknown = 0;
There("is %s here, but its lock is already %s.",
doname(otmp), otmp->obroken ? "broken" : "unlocked");
otmp->lknown = 1; otmp->lknown = 1;
continue; continue;
} }
@@ -630,8 +635,9 @@ int x, y;
} else if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc)) } else if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
return 0; return 0;
/* open at yourself/up/down */
if ((cc.x == u.ux) && (cc.y == u.uy)) if ((cc.x == u.ux) && (cc.y == u.uy))
return 0; return doloot();
if (stumble_on_door_mimic(cc.x, cc.y)) if (stumble_on_door_mimic(cc.x, cc.y))
return 1; return 1;
+125 -22
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.178 $ */ /* NetHack 3.6 objnam.c $NHDT-Date: 1521507553 2018/03/20 00:59:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.199 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -22,6 +22,7 @@ STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
const char *const *)); const char *const *));
STATIC_DCL char *FDECL(singplur_compound, (char *)); STATIC_DCL char *FDECL(singplur_compound, (char *));
STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned)); STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned));
STATIC_DCL boolean FDECL(badman, (const char *, BOOLEAN_P));
struct Jitem { struct Jitem {
int item; int item;
@@ -2042,10 +2043,11 @@ static struct sing_plur one_off[] = {
{ "nemesis", "nemeses" }, { "nemesis", "nemeses" },
{ "ovum", "ova" }, { "ovum", "ova" },
{ "ox", "oxen" }, { "ox", "oxen" },
{ "passerby", "passersby" },
{ "rtex", "rtices" }, /* vortex */ { "rtex", "rtices" }, /* vortex */
{ "tooth", "teeth" },
{ "serum", "sera" }, { "serum", "sera" },
{ "staff", "staves" }, { "staff", "staves" },
{ "tooth", "teeth" },
{ 0, 0 } { 0, 0 }
}; };
@@ -2054,19 +2056,18 @@ static const char *const as_is[] = {
"boots", "shoes", "gloves", "lenses", "scales", "boots", "shoes", "gloves", "lenses", "scales",
"eyes", "gauntlets", "iron bars", "eyes", "gauntlets", "iron bars",
/* both singular and plural are spelled the same */ /* both singular and plural are spelled the same */
"deer", "elk", "fish", "tuna", "yaki", "bison", "deer", "elk", "fish", "fowl",
"-hai", "krill", "manes", "moose", "ninja", "tuna", "yaki", "-hai", "krill", "manes",
"sheep", "ronin", "roshi", "shito", "tengu", "moose", "ninja", "sheep", "ronin", "roshi",
"ki-rin", "Nazgul", "gunyoki", "piranha", "samurai", "shito", "tengu", "ki-rin", "Nazgul", "gunyoki",
"shuriken", 0, "piranha", "samurai", "shuriken", 0,
/* Note: "fish" and "piranha" are collective plurals, suitable /* Note: "fish" and "piranha" are collective plurals, suitable
for "wiped out all <foo>". For "3 <foo>", they should be for "wiped out all <foo>". For "3 <foo>", they should be
"fishes" and "piranhas" instead. We settle for collective "fishes" and "piranhas" instead. We settle for collective
variant instead of attempting to support both. */ variant instead of attempting to support both. */
}; };
/* singularize/pluralize decisions common to both makesingular & makeplural /* singularize/pluralize decisions common to both makesingular & makeplural */
*/
STATIC_OVL boolean STATIC_OVL boolean
singplur_lookup(basestr, endstring, to_plural, alt_as_is) singplur_lookup(basestr, endstring, to_plural, alt_as_is)
char *basestr, *endstring; /* base string, pointer to eos(string) */ char *basestr, *endstring; /* base string, pointer to eos(string) */
@@ -2090,16 +2091,35 @@ const char *const *alt_as_is; /* another set like as_is[] */
} }
} }
/* avoid false hit on one_off[].plur == "lice"; /* avoid false hit on one_off[].plur == "lice" or .sing == "goose";
if more of these turn up, one_off[] entries will need to flagged if more of these turn up, one_off[] entries will need to flagged
as to which are whole words and which are matchable as suffices as to which are whole words and which are matchable as suffices
then matching in the loop below will end up becoming more complex */ then matching in the loop below will end up becoming more complex */
if (!strcmpi(basestr, "slice") if (!strcmpi(basestr, "slice")
|| !strcmpi(basestr, "mongoose")) { || !strcmpi(basestr, "mongoose")) {
if (to_plural) if (to_plural)
(void) strkitten(basestr, 's'); Strcasecpy(endstring, "s");
return TRUE; return TRUE;
} }
/* skip "ox" -> "oxen" entry when pluralizing "<something>ox"
unless it is muskox */
if (to_plural && strlen(basestr) > 2 && !strcmpi(endstring - 2, "ox")
&& strcmpi(endstring - 6, "muskox")) {
/* "fox" -> "foxes" */
Strcasecpy(endstring, "es");
return TRUE;
}
if (to_plural) {
if (!strcmpi(endstring - 3, "man")
&& badman(basestr, to_plural)) {
Strcasecpy(endstring, "s");
return TRUE;
}
} else {
if (!strcmpi(endstring - 3, "men")
&& badman(basestr, to_plural))
return TRUE;
}
for (sp = one_off; sp->sing; sp++) { for (sp = one_off; sp->sing; sp++) {
/* check whether endstring already matches */ /* check whether endstring already matches */
same = to_plural ? sp->plur : sp->sing; same = to_plural ? sp->plur : sp->sing;
@@ -2209,7 +2229,7 @@ const char *oldstr;
spot--; spot--;
while (spot > str && *spot == ' ') while (spot > str && *spot == ' ')
spot--; /* Strip blanks from end */ spot--; /* Strip blanks from end */
*(spot + 1) = 0; *(spot + 1) = '\0';
/* Now spot is the last character of the string */ /* Now spot is the last character of the string */
len = strlen(str); len = strlen(str);
@@ -2224,7 +2244,6 @@ const char *oldstr;
{ {
static const char *const already_plural[] = { static const char *const already_plural[] = {
"ae", /* algae, larvae, &c */ "ae", /* algae, larvae, &c */
"men", /* also catches women, watchmen */
"matzot", 0, "matzot", 0,
}; };
@@ -2240,9 +2259,8 @@ const char *oldstr;
/* man/men ("Wiped out all cavemen.") */ /* man/men ("Wiped out all cavemen.") */
if (len >= 3 && !strcmpi(spot - 2, "man") if (len >= 3 && !strcmpi(spot - 2, "man")
/* exclude shamans and humans */ /* exclude shamans and humans etc */
&& (len < 6 || strcmpi(spot - 5, "shaman")) && !badman(str, TRUE)) {
&& (len < 5 || strcmpi(spot - 4, "human"))) {
Strcasecpy(spot - 1, "en"); Strcasecpy(spot - 1, "en");
goto bottom; goto bottom;
} }
@@ -2417,7 +2435,8 @@ const char *oldstr;
} else { /* input doesn't end in 's' */ } else { /* input doesn't end in 's' */
if (!BSTRCMPI(bp, p - 3, "men")) { if (!BSTRCMPI(bp, p - 3, "men")
&& !badman(bp, FALSE)) {
Strcasecpy(p - 2, "an"); Strcasecpy(p - 2, "an");
goto bottom; goto bottom;
} }
@@ -2444,6 +2463,54 @@ bottom:
return bp; return bp;
} }
boolean
badman(basestr, to_plural)
const char *basestr;
boolean to_plural; /* true => makeplural, false => makesingular */
{
int i, al;
char *endstr, *spot;
/* these are all the prefixes for *man that don't have a *men plural */
const char *no_men[] = {
"albu", "antihu", "anti", "ata", "auto", "bildungsro", "cai", "cay",
"ceru", "corner", "decu", "des", "dura", "fir", "hanu", "het",
"infrahu", "inhu", "nonhu", "otto", "out", "prehu", "protohu",
"subhu", "superhu", "talis", "unhu", "sha",
"hu", "un", "le", "re", "so", "to", "at", "a",
};
/* these are all the prefixes for *men that don't have a *man singular */
const char *no_man[] = {
"abdo", "acu", "agno", "ceru", "cogno", "cycla", "fleh", "grava",
"hegu", "preno", "sonar", "speci", "dai", "exa", "fla", "sta", "teg",
"tegu", "vela", "da", "hy", "lu", "no", "nu", "ra", "ru", "se", "vi", "ya",
"o", "a",
};
if (!basestr || strlen(basestr) < 4)
return FALSE;
endstr = eos((char *)basestr);
if (to_plural) {
for (i = 0; i < SIZE(no_men); i++) {
al = (int) strlen(no_men[i]);
spot = endstr - (al + 3);
if (!BSTRNCMPI(basestr, spot, no_men[i], al)
&& (spot == basestr || *(spot - 1) == ' '))
return TRUE;
}
} else {
for (i = 0; i < SIZE(no_man); i++) {
al = (int) strlen(no_man[i]);
spot = endstr - (al + 3);
if (!BSTRNCMPI(basestr, spot, no_man[i], al)
&& (spot == basestr || *(spot - 1) == ' '))
return TRUE;
}
}
return FALSE;
}
/* compare user string against object name string using fuzzy matching */ /* compare user string against object name string using fuzzy matching */
STATIC_OVL boolean STATIC_OVL boolean
wishymatch(u_str, o_str, retry_inverted) wishymatch(u_str, o_str, retry_inverted)
@@ -2603,6 +2670,8 @@ struct alt_spellings {
{ "grapnel", GRAPPLING_HOOK }, { "grapnel", GRAPPLING_HOOK },
{ "grapple", GRAPPLING_HOOK }, { "grapple", GRAPPLING_HOOK },
{ "protection from shape shifters", RIN_PROTECTION_FROM_SHAPE_CHAN }, { "protection from shape shifters", RIN_PROTECTION_FROM_SHAPE_CHAN },
/* if we ever add other sizes, move this to o_ranges[] with "bag" */
{ "box", LARGE_BOX },
/* normally we wouldn't have to worry about unnecessary <space>, but /* normally we wouldn't have to worry about unnecessary <space>, but
" stone" will get stripped off, preventing a wishymatch; that actually " stone" will get stripped off, preventing a wishymatch; that actually
lets "flint stone" be a match, so we also accept bogus "flintstone" */ lets "flint stone" be a match, so we also accept bogus "flintstone" */
@@ -2696,7 +2765,7 @@ struct obj *no_wish;
register struct obj *otmp; register struct obj *otmp;
int cnt, spe, spesgn, typ, very, rechrg; int cnt, spe, spesgn, typ, very, rechrg;
int blessed, uncursed, iscursed, ispoisoned, isgreased; int blessed, uncursed, iscursed, ispoisoned, isgreased;
int eroded, eroded2, erodeproof; int eroded, eroded2, erodeproof, locked, unlocked, broken;
int halfeaten, mntmp, contents; int halfeaten, mntmp, contents;
int islit, unlabeled, ishistoric, isdiluted, trapped; int islit, unlabeled, ishistoric, isdiluted, trapped;
int tmp, tinv, tvariety; int tmp, tinv, tvariety;
@@ -2722,9 +2791,11 @@ struct obj *no_wish;
char *un, *dn, *actualn, *origbp = bp; char *un, *dn, *actualn, *origbp = bp;
const char *name = 0; const char *name = 0;
cnt = spe = spesgn = typ = very = rechrg = blessed = uncursed = iscursed = cnt = spe = spesgn = typ = 0;
ispoisoned = isgreased = eroded = eroded2 = erodeproof = halfeaten = very = rechrg = blessed = uncursed = iscursed = ispoisoned =
islit = unlabeled = ishistoric = isdiluted = trapped = 0; isgreased = eroded = eroded2 = erodeproof = halfeaten =
islit = unlabeled = ishistoric = isdiluted = trapped =
locked = unlocked = broken = 0;
tvariety = RANDOM_TIN; tvariety = RANDOM_TIN;
mntmp = NON_PM; mntmp = NON_PM;
#define UNDEFINED 0 #define UNDEFINED 0
@@ -2812,6 +2883,13 @@ struct obj *no_wish;
trapped = 1; trapped = 1;
} else if (!strncmpi(bp, "untrapped ", l = 10)) { } else if (!strncmpi(bp, "untrapped ", l = 10)) {
trapped = 2; /* not trapped */ trapped = 2; /* not trapped */
/* locked, unlocked, broken: box/chest lock states */
} else if (!strncmpi(bp, "locked ", l = 7)) {
locked = 1, unlocked = broken = 0;
} else if (!strncmpi(bp, "unlocked ", l = 9)) {
unlocked = 1, locked = broken = 0;
} else if (!strncmpi(bp, "broken ", l = 7)) {
broken = 1, locked = unlocked = 0;
} else if (!strncmpi(bp, "greased ", l = 8)) { } else if (!strncmpi(bp, "greased ", l = 8)) {
isgreased = 1; isgreased = 1;
} else if (!strncmpi(bp, "very ", l = 5)) { } else if (!strncmpi(bp, "very ", l = 5)) {
@@ -3217,7 +3295,10 @@ retry:
; /* avoid false hit on "* glass" */ ; /* avoid false hit on "* glass" */
} else if (!BSTRCMPI(bp, p - 6, " glass") || !strcmpi(bp, "glass")) { } else if (!BSTRCMPI(bp, p - 6, " glass") || !strcmpi(bp, "glass")) {
register char *g = bp; register char *g = bp;
if (strstri(g, "broken"))
/* treat "broken glass" as a non-existent item; since "broken" is
also a chest/box prefix it might have been stripped off above */
if (broken || strstri(g, "broken"))
return (struct obj *) 0; return (struct obj *) 0;
if (!strncmpi(g, "worthless ", 10)) if (!strncmpi(g, "worthless ", 10))
g += 10; g += 10;
@@ -3737,6 +3818,28 @@ typfnd:
if (Is_box(otmp) || typ == TIN) if (Is_box(otmp) || typ == TIN)
otmp->otrapped = (trapped == 1); otmp->otrapped = (trapped == 1);
} }
/* empty for containers rather than for tins */
if (contents == EMPTY) {
if (otmp->otyp == BAG_OF_TRICKS || otmp->otyp == HORN_OF_PLENTY) {
if (otmp->spe > 0)
otmp->spe = 0;
} else if (Has_contents(otmp)) {
/* this assumes that artifacts can't be randomly generated
inside containers */
delete_contents(otmp);
otmp->owt = weight(otmp);
}
}
/* set locked/unlocked/broken */
if (Is_box(otmp)) {
if (locked) {
otmp->olocked = 1, otmp->obroken = 0;
} else if (unlocked) {
otmp->olocked = 0, otmp->obroken = 0;
} else if (broken) {
otmp->olocked = 0, otmp->obroken = 1;
}
}
if (isgreased) if (isgreased)
otmp->greased = 1; otmp->greased = 1;
+13 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pline.c $NHDT-Date: 1519183957 2018/02/21 03:32:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.65 $ */ /* NetHack 3.6 pline.c $NHDT-Date: 1520964541 2018/03/13 18:09:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -96,6 +96,7 @@ void pline
VA_DECL(const char *, line) VA_DECL(const char *, line)
#endif /* USE_STDARG | USE_VARARG */ #endif /* USE_STDARG | USE_VARARG */
{ /* start of vpline() or of nested block in USE_OLDARG's pline() */ { /* start of vpline() or of nested block in USE_OLDARG's pline() */
static int in_pline = 0;
char pbuf[3 * BUFSZ]; char pbuf[3 * BUFSZ];
int ln; int ln;
int msgtyp; int msgtyp;
@@ -138,11 +139,14 @@ VA_DECL(const char *, line)
if ((pline_flags & SUPPRESS_HISTORY) == 0) if ((pline_flags & SUPPRESS_HISTORY) == 0)
dumplogmsg(line); dumplogmsg(line);
#endif #endif
/* use raw_print() if we're called too early (or perhaps too late
if (!iflags.window_inited) { during shutdown) or if we're being called recursively (probably
via debugpline() in the interface code) */
if (in_pline++ || !iflags.window_inited) {
/* [we should probably be using raw_printf("\n%s", line) here] */
raw_print(line); raw_print(line);
iflags.last_msg = PLNMSG_UNKNOWN; iflags.last_msg = PLNMSG_UNKNOWN;
return; goto pline_done;
} }
msgtyp = MSGTYP_NORMAL; msgtyp = MSGTYP_NORMAL;
@@ -158,7 +162,7 @@ VA_DECL(const char *, line)
* doing so out of context and probably end up seeming silly. * doing so out of context and probably end up seeming silly.
* (Not an issue for no-repeat but matters for no-show.) * (Not an issue for no-repeat but matters for no-show.)
*/ */
return; goto pline_done;
} }
if (vision_full_recalc) if (vision_full_recalc)
@@ -178,6 +182,10 @@ VA_DECL(const char *, line)
if (msgtyp == MSGTYP_STOP) if (msgtyp == MSGTYP_STOP)
display_nhwindow(WIN_MESSAGE, TRUE); /* --more-- */ display_nhwindow(WIN_MESSAGE, TRUE); /* --more-- */
pline_done:
--in_pline;
return;
#if !(defined(USE_STDARG) || defined(USE_VARARGS)) #if !(defined(USE_STDARG) || defined(USE_VARARGS))
/* provide closing brace for the nested block /* provide closing brace for the nested block
which immediately follows USE_OLDARGS's VA_DECL() */ which immediately follows USE_OLDARGS's VA_DECL() */
+14 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 polyself.c $NHDT-Date: 1513298347 2017/12/15 00:39:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.116 $ */ /* NetHack 3.6 polyself.c $NHDT-Date: 1520797126 2018/03/11 19:38:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.117 $ */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -964,7 +964,7 @@ int alone;
{ {
struct obj *otmp; struct obj *otmp;
const char *what, *which, *whichtoo; const char *what, *which, *whichtoo;
boolean candropwep, candropswapwep; boolean candropwep, candropswapwep, updateinv = TRUE;
if (uwep) { if (uwep) {
/* !alone check below is currently superfluous but in the /* !alone check below is currently superfluous but in the
@@ -989,17 +989,26 @@ int alone;
You("find you must %s %s %s!", what, You("find you must %s %s %s!", what,
the_your[!!strncmp(which, "corpse", 6)], which); the_your[!!strncmp(which, "corpse", 6)], which);
} }
/* if either uwep or wielded uswapwep is flagged as 'in_use'
then don't drop it or explicitly update inventory; leave
those actions to caller (or caller's caller, &c) */
if (u.twoweap) { if (u.twoweap) {
otmp = uswapwep; otmp = uswapwep;
uswapwepgone(); uswapwepgone();
if (candropswapwep) if (otmp->in_use)
updateinv = FALSE;
else if (candropswapwep)
dropx(otmp); dropx(otmp);
} }
otmp = uwep; otmp = uwep;
uwepgone(); uwepgone();
if (candropwep) if (otmp->in_use)
updateinv = FALSE;
else if (candropwep)
dropx(otmp); dropx(otmp);
update_inventory();
if (updateinv)
update_inventory();
} else if (!could_twoweap(youmonst.data)) { } else if (!could_twoweap(youmonst.data)) {
untwoweapon(); untwoweapon();
} }
+7 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 potion.c $NHDT-Date: 1502753790 2017/08/14 23:36:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.138 $ */ /* NetHack 3.6 potion.c $NHDT-Date: 1520797133 2018/03/11 19:38:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1563,6 +1563,11 @@ register struct obj *obj;
int i, ii, isdone, kn = 0; int i, ii, isdone, kn = 0;
boolean cureblind = FALSE; boolean cureblind = FALSE;
/* potion of unholy water might be wielded; prevent
you_were() -> drop_weapon() from dropping it so that it
remains in inventory where our caller expects it to be */
obj->in_use = 1;
switch (obj->otyp) { switch (obj->otyp) {
case POT_RESTORE_ABILITY: case POT_RESTORE_ABILITY:
case POT_GAIN_ABILITY: case POT_GAIN_ABILITY:
@@ -1714,7 +1719,7 @@ register struct obj *obj;
break; break;
*/ */
} }
/* note: no obfree() */ /* note: no obfree() -- that's our caller's responsibility */
if (obj->dknown) { if (obj->dknown) {
if (kn) if (kn)
makeknown(obj->otyp); makeknown(obj->otyp);
+1 -1
View File
@@ -143,7 +143,7 @@ time_t when;
#ifdef DUMPLOG #ifdef DUMPLOG
if (tmpwin == 0) if (tmpwin == 0)
dump_forward_putstr(0, 0, "Gave over:", TRUE); dump_forward_putstr(0, 0, "Game over:", TRUE);
else else
#endif #endif
putstr(tmpwin, 0, ""); putstr(tmpwin, 0, "");
+8 -12
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 uhitm.c $NHDT-Date: 1520043553 2018/03/03 02:19:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.175 $ */ /* NetHack 3.6 uhitm.c $NHDT-Date: 1521684760 2018/03/22 02:12:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.176 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -513,14 +513,10 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
u.dx, u.dy, u.dz); u.dx, u.dy, u.dz);
return TRUE; /* target hasn't been killed */ return TRUE; /* target hasn't been killed */
} }
clockwise = !clockwise; /* alternate */
/* adjust direction by two so that loop's increment (for clockwise) /* adjust direction by two so that loop's increment (for clockwise)
or decrement (for counter-clockwise) will point at the spot next or decrement (for counter-clockwise) will point at the spot next
to primary target */ to primary target */
if (clockwise) i = (i + (clockwise ? 6 : 2)) % 8;
i = (i + 6) % 8;
else
i = (i + 2) % 8;
umort = u.umortality; /* used to detect life-saving */ umort = u.umortality; /* used to detect life-saving */
/* /*
@@ -535,10 +531,8 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
struct monst *mtmp; struct monst *mtmp;
int tx, ty, tmp, dieroll, mhit, attknum, armorpenalty; int tx, ty, tmp, dieroll, mhit, attknum, armorpenalty;
if (clockwise) /* ++i, wrap 8 to i=0 /or/ --i, wrap -1 to i=7 */
i = (i + 1) % 8; /* ++i, wrap 8 to i=0 */ i = (i + (clockwise ? 1 : 7)) % 8;
else
i = (i + 7) % 8; /* --i, wrap -1 to i=7 */
tx = x + xdir[i], ty = y + ydir[i]; /* current target location */ tx = x + xdir[i], ty = y + ydir[i]; /* current target location */
if (!isok(tx, ty)) if (!isok(tx, ty))
@@ -563,6 +557,8 @@ struct attack *uattk; /* ... but we don't enforce that here; Null works ok */
if (!uwep || u.umortality > umort) if (!uwep || u.umortality > umort)
break; break;
} }
/* set up for next time */
clockwise = !clockwise; /* alternate */
/* return False if primary target died, True otherwise; note: if 'target' /* return False if primary target died, True otherwise; note: if 'target'
was nonNull upon entry then it's still nonNull even if *target died */ was nonNull upon entry then it's still nonNull even if *target died */
@@ -583,8 +579,8 @@ struct attack *uattk;
int dieroll = rnd(20); int dieroll = rnd(20);
int mhit = (tmp > dieroll || u.uswallow); int mhit = (tmp > dieroll || u.uswallow);
/* Cleaver attacks three spots, one on either side of 'mon'; /* Cleaver attacks three spots, 'mon' and one on either side of 'mon';
it can't we part of dual-wielding but we guard against that anyway; it can't be part of dual-wielding but we guard against that anyway;
cleave return value reflects status of primary target ('mon') */ cleave return value reflects status of primary target ('mon') */
if (uwep && uwep->oartifact == ART_CLEAVER && !u.twoweap if (uwep && uwep->oartifact == ART_CLEAVER && !u.twoweap
&& !u.uswallow && !u.ustuck && !NODIAG(u.umonnum)) && !u.uswallow && !u.ustuck && !NODIAG(u.umonnum))
+7 -5
View File
@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# NetHack 3.6 gitinfo.sh $NHDT-Date: 1520201830 2018/03/04 22:17:10 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $ # NetHack 3.6 gitinfo.sh $NHDT-Date: 1521185933 2018/03/16 07:38:53 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.1 $
# bring dat/gitinfo.txt up to date; called from Makefile.src # bring dat/gitinfo.txt up to date; called from Makefile.src
@@ -10,16 +10,18 @@
# this script to be skipped or to run but fail to generate dat/gitinfo.txt. # this script to be skipped or to run but fail to generate dat/gitinfo.txt.
# #
always=0
if [[ $1 -eq 1 || $1 == "force" || $1 == "always" ]]; then always=1; fi
# try to figure out where we are: top, one level down (expected), or sys/unix # try to figure out where we are: top, one level down (expected), or sys/unix
prefix=. prefix=.
if [ -f ../sys/unix/gitinfo.sh ]; then prefix=..; fi if [ -f ../sys/unix/gitinfo.sh ]; then prefix=..; fi
if [ -f ../../sys/unix/gitinfo.sh ]; then prefix=../..; fi if [ -f ../../sys/unix/gitinfo.sh ]; then prefix=../..; fi
rungit=0
if [ $1 -eq 1 ]; then rungit=1; fi
if [ $1 = "force" ]; then rungit=1; fi
if [ ! -f $prefix/dat/gitinfo.txt ]; then rungit=1; fi
# try to run a perl script which is part of nethack's git repository # try to run a perl script which is part of nethack's git repository
if [[ $always -eq 1 || ! -f $prefix/dat/gitinfo.txt ]]; then if [ $rungit -eq 1 ]; then
( cd $prefix; \ ( cd $prefix; \
perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \ perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \
2> /dev/null ) \ 2> /dev/null ) \
+1 -1
View File
@@ -1,5 +1,5 @@
# #
# NetHack 3.6 linux-x11 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ # NetHack 3.6 linux-qt4 $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007. # Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
# #
+2 -1
View File
@@ -1,4 +1,4 @@
# NetHack 3.6 Makefile.msc $NHDT-Date: 1520177858 2018/03/04 15:37:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.111 $ */ # NetHack 3.6 Makefile.msc $NHDT-Date: 1520858848 2018/03/12 12:47:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.112 $ */
# Copyright (c) NetHack PC Development Team 1993-2018 # Copyright (c) NetHack PC Development Team 1993-2018
# #
#============================================================================== #==============================================================================
@@ -1239,6 +1239,7 @@ spotless: clean
if exist $(O)gamedir.tag del $(O)gamedir.tag if exist $(O)gamedir.tag del $(O)gamedir.tag
if exist $(O)nh*key.lib del $(O)nh*key.lib if exist $(O)nh*key.lib del $(O)nh*key.lib
if exist $(O)nh*key.exp del $(O)nh*key.exp if exist $(O)nh*key.exp del $(O)nh*key.exp
if exist $(INCL)\win32api.h del $(INCL)\win32api.h
if exist $(MSWIN)\mnsel.bmp del $(MSWIN)\mnsel.bmp if exist $(MSWIN)\mnsel.bmp del $(MSWIN)\mnsel.bmp
if exist $(MSWIN)\mnselcnt.bmp del $(MSWIN)\mnselcnt.bmp if exist $(MSWIN)\mnselcnt.bmp del $(MSWIN)\mnselcnt.bmp
if exist $(MSWIN)\mnunsel.bmp del $(MSWIN)\mnunsel.bmp if exist $(MSWIN)\mnunsel.bmp del $(MSWIN)\mnunsel.bmp
+8 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 nttty.c $NHDT-Date: 1454381842 2016/02/02 02:57:22 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.67 $ */ /* NetHack 3.6 nttty.c $NHDT-Date: 1520825872 2018/03/12 03:37:52 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.70 $ */
/* Copyright (c) NetHack PC Development Team 1993 */ /* Copyright (c) NetHack PC Development Team 1993 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -366,10 +366,15 @@ nttty_kbhit()
void void
get_scr_size() get_scr_size()
{ {
int lines, cols;
GetConsoleScreenBufferInfo(hConOut, &csbi); GetConsoleScreenBufferInfo(hConOut, &csbi);
LI = csbi.srWindow.Bottom - (csbi.srWindow.Top + 1); lines = csbi.srWindow.Bottom - (csbi.srWindow.Top + 1);
CO = csbi.srWindow.Right - (csbi.srWindow.Left + 1); cols = csbi.srWindow.Right - (csbi.srWindow.Left + 1);
LI = lines;
CO = min(cols, 80);
if ((LI < 25) || (CO < 80)) { if ((LI < 25) || (CO < 80)) {
COORD newcoord; COORD newcoord;
+8 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1506908980 2017/10/02 01:49:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.140 $ */ /* NetHack 3.6 wintty.c $NHDT-Date: 1520825319 2018/03/12 03:28:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.142 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2365,7 +2365,13 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and
} }
debugpline4("bad curs positioning win %d %s (%d,%d)", window, s, x, debugpline4("bad curs positioning win %d %s (%d,%d)", window, s, x,
y); y);
return; /* This return statement caused a functional difference between DEBUG and
non-DEBUG operation, so it is being commented out. It caused tty_curs()
to fail to move the cursor to the location it needed to be if the x,y
range checks failed, leaving the next piece of output to be displayed
at whatever random location the cursor happened to be at prior. */
/* return; */
} }
#endif #endif
x += cw->offx; x += cw->offx;
+4 -3
View File
@@ -160,10 +160,11 @@ mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected,
ap = data->menu.gacc; ap = data->menu.gacc;
for (i = 0; i < data->menu.size; i++) { for (i = 0; i < data->menu.size; i++) {
if (data->menu.items[i].accelerator != 0) { if (data->menu.items[i].accelerator != 0) {
next_char = (char) (data->menu.items[i].accelerator + 1); if (isalpha(data->menu.items[i].accelerator)) {
next_char = (char)(data->menu.items[i].accelerator + 1);
}
} else if (NHMENU_IS_SELECTABLE(data->menu.items[i])) { } else if (NHMENU_IS_SELECTABLE(data->menu.items[i])) {
if ((next_char >= 'a' && next_char <= 'z') if (isalpha(next_char)) {
|| (next_char >= 'A' && next_char <= 'Z')) {
data->menu.items[i].accelerator = next_char; data->menu.items[i].accelerator = next_char;
} else { } else {
if (next_char > 'z') if (next_char > 'z')
+16 -2
View File
@@ -2,6 +2,7 @@
/* Copyright (C) 2001 by Alex Kompel */ /* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include <assert.h>
#include "winMS.h" #include "winMS.h"
#include "mhstatus.h" #include "mhstatus.h"
#include "mhmsg.h" #include "mhmsg.h"
@@ -352,16 +353,21 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
: status_fg_color)); : status_fg_color));
nBg = status_bg_color; nBg = status_bg_color;
GetTextExtentPoint32(hdc, wbuf, vlen, &sz); sz.cy = -1;
if (*f == BL_TITLE && iflags.wc2_hitpointbar) { if (*f == BL_TITLE && iflags.wc2_hitpointbar) {
HBRUSH back_brush = CreateSolidBrush(nhcolor_to_RGB(hpbar_color)); HBRUSH back_brush = CreateSolidBrush(nhcolor_to_RGB(hpbar_color));
RECT barrect; RECT barrect;
/* first draw title normally */ /* prepare for drawing */
SelectObject(hdc, fnt); SelectObject(hdc, fnt);
SetBkMode(hdc, OPAQUE); SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, status_bg_color); SetBkColor(hdc, status_bg_color);
SetTextColor(hdc, nhcolor_to_RGB(hpbar_color)); SetTextColor(hdc, nhcolor_to_RGB(hpbar_color));
/* get bounding rectangle */
GetTextExtentPoint32(hdc, wbuf, vlen, &sz);
/* first draw title normally */
DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); DrawText(hdc, wbuf, vlen, &rt, DT_LEFT);
/* calc bar length */ /* calc bar length */
@@ -386,12 +392,20 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
nFg = nBg; nFg = nBg;
nBg = tmp; nBg = tmp;
} }
/* prepare for drawing */
SelectObject(hdc, fnt); SelectObject(hdc, fnt);
SetBkMode(hdc, OPAQUE); SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, nBg); SetBkColor(hdc, nBg);
SetTextColor(hdc, nFg); SetTextColor(hdc, nFg);
/* get bounding rectangle */
GetTextExtentPoint32(hdc, wbuf, vlen, &sz);
/* draw */
DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); DrawText(hdc, wbuf, vlen, &rt, DT_LEFT);
} }
assert(sz.cy >= 0);
rt.left += sz.cx; rt.left += sz.cx;
cy = max(cy, sz.cy); cy = max(cy, sz.cy);