formatting: src/r*.c - src/s*.c continuation lines

This commit is contained in:
PatR
2015-10-26 17:49:40 -07:00
parent 3fd92e3ef8
commit bb09cab067
9 changed files with 454 additions and 373 deletions

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -831,8 +831,8 @@ genericptr_t p2;
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 {

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -809,13 +809,13 @@ boolean
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
@@ -871,8 +871,9 @@ validrace(rolenum, racenum)
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
@@ -895,11 +896,11 @@ int rolenum;
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
@@ -936,9 +937,9 @@ validgend(rolenum, racenum, gendnum)
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
@@ -962,11 +963,11 @@ int rolenum, racenum;
if (n)
n--;
else
return (i);
return i;
}
/* This role/race has no permitted genders? */
return (rn2(ROLE_GENDERS));
return rn2(ROLE_GENDERS);
}
int
@@ -1002,9 +1003,9 @@ validalign(rolenum, racenum, alignnum)
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
@@ -1028,11 +1029,11 @@ int rolenum, racenum;
if (n)
n--;
else
return (i);
return i;
}
/* This role/race has no permitted alignments? */
return (rn2(ROLE_ALIGNS));
return rn2(ROLE_ALIGNS);
}
int
@@ -2121,23 +2122,21 @@ struct monst *mtmp;
{
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";
}
}
@@ -2146,15 +2145,15 @@ Goodbye()
{
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";
}
}

178
src/shk.c
View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -175,7 +175,7 @@ register boolean withbill;
rile_shk(shkp);
}
}
return (shkp);
return shkp;
}
void shkgone(mtmp) /* called in mon.c */
@@ -316,7 +316,7 @@ register struct monst *shkp;
total += bp->price * bp->bquan;
bp++;
}
return (total);
return total;
}
STATIC_OVL void
@@ -381,9 +381,9 @@ register xchar x, y;
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
@@ -713,8 +713,8 @@ shopper_financial_report()
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 */
}
@@ -744,9 +744,10 @@ int
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 *
@@ -775,9 +776,9 @@ register struct mkroom *sroom;
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 *
@@ -808,7 +809,8 @@ boolean
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. */
@@ -905,9 +907,9 @@ register struct monst *shkp;
{
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;
@@ -916,7 +918,7 @@ register struct monst *shkp;
ESHK(shkp)->credit = 0L;
tmp -= credit;
}
return (tmp);
return tmp;
}
STATIC_OVL void
@@ -965,8 +967,8 @@ angry_shk_exists()
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 */
@@ -1143,7 +1145,7 @@ register struct monst *shkp;
gmin = bp->price * bp->bquan;
bp++;
}
return (gmin);
return gmin;
}
int
@@ -1180,12 +1182,12 @@ dopay()
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 */
@@ -1203,7 +1205,7 @@ dopay()
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;
@@ -1219,31 +1221,31 @@ dopay()
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);
@@ -1284,7 +1286,7 @@ proceed:
else
make_happy_shk(shkp, FALSE);
}
return (1);
return 1;
}
/* ltmp is still eshkp->robbed here */
@@ -1301,7 +1303,7 @@ proceed:
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.",
@@ -1318,7 +1320,7 @@ proceed:
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));
@@ -1328,13 +1330,13 @@ proceed:
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) {
@@ -1357,7 +1359,7 @@ proceed:
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;
@@ -1391,14 +1393,14 @@ proceed:
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
@@ -1464,7 +1466,7 @@ proceed:
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 */
@@ -1760,7 +1762,7 @@ int croaked;
clear:
shkp->minvis = save_minvis;
setpaid(shkp);
return (taken);
return taken;
}
STATIC_OVL void
@@ -2050,7 +2052,7 @@ register struct obj *obj;
else if (Has_contents(otmp))
value += contained_gold(otmp);
return (value);
return value;
}
STATIC_OVL void
@@ -2630,7 +2632,7 @@ boolean ininv;
price = stolen_container(otmp, shkp, price, ininv);
}
return (price);
return price;
}
long
@@ -2673,7 +2675,7 @@ boolean peaceful, silent;
}
if (gvalue + value == 0L)
return (0L);
return 0L;
value += gvalue;
@@ -2722,7 +2724,7 @@ boolean peaceful, silent;
hot_pursuit(shkp);
(void) angry_guards(FALSE);
}
return (value);
return value;
}
/* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */
@@ -3094,7 +3096,7 @@ int mode; /* 0: deliver count 1: paged */
display_nhwindow(datawin, FALSE);
quit:
destroy_nhwindow(datawin);
return (0);
return 0;
}
#define HUNGRY 2
@@ -3150,13 +3152,13 @@ register xchar x, y;
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)) {
@@ -3271,9 +3273,9 @@ boolean croaked;
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++;
@@ -3356,24 +3358,24 @@ boolean catchup; /* restoring a level */
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,
@@ -3391,16 +3393,16 @@ boolean catchup; /* restoring a level */
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) {
@@ -3466,7 +3468,7 @@ boolean catchup; /* restoring a level */
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
@@ -3500,7 +3502,7 @@ register struct monst *shkp;
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)) {
@@ -3508,7 +3510,7 @@ register struct monst *shkp;
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))
@@ -3522,7 +3524,7 @@ register struct monst *shkp;
}
}
if (udist < 2)
return (0);
return 0;
}
}
@@ -3539,7 +3541,7 @@ register struct monst *shkp;
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)) {
@@ -3561,7 +3563,7 @@ register struct monst *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);
@@ -3571,7 +3573,7 @@ register struct monst *shkp;
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;
}
@@ -3606,7 +3608,7 @@ boolean
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. */
@@ -3896,17 +3898,17 @@ boolean
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
@@ -3925,8 +3927,8 @@ register xchar x, y;
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;
}
@@ -4121,7 +4123,7 @@ boolean altusage; /* some items have an "alternate" use with different cost */
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 */
@@ -4164,7 +4166,7 @@ boolean altusage; /* some items have an "alternate" use with different cost */
} else if (otmp->otyp == POT_OIL) {
tmp /= 5L;
}
return (tmp);
return tmp;
}
/* Charge the player for partial use of an unpaid object.
@@ -4273,14 +4275,14 @@ register xchar x, y;
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_
@@ -4293,9 +4295,9 @@ register xchar x, y;
&& (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 */
@@ -4310,16 +4312,16 @@ register xchar x, y;
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;
@@ -4330,9 +4332,9 @@ register xchar x, 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) */

View File

@@ -1,15 +1,18 @@
/* 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) {
@@ -26,6 +29,7 @@ take_gold()
}
}
/* #sit command */
int
dosit()
{
@@ -35,7 +39,7 @@ 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 */
@@ -60,9 +64,9 @@ dosit()
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];
@@ -306,10 +310,12 @@ dosit()
} 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;
@@ -377,7 +383,9 @@ void rndcurse() /* curse a few inventory items at random! */
}
}
void attrcurse() /* remove a random INTRINSIC ability */
/* remove a random INTRINSIC ability */
void
attrcurse()
{
switch (rnd(11)) {
case 1:
@@ -438,6 +446,7 @@ void attrcurse() /* remove a random INTRINSIC ability */
break;
}
case 10:
/* intrinsic protection is just disabled, not set back to 0 */
if (HProtection & INTRINSIC) {
HProtection &= ~INTRINSIC;
You_feel("vulnerable.");

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -180,14 +180,14 @@ dosounds()
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;
}
@@ -229,11 +229,11 @@ dosounds()
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) {
@@ -483,7 +483,7 @@ struct monst *mon;
/* 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
@@ -499,9 +499,9 @@ register struct monst *mtmp;
/* 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)
@@ -904,29 +904,31 @@ register struct monst *mtmp;
};
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 */
@@ -952,9 +954,10 @@ register struct monst *mtmp;
verbalize1(verbl_msg);
}
}
return (1);
return 1;
}
/* #chat command */
int
dotalk()
{
@@ -967,29 +970,29 @@ 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) {
@@ -998,73 +1001,67 @@ dochat()
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) {
@@ -1072,7 +1069,7 @@ dochat()
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 */
@@ -1082,7 +1079,7 @@ dochat()
if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my);
pline("%s is eating noisily.", Monnam(mtmp));
return (0);
return 0;
}
return domonnoise(mtmp);

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -49,8 +49,7 @@ STATIC_DCL const char *FDECL(spelltypemnemonic, (int));
* 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
@@ -343,19 +342,19 @@ learn(VOID_ARGS)
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,
@@ -419,7 +418,7 @@ learn(VOID_ARGS)
check_unpaid(book);
context.spbook.book = 0;
context.spbook.o_id = 0;
return (0);
return 0;
}
int
@@ -453,20 +452,17 @@ register struct obj *spellbook;
}
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 */
@@ -483,7 +479,7 @@ register struct obj *spellbook;
u.uevent.read_tribute = 1; /* only once */
}
}
return (1);
return 1;
}
switch (objects[booktype].oc_level) {
@@ -529,7 +525,7 @@ register struct obj *spellbook;
(read_ability < 12 ? "very " : ""));
if (yn(qbuf) != 'y') {
spellbook->in_use = FALSE;
return (1);
return 1;
}
}
/* its up to random luck now */
@@ -555,7 +551,7 @@ register struct obj *spellbook;
useup(spellbook);
} else
spellbook->in_use = FALSE;
return (1);
return 1;
} else if (confused) {
if (!confused_book(spellbook)) {
spellbook->in_use = FALSE;
@@ -564,7 +560,7 @@ register struct obj *spellbook;
multi_reason = "reading a book";
nomovemsg = 0;
context.spbook.delay = 0;
return (1);
return 1;
}
spellbook->in_use = FALSE;
@@ -576,7 +572,7 @@ register struct obj *spellbook;
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;
@@ -714,7 +710,7 @@ int
spell_skilltype(booktype)
int booktype;
{
return (objects[booktype].oc_skill);
return objects[booktype].oc_skill;
}
STATIC_OVL void
@@ -849,7 +845,7 @@ boolean atme;
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 */
@@ -863,16 +859,16 @@ boolean atme;
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) {
@@ -881,7 +877,7 @@ boolean atme;
}
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;
@@ -938,7 +934,7 @@ boolean atme;
You("fail to cast the spell correctly.");
u.uen -= energy / 2;
context.botl = 1;
return (1);
return 1;
}
u.uen -= energy;
@@ -948,10 +944,10 @@ boolean atme;
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);
@@ -978,11 +974,12 @@ boolean atme;
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;
@@ -1100,14 +1097,14 @@ boolean atme;
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. */

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -253,7 +253,7 @@ char *objnambuf;
*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,
@@ -269,7 +269,7 @@ char *objnambuf;
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);
@@ -301,7 +301,7 @@ retry:
}
if (!otmp) {
impossible("Steal fails!");
return (0);
return 0;
}
/* can't steal ring(s) while wearing gloves */
if ((otmp == uleft || otmp == uright) && uarmg)
@@ -320,7 +320,7 @@ retry:
gotobj:
if (otmp->o_id == stealoid)
return (0);
return 0;
if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) {
if (!retrycnt++)
@@ -337,10 +337,10 @@ gotobj:
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) {
@@ -433,7 +433,7 @@ gotobj:
stealoid = otmp->o_id;
stealmid = mtmp->m_id;
afternmv = stealarm;
return (0);
return 0;
}
}
break;
@@ -463,7 +463,7 @@ gotobj:
minstapetrify(mtmp, TRUE);
return -1;
}
return ((multi < 0) ? 0 : 1);
return (multi < 0) ? 0 : 1;
}
/* Returns 1 if otmp is free'd, 0 otherwise. */
@@ -617,11 +617,10 @@ boolean verbosely;
/* 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 */

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -676,9 +676,9 @@ place_monster(mon, x, y)
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;