-/* NetHack 3.6 dbridge.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $ */
-/* Copyright (c) 1989 by Jean-Christophe Collet */
+/* NetHack 3.6 dbridge.c $NHDT-Date: 1446955279 2015/11/08 04:01:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
+/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
/*
lev = &levl[x][y];
if (lev->typ != DOOR && lev->typ != DBWALL)
- return (-1);
+ return -1;
if (IS_DRAWBRIDGE(levl[x + 1][y].typ)
&& (levl[x + 1][y].drawbridgemask & DB_DIR) == DB_WEST)
- return (DB_WEST);
+ return DB_WEST;
if (IS_DRAWBRIDGE(levl[x - 1][y].typ)
&& (levl[x - 1][y].drawbridgemask & DB_DIR) == DB_EAST)
- return (DB_EAST);
+ return DB_EAST;
if (IS_DRAWBRIDGE(levl[x][y - 1].typ)
&& (levl[x][y - 1].drawbridgemask & DB_DIR) == DB_SOUTH)
- return (DB_SOUTH);
+ return DB_SOUTH;
if (IS_DRAWBRIDGE(levl[x][y + 1].typ)
&& (levl[x][y + 1].drawbridgemask & DB_DIR) == DB_NORTH)
- return (DB_NORTH);
+ return DB_NORTH;
- return (-1);
+ return -1;
}
/*
is_db_wall(x, y)
int x, y;
{
- return ((boolean)(levl[x][y].typ == DBWALL));
+ return (boolean) (levl[x][y].typ == DBWALL);
}
/*
break;
default:
impossible("bad direction in create_drawbridge");
- /* fall through */
+ /*FALLTHRU*/
case DB_WEST:
horiz = FALSE;
x2--;
break;
}
if (!IS_WALL(levl[x2][y2].typ))
- return (FALSE);
+ return FALSE;
if (flag) { /* We want the bridge open */
levl[x][y].typ = DRAWBRIDGE_DOWN;
levl[x2][y2].typ = DOOR;
levl[x][y].drawbridgemask = dir;
if (lava)
levl[x][y].drawbridgemask |= DB_LAVA;
- return (TRUE);
+ return TRUE;
}
struct entity {
#ifdef D_DEBUG
wait_synch();
#endif
- return ((entitycnt == ENTITIES) ? (struct entity *) 0
- : &(occupants[entitycnt]));
+ return (entitycnt == ENTITIES) ? (struct entity *) 0
+ : &(occupants[entitycnt]);
}
STATIC_OVL void
e_nam(etmp)
struct entity *etmp;
{
- return (is_u(etmp) ? "you" : mon_nam(etmp->emon));
+ return is_u(etmp) ? "you" : mon_nam(etmp->emon);
}
/*
Strcpy(wholebuf, is_u(etmp) ? "You" : Monnam(etmp->emon));
if (!*verb)
- return (wholebuf);
+ return wholebuf;
Strcat(wholebuf, " ");
if (is_u(etmp))
Strcat(wholebuf, verb);
else
Strcat(wholebuf, vtense((char *) 0, verb));
- return (wholebuf);
+ return wholebuf;
}
/*
int x, y;
{
if (noncorporeal(etmp->edata))
- return (TRUE);
+ return TRUE;
if (is_pool(x, y))
- return (boolean)((is_u(etmp) && (Wwalking || Amphibious || Swimming
- || Flying || Levitation))
- || is_swimmer(etmp->edata) || is_flyer(etmp->edata)
- || is_floater(etmp->edata));
+ return (boolean) ((is_u(etmp) && (Wwalking || Amphibious || Swimming
+ || Flying || Levitation))
+ || is_swimmer(etmp->edata)
+ || is_flyer(etmp->edata)
+ || is_floater(etmp->edata));
/* must force call to lava_effects in e_died if is_u */
if (is_lava(x, y))
- return (boolean)((is_u(etmp) && (Levitation || Flying))
- || likes_lava(etmp->edata) || is_flyer(etmp->edata));
+ return (boolean) ((is_u(etmp) && (Levitation || Flying))
+ || likes_lava(etmp->edata)
+ || is_flyer(etmp->edata));
if (is_db_wall(x, y))
- return (
- (boolean)(is_u(etmp) ? Passes_walls : passes_walls(etmp->edata)));
- return (TRUE);
+ return (boolean) (is_u(etmp) ? Passes_walls
+ : passes_walls(etmp->edata));
+ return TRUE;
}
STATIC_OVL void
automiss(etmp)
struct entity *etmp;
{
- return (boolean)((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata))
- || noncorporeal(etmp->edata));
+ return (boolean) ((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata))
+ || noncorporeal(etmp->edata));
}
/*
if (chunks)
debugpline0("Do chunks miss?");
if (automiss(etmp))
- return (TRUE);
+ return TRUE;
if (is_flyer(etmp->edata)
&& (is_u(etmp) ? !Unaware
debugpline1("Miss chance = %d (out of 8)", misses);
- return ((boolean)((misses >= rnd(8)) ? TRUE : FALSE));
+ return (misses >= rnd(8)) ? TRUE : FALSE;
}
/*
if (is_u(etmp) ? (Unaware || Fumbling)
: (!etmp->emon->mcanmove || etmp->emon->msleeping
|| !etmp->edata->mmove || etmp->emon->wormno))
- return (FALSE);
+ return FALSE;
if (is_u(etmp) ? Confusion : etmp->emon->mconf)
tmp -= 2;
tmp -= 2; /* less room to maneuver */
debugpline2("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
- return ((boolean)((tmp >= rnd(10)) ? TRUE : FALSE));
+ return (tmp >= rnd(10)) ? TRUE : FALSE;
}
STATIC_OVL void
-/* NetHack 3.6 dokick.c $NHDT-Date: 1446808441 2015/11/06 11:14:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */
+/* NetHack 3.6 dokick.c $NHDT-Date: 1446955295 2015/11/08 04:01:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.104 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
} else if (tmp > (kickdieroll = rnd(20))) {
You("kick %s.", mon_nam(mon));
sum = damageum(mon, uattk);
- (void) passive(mon, (boolean)(sum > 0), (sum != 2), AT_KICK,
+ (void) passive(mon, (boolean) (sum > 0), (sum != 2), AT_KICK,
FALSE);
if (sum == 2)
break; /* Defender died */
} else {
missum(mon, uattk, (tmp + armorpenalty > kickdieroll));
- (void) passive(mon, 0, 1, AT_KICK, FALSE);
+ (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
}
}
return;
-/* NetHack 3.6 dungeon.c $NHDT-Date: 1446808442 2015/11/06 11:14:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
+/* NetHack 3.6 dungeon.c $NHDT-Date: 1446955297 2015/11/08 04:01:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.68 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* only print out info for a level or a dungeon if interest */
if (why > 0 || interest_mapseen(mptr)) {
- showheader = (boolean)(mptr->lev.dnum != *lastdun_p);
+ showheader = (boolean) (mptr->lev.dnum != *lastdun_p);
print_mapseen(win, mptr, why, reason, showheader);
*lastdun_p = mptr->lev.dnum;
}
-/* NetHack 3.6 explode.c $NHDT-Date: 1445388916 2015/10/21 00:55:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.43 $ */
-/* Copyright (C) 1990 by Ken Arromdee */
+/* NetHack 3.6 explode.c $NHDT-Date: 1446955298 2015/11/08 04:01:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
+/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
* these disadvantages....
*
* Important note about Half_physical_damage:
- * Unlike losehp() , explode() makes the Half_physical_damage adjustments
- * itself, so the caller should never have done that ahead of time.
- * It has to be done this way because the damage value is applied to
- * things beside the player. Care is taken within explode() to ensure
- * that Half_physical_damage only affects the damage applied to the hero.
+ * Unlike losehp(), explode() makes the Half_physical_damage adjustments
+ * itself, so the caller should never have done that ahead of time.
+ * It has to be done this way because the damage value is applied to
+ * things beside the player. Care is taken within explode() to ensure
+ * that Half_physical_damage only affects the damage applied to the hero.
*/
void
explode(x, y, type, dam, olet, expltype)
short exploding_wand_typ = 0;
if (olet == WAND_CLASS) { /* retributive strike */
- /* 'type' is passed as (wand's object type * -1); save
- object type and convert 'type' itself to zap-type */
+ /* 'type' is passed as (wand's object type * -1); save
+ object type and convert 'type' itself to zap-type */
if (type < 0) {
type = -type;
exploding_wand_typ = (short) type;
adtyp = AD_MAGM;
break;
case 1:
- str = olet == BURNING_OIL ? "burning oil" : olet == SCROLL_CLASS
- ? "tower of flame"
- : "fireball";
+ str = (olet == BURNING_OIL) ? "burning oil"
+ : (olet == SCROLL_CLASS) ? "tower of flame" : "fireball";
/* fire damage, not physical damage */
adtyp = AD_FIRE;
break;
adtyp = AD_COLD;
break;
case 4:
- str =
- (olet == WAND_CLASS) ? "death field" : "disintegration field";
+ str = (olet == WAND_CLASS) ? "death field"
+ : "disintegration field";
adtyp = AD_DISN;
break;
case 5:
continue;
idamres = idamnonres = 0;
if (type >= 0 && !u.uswallow)
- (void) zap_over_floor((xchar)(i + x - 1),
- (xchar)(j + y - 1), type,
+ (void) zap_over_floor((xchar) (i + x - 1),
+ (xchar) (j + y - 1), type,
&shopdamage, exploding_wand_typ);
mtmp = m_at(i + x - 1, j + y - 1);
}
struct scatter_chain {
- struct scatter_chain *next; /* pointer to next scatter item */
- struct obj *obj; /* pointer to the object */
- xchar ox; /* location of */
- xchar oy; /* item */
- schar dx; /* direction of */
- schar dy; /* travel */
- int range; /* range of object */
- boolean stopped; /* flag for in-motion/stopped */
+ struct scatter_chain *next; /* pointer to next scatter item */
+ struct obj *obj; /* pointer to the object */
+ xchar ox; /* location of */
+ xchar oy; /* item */
+ schar dx; /* direction of */
+ schar dy; /* travel */
+ int range; /* range of object */
+ boolean stopped; /* flag for in-motion/stopped */
};
/*
* scflags:
- * VIS_EFFECTS Add visual effects to display
- * MAY_HITMON Objects may hit monsters
- * MAY_HITYOU Objects may hit hero
- * MAY_HIT Objects may hit you or monsters
- * MAY_DESTROY Objects may be destroyed at random
- * MAY_FRACTURE Stone objects can be fractured (statues, boulders)
+ * VIS_EFFECTS Add visual effects to display
+ * MAY_HITMON Objects may hit monsters
+ * MAY_HITYOU Objects may hit hero
+ * MAY_HIT Objects may hit you or monsters
+ * MAY_DESTROY Objects may be destroyed at random
+ * MAY_FRACTURE Stone objects can be fractured (statues, boulders)
*/
/* returns number of scattered objects */
long
scatter(sx, sy, blastforce, scflags, obj)
int sx, sy; /* location of objects to scatter */
-int blastforce; /* force behind the scattering */
+int blastforce; /* force behind the scattering */
unsigned int scflags;
struct obj *obj; /* only scatter this obj */
{
-/* NetHack 3.6 files.c $NHDT-Date: 1446854228 2015/11/06 23:57:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.185 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1446955299 2015/11/08 04:01:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.186 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
putstr(tribwin, 0, line);
Strcpy(lastline, line);
} else if (nowin_buf) {
- if ((int)strlen(line) < bufsz-1)
+ if ((int) strlen(line) < bufsz - 1)
Strcpy(nowin_buf, line);
}
}
-/* NetHack 3.6 lock.c $NHDT-Date: 1446808444 2015/11/06 11:14:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
+/* NetHack 3.6 lock.c $NHDT-Date: 1446955300 2015/11/08 04:01:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
struct monst *shkp = (*u.ushops && costly_spot(u.ux, u.uy))
? shop_keeper(*u.ushops)
: 0;
- boolean costly = (boolean)(shkp != 0),
+ boolean costly = (boolean) (shkp != 0),
peaceful_shk = costly && (boolean) shkp->mpeaceful;
long loss = 0L;
return 1; /* still busy */
You("succeed in forcing the lock.");
- breakchestlock(xlock.box, (boolean)(!xlock.picktyp && !rn2(3)));
+ breakchestlock(xlock.box, (boolean) (!xlock.picktyp && !rn2(3)));
exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((xlock.usedtime = 0));
-/* NetHack 3.6 makemon.c $NHDT-Date: 1446808445 2015/11/06 11:14:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.100 $ */
+/* NetHack 3.6 makemon.c $NHDT-Date: 1446955301 2015/11/08 04:01:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
mtmp->isminion = 1; /* make priest be a roamer */
eminp->min_align = rn2(3) - 1; /* no A_NONE */
- eminp->renegade = (boolean)((mmflags & MM_ANGRY) ? 1 : !rn2(3));
+ eminp->renegade = (boolean) ((mmflags & MM_ANGRY) ? 1 : !rn2(3));
mtmp->mpeaceful = (eminp->min_align == u.ualign.type)
? !eminp->renegade
: eminp->renegade;
-/* NetHack 3.6 mapglyph.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
-/* Copyright (c) David Cohrs, 1991 */
+/* NetHack 3.6 mapglyph.c $NHDT-Date: 1446955302 2015/11/08 04:01:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
+/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
unsigned special = 0;
/* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS;
- boolean has_rogue_color =
- (has_rogue_ibm_graphics && (symset[currentgraphics].nocolor == 0));
+ boolean has_rogue_color = (has_rogue_ibm_graphics
+ && symset[currentgraphics].nocolor == 0);
/*
* Map the glyph back to a character and color.
*
* Warning: For speed, this makes an assumption on the order of
- * offsets. The order is set in display.h.
+ * offsets. The order is set in display.h.
*/
if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */
idx = mons[offset].mlet + SYM_OFF_M;
else
obj_color(STATUE);
special |= MG_STATUE;
- if (level.objects[x][y] && level.objects[x][y]->nexthere)
- special |= MG_OBJPILE;
- } else if ((offset = (glyph - GLYPH_WARNING_OFF))
- >= 0) { /* a warning flash */
+ if (level.objects[x][y] && level.objects[x][y]->nexthere)
+ special |= MG_OBJPILE;
+ } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* warn flash */
idx = offset + SYM_OFF_W;
if (has_rogue_color)
color = NO_COLOR;
}
} else
obj_color(offset);
- if (offset != BOULDER && level.objects[x][y] && level.objects[x][y]->nexthere)
- special |= MG_OBJPILE;
+ if (offset != BOULDER && level.objects[x][y]
+ && level.objects[x][y]->nexthere)
+ special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
else
mon_color(offset);
special |= MG_CORPSE;
- if (level.objects[x][y] && level.objects[x][y]->nexthere)
- special |= MG_OBJPILE;
+ if (level.objects[x][y] && level.objects[x][y]->nexthere)
+ special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
idx = mons[glyph].mlet + SYM_OFF_M;
if (has_rogue_color && iflags.use_color) {
if (x == u.ux && y == u.uy)
- /* actually player should be yellow-on-gray if in a corridor
- */
+ /* actually player should be yellow-on-gray if in corridor */
color = CLR_YELLOW;
else
color = NO_COLOR;
} else {
mon_color(glyph);
-/* special case the hero for `showrace' option */
#ifdef TEXTCOLOR
- if (iflags.use_color && x == u.ux && y == u.uy && flags.showrace
- && !Upolyd)
+ /* special case the hero for `showrace' option */
+ if (iflags.use_color && x == u.ux && y == u.uy
+ && flags.showrace && !Upolyd)
color = HI_DOMESTIC;
#endif
}
int glyph;
{
static char encbuf[20];
+
Sprintf(encbuf, "\\G%04X%04X", context.rndencode, glyph);
return encbuf;
}
/*
* This differs from putstr() because the str parameter can
* contain a sequence of characters representing:
- * \GXXXXNNNN a glyph value, encoded by encglyph().
+ * \GXXXXNNNN a glyph value, encoded by encglyph().
*
* For window ports that haven't yet written their own
* XXX_putmixed() routine, this general one can be used.
char buf[BUFSZ];
const char *cp = str;
char *put = buf;
+
while (*cp) {
if (*cp == '\\') {
int rndchk = 0, so = 0, gv = 0, ch, oc, dcount;
}
break;
#if 0
- case 'S': /* symbol offset */
- dcount = 0;
- for (++cp; *cp && (dp = index(hex, *cp)) && (dcount++ < 4); cp++)
- rndchk = (int)((rndchk * 16) + ((int)(dp - hex) / 2));
-
- if (rndchk == context.rndencode) {
- dcount = 0;
- for (; *cp && (dp = index(hex, *cp)) && (dcount++ < 2); cp++)
- so = (int)((so * 16) + ((int)(dp - hex) / 2));
- }
- *put++ = showsyms[so];
- break;
+ case 'S': /* symbol offset */
+ dcount = 0;
+ for (++cp; *cp && (dp = index(hex, *cp)) != 0 && dcount++ < 4;
+ cp++)
+ rndchk = (int) ((rndchk * 16) + ((int) (dp - hex) / 2));
+ if (rndchk == context.rndencode) {
+ dcount = 0;
+ for (; *cp && (dp = index(hex, *cp)) != 0 && dcount++ < 2;
+ cp++)
+ so = (int) ((so * 16) + ((int) (dp - hex) / 2));
+ }
+ *put++ = showsyms[so];
+ break;
#endif
case '\\':
break;