-/* NetHack 3.6 region.c $NHDT-Date: 1432512774 2015/05/25 00:12:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
+/* NetHack 3.6 region.c $NHDT-Date: 1445906843 2015/10/27 00:47:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) 1996 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
if (p2 == (genericptr_t)0) { /* That means the player */
if (!Blind)
You("bump into %s. Ouch!",
- Hallucination ? "an invisible tree" :
- "some kind of invisible wall");
+ Hallucination ? "an invisible tree"
+ : "some kind of invisible wall");
else
pline("Ouch!");
} else {
-/* NetHack 3.6 role.c $NHDT-Date: 1434073671 2015/06/12 01:47:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $ */
+/* NetHack 3.6 role.c $NHDT-Date: 1445906861 2015/10/27 00:47:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/* NetHack may be freely redistributed. See license for details. */
validrole(rolenum)
int rolenum;
{
- return (rolenum >= 0 && rolenum < SIZE(roles) - 1);
+ return (boolean) (rolenum >= 0 && rolenum < SIZE(roles) - 1);
}
int
randrole()
{
- return (rn2(SIZE(roles) - 1));
+ return rn2(SIZE(roles) - 1);
}
STATIC_OVL int
int rolenum, racenum;
{
/* Assumes validrole */
- return (racenum >= 0 && racenum < SIZE(races) - 1
- && (roles[rolenum].allow & races[racenum].allow & ROLE_RACEMASK));
+ return (boolean) (racenum >= 0 && racenum < SIZE(races) - 1
+ && (roles[rolenum].allow & races[racenum].allow
+ & ROLE_RACEMASK));
}
int
if (n)
n--;
else
- return (i);
+ return i;
}
/* This role has no permitted races? */
- return (rn2(SIZE(races) - 1));
+ return rn2(SIZE(races) - 1);
}
int
int rolenum, racenum, gendnum;
{
/* Assumes validrole and validrace */
- return (gendnum >= 0 && gendnum < ROLE_GENDERS
- && (roles[rolenum].allow & races[racenum].allow
- & genders[gendnum].allow & ROLE_GENDMASK));
+ return (boolean) (gendnum >= 0 && gendnum < ROLE_GENDERS
+ && (roles[rolenum].allow & races[racenum].allow
+ & genders[gendnum].allow & ROLE_GENDMASK));
}
int
if (n)
n--;
else
- return (i);
+ return i;
}
/* This role/race has no permitted genders? */
- return (rn2(ROLE_GENDERS));
+ return rn2(ROLE_GENDERS);
}
int
int rolenum, racenum, alignnum;
{
/* Assumes validrole and validrace */
- return (alignnum >= 0 && alignnum < ROLE_ALIGNS
- && (roles[rolenum].allow & races[racenum].allow
- & aligns[alignnum].allow & ROLE_ALIGNMASK));
+ return (boolean) (alignnum >= 0 && alignnum < ROLE_ALIGNS
+ && (roles[rolenum].allow & races[racenum].allow
+ & aligns[alignnum].allow & ROLE_ALIGNMASK));
}
int
if (n)
n--;
else
- return (i);
+ return i;
}
/* This role/race has no permitted alignments? */
- return (rn2(ROLE_ALIGNS));
+ return rn2(ROLE_ALIGNS);
}
int
{
switch (Role_switch) {
case PM_KNIGHT:
- return ("Salutations"); /* Olde English */
+ return "Salutations"; /* Olde English */
case PM_SAMURAI:
- return (mtmp && mtmp->data == &mons[PM_SHOPKEEPER]
+ return (mtmp && mtmp->data == &mons[PM_SHOPKEEPER])
? "Irasshaimase"
- : "Konnichi wa"); /* Japanese */
+ : "Konnichi wa"; /* Japanese */
case PM_TOURIST:
- return ("Aloha"); /* Hawaiian */
+ return "Aloha"; /* Hawaiian */
case PM_VALKYRIE:
- return (
+ return
#ifdef MAIL
- mtmp && mtmp->data == &mons[PM_MAIL_DAEMON]
- ? "Hallo"
- :
+ (mtmp && mtmp->data == &mons[PM_MAIL_DAEMON]) ? "Hallo" :
#endif
- "Velkommen"); /* Norse */
+ "Velkommen"; /* Norse */
default:
- return ("Hello");
+ return "Hello";
}
}
{
switch (Role_switch) {
case PM_KNIGHT:
- return ("Fare thee well"); /* Olde English */
+ return "Fare thee well"; /* Olde English */
case PM_SAMURAI:
- return ("Sayonara"); /* Japanese */
+ return "Sayonara"; /* Japanese */
case PM_TOURIST:
- return ("Aloha"); /* Hawaiian */
+ return "Aloha"; /* Hawaiian */
case PM_VALKYRIE:
- return ("Farvel"); /* Norse */
+ return "Farvel"; /* Norse */
default:
- return ("Goodbye");
+ return "Goodbye";
}
}
-/* NetHack 3.6 shk.c $NHDT-Date: 1433035328 2015/05/31 01:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
+/* NetHack 3.6 shk.c $NHDT-Date: 1445906862 2015/10/27 00:47:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.114 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
rile_shk(shkp);
}
}
- return (shkp);
+ return shkp;
}
void shkgone(mtmp) /* called in mon.c */
total += bp->price * bp->bquan;
bp++;
}
- return (total);
+ return total;
}
STATIC_OVL void
rno = levl[x][y].roomno;
if ((rno < ROOMOFFSET) || levl[x][y].edge || !IS_SHOP(rno - ROOMOFFSET))
- return (NO_ROOM);
+ return NO_ROOM;
else
- return (rno);
+ return rno;
}
void
long amt;
int pass;
- if (this_shkp
- && !(ESHK(this_shkp)->credit || shop_debt(ESHK(this_shkp)))) {
+ eshkp = this_shkp ? ESHK(this_shkp) : 0;
+ if (eshkp && !(eshkp->credit || shop_debt(eshkp))) {
You("have no credit or debt in here.");
this_shkp = 0; /* skip first pass */
}
inhishop(mtmp)
register struct monst *mtmp;
{
- return (
- index(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), ESHK(mtmp)->shoproom)
- && on_level(&(ESHK(mtmp)->shoplevel), &u.uz));
+ struct eshk *eshkp = ESHK(mtmp);
+
+ return (index(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), eshkp->shoproom)
+ && on_level(&eshkp->shoplevel, &u.uz));
}
struct monst *
register struct monst *mtmp = sroom->resident;
if (!mtmp)
- return (FALSE);
+ return FALSE;
else
- return ((boolean)(inhishop(mtmp)));
+ return (boolean) inhishop(mtmp);
}
STATIC_OVL struct bill_x *
is_unpaid(obj)
struct obj *obj;
{
- return (obj->unpaid || (Has_contents(obj) && count_unpaid(obj->cobj)));
+ return (boolean) (obj->unpaid
+ || (Has_contents(obj) && count_unpaid(obj->cobj)));
}
/* Delete the contents of the given object. */
{
long credit = ESHK(shkp)->credit;
- if (credit == 0L)
- return (tmp);
- if (credit >= tmp) {
+ if (credit == 0L) {
+ ; /* nothing to do; just 'return tmp;' */
+ } else if (credit >= tmp) {
pline_The("price is deducted from your credit.");
ESHK(shkp)->credit -= tmp;
tmp = 0L;
ESHK(shkp)->credit = 0L;
tmp -= credit;
}
- return (tmp);
+ return tmp;
}
STATIC_OVL void
for (shkp = next_shkp(fmon, FALSE); shkp;
shkp = next_shkp(shkp->nmon, FALSE))
if (ANGRY(shkp))
- return (TRUE);
- return (FALSE);
+ return TRUE;
+ return FALSE;
}
/* remove previously applied surcharge from all billed items */
gmin = bp->price * bp->bquan;
bp++;
}
- return (gmin);
+ return gmin;
}
int
if ((!sk && (!Blind || Blind_telepat)) || (!Blind && !seensk)) {
There("appears to be no shopkeeper here to receive your payment.");
- return (0);
+ return 0;
}
if (!seensk) {
You_cant("see...");
- return (0);
+ return 0;
}
/* the usual case. allow paying at a distance when */
if (shkp != resident && distu(shkp->mx, shkp->my) > 2) {
pline("%s is not near enough to receive your payment.",
Monnam(shkp));
- return (0);
+ return 0;
}
} else {
struct monst *mtmp;
cy = cc.y;
if (cx < 0) {
pline("Try again...");
- return (0);
+ return 0;
}
if (u.ux == cx && u.uy == cy) {
You("are generous to yourself.");
- return (0);
+ return 0;
}
mtmp = m_at(cx, cy);
if (!mtmp) {
There("is no one there to receive your payment.");
- return (0);
+ return 0;
}
if (!mtmp->isshk) {
pline("%s is not interested in your payment.", Monnam(mtmp));
- return (0);
+ return 0;
}
if (mtmp != resident && distu(mtmp->mx, mtmp->my) > 2) {
pline("%s is too far to receive your payment.", Monnam(mtmp));
- return (0);
+ return 0;
}
shkp = mtmp;
}
if (!shkp) {
debugpline0("dopay: null shkp.");
- return (0);
+ return 0;
}
proceed:
eshkp = ESHK(shkp);
else
make_happy_shk(shkp, FALSE);
}
- return (1);
+ return 1;
}
/* ltmp is still eshkp->robbed here */
pline(no_money, stashed_gold ? " seem to" : "");
else
pline(not_enough_money, mhim(shkp));
- return (1);
+ return 1;
}
pline("But since %s shop has been robbed recently,", mhis(shkp));
pline("you %scompensate %s for %s losses.",
pline(no_money, stashed_gold ? " seem to" : "");
else
pline(not_enough_money, mhim(shkp));
- return (1);
+ return 1;
}
You("try to appease %s by giving %s 1000 gold pieces.",
x_monnam(shkp, ARTICLE_THE, "angry", 0, FALSE), mhim(shkp));
else
pline("But %s is as angry as ever.", shkname(shkp));
}
- return (1);
+ return 1;
}
if (shkp != resident) {
impossible("dopay: not to shopkeeper?");
if (resident)
setpaid(resident);
- return (0);
+ return 0;
}
/* pay debt, if any, first */
if (eshkp->debit) {
pline("But you don't%s have enough gold%s.",
stashed_gold ? " seem to" : "",
eshkp->credit ? " or credit" : "");
- return (1);
+ return 1;
} else {
if (eshkp->credit >= dtmp) {
eshkp->credit -= dtmp;
if (!umoney && !eshkp->credit) {
You("%shave no money or credit%s.",
stashed_gold ? "seem to " : "", paid ? " left" : "");
- return (0);
+ return 0;
}
if ((umoney + eshkp->credit) < cheapest_item(shkp)) {
You("don't have enough money to buy%s the item%s you picked.",
eshkp->billct > 1 ? " any of" : "", plur(eshkp->billct));
if (stashed_gold)
pline("Maybe you have some gold stashed away?");
- return (0);
+ return 0;
}
/* this isn't quite right; it itemizes without asking if the
if (!ANGRY(shkp) && paid && !muteshk(shkp))
verbalize("Thank you for shopping in %s %s!", s_suffix(shkname(shkp)),
shtypes[eshkp->shoptype - SHOPBASE].name);
- return (1);
+ return 1;
}
/* return 2 if used-up portion paid */
clear:
shkp->minvis = save_minvis;
setpaid(shkp);
- return (taken);
+ return taken;
}
STATIC_OVL void
else if (Has_contents(otmp))
value += contained_gold(otmp);
- return (value);
+ return value;
}
STATIC_OVL void
price = stolen_container(otmp, shkp, price, ininv);
}
- return (price);
+ return price;
}
long
}
if (gvalue + value == 0L)
- return (0L);
+ return 0L;
value += gvalue;
hot_pursuit(shkp);
(void) angry_guards(FALSE);
}
- return (value);
+ return value;
}
/* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */
display_nhwindow(datawin, FALSE);
quit:
destroy_nhwindow(datawin);
- return (0);
+ return 0;
}
#define HUNGRY 2
register struct monst *shkp;
if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp))
- return (0);
+ return 0;
if (shkp->mcanmove && !shkp->msleeping
&& (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy))
- && dist2(shkp->mx, shkp->my, x, y) < 3 &&
+ && dist2(shkp->mx, shkp->my, x, y) < 3
/* if it is the shk's pos, you hit and anger him */
- (shkp->mx != x || shkp->my != y)) {
+ && (shkp->mx != x || shkp->my != y)) {
if (mnearto(shkp, x, y, TRUE) && !muteshk(shkp))
verbalize("Out of my way, scum!");
if (cansee(x, y)) {
if (cansee(x, y)) {
if (IS_WALL(levl[x][y].typ)) {
saw_walls++;
- } else if (IS_DOOR(levl[x][y].typ) &&
+ } else if (IS_DOOR(levl[x][y].typ)
/* an existing door here implies trap removal */
- !(old_doormask & (D_ISOPEN | D_CLOSED))) {
+ && !(old_doormask & (D_ISOPEN | D_CLOSED))) {
saw_door = TRUE;
} else if (disposition == 3) { /* untrapped */
saw_untrap++;
register struct trap *ttmp;
if ((monstermoves - tmp_dam->when) < REPAIR_DELAY)
- return (0);
+ return 0;
if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following)
- return (0);
+ return 0;
x = tmp_dam->place.x;
y = tmp_dam->place.y;
if (!IS_ROOM(tmp_dam->typ)) {
if (x == u.ux && y == u.uy)
if (!Passes_walls)
- return (0);
+ return 0;
if (x == shkp->mx && y == shkp->my)
- return (0);
+ return 0;
if ((mtmp = m_at(x, y)) && (!passes_walls(mtmp->data)))
- return (0);
+ return 0;
}
if ((ttmp = t_at(x, y)) != 0) {
if (x == u.ux && y == u.uy)
if (!Passes_walls)
- return (0);
+ return 0;
if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) {
/* convert to an object */
otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP,
block_point(x, y);
}
newsym(x, y);
- return (3);
+ return 3;
}
if (IS_ROOM(tmp_dam->typ)) {
/* No messages, because player already filled trap door */
- return (1);
+ return 1;
}
if ((tmp_dam->typ == levl[x][y].typ)
&& (!IS_DOOR(tmp_dam->typ) || (levl[x][y].doormask > D_BROKEN)))
/* No messages if player already replaced shop door */
- return (1);
+ return 1;
levl[x][y].typ = tmp_dam->typ;
(void) memset((genericptr_t) litter, 0, sizeof(litter));
if ((otmp = level.objects[x][y]) != 0) {
for (i = 0; i < 9; i++)
if (litter[i] & NEED_UPDATE)
newsym(x + horiz(i), y + vert(i));
- return (2);
+ return 2;
#undef NEED_UPDATE
#undef OPEN
#undef INSHOP
if (Displaced)
Your("displaced image doesn't fool %s!", mon_nam(shkp));
(void) mattacku(shkp);
- return (0);
+ return 0;
}
if (eshkp->following) {
if (strncmp(eshkp->customer, plname, PL_NSIZ)) {
verbalize("%s, %s! I was looking for %s.", Hello(shkp),
plname, eshkp->customer);
eshkp->following = 0;
- return (0);
+ return 0;
}
if (moves > followmsg + 4) {
if (!muteshk(shkp))
}
}
if (udist < 2)
- return (0);
+ return 0;
}
}
invent, triggering billing impossibilities on the
next level once the character fell through the hole.] */
if (udist > 4 && eshkp->following && !eshkp->billct)
- return (-1); /* leave it to m_move */
+ return -1; /* leave it to m_move */
gx = u.ux;
gy = u.uy;
} else if (ANGRY(shkp)) {
|| (Fast && (sobj_at(PICK_AXE, u.ux, u.uy)
|| sobj_at(DWARVISH_MATTOCK, u.ux, u.uy))));
if (satdoor && badinv)
- return (0);
+ return 0;
avoid = !badinv;
} else {
avoid = (*u.ushops && distu(gx, gy) > 8);
if (((!eshkp->robbed && !eshkp->billct && !eshkp->debit) || avoid)
&& GDIST(omx, omy) < 3) {
if (!badinv && !onlineu(omx, omy))
- return (0);
+ return 0;
if (satdoor)
appr = gx = gy = 0;
}
is_fshk(mtmp)
register struct monst *mtmp;
{
- return ((boolean)(mtmp->isshk && ESHK(mtmp)->following));
+ return (boolean) (mtmp->isshk && ESHK(mtmp)->following);
}
/* You are digging in the shop. */
costly_spot(x, y)
register xchar x, y;
{
- register struct monst *shkp;
+ struct monst *shkp;
+ struct eshk *eshkp;
if (!level.flags.has_shop)
return FALSE;
shkp = shop_keeper(*in_rooms(x, y, SHOPBASE));
if (!shkp || !inhishop(shkp))
- return (FALSE);
-
- return (
- (boolean)(inside_shop(x, y)
- && !(x == ESHK(shkp)->shk.x && y == ESHK(shkp)->shk.y)));
+ return FALSE;
+ eshkp = ESHK(shkp);
+ return (boolean) (inside_shop(x, y)
+ && !(x == eshkp->shk.x && y == eshkp->shk.y));
}
/* called by dotalk(sounds.c) when #chatting; returns obj if location
if (otmp->oclass != COIN_CLASS)
break;
/* note: otmp might have ->no_charge set, but that's ok */
- return (otmp && costly_spot(x, y) && NOTANGRY(shkp) && shkp->mcanmove
- && !shkp->msleeping)
+ return (otmp && costly_spot(x, y)
+ && NOTANGRY(shkp) && shkp->mcanmove && !shkp->msleeping)
? otmp
: (struct obj *) 0;
}
long tmp = 0L;
if (!shkp || !inhishop(shkp))
- return (0L); /* insurance */
+ return 0L; /* insurance */
tmp = get_cost(otmp, shkp);
/* The idea is to make the exhaustive use of */
} else if (otmp->otyp == POT_OIL) {
tmp /= 5L;
}
- return (tmp);
+ return tmp;
}
/* Charge the player for partial use of an unpaid object.
register struct monst *shkp;
if (roomno < 0 || !IS_SHOP(roomno))
- return (FALSE);
+ return FALSE;
if (!IS_DOOR(levl[x][y].typ))
- return (FALSE);
+ return FALSE;
if (roomno != *u.ushops)
- return (FALSE);
+ return FALSE;
if (!(shkp = shop_keeper((char) roomno)) || !inhishop(shkp))
- return (FALSE);
+ return FALSE;
if (shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y
/* Actually, the shk should be made to block _any_
&& (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) {
pline("%s%s blocks your way!", shkname(shkp),
Invis ? " senses your motion and" : "");
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/* used in domove to block diagonal shop-entry */
if (!(IS_DOOR(levl[u.ux][u.uy].typ)
&& levl[u.ux][u.uy].doormask == D_BROKEN))
- return (FALSE);
+ return FALSE;
roomno = *in_rooms(x, y, SHOPBASE);
if (roomno < 0 || !IS_SHOP(roomno))
- return (FALSE);
+ return FALSE;
if (!(shkp = shop_keeper((char) roomno)) || !inhishop(shkp))
- return (FALSE);
+ return FALSE;
if (ESHK(shkp)->shd.x != u.ux || ESHK(shkp)->shd.y != u.uy)
- return (FALSE);
+ return FALSE;
sx = ESHK(shkp)->shk.x;
sy = ESHK(shkp)->shk.y;
|| u.usteed)) {
pline("%s%s blocks your way!", shkname(shkp),
Invis ? " senses your motion and" : "");
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/* "your " or "Foobar's " (note the trailing space) */
-/* NetHack 3.6 sit.c $NHDT-Date: 1436753523 2015/07/13 02:12:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.50 $ */
+/* NetHack 3.6 sit.c $NHDT-Date: 1445906863 2015/10/27 00:47:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "artifact.h"
+
+/* take away the hero's money */
void
take_gold()
{
struct obj *otmp, *nobj;
int lost_money = 0;
+
for (otmp = invent; otmp; otmp = nobj) {
nobj = otmp->nobj;
if (otmp->oclass == COIN_CLASS) {
}
}
+/* #sit command */
int
dosit()
{
if (u.usteed) {
You("are already sitting on %s.", mon_nam(u.usteed));
- return (0);
+ return 0;
}
if (u.uundetected && is_hider(youmonst.data) && u.umonnum != PM_TRAPPER)
u.uundetected = 0; /* no longer on the ceiling */
goto in_water;
}
- if (OBJ_AT(u.ux, u.uy) &&
+ if (OBJ_AT(u.ux, u.uy)
/* ensure we're not standing on the precipice */
- !uteetering_at_seen_pit(trap)) {
+ && !uteetering_at_seen_pit(trap)) {
register struct obj *obj;
obj = level.objects[u.ux][u.uy];
} else {
pline("Having fun sitting on the %s?", surface(u.ux, u.uy));
}
- return (1);
+ return 1;
}
-void rndcurse() /* curse a few inventory items at random! */
+/* curse a few inventory items at random! */
+void
+rndcurse()
{
int nobj = 0;
int cnt, onum;
}
}
-void attrcurse() /* remove a random INTRINSIC ability */
+/* remove a random INTRINSIC ability */
+void
+attrcurse()
{
switch (rnd(11)) {
case 1:
break;
}
case 10:
+ /* intrinsic protection is just disabled, not set back to 0 */
if (HProtection & INTRINSIC) {
HProtection &= ~INTRINSIC;
You_feel("vulnerable.");
-/* NetHack 3.6 sounds.c $NHDT-Date: 1436753524 2015/07/13 02:12:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.69 $ */
+/* NetHack 3.6 sounds.c $NHDT-Date: 1445906863 2015/10/27 00:47:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
- if (is_mercenary(mtmp->data) &&
+ if (is_mercenary(mtmp->data)
#if 0 /* don't bother excluding these */
- !strstri(mtmp->data->mname, "watch") &&
- !strstri(mtmp->data->mname, "guard") &&
+ && !strstri(mtmp->data->mname, "watch")
+ && !strstri(mtmp->data->mname, "guard")
#endif
- mon_in_room(mtmp, BARRACKS) &&
+ && mon_in_room(mtmp, BARRACKS)
/* sleeping implies not-yet-disturbed (usually) */
- (mtmp->msleeping || ++count > 5)) {
+ && (mtmp->msleeping || ++count > 5)) {
You_hear1(barracks_msg[rn2(3) + hallu]);
return;
}
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
- if (mtmp->ispriest && inhistemple(mtmp) &&
+ if (mtmp->ispriest && inhistemple(mtmp)
/* priest must be active */
- mtmp->mcanmove && !mtmp->msleeping &&
+ && mtmp->mcanmove && !mtmp->msleeping
/* hero must be outside this temple */
- temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
+ && temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
break;
}
if (mtmp) {
/* result depends upon whether map spot shows a gecko, which will
be due to hallucination or to mimickery since mon isn't one */
glyph = glyph_at(mon->mx, mon->my);
- return (boolean)(glyph_to_mon(glyph) == PM_GECKO);
+ return (boolean) (glyph_to_mon(glyph) == PM_GECKO);
}
STATIC_OVL int
/* presumably nearness and sleep checks have already been made */
if (Deaf)
- return (0);
+ return 0;
if (is_silent(ptr))
- return (0);
+ return 0;
/* leader might be poly'd; if he can still speak, give leader speech */
if (mtmp->m_id == quest_status.leader_m_id && msound > MS_ANIMAL)
};
verbl_msg = mtmp->mpeaceful ? soldier_pax_msg[rn2(3)]
: soldier_foe_msg[rn2(3)];
- } break;
+ break;
+ }
case MS_RIDER:
/* 3.6.0 tribute */
- if (ptr == &mons[PM_DEATH] &&
- !context.tribute.Deathnotice && u_have_novel()) {
+ if (ptr == &mons[PM_DEATH]
+ && !context.tribute.Deathnotice && u_have_novel()) {
struct obj *book = u_have_novel();
const char *tribtitle = (char *)0;
if (book) {
int novelidx = book->novelidx;
+
tribtitle = noveltitle(&novelidx);
}
if (tribtitle) {
Sprintf(verbuf, "Ah, so you have a copy of /%s/.", tribtitle);
/* no Death featured in these two, so exclude them */
- if (!(strcmpi(tribtitle, "Snuff") == 0 ||
- strcmpi(tribtitle, "The Wee Free Men") == 0))
+ if (!(strcmpi(tribtitle, "Snuff") == 0
+ || strcmpi(tribtitle, "The Wee Free Men") == 0))
Strcat(verbuf, " I may have been misquoted there.");
verbl_msg = verbuf;
context.tribute.Deathnotice = 1;
}
- } else if (ptr == &mons[PM_DEATH] &&
- !rn2(2) && Death_quote(verbuf, BUFSZ)) {
+ } else if (ptr == &mons[PM_DEATH]
+ && !rn2(2) && Death_quote(verbuf, BUFSZ)) {
verbl_msg = verbuf;
}
/* end of tribute addition */
verbalize1(verbl_msg);
}
}
- return (1);
+ return 1;
}
+/* #chat command */
int
dotalk()
{
STATIC_OVL int
dochat()
{
- register struct monst *mtmp;
- register int tx, ty;
+ struct monst *mtmp;
+ int tx, ty;
struct obj *otmp;
if (is_silent(youmonst.data)) {
pline("As %s, you cannot speak.", an(youmonst.data->mname));
- return (0);
+ return 0;
}
if (Strangled) {
You_cant("speak. You're choking!");
- return (0);
+ return 0;
}
if (u.uswallow) {
pline("They won't hear you out there.");
- return (0);
+ return 0;
}
if (Underwater) {
Your("speech is unintelligible underwater.");
- return (0);
+ return 0;
}
if (Deaf) {
pline("How can you hold a conversation when you cannot hear?");
- return (0);
+ return 0;
}
if (!Blind && (otmp = shop_object(u.ux, u.uy)) != (struct obj *) 0) {
a shop, but that shouldn't matter much. shop_object() returns an
object iff inside a shop and the shopkeeper is present and willing
(not angry) and able (not asleep) to speak and the position
- contains
- any objects other than just gold.
+ contains any objects other than just gold.
*/
price_quote(otmp);
- return (1);
+ return 1;
}
if (!getdir("Talk to whom? (in what direction)")) {
/* decided not to chat */
- return (0);
+ return 0;
}
if (u.usteed && u.dz > 0) {
if (!u.usteed->mcanmove || u.usteed->msleeping) {
pline("%s seems not to notice you.", Monnam(u.usteed));
- return (1);
+ return 1;
} else
- return (domonnoise(u.usteed));
+ return domonnoise(u.usteed);
}
if (u.dz) {
pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
- return (0);
+ return 0;
}
if (u.dx == 0 && u.dy == 0) {
/*
- * Let's not include this. It raises all sorts of questions: can you
- wear
+ * Let's not include this.
+ * It raises all sorts of questions: can you wear
* 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
* etc... --KAA
- if (u.umonnum == PM_ETTIN) {
- You("discover that your other head makes boring
- conversation.");
- return(1);
- }
- */
+ if (u.umonnum == PM_ETTIN) {
+ You("discover that your other head makes boring conversation.");
+ return 1;
+ }
+ */
pline("Talking to yourself is a bad habit for a dungeoneer.");
- return (0);
+ return 0;
}
tx = u.ux + u.dx;
ty = u.uy + u.dy;
if (!isok(tx, ty))
- return (0);
+ return 0;
mtmp = m_at(tx, ty);
- if ((!mtmp || mtmp->mundetected) && (otmp = vobj_at(tx, ty))
- && otmp->otyp == STATUE) {
+ if ((!mtmp || mtmp->mundetected)
+ && (otmp = vobj_at(tx, ty)) != 0 && otmp->otyp == STATUE) {
/* Talking to a statue */
-
if (!Blind) {
- if (Hallucination) {
- /* if you're hallucinating, you can't tell it's a statue */
- pline_The("%s seems not to notice you.", rndmonnam(NULL));
- } else {
- pline_The("statue seems not to notice you.");
- }
+ pline_The("%s seems not to notice you.",
+ /* if hallucinating, you can't tell it's a statue */
+ Hallucination ? rndmonnam((char *) 0) : "statue");
}
- return (0);
+ return 0;
}
if (!mtmp || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE
|| mtmp->m_ap_type == M_AP_OBJECT)
- return (0);
+ return 0;
/* sleeping monsters won't talk, except priests (who wake up) */
if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) {
not noticing him and just not existing, so skip the message. */
if (canspotmon(mtmp))
pline("%s seems not to notice you.", Monnam(mtmp));
- return (0);
+ return 0;
}
/* if this monster is waiting for something, prod it into action */
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
pline("%s is eating noisily.", Monnam(mtmp));
- return (0);
+ return 0;
}
return domonnoise(mtmp);
-/* NetHack 3.6 sp_lev.c $NHDT-Date: 1444774496 2015/10/13 22:14:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 sp_lev.c $NHDT-Date: 1445906864 2015/10/27 00:47:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
solidify_map()
{
xchar x, y;
+
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
if (IS_STWALL(levl[x][y].typ) && !SpLev_Map[x][y])
if (st->depth >= st->depth_alloc) {
struct opvar **tmp = (struct opvar **) alloc(
(st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof(struct opvar *));
+
(void) memcpy(tmp, st->stackdata,
st->depth_alloc * sizeof(struct opvar *));
Free(st->stackdata);
struct splevstack *st;
{
struct opvar *ret = NULL;
+
if (!st)
return ret;
if (!st->stackdata)
{
long i;
struct opvar *tmp;
+
if (!st)
return NULL;
if (!st->stackdata)
struct splev_var *tmp;
struct opvar *tmpov;
struct opvar *array_idx = NULL;
+
if (!coder || !ov)
return NULL;
if (ov->spovartyp != SPOVAR_VARIABLE)
char *name;
{
struct splev_var *tmp;
+
if (!coder)
return NULL;
tmp = coder->frame->variables;
{
if (coder && coder->stack) {
struct opvar *tmp = splev_stack_pop(coder->stack);
+
if (!tmp)
panic("no value type %i in stack.", typ);
if (tmp->spovartyp == SPOVAR_VARIABLE)
/*
* Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able
*/
-
STATIC_OVL void
set_wall_property(x1, y1, x2, y2, prop)
xchar x1, y1, x2, y2;
{
int i;
aligntyp atmp;
+
/* shuffle 3 alignments */
i = rn2(3);
atmp = ralign[2];
count_features()
{
xchar x, y;
+
level.flags.nfountains = level.flags.nsinks = 0;
for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++) {
*/
xchar x, y;
boolean has_bounds = FALSE;
+
for (x = 0; x < COLNO - 1; x++)
for (y = 0; y < ROWNO - 1; y++)
if (levl[x][y].typ == CROSSWALL) {
{
int x, y;
int tmpi, m;
+
for (y = 0; y < ROWNO; y++)
for (x = 0; x < COLNO; x++)
if (IS_DOOR(levl[x][y].typ) || levl[x][y].typ == SDOOR) {
fill_rooms()
{
int tmpi;
+
for (tmpi = 0; tmpi < nroom; tmpi++) {
int m;
if (rooms[tmpi].needfill)
rnddoor()
{
int i = 1 << rn2(5);
+
i >>= 1;
return i;
}
} while (++cpt < 100);
if (cpt >= 100) {
register int xx, yy;
+
/* last try */
for (xx = 0; xx < sx; xx++)
for (yy = 0; yy < sy; yy++) {
long crd;
{
unpacked_coord c;
+
c = get_unpacked_coord(crd, humidity);
*x = c.x;
*y = c.y;
* Get a relative position inside a room.
* negative values for x or y means RANDOM!
*/
-
STATIC_OVL void
get_free_room_loc(x, y, croom, pos)
schar *x, *y;
* Create a new room.
* This is still very incomplete...
*/
-
boolean
create_room(x, y, w, h, xal, yal, rtype, rlit)
xchar x, y;
* Create a subroom in room proom at pos x,y with width w & height h.
* x & y are relative to the parent room.
*/
-
STATIC_OVL boolean
create_subroom(proom, x, y, w, h, rtype, rlit)
struct mkroom *proom;
* Create a new door in a room.
* It's placed on a wall (north, south, east or west).
*/
-
STATIC_OVL void
create_door(dd, broom)
room_door *dd;
/*
* Create a trap in a room.
*/
-
STATIC_OVL void
create_trap(t, croom)
trap *t;
/*
* Create a monster in a room.
*/
-
STATIC_OVL int
noncoalignment(alignment)
aligntyp alignment;
if (class == MAXMCLASSES)
panic("create_monster: unknown monster class '%c'", m->class);
- amask =
- (m->align == AM_SPLEV_CO)
- ? Align2amask(u.ualignbase[A_ORIGINAL])
- : (m->align == AM_SPLEV_NONCO)
+ amask = (m->align == AM_SPLEV_CO)
+ ? Align2amask(u.ualignbase[A_ORIGINAL])
+ : (m->align == AM_SPLEV_NONCO)
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
: (m->align <= -(MAX_REGISTERS + 1))
- ? induced_align(80)
- : (m->align < 0 ? ralign[-m->align - 1] : m->align);
+ ? induced_align(80)
+ : (m->align < 0 ? ralign[-m->align - 1] : m->align);
if (!class)
pm = (struct permonst *) 0;
switch (m->appear) {
case M_AP_NOTHING:
- impossible("create_monster: mon has an appearance, \"%s\", "
- "but no type",
+ impossible(
+ "create_monster: mon has an appearance, \"%s\", but no type",
m->appear_as.str);
break;
case M_AP_MONSTER: {
int mndx;
+
if (!strcmpi(m->appear_as.str, "random"))
mndx = select_newcham_form(mtmp);
else
if (!mtmp->perminvis || pm_invisible(olddata))
mtmp->perminvis = pm_invisible(mdat);
}
- } break;
+ break;
+ }
default:
impossible("create_monster: unimplemented mon appear type "
"[%d,\"%s\"]",
/*
* Create an object in a room.
*/
-
STATIC_OVL void
create_object(o, croom)
object *o;
otmp = oname(otmp, o->name.str);
if (o->eroded) {
- if (o->eroded < 0)
+ if (o->eroded < 0) {
otmp->oerodeproof = 1;
- else {
+ } else {
otmp->oeroded = (o->eroded % 4);
otmp->oeroded2 = ((o->eroded >> 2) % 4);
}
}
if (o->recharged)
otmp->recharged = (o->recharged % 8);
- if (o->locked)
+ if (o->locked) {
otmp->olocked = 1;
- else if (o->broken) {
+ } else if (o->broken) {
otmp->obroken = 1;
otmp->olocked = 0; /* obj generation may set */
}
otmp->oinvis = 1;
#endif
- if ((o->quan > 0) && objects[otmp->otyp].oc_merge) {
+ if (o->quan > 0 && objects[otmp->otyp].oc_merge) {
otmp->quan = o->quan;
otmp->owt = weight(otmp);
}
if (otmp->otyp == LUCKSTONE && Is_mineend_level(&u.uz)) {
otmp->record_achieve_special = 1;
} else if ((otmp->otyp == AMULET_OF_REFLECTION
- || otmp->otyp == BAG_OF_HOLDING) && Is_sokoend_level(&u.uz)) {
+ || otmp->otyp == BAG_OF_HOLDING)
+ && Is_sokoend_level(&u.uz)) {
otmp->record_achieve_special = 1;
}
if (o->buried) {
boolean dealloced;
+
(void) bury_an_obj(otmp, &dealloced);
if (dealloced && container_idx) {
container_obj[container_idx - 1] = NULL;
/*
* Create an altar in a room.
*/
-
STATIC_OVL void
create_altar(a, croom)
altar *a;
* values to avoid conflicting with the rest of the encoding,
* shared by many other parts of the special level code.
*/
-
- amask =
- (a->align == AM_SPLEV_CO)
- ? Align2amask(u.ualignbase[A_ORIGINAL])
- : (a->align == AM_SPLEV_NONCO)
+ amask = (a->align == AM_SPLEV_CO)
+ ? Align2amask(u.ualignbase[A_ORIGINAL])
+ : (a->align == AM_SPLEV_NONCO)
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
: (a->align == -(MAX_REGISTERS + 1))
- ? induced_align(80)
- : (a->align < 0 ? ralign[-a->align - 1] : a->align);
+ ? induced_align(80)
+ : (a->align < 0 ? ralign[-a->align - 1] : a->align);
levl[x][y].typ = ALTAR;
levl[x][y].altarmask = amask;
for (x = max(x1, 0); x <= min(x2, COLNO - 1); x++)
for (y = max(y1, 0); y <= min(y2, ROWNO - 1); y++)
- if ((levl[x][y].typ == terr->fromter)
- && (rn2(100) < terr->chance)) {
+ if (levl[x][y].typ == terr->fromter && rn2(100) < terr->chance) {
SET_TYPLIT(x, y, terr->toter, terr->tolit);
}
}
/*
* Search for a door in a room on a specified wall.
*/
-
STATIC_OVL boolean
search_door(croom, x, y, wall, cnt)
struct mkroom *croom;
/*
* Dig a corridor between two points.
*/
-
boolean
dig_corridor(org, dest, nxcor, ftyp, btyp)
coord *org, *dest;
boolean nxcor;
schar ftyp, btyp;
{
- register int dx = 0, dy = 0, dix, diy, cct;
- register struct rm *crm;
- register int tx, ty, xx, yy;
+ int dx = 0, dy = 0, dix, diy, cct;
+ struct rm *crm;
+ int tx, ty, xx, yy;
xx = org->x;
yy = org->y;
ty = dest->y;
if (xx <= 0 || yy <= 0 || tx <= 0 || ty <= 0 || xx > COLNO - 1
|| tx > COLNO - 1 || yy > ROWNO - 1 || ty > ROWNO - 1) {
- debugpline4("dig_corridor: bad coords <%d,%d> <%d,%d>.", xx, yy, tx,
- ty);
+ debugpline4("dig_corridor: bad coords <%d,%d> <%d,%d>.",
+ xx, yy, tx, ty);
return FALSE;
}
if (tx > xx)
* Basically we search for door coordinates or for endpoints coordinates
* (from a distance).
*/
-
STATIC_OVL void
create_corridor(c)
corridor *c;
/*
* Fill a room (shop, zoo, etc...) with appropriate stuff.
*/
-
void
fill_room(croom, prefilled)
struct mkroom *croom;
case VAULT:
for (x = croom->lx; x <= croom->hx; x++)
for (y = croom->ly; y <= croom->hy; y++)
- (void) mkgold((long) rn1(abs(depth(&u.uz)) * 100, 51), x,
- y);
+ (void) mkgold((long) rn1(abs(depth(&u.uz)) * 100, 51),
+ x, y);
break;
case COURT:
case ZOO:
* We want a place not 'touched' by the loader. That is, a place in
* the maze outside every part of the special level.
*/
-
STATIC_OVL void
maze1xy(m, humidity)
coord *m;
case SPOVAR_STRING:
case SPOVAR_SEL: {
char *opd;
+
Fread((genericptr_t) &nsize, 1, sizeof(nsize), fd);
opd = (char *) alloc(nsize + 1);
Fread(opd, 1, nsize, fd);
opd[nsize] = 0;
ov->vardata.str = opd;
- } break;
+ break;
+ }
default:
panic("sp_level_loader: unknown opvar type %i",
ov->spovartyp);
struct sp_coder *coder;
{
struct sp_frame *tmpframe = frame_new(coder->frame->n_opcode);
+
tmpframe->next = coder->frame;
coder->frame = tmpframe;
}
{
if (coder->frame && coder->frame->next) {
struct sp_frame *tmpframe = coder->frame->next;
+
frame_del(coder->frame);
coder->frame = tmpframe;
coder->stack = coder->frame->stack;
if (OV_i(params) < 0)
return;
- tmpframe =
- frame_new(sp_code_jmpaddr(coder->frame->n_opcode, OV_i(addr) - 1));
+ tmpframe = frame_new(sp_code_jmpaddr(coder->frame->n_opcode,
+ OV_i(addr) - 1));
while (OV_i(params)-- > 0) {
splev_stack_push(tmpframe->stack, splev_stack_getdat_any(coder));
{
static const char nhFunc[] = "spo_message";
struct opvar *op;
-
char *msg, *levmsg;
int old_n, n;
+
if (!OV_pop_s(op))
return;
msg = OV_s(op);
{
static const char nhFunc[] = "spo_monster";
int nparams = 0;
-
struct opvar *varparam;
struct opvar *id, *mcoord, *has_inv;
monster tmpmons;
if (OV_typ(parm) == SPOVAR_MONST) {
char monclass = SP_MONST_CLASS(OV_i(parm));
int monid = SP_MONST_PM(OV_i(parm));
+
if (monid >= 0 && monid < NUMMONS) {
tmpobj.corpsenm = monid;
break; /* we're done! */
struct sp_coder *coder;
{
static const char nhFunc[] = "spo_room";
+
if (coder->n_subroom > MAX_NESTED_ROOMS) {
panic("Too deeply nested rooms?!");
} else {
struct opvar *rflags, *h, *w, *yalign, *xalign, *y, *x, *rlit,
*chance, *rtype;
-
room tmproom;
struct mkroom *tmpcr;
{
struct opvar *ov;
int x, y;
- ov = selection_opvar(NULL);
+
+ ov = selection_opvar((char *) 0);
if (!ov)
return NULL;
struct opvar *ov;
int x, y;
- ov = selection_opvar(NULL);
+ ov = selection_opvar((char *) 0);
if (!ov)
return NULL;
int x, y;
schar mapc;
xchar lit;
- struct opvar *ret = selection_opvar(NULL);
+ struct opvar *ret = selection_opvar((char *) 0);
+
if (!ov || !mc || !ret)
return NULL;
mapc = SP_MAPCHAR_TYP(OV_i(mc));
int percent;
{
int x, y;
+
if (!ov)
return;
for (x = 0; x < COLNO; x++)
selection_setpoint(x, y, ov, 1);
}
-int (*selection_flood_check_func)(int, int) = NULL;
+STATIC_VAR int FDECL((*selection_flood_check_func), (int, int));
+STATIC_VAR schar floodfill_checker_match_under_typ;
void
set_selection_floodfill_checker(f)
-int (*f)(int, int);
+int FDECL((*f), (int, int));
{
selection_flood_check_func = f;
}
-static schar floodfill_checker_match_under_typ;
-
int
floodfill_checker_match_under(x,y)
int x,y;
}
int
-floodfill_checker_match_accessible(x,y)
-int x,y;
+floodfill_checker_match_accessible(x, y)
+int x, y;
{
return (ACCESSIBLE(levl[x][y].typ)
|| levl[x][y].typ == SDOOR
boolean diagonals;
{
static const char nhFunc[] = "selection_floodfill";
- struct opvar *tmp = selection_opvar(NULL);
+ struct opvar *tmp = selection_opvar((char *) 0);
#define SEL_FLOOD_STACK (COLNO * ROWNO)
#define SEL_FLOOD(nx, ny) \
do { \
int idx = 0;
xchar dx[SEL_FLOOD_STACK];
xchar dy[SEL_FLOOD_STACK];
+
if (selection_flood_check_func == NULL) {
opvar_free(tmp);
return;
selection_setpoint(dx, dy, ov, 1);
}
}
- } break;
+ break;
+ }
case SEL_GRADIENT_SQUARE: {
for (dx = 0; dx < COLNO; dx++)
for (dy = 0; dy < ROWNO; dy++) {
selection_setpoint(dx, dy, ov, 1);
}
}
- } break;
- }
+ break;
+ } /*case*/
+ } /*switch*/
}
-void selection_do_line(x1, y1, x2, y2, ov) /* bresenham line algo */
+/* bresenham line algo */
+void
+selection_do_line(x1, y1, x2, y2, ov)
schar x1, y1, x2, y2;
struct opvar *ov;
{
genericptr_t arg;
{
int x, y;
+
/* yes, this is very naive, but it's not _that_ expensive. */
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
genericptr_t arg;
{
terrain terr;
- terr = (*(terrain *) arg);
+
+ terr = *(terrain *) arg;
SET_TYPLIT(x, y, terr.ter, terr.tlit);
/* handle doors and secret doors */
if (levl[x][y].typ == SDOOR || IS_DOOR(levl[x][y].typ)) {
int dx, dy;
genericptr_t arg;
{
- xchar typ = (*(xchar *) arg);
+ xchar typ = *(xchar *) arg;
xchar x = dx;
xchar y = dy;
+
if (!IS_DOOR(levl[x][y].typ) && levl[x][y].typ != SDOOR)
levl[x][y].typ = (typ & D_SECRET) ? SDOOR : DOOR;
if (typ & D_SECRET) {
opvar_free(chance);
}
-
boolean
generate_way_out_method(nx,ny, ov)
int nx,ny;
WAN_TELEPORTATION,
SCR_TELEPORTATION,
RIN_TELEPORTATION };
- struct opvar *ov2 = selection_opvar(NULL), *ov3;
+ struct opvar *ov2 = selection_opvar((char *) 0), *ov3;
schar x, y;
boolean res = TRUE;
+
selection_floodfill(ov2, nx, ny, TRUE);
ov3 = opvar_clone(ov2);
/* try to make a secret door */
while (selection_rndcoord(ov3, &x, &y, TRUE)) {
- if (isok(x+1, y) && !selection_getpoint(x+1, y, ov) && IS_WALL(levl[x+1][y].typ) &&
- isok(x+2, y) && selection_getpoint(x+2, y, ov) && ACCESSIBLE(levl[x+2][y].typ)) {
+ if (isok(x+1, y) && !selection_getpoint(x+1, y, ov)
+ && IS_WALL(levl[x+1][y].typ)
+ && isok(x+2, y) && selection_getpoint(x+2, y, ov)
+ && ACCESSIBLE(levl[x+2][y].typ)) {
levl[x+1][y].typ = SDOOR;
goto gotitdone;
}
- if (isok(x-1, y) && !selection_getpoint(x-1, y, ov) && IS_WALL(levl[x-1][y].typ) &&
- isok(x-2, y) && selection_getpoint(x-2, y, ov) && ACCESSIBLE(levl[x-2][y].typ)) {
+ if (isok(x-1, y) && !selection_getpoint(x-1, y, ov)
+ && IS_WALL(levl[x-1][y].typ)
+ && isok(x-2, y) && selection_getpoint(x-2, y, ov)
+ && ACCESSIBLE(levl[x-2][y].typ)) {
levl[x-1][y].typ = SDOOR;
goto gotitdone;
}
- if (isok(x, y+1) && !selection_getpoint(x, y+1, ov) && IS_WALL(levl[x][y+1].typ) &&
- isok(x, y+2) && selection_getpoint(x, y+2, ov) && ACCESSIBLE(levl[x][y+2].typ)) {
+ if (isok(x, y+1) && !selection_getpoint(x, y+1, ov)
+ && IS_WALL(levl[x][y+1].typ)
+ && isok(x, y+2) && selection_getpoint(x, y+2, ov)
+ && ACCESSIBLE(levl[x][y+2].typ)) {
levl[x][y+1].typ = SDOOR;
goto gotitdone;
}
- if (isok(x, y-1) && !selection_getpoint(x, y-1, ov) && IS_WALL(levl[x][y-1].typ) &&
- isok(x, y-2) && selection_getpoint(x, y-2, ov) && ACCESSIBLE(levl[x][y-2].typ)) {
+ if (isok(x, y-1) && !selection_getpoint(x, y-1, ov)
+ && IS_WALL(levl[x][y-1].typ)
+ && isok(x, y-2) && selection_getpoint(x, y-2, ov)
+ && ACCESSIBLE(levl[x][y-2].typ)) {
levl[x][y-1].typ = SDOOR;
goto gotitdone;
}
return res;
}
-
void
ensure_way_out()
{
static const char nhFunc[] = "ensure_way_out";
- struct opvar *ov = selection_opvar(NULL);
+ struct opvar *ov = selection_opvar((char *) 0);
struct trap *ttmp = ftrap;
int x,y;
boolean ret = TRUE;
static const char nhFunc[] = "spo_wall_property";
struct opvar *r;
xchar dx1, dy1, dx2, dy2;
- int wprop =
- (coder->opcode == SPO_NON_DIGGABLE) ? W_NONDIGGABLE : W_NONPASSWALL;
+ int wprop = (coder->opcode == SPO_NON_DIGGABLE)
+ ? W_NONDIGGABLE
+ : W_NONPASSWALL;
if (!OV_pop_r(r))
return;
return;
switch (OV_i(typ)) {
default:
- case 0: {
+ case 0:
if (!OV_pop_r(r))
return;
dx1 = (xchar) SP_REGION_X1(OV_i(r));
wallify_map(dx1 < 0 ? xstart : dx1, dy1 < 0 ? ystart : dy1,
dx2 < 0 ? xstart + xsize : dx2,
dy2 < 0 ? ystart + ysize : dy2);
- } break;
- case 1: {
+ break;
+ case 1:
if (!OV_pop_typ(r, SPOVAR_SEL))
return;
selection_iterate(r, sel_set_wallify, NULL);
- } break;
+ break;
}
opvar_free(r);
}
static const char nhFunc[] = "spo_jmp";
struct opvar *tmpa;
long a;
+
if (!OV_pop_i(tmpa))
return;
a = sp_code_jmpaddr(coder->frame->n_opcode, (OV_i(tmpa) - 1));
break;
case SPO_POP: {
struct opvar *ov = splev_stack_pop(coder->stack);
+
opvar_free(ov);
- } break;
+ break;
+ }
case SPO_PUSH:
splev_stack_push(coder->stack, opvar_clone(coder->opdat));
break;
break;
case SPO_COPY: {
struct opvar *a = splev_stack_pop(coder->stack);
+
splev_stack_push(coder->stack, opvar_clone(a));
splev_stack_push(coder->stack, opvar_clone(a));
opvar_free(a);
- } break;
+ break;
+ }
case SPO_DEC: {
struct opvar *a;
+
if (!OV_pop_i(a))
break;
OV_i(a)--;
splev_stack_push(coder->stack, a);
- } break;
+ break;
+ }
case SPO_INC: {
struct opvar *a;
+
if (!OV_pop_i(a))
break;
OV_i(a)++;
splev_stack_push(coder->stack, a);
- } break;
+ break;
+ }
case SPO_MATH_SIGN: {
struct opvar *a;
+
if (!OV_pop_i(a))
break;
OV_i(a) = ((OV_i(a) < 0) ? -1 : ((OV_i(a) > 0) ? 1 : 0));
splev_stack_push(coder->stack, a);
- } break;
+ break;
+ }
case SPO_MATH_ADD: {
struct opvar *a, *b;
+
if (!OV_pop(b) || !OV_pop(a))
break;
if (OV_typ(b) == OV_typ(a)) {
opvar_free(b);
} else if (OV_typ(a) == SPOVAR_STRING) {
struct opvar *c;
- char *tmpbuf =
- (char *) alloc(strlen(OV_s(a)) + strlen(OV_s(b)) + 1);
+ char *tmpbuf = (char *) alloc(strlen(OV_s(a))
+ + strlen(OV_s(b)) + 1);
+
(void) sprintf(tmpbuf, "%s%s", OV_s(a), OV_s(b));
c = opvar_new_str(tmpbuf);
splev_stack_push(coder->stack, c);
opvar_free(b);
impossible("adding different types");
}
- } break;
+ break;
+ }
case SPO_MATH_SUB: {
struct opvar *a, *b;
+
if (!OV_pop_i(b) || !OV_pop_i(a))
break;
OV_i(a) = OV_i(a) - OV_i(b);
splev_stack_push(coder->stack, a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_MATH_MUL: {
struct opvar *a, *b;
+
if (!OV_pop_i(b) || !OV_pop_i(a))
break;
OV_i(a) = OV_i(a) * OV_i(b);
splev_stack_push(coder->stack, a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_MATH_DIV: {
struct opvar *a, *b;
+
if (!OV_pop_i(b) || !OV_pop_i(a))
break;
if (OV_i(b) >= 1) {
}
splev_stack_push(coder->stack, a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_MATH_MOD: {
struct opvar *a, *b;
+
if (!OV_pop_i(b) || !OV_pop_i(a))
break;
if (OV_i(b) > 0) {
}
splev_stack_push(coder->stack, a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_CMP: {
struct opvar *a;
struct opvar *b;
OV_pop(b);
OV_pop(a);
-
if (!a || !b) {
impossible("spo_cmp: no values in stack");
break;
}
-
if (OV_typ(a) != OV_typ(b)) {
impossible("spo_cmp: trying to compare differing datatypes");
break;
}
-
switch (OV_typ(a)) {
case SPOVAR_COORD:
case SPOVAR_REGION:
c = opvar_new_int(val);
break;
case SPOVAR_STRING:
- c = opvar_new_int(
- ((!strcmp(OV_s(b), OV_s(a))) ? SP_CPUFLAG_EQ : 0));
+ c = opvar_new_int(!strcmp(OV_s(b), OV_s(a))
+ ? SP_CPUFLAG_EQ
+ : 0);
break;
default:
c = opvar_new_int(0);
splev_stack_push(coder->stack, c);
opvar_free(a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_JMP:
spo_jmp(coder, lvl);
break;
case SPO_RN2: {
struct opvar *tmpv;
struct opvar *t;
+
if (!OV_pop_i(tmpv))
break;
t = opvar_new_int((OV_i(tmpv) > 1) ? rn2(OV_i(tmpv)) : 0);
splev_stack_push(coder->stack, t);
opvar_free(tmpv);
- } break;
+ break;
+ }
case SPO_DICE: {
struct opvar *a, *b, *t;
+
if (!OV_pop_i(b) || !OV_pop_i(a))
break;
if (OV_i(b) < 1)
splev_stack_push(coder->stack, t);
opvar_free(a);
opvar_free(b);
- } break;
+ break;
+ }
case SPO_MAP:
spo_map(coder);
break;
case SPO_SEL_ADD: /* actually, logical or */
{
struct opvar *sel1, *sel2, *pt;
+
if (!OV_pop_typ(sel1, SPOVAR_SEL))
panic("no sel1 for add");
if (!OV_pop_typ(sel2, SPOVAR_SEL))
opvar_free(sel1);
opvar_free(sel2);
splev_stack_push(coder->stack, pt);
- } break;
+ break;
+ }
case SPO_SEL_COMPLEMENT: {
struct opvar *sel, *pt;
+
if (!OV_pop_typ(sel, SPOVAR_SEL))
panic("no sel for not");
pt = selection_not(sel);
opvar_free(sel);
splev_stack_push(coder->stack, pt);
- } break;
+ break;
+ }
case SPO_SEL_FILTER: /* sorta like logical and */
{
struct opvar *filtertype;
+
if (!OV_pop_i(filtertype))
panic("no sel filter type");
switch (OV_i(filtertype)) {
case SPOFILTER_PERCENT: {
struct opvar *tmp1, *sel;
+
if (!OV_pop_i(tmp1))
panic("no sel filter percent");
if (!OV_pop_typ(sel, SPOVAR_SEL))
selection_filter_percent(sel, OV_i(tmp1));
splev_stack_push(coder->stack, sel);
opvar_free(tmp1);
- } break;
+ break;
+ }
case SPOFILTER_SELECTION: /* logical and */
{
struct opvar *pt, *sel1, *sel2;
+
if (!OV_pop_typ(sel1, SPOVAR_SEL))
panic("no sel filter sel1");
if (!OV_pop_typ(sel2, SPOVAR_SEL))
splev_stack_push(coder->stack, pt);
opvar_free(sel1);
opvar_free(sel2);
- } break;
+ break;
+ }
case SPOFILTER_MAPCHAR: {
struct opvar *pt, *tmp1, *sel;
+
if (!OV_pop_typ(sel, SPOVAR_SEL))
panic("no sel filter");
if (!OV_pop_typ(tmp1, SPOVAR_MAPCHAR))
splev_stack_push(coder->stack, pt);
opvar_free(tmp1);
opvar_free(sel);
- } break;
+ break;
+ }
default:
panic("unknown sel filter type");
}
opvar_free(filtertype);
- } break;
+ break;
+ }
case SPO_SEL_POINT: {
struct opvar *tmp;
- struct opvar *pt = selection_opvar(NULL);
+ struct opvar *pt = selection_opvar((char *) 0);
schar x, y;
+
if (!OV_pop_c(tmp))
panic("no ter sel coord");
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(tmp));
selection_setpoint(x, y, pt, 1);
splev_stack_push(coder->stack, pt);
opvar_free(tmp);
- } break;
+ break;
+ }
case SPO_SEL_RECT:
case SPO_SEL_FILLRECT: {
- struct opvar *tmp, *pt = selection_opvar(NULL);
+ struct opvar *tmp, *pt = selection_opvar((char *) 0);
schar x, y, x1, y1, x2, y2;
+
if (!OV_pop_r(tmp))
panic("no ter sel region");
x1 = min(SP_REGION_X1(OV_i(tmp)), SP_REGION_X2(OV_i(tmp)));
}
splev_stack_push(coder->stack, pt);
opvar_free(tmp);
- } break;
+ break;
+ }
case SPO_SEL_LINE: {
struct opvar *tmp = NULL, *tmp2 = NULL,
- *pt = selection_opvar(NULL);
+ *pt = selection_opvar((char *) 0);
schar x1, y1, x2, y2;
+
if (!OV_pop_c(tmp))
panic("no ter sel linecoord1");
if (!OV_pop_c(tmp2))
splev_stack_push(coder->stack, pt);
opvar_free(tmp);
opvar_free(tmp2);
- } break;
+ break;
+ }
case SPO_SEL_RNDLINE: {
struct opvar *tmp = NULL, *tmp2 = NULL, *tmp3,
- *pt = selection_opvar(NULL);
+ *pt = selection_opvar((char *) 0);
schar x1, y1, x2, y2;
+
if (!OV_pop_i(tmp3))
panic("no ter sel randline1");
if (!OV_pop_c(tmp))
opvar_free(tmp);
opvar_free(tmp2);
opvar_free(tmp3);
- } break;
+ break;
+ }
case SPO_SEL_GROW: {
struct opvar *dirs, *pt;
+
if (!OV_pop_i(dirs))
panic("no dirs for grow");
if (!OV_pop_typ(pt, SPOVAR_SEL))
selection_do_grow(pt, OV_i(dirs));
splev_stack_push(coder->stack, pt);
opvar_free(dirs);
- } break;
+ break;
+ }
case SPO_SEL_FLOOD: {
struct opvar *tmp;
schar x, y;
+
if (!OV_pop_c(tmp))
panic("no ter sel flood coord");
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(tmp));
if (isok(x, y)) {
- struct opvar *pt = selection_opvar(NULL);
+ struct opvar *pt = selection_opvar((char *) 0);
+
set_selection_floodfill_checker(floodfill_checker_match_under);
floodfill_checker_match_under_typ = levl[x][y].typ;
selection_floodfill(pt, x, y, FALSE);
splev_stack_push(coder->stack, pt);
}
opvar_free(tmp);
- } break;
+ break;
+ }
case SPO_SEL_RNDCOORD: {
struct opvar *pt;
schar x, y;
+
if (!OV_pop_typ(pt, SPOVAR_SEL))
panic("no selection for rndcoord");
if (selection_rndcoord(pt, &x, &y, FALSE)) {
}
splev_stack_push(coder->stack, opvar_new_coord(x, y));
opvar_free(pt);
- } break;
+ break;
+ }
case SPO_SEL_ELLIPSE: {
struct opvar *filled, *xaxis, *yaxis, *pt;
- struct opvar *sel = selection_opvar(NULL);
+ struct opvar *sel = selection_opvar((char *) 0);
schar x, y;
+
if (!OV_pop_i(filled))
panic("no filled for ellipse");
if (!OV_pop_i(yaxis))
opvar_free(yaxis);
opvar_free(xaxis);
opvar_free(pt);
- } break;
+ break;
+ }
case SPO_SEL_GRADIENT: {
struct opvar *gtyp, *glim, *mind, *maxd, *gcoord, *coord2;
struct opvar *sel;
schar x, y, x2, y2;
+
if (!OV_pop_i(gtyp))
panic("no gtyp for grad");
if (!OV_pop_i(glim))
get_location_coord(&x, &y, ANY_LOC, coder->croom, OV_i(gcoord));
get_location_coord(&x2, &y2, ANY_LOC, coder->croom, OV_i(coord2));
- sel = selection_opvar(NULL);
+ sel = selection_opvar((char *) 0);
selection_do_gradient(sel, x, y, x2, y2, OV_i(gtyp), OV_i(mind),
OV_i(maxd), OV_i(glim));
splev_stack_push(coder->stack, sel);
opvar_free(coord2);
opvar_free(maxd);
opvar_free(mind);
- } break;
+ break;
+ }
default:
panic("sp_level_coder: Unknown opcode %i", coder->opcode);
}
/*
* General loader
*/
-
boolean
load_special(name)
const char *name;
-/* NetHack 3.6 spell.c $NHDT-Date: 1444295991 2015/10/08 09:19:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
+/* NetHack 3.6 spell.c $NHDT-Date: 1445906865 2015/10/27 00:47:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */
* Reasoning:
* spelbase, spelheal:
* Arc are aware of magic through historical research
- * Bar abhor magic (Conan finds it "interferes with his animal
- *instincts")
+ * Bar abhor magic (Conan finds it "interferes with his animal instincts")
* Cav are ignorant to magic
* Hea are very aware of healing magic through medical research
* Kni are moderately aware of healing from Paladin training
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
- return (0);
+ return 0;
}
if (context
.spbook.delay) { /* not if (context.spbook.delay++), so at end
delay == 0 */
context.spbook.delay++;
- return (1); /* still busy */
+ return 1; /* still busy */
}
exercise(A_WIS, TRUE); /* you're studying. */
booktype = book->otyp;
if (booktype == SPE_BOOK_OF_THE_DEAD) {
deadbook(book);
- return (0);
+ return 0;
}
Sprintf(splname,
check_unpaid(book);
context.spbook.book = 0;
context.spbook.o_id = 0;
- return (0);
+ return 0;
}
int
}
if (context.spbook.delay && !confused && spellbook == context.spbook.book
- &&
- /* handle the sequence: start reading, get interrupted,
- have context.spbook.book become erased somehow, resume reading it
- */
- booktype != SPE_BLANK_PAPER) {
- You("continue your efforts to %s.", (booktype == SPE_NOVEL)
- ? "read the novel"
- : "memorize the spell");
+ /* handle the sequence: start reading, get interrupted, have
+ context.spbook.book become erased somehow, resume reading it */
+ && booktype != SPE_BLANK_PAPER) {
+ You("continue your efforts to %s.",
+ (booktype == SPE_NOVEL) ? "read the novel" : "memorize the spell");
} else {
/* KMH -- Simplified this code */
if (booktype == SPE_BLANK_PAPER) {
pline("This spellbook is all blank.");
makeknown(booktype);
- return (1);
+ return 1;
}
/* 3.6.0 tribute */
u.uevent.read_tribute = 1; /* only once */
}
}
- return (1);
+ return 1;
}
switch (objects[booktype].oc_level) {
(read_ability < 12 ? "very " : ""));
if (yn(qbuf) != 'y') {
spellbook->in_use = FALSE;
- return (1);
+ return 1;
}
}
/* its up to random luck now */
useup(spellbook);
} else
spellbook->in_use = FALSE;
- return (1);
+ return 1;
} else if (confused) {
if (!confused_book(spellbook)) {
spellbook->in_use = FALSE;
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
- return (1);
+ return 1;
}
spellbook->in_use = FALSE;
if (context.spbook.book)
context.spbook.o_id = context.spbook.book->o_id;
set_occupation(learn, "studying", 0);
- return (1);
+ return 1;
}
/* a spellbook has been destroyed or the character has changed levels;
spell_skilltype(booktype)
int booktype;
{
- return (objects[booktype].oc_skill);
+ return objects[booktype].oc_skill;
}
STATIC_OVL void
Your("knowledge of this spell is twisted.");
pline("It invokes nightmarish images in your mind...");
spell_backfire(spell);
- return (0);
+ return 0;
} else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */
You("strain to recall the spell.");
} else if (spellknow(spell) <= KEEN / 40) { /* 500 turns left */
if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) {
You("are too hungry to cast that spell.");
- return (0);
+ return 0;
} else if (ACURR(A_STR) < 4 && spellid(spell) != SPE_RESTORE_ABILITY) {
You("lack the strength to cast spells.");
- return (0);
+ return 0;
} else if (check_capacity("Your concentration falters while carrying so "
"much stuff.")) {
- return (1);
+ return 1;
} else if (!freehand()) {
Your("arms are not free to cast!");
- return (0);
+ return 0;
}
if (u.uhave.amulet) {
}
if (energy > u.uen) {
You("don't have enough energy to cast that spell.");
- return (0);
+ return 0;
} else {
if (spellid(spell) != SPE_DETECT_FOOD) {
int hungr = energy * 2;
You("fail to cast the spell correctly.");
u.uen -= energy / 2;
context.botl = 1;
- return (1);
+ return 1;
}
u.uen -= energy;
pseudo = mksobj(spellid(spell), FALSE, FALSE);
pseudo->blessed = pseudo->cursed = 0;
pseudo->quan = 20L; /* do not let useup get it */
- /*
- * Find the skill the hero has in a spell type category.
- * See spell_skilltype for categories.
- */
+ /*
+ * Find the skill the hero has in a spell type category.
+ * See spell_skilltype for categories.
+ */
skill = spell_skilltype(pseudo->otyp);
role_skill = P_SKILL(skill);
losehp(damage, buf, NO_KILLER_PREFIX);
}
} else {
- explode(
- u.dx, u.dy, pseudo->otyp - SPE_MAGIC_MISSILE + 10,
- spell_damage_bonus(u.ulevel / 2 + 1), 0,
- (pseudo->otyp == SPE_CONE_OF_COLD) ? EXPL_FROSTY
- : EXPL_FIERY);
+ explode(u.dx, u.dy,
+ pseudo->otyp - SPE_MAGIC_MISSILE + 10,
+ spell_damage_bonus(u.ulevel / 2 + 1), 0,
+ (pseudo->otyp == SPE_CONE_OF_COLD)
+ ? EXPL_FROSTY
+ : EXPL_FIERY);
}
u.dx = cc.x + rnd(3) - 2;
u.dy = cc.y + rnd(3) - 2;
default:
impossible("Unknown spell %d attempted.", spell);
obfree(pseudo, (struct obj *) 0);
- return (0);
+ return 0;
}
/* gain skill for successful cast */
use_skill(skill, spellev(spell));
obfree(pseudo, (struct obj *) 0); /* now, get rid of it */
- return (1);
+ return 1;
}
/* Choose location where spell takes effect. */
-/* NetHack 3.6 steal.c $NHDT-Date: 1437877184 2015/07/26 02:19:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 steal.c $NHDT-Date: 1445906866 2015/10/27 00:47:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
*objnambuf = '\0';
/* the following is true if successful on first of two attacks. */
if (!monnear(mtmp, u.ux, u.uy))
- return (0);
+ return 0;
/* food being eaten might already be used up but will not have
been removed from inventory yet; we don't want to steal that,
else
pline("%s tries to rob you, but there is nothing to steal!",
Monnam(mtmp));
- return (1); /* let her flee */
+ return 1; /* let her flee */
}
monkey_business = is_animal(mtmp->data);
}
if (!otmp) {
impossible("Steal fails!");
- return (0);
+ return 0;
}
/* can't steal ring(s) while wearing gloves */
if ((otmp == uleft || otmp == uright) && uarmg)
gotobj:
if (otmp->o_id == stealoid)
- return (0);
+ return 0;
if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) {
if (!retrycnt++)
else if (otmp == uquiver || (otmp == uswapwep && !u.twoweap))
ostuck = FALSE; /* not really worn; curse doesn't matter */
else
- ostuck = ((otmp->cursed && otmp->owornmask) ||
+ ostuck = ((otmp->cursed && otmp->owornmask)
/* nymphs can steal rings from under
cursed weapon but animals can't */
- (otmp == uright && welded(uwep))
+ || (otmp == uright && welded(uwep))
|| (otmp == uleft && welded(uwep) && bimanual(uwep)));
if (ostuck || can_carry(mtmp, otmp) == 0) {
stealoid = otmp->o_id;
stealmid = mtmp->m_id;
afternmv = stealarm;
- return (0);
+ return 0;
}
}
break;
minstapetrify(mtmp, TRUE);
return -1;
}
- return ((multi < 0) ? 0 : 1);
+ return (multi < 0) ? 0 : 1;
}
/* Returns 1 if otmp is free'd, 0 otherwise. */
/* don't charge for an owned saddle on dead steed (provided
that the hero is within the same shop at the time) */
} else if (mon->mtame && (obj->owornmask & W_SADDLE) && !obj->unpaid
- && costly_spot(omx, omy) &&
- /* being at a costly_spot guarantees lev->roomno is not 0
- */
- index(in_rooms(u.ux, u.uy, SHOPBASE),
- levl[omx][omy].roomno)) {
+ && costly_spot(omx, omy)
+ /* being at costly_spot guarantees lev->roomno is not 0 */
+ && index(in_rooms(u.ux, u.uy, SHOPBASE),
+ levl[omx][omy].roomno)) {
obj->no_charge = 1;
}
/* this should be done even if the monster has died */
-/* NetHack 3.6 steed.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */
+/* NetHack 3.6 steed.c $NHDT-Date: 1445906867 2015/10/27 00:47:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */
struct monst *mon;
int x, y;
{
- if (mon == u.usteed ||
+ if (mon == u.usteed
/* special case is for convoluted vault guard handling */
- (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
+ || (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
impossible("placing %s onto map?",
(mon == u.usteed) ? "steed" : "defunct monster");
return;