-/* NetHack 3.6 invent.c $NHDT-Date: 1456354616 2016/02/24 22:56:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.195 $ */
+/* NetHack 3.6 invent.c $NHDT-Date: 1456907837 2016/03/02 08:37:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.196 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
unsigned *resultflags;
{
int FDECL((*ckfn), (OBJ_P)) = (int FDECL((*), (OBJ_P))) 0;
- boolean FDECL((*filter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0;
+ boolean FDECL((*ofilter), (OBJ_P)) = (boolean FDECL((*), (OBJ_P))) 0;
boolean takeoff, ident, allflag, m_seen;
int itemcount;
int oletct, iletct, unpaid, oc_of_sym;
add_valid_menu_class(0); /* reset */
if (taking_off(word)) {
takeoff = TRUE;
- filter = is_worn;
+ ofilter = is_worn;
} else if (!strcmp(word, "identify")) {
ident = TRUE;
- filter = not_fully_identified;
+ ofilter = not_fully_identified;
}
- iletct = collect_obj_classes(ilets, invent, FALSE, filter, &itemcount);
+ iletct = collect_obj_classes(ilets, invent, FALSE, ofilter, &itemcount);
unpaid = count_unpaid(invent);
if (ident && !iletct) {
-/* NetHack 3.6 role.c $NHDT-Date: 1453514597 2016/01/23 02:03:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $ */
+/* NetHack 3.6 role.c $NHDT-Date: 1456907852 2016/03/02 08:37:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.37 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/* NetHack may be freely redistributed. See license for details. */
static struct {
boolean roles[SIZE(roles)];
short mask;
-} filter;
+} rfilter;
STATIC_DCL int NDECL(randrole_filtered);
STATIC_DCL char *FDECL(promptsep, (char *, int));
short allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1) {
- if (filter.roles[rolenum])
+ if (rfilter.roles[rolenum])
return FALSE;
allow = roles[rolenum].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < SIZE(roles) - 1; i++) {
- if (filter.roles[i])
+ if (rfilter.roles[i])
continue;
allow = roles[i].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1
short allow;
if (racenum >= 0 && racenum < SIZE(races) - 1) {
- if (filter.mask & races[racenum].selfmask)
+ if (rfilter.mask & races[racenum].selfmask)
return FALSE;
allow = races[racenum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < SIZE(races) - 1; i++) {
- if (filter.mask & races[i].selfmask)
+ if (rfilter.mask & races[i].selfmask)
continue;
allow = races[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
short allow;
if (gendnum >= 0 && gendnum < ROLE_GENDERS) {
- if (filter.mask & genders[gendnum].allow)
+ if (rfilter.mask & genders[gendnum].allow)
return FALSE;
allow = genders[gendnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < ROLE_GENDERS; i++) {
- if (filter.mask & genders[i].allow)
+ if (rfilter.mask & genders[i].allow)
continue;
allow = genders[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
short allow;
if (alignnum >= 0 && alignnum < ROLE_ALIGNS) {
- if (filter.mask & aligns[alignnum].allow)
+ if (rfilter.mask & aligns[alignnum].allow)
return FALSE;
allow = aligns[alignnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < ROLE_ALIGNS; i++) {
- if (filter.mask & aligns[i].allow)
+ if (rfilter.mask & aligns[i].allow)
return FALSE;
allow = aligns[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
boolean reslt = TRUE;
if ((i = str2role(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.roles[i] = TRUE;
+ rfilter.roles[i] = TRUE;
else if ((i = str2race(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= races[i].selfmask;
+ rfilter.mask |= races[i].selfmask;
else if ((i = str2gend(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= genders[i].allow;
+ rfilter.mask |= genders[i].allow;
else if ((i = str2align(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= aligns[i].allow;
+ rfilter.mask |= aligns[i].allow;
else
reslt = FALSE;
return reslt;
{
int i;
- if (filter.mask)
+ if (rfilter.mask)
return TRUE;
for (i = 0; i < SIZE(roles); ++i)
- if (filter.roles[i])
+ if (rfilter.roles[i])
return TRUE;
return FALSE;
}
int i;
for (i = 0; i < SIZE(roles); ++i)
- filter.roles[i] = FALSE;
- filter.mask = 0;
+ rfilter.roles[i] = FALSE;
+ rfilter.mask = 0;
}
#define BP_ALIGN 0
what = "role";
f = r;
for (i = 0; i < SIZE(roles); ++i)
- if (i != f && !filter.roles[i])
+ if (i != f && !rfilter.roles[i])
break;
if (i == SIZE(roles)) {
constrainer = "filter";
constrainer = "role";
forcedvalue = races[c].noun;
} else if (f >= 0
- && (allowmask & ~filter.mask) == races[f].selfmask) {
+ && (allowmask & ~rfilter.mask) == races[f].selfmask) {
/* if there is only one race choice available due to user
options disallowing others, race menu entry is disabled */
constrainer = "filter";
constrainer = "role";
forcedvalue = genders[g].adj;
} else if (f >= 0
- && (allowmask & ~filter.mask) == genders[f].allow) {
+ && (allowmask & ~rfilter.mask) == genders[f].allow) {
/* if there is only one gender choice available due to user
options disallowing other, gender menu entry is disabled */
constrainer = "filter";
constrainer = "race";
}
if (f >= 0 && !constrainer
- && (ROLE_ALIGNMASK & ~filter.mask) == aligns[f].allow) {
+ && (ROLE_ALIGNMASK & ~rfilter.mask) == aligns[f].allow) {
/* if there is only one alignment choice available due to user
options disallowing others, algn menu entry is disabled */
constrainer = "filter";
-/* NetHack 3.6 termcap.c $NHDT-Date: 1447234979 2015/11/11 09:42:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.23 $ */
+/* NetHack 3.6 termcap.c $NHDT-Date: 1456907853 2016/03/02 08:37:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.24 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
xputs(hilites[color]);
}
+/* not to be confused with has_colors() in unixtty.c */
int
has_color(color)
int color;
#ifdef X11_GRAPHICS
/* XXX has_color() should be added to windowprocs */
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "X11"))
- return TRUE;
+ return 1;
#endif
#ifdef GEM_GRAPHICS
/* XXX has_color() should be added to windowprocs */
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Gem"))
- return TRUE;
+ return 1;
#endif
#ifdef QT_GRAPHICS
/* XXX has_color() should be added to windowprocs */
if (windowprocs.name != NULL && !strcmpi(windowprocs.name, "Qt"))
- return TRUE;
+ return 1;
#endif
#ifdef AMII_GRAPHICS
/* hilites[] not used */
- return iflags.use_color;
-#endif
+ return iflags.use_color ? 1 : 0;
+#else
return hilites[color] != (char *) 0;
+#endif
}
#endif /* TEXTCOLOR */
-/* NetHack 3.6 wintty.c $NHDT-Date: 1453514601 2016/01/23 02:03:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.124 $ */
+/* NetHack 3.6 wintty.c $NHDT-Date: 1456907854 2016/03/02 08:37:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.125 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
#include "wintty.h"
#ifdef CLIPPING /* might want SIGWINCH */
-#if defined(BSD) || defined(ULTRIX) || defined(AIX_31) \
- || defined(_BULL_SOURCE)
+#if defined(BSD) || defined(ULTRIX) || defined(AIX_31) || defined(_BULL_SOURCE)
#include <signal.h>
#endif
#endif
}
#if defined(SIGWINCH) && defined(CLIPPING)
+STATIC_DCL void FDECL(winch_handler, (int));
+
+ /*
+ * This really ought to just set a flag like the hangup handler does,
+ * then check the flag at "safe" times, in case the signal arrives
+ * while something fragile is executing. Better to have a brief period
+ * where display updates don't fit the new size than for tty internals
+ * to become corrupted.
+ *
+ * 'winch_seen' has been "notyet" for a long time....
+ */
+/*ARGUSED*/
STATIC_OVL void
-winch()
+winch_handler(sig_unused) /* signal handler is called with at least 1 arg */
+int sig_unused UNUSED;
{
int oldLI = LI, oldCO = CO, i;
register struct WinDesc *cw;
ttyDisplay->lastwin = WIN_ERR;
#if defined(SIGWINCH) && defined(CLIPPING) && !defined(NO_SIGNAL)
- (void) signal(SIGWINCH, winch);
+ (void) signal(SIGWINCH, (SIG_RET_TYPE) winch_handler);
#endif
/* add one a space forward menu command alias */