-/* NetHack 3.6 mkroom.c $NHDT-Date: 1432512772 2015/05/25 00:12:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.23 $ */
+/* NetHack 3.6 mkroom.c $NHDT-Date: 1446887530 2015/11/07 09:12:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/*
* Entry points:
- * mkroom() -- make and stock a room of a given type
- * nexttodoor() -- return TRUE if adjacent to a door
- * has_dnstairs() -- return TRUE if given room has a down staircase
- * has_upstairs() -- return TRUE if given room has an up staircase
- * courtmon() -- generate a court monster
- * save_rooms() -- save rooms into file fd
- * rest_rooms() -- restore rooms from file fd
- * cmap_to_type() -- convert S_xxx symbol to XXX topology code
+ * mkroom() -- make and stock a room of a given type
+ * nexttodoor() -- return TRUE if adjacent to a door
+ * has_dnstairs() -- return TRUE if given room has a down staircase
+ * has_upstairs() -- return TRUE if given room has an up staircase
+ * courtmon() -- generate a court monster
+ * save_rooms() -- save rooms into file fd
+ * rest_rooms() -- restore rooms from file fd
+ * cmap_to_type() -- convert S_xxx symbol to XXX topology code
*/
#include "hack.h"
isbig(sroom)
register struct mkroom *sroom;
{
- register int area =
- (sroom->hx - sroom->lx + 1) * (sroom->hy - sroom->ly + 1);
- return ((boolean)(area > 20));
+ register int area = (sroom->hx - sroom->lx + 1)
+ * (sroom->hy - sroom->ly + 1);
+
+ return (boolean) (area > 20);
}
+/* make and stock a room of a given type */
void
mkroom(roomtype)
-/* make and stock a room of a given type */
int roomtype;
{
if (roomtype >= SHOPBASE)
}
sroom->rtype = SHOPBASE + i;
-/* set room bits before stocking the shop */
+ /* set room bits before stocking the shop */
#ifdef SPECIALIZATION
topologize(sroom, FALSE); /* doesn't matter - this is a special room */
#else
stock_room(i, sroom);
}
+/* pick an unused room, preferably with only one door */
STATIC_OVL struct mkroom *
pick_room(strict)
register boolean strict;
-/* pick an unused room, preferably with only one door */
{
register struct mkroom *sroom;
register int i = nroom;
goldlim = 500 * level_difficulty();
break;
}
+
for (sx = sroom->lx; sx <= sroom->hx; sx++)
for (sy = sroom->ly; sy <= sroom->hy; sy++) {
if (sroom->irregular) {
/* don't place monster on explicitly placed throne */
if (type == COURT && IS_THRONE(levl[sx][sy].typ))
continue;
- mon = makemon(
- (type == COURT)
- ? courtmon()
- : (type == BARRACKS)
- ? squadmon()
- : (type == MORGUE)
- ? morguemon()
- : (type == BEEHIVE)
- ? (sx == tx && sy == ty
- ? &mons[PM_QUEEN_BEE]
- : &mons[PM_KILLER_BEE])
- : (type == LEPREHALL)
- ? &mons[PM_LEPRECHAUN]
- : (type == COCKNEST)
- ? &mons[PM_COCKATRICE]
- : (type == ANTHOLE)
- ? antholemon()
- : (struct permonst
- *) 0,
- sx, sy, NO_MM_FLAGS);
+ mon = makemon((type == COURT)
+ ? courtmon()
+ : (type == BARRACKS)
+ ? squadmon()
+ : (type == MORGUE)
+ ? morguemon()
+ : (type == BEEHIVE)
+ ? (sx == tx && sy == ty
+ ? &mons[PM_QUEEN_BEE]
+ : &mons[PM_KILLER_BEE])
+ : (type == LEPREHALL)
+ ? &mons[PM_LEPRECHAUN]
+ : (type == COCKNEST)
+ ? &mons[PM_COCKATRICE]
+ : (type == ANTHOLE)
+ ? antholemon()
+ : (struct permonst *) 0,
+ sx, sy, NO_MM_FLAGS);
if (mon) {
mon->msleeping = 1;
if (type == COURT && mon->mpeaceful) {
while (cnt--) {
mdat = morguemon();
if (enexto(&cc, mm->x, mm->y, mdat)
- && (!revive_corpses || !(otmp = sobj_at(CORPSE, cc.x, cc.y))
+ && (!revive_corpses
+ || !(otmp = sobj_at(CORPSE, cc.x, cc.y))
|| !revive(otmp, FALSE)))
(void) makemon(mdat, cc.x, cc.y, mm_flags);
}
if (hd > 10 && i < 10) {
if (Inhell || In_endgame(&u.uz)) {
- return (mkclass(S_DEMON, 0));
+ return mkclass(S_DEMON, 0);
} else {
int ndemon_res = ndemon(A_NONE);
if (ndemon_res != NON_PM)
- return (&mons[ndemon_res]);
+ return &mons[ndemon_res];
/* else do what? As is, it will drop to ghost/wraith/zombie */
}
}
if (hd > 8 && i > 85)
- return (mkclass(S_VAMPIRE, 0));
+ return mkclass(S_VAMPIRE, 0);
- return ((i < 20) ? &mons[PM_GHOST] : (i < 40) ? &mons[PM_WRAITH]
- : mkclass(S_ZOMBIE, 0));
+ return ((i < 20) ? &mons[PM_GHOST]
+ : (i < 40) ? &mons[PM_WRAITH]
+ : mkclass(S_ZOMBIE, 0));
}
struct permonst *
}
/* try again if chosen type has been genocided or used up */
} while (++trycnt < 3 && (mvitals[mtyp].mvflags & G_GONE));
+
return ((mvitals[mtyp].mvflags & G_GONE) ? (struct permonst *) 0
: &mons[mtyp]);
}
-STATIC_OVL void mkswamp() /* Michiel Huisjes & Fred de Wilde */
+STATIC_OVL void
+mkswamp() /* Michiel Huisjes & Fred de Wilde */
{
register struct mkroom *sroom;
register int sx, sy, i, eelct = 0;
levl[sx][sy].typ = POOL;
if (!eelct || !rn2(4)) {
/* mkclass() won't do, as we might get kraken */
- (void) makemon(
- rn2(5) ? &mons[PM_GIANT_EEL]
- : rn2(2) ? &mons[PM_PIRANHA]
- : &mons[PM_ELECTRIC_EEL],
- sx, sy, NO_MM_FLAGS);
+ (void) makemon(rn2(5)
+ ? &mons[PM_GIANT_EEL]
+ : rn2(2)
+ ? &mons[PM_PIRANHA]
+ : &mons[PM_ELECTRIC_EEL],
+ sx, sy, NO_MM_FLAGS);
eelct++;
}
} else if (!rn2(4)) /* swamps tend to be moldy */
{
register int dx, dy;
register struct rm *lev;
+
for (dx = -1; dx <= 1; dx++)
for (dy = -1; dy <= 1; dy++) {
if (!isok(sx + dx, sy + dy))
continue;
- if (IS_DOOR((lev = &levl[sx + dx][sy + dy])->typ)
- || lev->typ == SDOOR)
- return (TRUE);
+ lev = &levl[sx + dx][sy + dy];
+ if (IS_DOOR(lev->typ) || lev->typ == SDOOR)
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
boolean
if (sroom == dnstairs_room)
return TRUE;
if (sstairs.sx && !sstairs.up)
- return ((boolean)(sroom == sstairs_room));
+ return (boolean) (sroom == sstairs_room);
return FALSE;
}
if (sroom == upstairs_room)
return TRUE;
if (sstairs.sx && sstairs.up)
- return ((boolean)(sroom == sstairs_room));
+ return (boolean) (sroom == sstairs_room);
return FALSE;
}
struct mkroom *croom;
xchar x, y;
{
- return ((boolean)(x >= croom->lx - 1 && x <= croom->hx + 1
- && y >= croom->ly - 1 && y <= croom->hy + 1));
+ return (boolean) (x >= croom->lx - 1 && x <= croom->hx + 1
+ && y >= croom->ly - 1 && y <= croom->hy + 1);
}
boolean
* - ANY_SHOP
* - ANY_TYPE
*/
-
struct mkroom *
search_special(type)
schar type;
courtmon()
{
int i = rn2(60) + rn2(3 * level_difficulty());
+
if (i > 100)
- return (mkclass(S_DRAGON, 0));
+ return mkclass(S_DRAGON, 0);
else if (i > 95)
- return (mkclass(S_GIANT, 0));
+ return mkclass(S_GIANT, 0);
else if (i > 85)
- return (mkclass(S_TROLL, 0));
+ return mkclass(S_TROLL, 0);
else if (i > 75)
- return (mkclass(S_CENTAUR, 0));
+ return mkclass(S_CENTAUR, 0);
else if (i > 60)
- return (mkclass(S_ORC, 0));
+ return mkclass(S_ORC, 0);
else if (i > 45)
- return (&mons[PM_BUGBEAR]);
+ return &mons[PM_BUGBEAR];
else if (i > 30)
- return (&mons[PM_HOBGOBLIN]);
+ return &mons[PM_HOBGOBLIN];
else if (i > 15)
- return (mkclass(S_GNOME, 0));
+ return mkclass(S_GNOME, 0);
else
- return (mkclass(S_KOBOLD, 0));
+ return mkclass(S_KOBOLD, 0);
}
#define NSTYPES (PM_CAPTAIN - PM_SOLDIER + 1)
{ PM_LIEUTENANT, 4 },
{ PM_CAPTAIN, 1 } };
-STATIC_OVL struct permonst *squadmon() /* return soldier types. */
+/* return soldier types. */
+STATIC_OVL struct permonst *
+squadmon()
{
int sel_prob, i, cpro, mndx;
mndx = squadprob[rn2(NSTYPES)].pm;
gotone:
if (!(mvitals[mndx].mvflags & G_GONE))
- return (&mons[mndx]);
+ return &mons[mndx];
else
- return ((struct permonst *) 0);
+ return (struct permonst *) 0;
}
/*
* save_room : A recursive function that saves a room and its subrooms
* (if any).
*/
-
STATIC_OVL void
save_room(fd, r)
int fd;
struct mkroom *r;
{
short i;
+
/*
* Well, I really should write only useful information instead
* of writing the whole structure. That is I should not write
* the subrooms pointers, but who cares ?
*/
- bwrite(fd, (genericptr_t) r, sizeof(struct mkroom));
+ bwrite(fd, (genericptr_t) r, sizeof (struct mkroom));
for (i = 0; i < r->nsubrooms; i++)
save_room(fd, r->sbrooms[i]);
}
/*
* save_rooms : Save all the rooms on disk!
*/
-
void
save_rooms(fd)
int fd;
* rest_rooms : That's for restoring rooms. Read the rooms structure from
* the disk.
*/
-
void
rest_rooms(fd)
int fd;
-/* NetHack 3.6 mthrowu.c $NHDT-Date: 1446808447 2015/11/06 11:14:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 mthrowu.c $NHDT-Date: 1446887531 2015/11/07 09:12:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
mondied(mtmp);
}
- if (can_blnd(
- (struct monst *) 0, mtmp,
- (uchar)(otmp->otyp == BLINDING_VENOM ? AT_SPIT : AT_WEAP),
- otmp)) {
+ if (can_blnd((struct monst *) 0, mtmp,
+ (uchar) (otmp->otyp == BLINDING_VENOM ? AT_SPIT
+ : AT_WEAP),
+ otmp)) {
if (vis && mtmp->mcansee)
pline("%s is blinded by %s.", Monnam(mtmp), the(xname(otmp)));
mtmp->mcansee = 0;
(u.umortality > oldumort) ? 0 : 10, TRUE);
}
if (hitu && can_blnd((struct monst *) 0, &youmonst,
- (uchar)(singleobj->otyp == BLINDING_VENOM
+ (uchar) (singleobj->otyp == BLINDING_VENOM
? AT_SPIT
: AT_WEAP),
singleobj)) {
-/* NetHack 3.6 shknam.c $NHDT-Date: 1432512765 2015/05/25 00:12:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.36 $ */
+/* NetHack 3.6 shknam.c $NHDT-Date: 1446887533 2015/11/07 09:12:13 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL boolean FDECL(veggy_item, (struct obj * obj, int));
STATIC_DCL int NDECL(shkveg);
STATIC_DCL void FDECL(mkveggy_at, (int, int));
-STATIC_DCL void FDECL(mkshobj_at,
- (const struct shclass *, int, int, BOOLEAN_P));
+STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *, int, int,
+ BOOLEAN_P));
STATIC_DCL void FDECL(nameshk, (struct monst *, const char *const *));
STATIC_DCL int FDECL(shkinit, (const struct shclass *, struct mkroom *));
/*
* Name prefix codes:
- * dash - female, personal name
- * underscore _ female, general name
- * plus + male, personal name
- * vertical bar | male, general name (implied for most of shktools)
- * equals = gender not specified, personal name
+ * dash - female, personal name
+ * underscore _ female, general name
+ * plus + male, personal name
+ * vertical bar | male, general name (implied for most of shktools)
+ * equals = gender not specified, personal name
*
* Personal names do not receive the honorific prefix "Mr." or "Ms.".
*/
{ 3, -MAGIC_LAMP },
{ 5, -POT_OIL } },
shklight },
+ /* sentinel */
{ (char *) 0,
0,
0,
void
init_shop_selection()
{
- register int i, j, item_prob, shop_prob;
-
- for (shop_prob = 0, i = 0; i < SIZE(shtypes); i++) {
- shop_prob += shtypes[i].prob;
- for (item_prob = 0, j = 0; j < SIZE(shtypes[0].iprobs); j++)
- item_prob += shtypes[i].iprobs[j].iprob;
- if (item_prob != 100)
- panic("item probabilities total to %d for %s shops!",
- item_prob, shtypes[i].name);
- }
- if (shop_prob != 100)
- panic("shop probabilities total to %d!", shop_prob);
+ register int i, j, item_prob, shop_prob;
+
+ for (shop_prob = 0, i = 0; i < SIZE(shtypes); i++) {
+ shop_prob += shtypes[i].prob;
+ for (item_prob = 0, j = 0; j < SIZE(shtypes[0].iprobs); j++)
+ item_prob += shtypes[i].iprobs[j].iprob;
+ if (item_prob != 100)
+ panic("item probabilities total to %d for %s shops!",
+ item_prob, shtypes[i].name);
+ }
+ if (shop_prob != 100)
+ panic("shop probabilities total to %d!", shop_prob);
}
#endif /*0*/
if (objects[otyp].oc_material == VEGGY || otyp == EGG)
return TRUE;
if (otyp == TIN && corpsenm == NON_PM) /* implies obj is non-null */
- return (obj->spe == 1); /* 0 = empty, 1 = spinach */
+ return (boolean) (obj->spe == 1); /* 0 = empty, 1 = spinach */
if (otyp == TIN || otyp == CORPSE)
- return (corpsenm >= LOW_PM && vegetarian(&mons[corpsenm]));
+ return (boolean) (corpsenm >= LOW_PM
+ && vegetarian(&mons[corpsenm]));
}
return FALSE;
}
return;
}
+/* make an object of the appropriate type for a shop square */
STATIC_OVL void
mkshobj_at(shp, sx, sy, mkspecl)
-/* make an object of the appropriate type for a shop square */
const struct shclass *shp;
int sx, sy;
boolean mkspecl;
{
struct monst *mtmp;
- int atype;
struct permonst *ptr;
+ int atype;
/* 3.6.0 tribute */
if (mkspecl && (!strcmp(shp->name, "rare books")
|| !strcmp(shp->name, "second-hand bookstore"))) {
struct obj *novel = mksobj_at(SPE_NOVEL, sx, sy, FALSE, FALSE);
+
if (novel)
context.tribute.bookstock = TRUE;
return;
}
if (rn2(100) < depth(&u.uz) && !MON_AT(sx, sy)
- && (ptr = mkclass(S_MIMIC, 0))
+ && (ptr = mkclass(S_MIMIC, 0)) != 0
&& (mtmp = makemon(ptr, sx, sy, NO_MM_FLAGS)) != 0) {
/* note: makemon will set the mimic symbol to a shop item */
if (rn2(10) >= depth(&u.uz)) {
mtmp->isshk = 0;
}
-STATIC_OVL int shkinit(shp,
- sroom) /* create a new shopkeeper in the given room */
+/* create a new shopkeeper in the given room */
+STATIC_OVL int
+shkinit(shp, sroom)
const struct shclass *shp;
struct mkroom *sroom;
{
display_nhwindow(WIN_MESSAGE, FALSE);
}
#endif
- return (-1);
+ return -1;
}
if (MON_AT(sx, sy))
/* now initialize the shopkeeper monster structure */
if (!(shk = makemon(&mons[PM_SHOPKEEPER], sx, sy, MM_ESHK)))
- return (-1);
+ return -1;
eshkp = ESHK(shk); /* makemon(...,MM_ESHK) allocates this */
shk->isshk = shk->mpeaceful = 1;
set_malign(shk);
shk->msleeping = 0;
shk->mtrapseen = ~0; /* we know all the traps already */
- eshkp->shoproom = (schar)((sroom - rooms) + ROOMOFFSET);
+ eshkp->shoproom = (schar) ((sroom - rooms) + ROOMOFFSET);
sroom->resident = shk;
eshkp->shoptype = sroom->rtype;
assign_level(&eshkp->shoplevel, &u.uz);
(void) mongets(shk, TOUCHSTONE);
nameshk(shk, shp->shknms);
- return (sh);
+ return sh;
}
/* stock a newly-created room with objects */
if ((sh = shkinit(shp, sroom)) < 0)
return;
- /* make sure no doorways without doors, and no */
- /* trapped doors, in shops. */
+ /* make sure no doorways without doors, and no trapped doors, in shops */
sx = doors[sroom->fdoor].x;
sy = doors[sroom->fdoor].y;
-
if (levl[sx][sy].doormask == D_NODOOR) {
levl[sx][sy].doormask = D_ISOPEN;
newsym(sx, sy);
{
const char *shknm = ESHK(mtmp)->shknam;
- return (*shknm == '-' || *shknm == '+' || *shknm == '=');
+ return (boolean) (*shknm == '-' || *shknm == '+' || *shknm == '=');
}
boolean
/* skip "+" prefix */
if (!letter(*shknm))
++shknm;
- return !strcmp(shknm, "Izchak");
+ return (boolean) !strcmp(shknm, "Izchak");
}
/*shknam.c*/
-/* NetHack 3.6 sp_lev.c $NHDT-Date: 1446854235 2015/11/06 23:57:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.69 $ */
+/* NetHack 3.6 sp_lev.c $NHDT-Date: 1446887534 2015/11/07 09:12:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.70 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
/*
* This file contains the various functions that are related to the special
* levels.
- * It contains also the special level loader.
*
+ * It contains also the special level loader.
*/
#include "hack.h"
#include "dlb.h"
-
#include "sp_lev.h"
#ifdef _MSC_VER
#define Fgetc (schar) dlb_fgetc
#define New(type) (type *) alloc(sizeof(type))
#define NewTab(type, size) (type **) alloc(sizeof(type *) * (unsigned) size)
-#define Free(ptr) if (ptr) free((genericptr_t)(ptr))
+#define Free(ptr) if (ptr) free((genericptr_t) (ptr))
extern struct engr *head_engr;
opvar_new_region(x1,y1,x2,y2)
int x1,y1,x2,y2;
{
- struct opvar *tmpov = (struct opvar *)alloc(sizeof(struct opvar));
+ struct opvar *tmpov = (struct opvar *)alloc(sizeof (struct opvar));
tmpov->spovartyp = SPOVAR_REGION;
tmpov->vardata.l = SP_REGION_PACK(x1,y1,x2,y2);
/* realloc the lregion space to add the new one */
lev_region *newl = (lev_region *) alloc(
sizeof(lev_region) * (unsigned) (1 + num_lregions));
- (void) memcpy((genericptr_t)(newl), (genericptr_t) lregions,
+
+ (void) memcpy((genericptr_t) (newl), (genericptr_t) lregions,
sizeof(lev_region) * num_lregions);
Free(lregions);
num_lregions++;
-/* NetHack 3.6 teleport.c $NHDT-Date: 1446078762 2015/10/29 00:32:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */
+/* NetHack 3.6 teleport.c $NHDT-Date: 1446887535 2015/11/07 09:12:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
* not allow_drag is true, because we are calling that function, not
* to drag, but to move the chain. *However* there are some dumb
* special cases:
- * 0 0
+ * 0 0
* _X move east -----> X_
- * @ @
+ * @ @
* These are permissible if teleporting, but not if dragging. As a
* result, drag_ball() needs to know about allow_drag and might end
* up dragging the ball anyway. Also, drag_ball() might find that
do {
nux = rnd(COLNO - 1);
nuy = rn2(ROWNO);
- } while (!teleok(nux, nuy, (boolean)(tcnt > 200)) && ++tcnt <= 400);
+ } while (!teleok(nux, nuy, (boolean) (tcnt > 200)) && ++tcnt <= 400);
if (tcnt <= 400) {
teleds(nux, nuy, allow_drag);
return 0;
}
-/* place object randomly, returns FALSE if it's gone (eg broken) as a result
- */
+/* place object randomly, returns False if it's gone (eg broken) */
boolean
rloco(obj)
register struct obj *obj;
-/* NetHack 3.6 topten.c $NHDT-Date: 1436753525 2015/07/13 02:12:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */
+/* NetHack 3.6 topten.c $NHDT-Date: 1446887536 2015/11/07 09:12:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#endif
#ifdef VMS
-/* We don't want to rewrite the whole file, because that entails */
-/* creating a new version which requires that the old one be deletable. */
+/* We don't want to rewrite the whole file, because that entails
+ creating a new version which requires that the old one be deletable. */
#define UPDATE_RECORD_IN_PLACE
#endif
#define done_stopprint program_state.stopprint
-#define newttentry() (struct toptenentry *) alloc(sizeof(struct toptenentry))
-#define dealloc_ttentry(ttent) free((genericptr_t)(ttent))
+#define newttentry() (struct toptenentry *) alloc(sizeof (struct toptenentry))
+#define dealloc_ttentry(ttent) free((genericptr_t) (ttent))
#define NAMSZ 10
#define DTHSZ 100
#define ROLESZ 3
observable_depth(lev)
d_level *lev;
{
-#if 0 /* if we ever randomize the order of the elemental planes, we \
- must use a constant external representation in the record file */
- if (In_endgame(lev)) {
- if (Is_astralevel(lev)) return -5;
- else if (Is_waterlevel(lev)) return -4;
- else if (Is_firelevel(lev)) return -3;
- else if (Is_airlevel(lev)) return -2;
- else if (Is_earthlevel(lev)) return -1;
- else return 0; /* ? */
- } else
+#if 0
+ /* if we ever randomize the order of the elemental planes, we
+ must use a constant external representation in the record file */
+ if (In_endgame(lev)) {
+ if (Is_astralevel(lev))
+ return -5;
+ else if (Is_waterlevel(lev))
+ return -4;
+ else if (Is_firelevel(lev))
+ return -3;
+ else if (Is_airlevel(lev))
+ return -2;
+ else if (Is_earthlevel(lev))
+ return -1;
+ else
+ return 0; /* ? */
+ } else
#endif
return depth(lev);
}
if (rank0 < 0) {
rank0 = 0;
rank1 = rank;
- HUP
- {
+ HUP {
char pbuf[BUFSZ];
- Sprintf(
- pbuf,
+
+ Sprintf(pbuf,
"You didn't beat your previous score of %ld points.",
- t1->points);
+ t1->points);
topten_print(pbuf);
topten_print("");
}
#endif /* UPDATE_RECORD_IN_PLACE */
if (!done_stopprint)
if (rank0 > 0) {
- if (rank0 <= 10)
+ if (rank0 <= 10) {
topten_print("You made the top ten list!");
- else {
+ } else {
char pbuf[BUFSZ];
+
Sprintf(pbuf,
"You reached the %d%s place on the top %d list.",
rank0, ordin(rank0), sysopt.entrymax);
#ifdef AMIGA
{
extern winid amii_rawprwin;
+
display_nhwindow(amii_rawprwin, 1);
destroy_nhwindow(amii_rawprwin);
amii_rawprwin = WIN_ERR;
return PM_RANGER;
impossible("What weird role is this? (%s)", plch);
- return (PM_HUMAN_MUMMY);
+ return PM_HUMAN_MUMMY;
}
/*
struct toptenentry tt_buf;
if (!otmp)
- return ((struct obj *) 0);
+ return (struct obj *) 0;
rfile = fopen_datafile(RECORD, "r", SCOREPREFIX);
if (!rfile) {
-/* NetHack 3.6 uhitm.c $NHDT-Date: 1446713645 2015/11/05 08:54:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.150 $ */
+/* NetHack 3.6 uhitm.c $NHDT-Date: 1446887537 2015/11/07 09:12:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
case BLINDING_VENOM:
mon->msleeping = 0;
if (can_blnd(&youmonst, mon,
- (uchar)(obj->otyp == BLINDING_VENOM
+ (uchar) (obj->otyp == BLINDING_VENOM
? AT_SPIT
: AT_WEAP),
obj)) {
-/* NetHack 3.6 version.c $NHDT-Date: 1444867101 2015/10/14 23:58:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
+/* NetHack 3.6 version.c $NHDT-Date: 1446887538 2015/11/07 09:12:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
if (!rtadded) {
const char *catchphrase = ", and basic NetHack features.";
+
pd = strstri(buf, catchphrase);
if (pd) {
*pd = '\0';
insert_rtoptions(win, buf, &catchphrase[2]);
rtadded = TRUE; /* only do it once */
- }
+ }
}
if (*buf)
putstr(win, 0, buf);
int l, i;
const char *s1 = 0, *s2 = 0, *s3 = 0, *s4 = 0;
- if ((int)strlen(buf) >= (BUFSZ - 1))
+ if ((int) strlen(buf) >= (BUFSZ - 1))
return;
strcpy(rtbuf, buf);
s3 = "";
s4 = "";
}
- l = (int)strlen(rtbuf) + (int)strlen(s1) + (int)strlen(s2) +
- (int)strlen(s3) + (int)strlen(s4) + 1;
- if (l <= (COLNO - 5) && l < (BUFSZ-1)) {
+ l = (int) strlen(rtbuf) + (int) strlen(s1) + (int) strlen(s2)
+ + (int) strlen(s3) + (int) strlen(s4) + 1;
+ if (l <= (COLNO - 5) && l < (BUFSZ - 1)) {
Strcat(rtbuf, s1);
Strcat(rtbuf, s2);
Strcat(rtbuf, s3);
putstr(win, 0, rtbuf);
if (i >= SIZE(rt_opts))
s1 = "";
- l = (int)strlen(indent) + (int)strlen(s1) + (int)strlen(s2) +
- (int)strlen(s3) + (int)strlen(s4) + 1;
- if (l <= (COLNO -5) && l < (BUFSZ-1)) {
+ l = (int) strlen(indent) + (int) strlen(s1) + (int) strlen(s2)
+ + (int) strlen(s3) + (int) strlen(s4) + 1;
+ if (l <= (COLNO - 5) && l < (BUFSZ - 1)) {
Strcpy(rtbuf, indent);
Strcat(rtbuf, s1);
Strcat(rtbuf, s2);
Strcat(rtbuf, s3);
Strcat(rtbuf, s4);
}
- }
+ }
}
if (l)
comp_times(filetime)
long filetime;
{
- return ((boolean)(filetime < BUILD_TIME));
+ return (boolean) (filetime < BUILD_TIME);
}
#endif
int fd;
{
static const struct version_info version_data = {
- VERSION_NUMBER, VERSION_FEATURES, VERSION_SANITY1, VERSION_SANITY2,
- VERSION_SANITY3
+ VERSION_NUMBER, VERSION_FEATURES,
+ VERSION_SANITY1, VERSION_SANITY2, VERSION_SANITY3
};
bufoff(fd);
-/* NetHack 3.6 wield.c $NHDT-Date: 1446861774 2015/11/07 02:02:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */
+/* NetHack 3.6 wield.c $NHDT-Date: 1446887539 2015/11/07 09:12:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
(amount >= 0) ? "twitch" : "itch");
strange_feeling(otmp, buf);
- exercise(A_DEX, (boolean)(amount >= 0));
+ exercise(A_DEX, (boolean) (amount >= 0));
return 0;
}
-/* NetHack 3.6 worm.c $NHDT-Date: 1446078769 2015/10/29 00:32:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
+/* NetHack 3.6 worm.c $NHDT-Date: 1446887540 2015/11/07 09:12:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "lev.h"
-#define newseg() (struct wseg *) alloc(sizeof(struct wseg))
-#define dealloc_seg(wseg) free((genericptr_t)(wseg))
+#define newseg() (struct wseg *) alloc(sizeof (struct wseg))
+#define dealloc_seg(wseg) free((genericptr_t) (wseg))
/* worm segment structure */
struct wseg {
-/* NetHack 3.6 worn.c $NHDT-Date: 1446078770 2015/10/29 00:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */
+/* NetHack 3.6 worn.c $NHDT-Date: 1446887541 2015/11/07 09:12:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
default:
if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */
/* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */
- mask = (uchar)(1 << (which - 1));
+ mask = (uchar) (1 << (which - 1));
mon->mintrinsics |= (unsigned short) mask;
}
break;
case POISON_RES:
case ACID_RES:
case STONE_RES:
- mask = (uchar)(1 << (which - 1));
+ mask = (uchar) (1 << (which - 1));
/* If the monster doesn't have this resistance intrinsically,
check whether any other worn item confers it. Note that
we don't currently check for anything conferred via simply
return base;
}
-/* weapons are handled separately; rings and eyewear aren't used by monsters
+/*
+ * weapons are handled separately;
+ * rings and eyewear aren't used by monsters
*/
/* Wear the best object of each type that the monster has. During creation,
nobj = otmp->nobj;
if (otmp->bypass) {
otmp->bypass = 0;
-/* bypass will have inhibited any stacking, but since it's
- * used for polymorph handling, the objects here probably
- * have been transformed and won't be stacked in the usual
- * manner afterwards; so don't bother with this.
- * [Changing the fobj chain mid-traversal would also be risky.]
- */
+
+ /* bypass will have inhibited any stacking, but since it's
+ * used for polymorph handling, the objects here probably
+ * have been transformed and won't be stacked in the usual
+ * manner afterwards; so don't bother with this.
+ * [Changing the fobj chain mid-traversal would also be risky.]
+ */
#if 0
if (objects[otmp->otyp].oc_merge) {
xchar ox, oy;
}
/* bias a monster's preferences towards armor that has special benefits. */
-/* currently only does speed boots, but might be expanded if monsters get to
- use more armor abilities */
STATIC_OVL int
extra_pref(mon, obj)
struct monst *mon;
struct obj *obj;
{
+ /* currently only does speed boots, but might be expanded if monsters
+ * get to use more armor abilities
+ */
if (obj) {
if (obj->otyp == SPEED_BOOTS && mon->permspeed != MFAST)
return 20;
}
/*
- * Exceptions to things based on race. Correctly checks polymorphed player
- *race.
+ * Exceptions to things based on race.
+ * Correctly checks polymorphed player race.
* Returns:
* 0 No exception, normal rules apply.
* 1 If the race/object combination is acceptable.
-/* NetHack 3.6 zap.c $NHDT-Date: 1446861775 2015/11/07 02:02:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.232 $ */
+/* NetHack 3.6 zap.c $NHDT-Date: 1446887542 2015/11/07 09:12:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.233 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
xchar x, y;
long where = arg->a_long;
- y = (xchar)(where & 0xFFFF);
- x = (xchar)((where >> 16) & 0xFFFF);
+ y = (xchar) (where & 0xFFFF);
+ x = (xchar) ((where >> 16) & 0xFFFF);
/* melt_ice does newsym when appropriate */
melt_ice(x, y, "Some ice melts away.");
}