formatting: casts involving typedefs

The automated reformatting put a space in casts of the form
'(type)(expression)', yielding '(type) (expression)', but it didn't
do that for '(typedef)(expression)'.  There are lots of instances of
'(boolean)(expression)'; (uchar) and (xchar) also occur.  I haven't
noticed other types, but I haven't looked in very many files yet.
This commit is contained in:
PatR
2015-11-07 01:12:30 -08:00
parent 8bfa1579e7
commit e5ff572891
12 changed files with 206 additions and 186 deletions

View File

@@ -1,17 +1,17 @@
/* 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"
@@ -34,14 +34,15 @@ STATIC_OVL boolean
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)
@@ -189,7 +190,7 @@ gottype:
}
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
@@ -200,10 +201,10 @@ gottype:
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;
@@ -283,6 +284,7 @@ struct mkroom *sroom;
goldlim = 500 * level_difficulty();
break;
}
for (sx = sroom->lx; sx <= sroom->hx; sx++)
for (sy = sroom->ly; sy <= sroom->hy; sy++) {
if (sroom->irregular) {
@@ -301,26 +303,24 @@ struct mkroom *sroom;
/* 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) {
@@ -423,7 +423,8 @@ int mm_flags;
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);
}
@@ -437,20 +438,21 @@ morguemon()
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 *
@@ -476,11 +478,13 @@ antholemon()
}
/* 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;
@@ -501,11 +505,12 @@ STATIC_OVL void mkswamp() /* Michiel Huisjes & Fred de Wilde */
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 */
@@ -569,15 +574,16 @@ register int sx, sy;
{
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
@@ -587,7 +593,7 @@ register struct mkroom *sroom;
if (sroom == dnstairs_room)
return TRUE;
if (sstairs.sx && !sstairs.up)
return ((boolean)(sroom == sstairs_room));
return (boolean) (sroom == sstairs_room);
return FALSE;
}
@@ -598,7 +604,7 @@ register struct mkroom *sroom;
if (sroom == upstairs_room)
return TRUE;
if (sstairs.sx && sstairs.up)
return ((boolean)(sroom == sstairs_room));
return (boolean) (sroom == sstairs_room);
return FALSE;
}
@@ -621,8 +627,8 @@ inside_room(croom, x, y)
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
@@ -682,7 +688,6 @@ coord *c;
* - ANY_SHOP
* - ANY_TYPE
*/
struct mkroom *
search_special(type)
schar type;
@@ -706,24 +711,25 @@ struct permonst *
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)
@@ -736,7 +742,9 @@ static struct {
{ 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;
@@ -753,28 +761,28 @@ STATIC_OVL struct permonst *squadmon() /* return soldier types. */
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]);
}
@@ -782,7 +790,6 @@ struct mkroom *r;
/*
* save_rooms : Save all the rooms on disk!
*/
void
save_rooms(fd)
int fd;
@@ -814,7 +821,6 @@ struct mkroom *r;
* rest_rooms : That's for restoring rooms. Read the rooms structure from
* the disk.
*/
void
rest_rooms(fd)
int fd;

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -230,10 +230,10 @@ boolean verbose; /* give message(s) even when you can't see what happened */
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;
@@ -410,7 +410,7 @@ struct obj *obj; /* missile (or stack providing it) */
(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)) {

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -9,8 +9,8 @@
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 *));
@@ -18,11 +18,11 @@ 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.".
*/
@@ -336,6 +336,7 @@ const struct shclass shtypes[] = {
{ 3, -MAGIC_LAMP },
{ 5, -POT_OIL } },
shklight },
/* sentinel */
{ (char *) 0,
0,
0,
@@ -350,18 +351,18 @@ const struct shclass shtypes[] = {
void
init_shop_selection()
{
register int i, j, item_prob, 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);
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*/
@@ -390,9 +391,10 @@ int otyp; /* used iff obj is null */
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;
}
@@ -442,28 +444,29 @@ int sx, sy;
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)) {
@@ -579,8 +582,9 @@ struct monst *mtmp;
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;
{
@@ -638,7 +642,7 @@ struct mkroom *sroom;
display_nhwindow(WIN_MESSAGE, FALSE);
}
#endif
return (-1);
return -1;
}
if (MON_AT(sx, sy))
@@ -646,13 +650,13 @@ struct mkroom *sroom;
/* 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);
@@ -669,7 +673,7 @@ struct mkroom *sroom;
(void) mongets(shk, TOUCHSTONE);
nameshk(shk, shp->shknms);
return (sh);
return sh;
}
/* stock a newly-created room with objects */
@@ -694,11 +698,9 @@ register struct mkroom *sroom;
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);
@@ -848,7 +850,7 @@ struct monst *mtmp;
{
const char *shknm = ESHK(mtmp)->shknam;
return (*shknm == '-' || *shknm == '+' || *shknm == '=');
return (boolean) (*shknm == '-' || *shknm == '+' || *shknm == '=');
}
boolean
@@ -869,7 +871,7 @@ boolean override_hallucination;
/* skip "+" prefix */
if (!letter(*shknm))
++shknm;
return !strcmp(shknm, "Izchak");
return (boolean) !strcmp(shknm, "Izchak");
}
/*shknam.c*/

View File

@@ -1,17 +1,16 @@
/* 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
@@ -168,7 +167,7 @@ STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *));
#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;
@@ -386,7 +385,7 @@ struct opvar *
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);
@@ -4415,7 +4414,8 @@ struct sp_coder *coder;
/* 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++;

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -261,9 +261,9 @@ boolean allow_drag;
* 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
@@ -357,7 +357,7 @@ boolean allow_drag;
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);
@@ -1184,8 +1184,7 @@ int in_sight;
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;

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -11,8 +11,8 @@
#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
@@ -28,8 +28,8 @@ static long final_fpos;
#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
@@ -144,16 +144,23 @@ STATIC_OVL xchar
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);
}
@@ -602,13 +609,12 @@ time_t when;
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("");
}
@@ -643,10 +649,11 @@ time_t when;
#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);
@@ -1091,6 +1098,7 @@ char **argv;
#ifdef AMIGA
{
extern winid amii_rawprwin;
display_nhwindow(amii_rawprwin, 1);
destroy_nhwindow(amii_rawprwin);
amii_rawprwin = WIN_ERR;
@@ -1120,7 +1128,7 @@ boolean fem;
return PM_RANGER;
impossible("What weird role is this? (%s)", plch);
return (PM_HUMAN_MUMMY);
return PM_HUMAN_MUMMY;
}
/*
@@ -1138,7 +1146,7 @@ struct obj *otmp;
struct toptenentry tt_buf;
if (!otmp)
return ((struct obj *) 0);
return (struct obj *) 0;
rfile = fopen_datafile(RECORD, "r", SCOREPREFIX);
if (!rfile) {

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -864,7 +864,7 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
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)) {

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -113,12 +113,13 @@ doextversion()
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);
@@ -153,7 +154,7 @@ const char *finalphrase;
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);
@@ -169,9 +170,9 @@ const char *finalphrase;
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);
@@ -180,16 +181,16 @@ const char *finalphrase;
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)
@@ -202,7 +203,7 @@ boolean
comp_times(filetime)
long filetime;
{
return ((boolean)(filetime < BUILD_TIME));
return (boolean) (filetime < BUILD_TIME);
}
#endif
@@ -273,8 +274,8 @@ store_version(fd)
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);

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -611,7 +611,7 @@ register int amount;
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;
}

View File

@@ -1,12 +1,12 @@
/* 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 {

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -346,7 +346,7 @@ boolean on, silently;
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;
@@ -372,7 +372,7 @@ boolean on, silently;
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
@@ -428,7 +428,9 @@ register struct monst *mon;
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,
@@ -690,12 +692,13 @@ clear_bypasses()
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;
@@ -924,13 +927,14 @@ boolean polyspot;
}
/* 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;
@@ -939,8 +943,8 @@ struct obj *obj;
}
/*
* 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.

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -4133,8 +4133,8 @@ long timeout UNUSED;
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.");
}