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
+3 -3
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 */ /* Copyright (c) 1996 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* 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 (p2 == (genericptr_t)0) { /* That means the player */
if (!Blind) if (!Blind)
You("bump into %s. Ouch!", You("bump into %s. Ouch!",
Hallucination ? "an invisible tree" : Hallucination ? "an invisible tree"
"some kind of invisible wall"); : "some kind of invisible wall");
else else
pline("Ouch!"); pline("Ouch!");
} else { } else {
+31 -32
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -809,13 +809,13 @@ boolean
validrole(rolenum) validrole(rolenum)
int rolenum; int rolenum;
{ {
return (rolenum >= 0 && rolenum < SIZE(roles) - 1); return (boolean) (rolenum >= 0 && rolenum < SIZE(roles) - 1);
} }
int int
randrole() randrole()
{ {
return (rn2(SIZE(roles) - 1)); return rn2(SIZE(roles) - 1);
} }
STATIC_OVL int STATIC_OVL int
@@ -871,8 +871,9 @@ validrace(rolenum, racenum)
int rolenum, racenum; int rolenum, racenum;
{ {
/* Assumes validrole */ /* Assumes validrole */
return (racenum >= 0 && racenum < SIZE(races) - 1 return (boolean) (racenum >= 0 && racenum < SIZE(races) - 1
&& (roles[rolenum].allow & races[racenum].allow & ROLE_RACEMASK)); && (roles[rolenum].allow & races[racenum].allow
& ROLE_RACEMASK));
} }
int int
@@ -895,11 +896,11 @@ int rolenum;
if (n) if (n)
n--; n--;
else else
return (i); return i;
} }
/* This role has no permitted races? */ /* This role has no permitted races? */
return (rn2(SIZE(races) - 1)); return rn2(SIZE(races) - 1);
} }
int int
@@ -936,9 +937,9 @@ validgend(rolenum, racenum, gendnum)
int rolenum, racenum, gendnum; int rolenum, racenum, gendnum;
{ {
/* Assumes validrole and validrace */ /* Assumes validrole and validrace */
return (gendnum >= 0 && gendnum < ROLE_GENDERS return (boolean) (gendnum >= 0 && gendnum < ROLE_GENDERS
&& (roles[rolenum].allow & races[racenum].allow && (roles[rolenum].allow & races[racenum].allow
& genders[gendnum].allow & ROLE_GENDMASK)); & genders[gendnum].allow & ROLE_GENDMASK));
} }
int int
@@ -962,11 +963,11 @@ int rolenum, racenum;
if (n) if (n)
n--; n--;
else else
return (i); return i;
} }
/* This role/race has no permitted genders? */ /* This role/race has no permitted genders? */
return (rn2(ROLE_GENDERS)); return rn2(ROLE_GENDERS);
} }
int int
@@ -1002,9 +1003,9 @@ validalign(rolenum, racenum, alignnum)
int rolenum, racenum, alignnum; int rolenum, racenum, alignnum;
{ {
/* Assumes validrole and validrace */ /* Assumes validrole and validrace */
return (alignnum >= 0 && alignnum < ROLE_ALIGNS return (boolean) (alignnum >= 0 && alignnum < ROLE_ALIGNS
&& (roles[rolenum].allow & races[racenum].allow && (roles[rolenum].allow & races[racenum].allow
& aligns[alignnum].allow & ROLE_ALIGNMASK)); & aligns[alignnum].allow & ROLE_ALIGNMASK));
} }
int int
@@ -1028,11 +1029,11 @@ int rolenum, racenum;
if (n) if (n)
n--; n--;
else else
return (i); return i;
} }
/* This role/race has no permitted alignments? */ /* This role/race has no permitted alignments? */
return (rn2(ROLE_ALIGNS)); return rn2(ROLE_ALIGNS);
} }
int int
@@ -2121,23 +2122,21 @@ struct monst *mtmp;
{ {
switch (Role_switch) { switch (Role_switch) {
case PM_KNIGHT: case PM_KNIGHT:
return ("Salutations"); /* Olde English */ return "Salutations"; /* Olde English */
case PM_SAMURAI: case PM_SAMURAI:
return (mtmp && mtmp->data == &mons[PM_SHOPKEEPER] return (mtmp && mtmp->data == &mons[PM_SHOPKEEPER])
? "Irasshaimase" ? "Irasshaimase"
: "Konnichi wa"); /* Japanese */ : "Konnichi wa"; /* Japanese */
case PM_TOURIST: case PM_TOURIST:
return ("Aloha"); /* Hawaiian */ return "Aloha"; /* Hawaiian */
case PM_VALKYRIE: case PM_VALKYRIE:
return ( return
#ifdef MAIL #ifdef MAIL
mtmp && mtmp->data == &mons[PM_MAIL_DAEMON] (mtmp && mtmp->data == &mons[PM_MAIL_DAEMON]) ? "Hallo" :
? "Hallo"
:
#endif #endif
"Velkommen"); /* Norse */ "Velkommen"; /* Norse */
default: default:
return ("Hello"); return "Hello";
} }
} }
@@ -2146,15 +2145,15 @@ Goodbye()
{ {
switch (Role_switch) { switch (Role_switch) {
case PM_KNIGHT: case PM_KNIGHT:
return ("Fare thee well"); /* Olde English */ return "Fare thee well"; /* Olde English */
case PM_SAMURAI: case PM_SAMURAI:
return ("Sayonara"); /* Japanese */ return "Sayonara"; /* Japanese */
case PM_TOURIST: case PM_TOURIST:
return ("Aloha"); /* Hawaiian */ return "Aloha"; /* Hawaiian */
case PM_VALKYRIE: case PM_VALKYRIE:
return ("Farvel"); /* Norse */ return "Farvel"; /* Norse */
default: default:
return ("Goodbye"); return "Goodbye";
} }
} }
+90 -88
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -175,7 +175,7 @@ register boolean withbill;
rile_shk(shkp); rile_shk(shkp);
} }
} }
return (shkp); return shkp;
} }
void shkgone(mtmp) /* called in mon.c */ void shkgone(mtmp) /* called in mon.c */
@@ -316,7 +316,7 @@ register struct monst *shkp;
total += bp->price * bp->bquan; total += bp->price * bp->bquan;
bp++; bp++;
} }
return (total); return total;
} }
STATIC_OVL void STATIC_OVL void
@@ -381,9 +381,9 @@ register xchar x, y;
rno = levl[x][y].roomno; rno = levl[x][y].roomno;
if ((rno < ROOMOFFSET) || levl[x][y].edge || !IS_SHOP(rno - ROOMOFFSET)) if ((rno < ROOMOFFSET) || levl[x][y].edge || !IS_SHOP(rno - ROOMOFFSET))
return (NO_ROOM); return NO_ROOM;
else else
return (rno); return rno;
} }
void void
@@ -713,8 +713,8 @@ shopper_financial_report()
long amt; long amt;
int pass; int pass;
if (this_shkp eshkp = this_shkp ? ESHK(this_shkp) : 0;
&& !(ESHK(this_shkp)->credit || shop_debt(ESHK(this_shkp)))) { if (eshkp && !(eshkp->credit || shop_debt(eshkp))) {
You("have no credit or debt in here."); You("have no credit or debt in here.");
this_shkp = 0; /* skip first pass */ this_shkp = 0; /* skip first pass */
} }
@@ -744,9 +744,10 @@ int
inhishop(mtmp) inhishop(mtmp)
register struct monst *mtmp; register struct monst *mtmp;
{ {
return ( struct eshk *eshkp = ESHK(mtmp);
index(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), ESHK(mtmp)->shoproom)
&& on_level(&(ESHK(mtmp)->shoplevel), &u.uz)); return (index(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), eshkp->shoproom)
&& on_level(&eshkp->shoplevel, &u.uz));
} }
struct monst * struct monst *
@@ -775,9 +776,9 @@ register struct mkroom *sroom;
register struct monst *mtmp = sroom->resident; register struct monst *mtmp = sroom->resident;
if (!mtmp) if (!mtmp)
return (FALSE); return FALSE;
else else
return ((boolean)(inhishop(mtmp))); return (boolean) inhishop(mtmp);
} }
STATIC_OVL struct bill_x * STATIC_OVL struct bill_x *
@@ -808,7 +809,8 @@ boolean
is_unpaid(obj) is_unpaid(obj)
struct obj *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. */ /* Delete the contents of the given object. */
@@ -905,9 +907,9 @@ register struct monst *shkp;
{ {
long credit = ESHK(shkp)->credit; long credit = ESHK(shkp)->credit;
if (credit == 0L) if (credit == 0L) {
return (tmp); ; /* nothing to do; just 'return tmp;' */
if (credit >= tmp) { } else if (credit >= tmp) {
pline_The("price is deducted from your credit."); pline_The("price is deducted from your credit.");
ESHK(shkp)->credit -= tmp; ESHK(shkp)->credit -= tmp;
tmp = 0L; tmp = 0L;
@@ -916,7 +918,7 @@ register struct monst *shkp;
ESHK(shkp)->credit = 0L; ESHK(shkp)->credit = 0L;
tmp -= credit; tmp -= credit;
} }
return (tmp); return tmp;
} }
STATIC_OVL void STATIC_OVL void
@@ -965,8 +967,8 @@ angry_shk_exists()
for (shkp = next_shkp(fmon, FALSE); shkp; for (shkp = next_shkp(fmon, FALSE); shkp;
shkp = next_shkp(shkp->nmon, FALSE)) shkp = next_shkp(shkp->nmon, FALSE))
if (ANGRY(shkp)) if (ANGRY(shkp))
return (TRUE); return TRUE;
return (FALSE); return FALSE;
} }
/* remove previously applied surcharge from all billed items */ /* remove previously applied surcharge from all billed items */
@@ -1143,7 +1145,7 @@ register struct monst *shkp;
gmin = bp->price * bp->bquan; gmin = bp->price * bp->bquan;
bp++; bp++;
} }
return (gmin); return gmin;
} }
int int
@@ -1180,12 +1182,12 @@ dopay()
if ((!sk && (!Blind || Blind_telepat)) || (!Blind && !seensk)) { if ((!sk && (!Blind || Blind_telepat)) || (!Blind && !seensk)) {
There("appears to be no shopkeeper here to receive your payment."); There("appears to be no shopkeeper here to receive your payment.");
return (0); return 0;
} }
if (!seensk) { if (!seensk) {
You_cant("see..."); You_cant("see...");
return (0); return 0;
} }
/* the usual case. allow paying at a distance when */ /* the usual case. allow paying at a distance when */
@@ -1203,7 +1205,7 @@ dopay()
if (shkp != resident && distu(shkp->mx, shkp->my) > 2) { if (shkp != resident && distu(shkp->mx, shkp->my) > 2) {
pline("%s is not near enough to receive your payment.", pline("%s is not near enough to receive your payment.",
Monnam(shkp)); Monnam(shkp));
return (0); return 0;
} }
} else { } else {
struct monst *mtmp; struct monst *mtmp;
@@ -1219,31 +1221,31 @@ dopay()
cy = cc.y; cy = cc.y;
if (cx < 0) { if (cx < 0) {
pline("Try again..."); pline("Try again...");
return (0); return 0;
} }
if (u.ux == cx && u.uy == cy) { if (u.ux == cx && u.uy == cy) {
You("are generous to yourself."); You("are generous to yourself.");
return (0); return 0;
} }
mtmp = m_at(cx, cy); mtmp = m_at(cx, cy);
if (!mtmp) { if (!mtmp) {
There("is no one there to receive your payment."); There("is no one there to receive your payment.");
return (0); return 0;
} }
if (!mtmp->isshk) { if (!mtmp->isshk) {
pline("%s is not interested in your payment.", Monnam(mtmp)); pline("%s is not interested in your payment.", Monnam(mtmp));
return (0); return 0;
} }
if (mtmp != resident && distu(mtmp->mx, mtmp->my) > 2) { if (mtmp != resident && distu(mtmp->mx, mtmp->my) > 2) {
pline("%s is too far to receive your payment.", Monnam(mtmp)); pline("%s is too far to receive your payment.", Monnam(mtmp));
return (0); return 0;
} }
shkp = mtmp; shkp = mtmp;
} }
if (!shkp) { if (!shkp) {
debugpline0("dopay: null shkp."); debugpline0("dopay: null shkp.");
return (0); return 0;
} }
proceed: proceed:
eshkp = ESHK(shkp); eshkp = ESHK(shkp);
@@ -1284,7 +1286,7 @@ proceed:
else else
make_happy_shk(shkp, FALSE); make_happy_shk(shkp, FALSE);
} }
return (1); return 1;
} }
/* ltmp is still eshkp->robbed here */ /* ltmp is still eshkp->robbed here */
@@ -1301,7 +1303,7 @@ proceed:
pline(no_money, stashed_gold ? " seem to" : ""); pline(no_money, stashed_gold ? " seem to" : "");
else else
pline(not_enough_money, mhim(shkp)); pline(not_enough_money, mhim(shkp));
return (1); return 1;
} }
pline("But since %s shop has been robbed recently,", mhis(shkp)); pline("But since %s shop has been robbed recently,", mhis(shkp));
pline("you %scompensate %s for %s losses.", pline("you %scompensate %s for %s losses.",
@@ -1318,7 +1320,7 @@ proceed:
pline(no_money, stashed_gold ? " seem to" : ""); pline(no_money, stashed_gold ? " seem to" : "");
else else
pline(not_enough_money, mhim(shkp)); pline(not_enough_money, mhim(shkp));
return (1); return 1;
} }
You("try to appease %s by giving %s 1000 gold pieces.", You("try to appease %s by giving %s 1000 gold pieces.",
x_monnam(shkp, ARTICLE_THE, "angry", 0, FALSE), mhim(shkp)); x_monnam(shkp, ARTICLE_THE, "angry", 0, FALSE), mhim(shkp));
@@ -1328,13 +1330,13 @@ proceed:
else else
pline("But %s is as angry as ever.", shkname(shkp)); pline("But %s is as angry as ever.", shkname(shkp));
} }
return (1); return 1;
} }
if (shkp != resident) { if (shkp != resident) {
impossible("dopay: not to shopkeeper?"); impossible("dopay: not to shopkeeper?");
if (resident) if (resident)
setpaid(resident); setpaid(resident);
return (0); return 0;
} }
/* pay debt, if any, first */ /* pay debt, if any, first */
if (eshkp->debit) { if (eshkp->debit) {
@@ -1357,7 +1359,7 @@ proceed:
pline("But you don't%s have enough gold%s.", pline("But you don't%s have enough gold%s.",
stashed_gold ? " seem to" : "", stashed_gold ? " seem to" : "",
eshkp->credit ? " or credit" : ""); eshkp->credit ? " or credit" : "");
return (1); return 1;
} else { } else {
if (eshkp->credit >= dtmp) { if (eshkp->credit >= dtmp) {
eshkp->credit -= dtmp; eshkp->credit -= dtmp;
@@ -1391,14 +1393,14 @@ proceed:
if (!umoney && !eshkp->credit) { if (!umoney && !eshkp->credit) {
You("%shave no money or credit%s.", You("%shave no money or credit%s.",
stashed_gold ? "seem to " : "", paid ? " left" : ""); stashed_gold ? "seem to " : "", paid ? " left" : "");
return (0); return 0;
} }
if ((umoney + eshkp->credit) < cheapest_item(shkp)) { if ((umoney + eshkp->credit) < cheapest_item(shkp)) {
You("don't have enough money to buy%s the item%s you picked.", You("don't have enough money to buy%s the item%s you picked.",
eshkp->billct > 1 ? " any of" : "", plur(eshkp->billct)); eshkp->billct > 1 ? " any of" : "", plur(eshkp->billct));
if (stashed_gold) if (stashed_gold)
pline("Maybe you have some gold stashed away?"); pline("Maybe you have some gold stashed away?");
return (0); return 0;
} }
/* this isn't quite right; it itemizes without asking if the /* this isn't quite right; it itemizes without asking if the
@@ -1464,7 +1466,7 @@ proceed:
if (!ANGRY(shkp) && paid && !muteshk(shkp)) if (!ANGRY(shkp) && paid && !muteshk(shkp))
verbalize("Thank you for shopping in %s %s!", s_suffix(shkname(shkp)), verbalize("Thank you for shopping in %s %s!", s_suffix(shkname(shkp)),
shtypes[eshkp->shoptype - SHOPBASE].name); shtypes[eshkp->shoptype - SHOPBASE].name);
return (1); return 1;
} }
/* return 2 if used-up portion paid */ /* return 2 if used-up portion paid */
@@ -1760,7 +1762,7 @@ int croaked;
clear: clear:
shkp->minvis = save_minvis; shkp->minvis = save_minvis;
setpaid(shkp); setpaid(shkp);
return (taken); return taken;
} }
STATIC_OVL void STATIC_OVL void
@@ -2050,7 +2052,7 @@ register struct obj *obj;
else if (Has_contents(otmp)) else if (Has_contents(otmp))
value += contained_gold(otmp); value += contained_gold(otmp);
return (value); return value;
} }
STATIC_OVL void STATIC_OVL void
@@ -2630,7 +2632,7 @@ boolean ininv;
price = stolen_container(otmp, shkp, price, ininv); price = stolen_container(otmp, shkp, price, ininv);
} }
return (price); return price;
} }
long long
@@ -2673,7 +2675,7 @@ boolean peaceful, silent;
} }
if (gvalue + value == 0L) if (gvalue + value == 0L)
return (0L); return 0L;
value += gvalue; value += gvalue;
@@ -2722,7 +2724,7 @@ boolean peaceful, silent;
hot_pursuit(shkp); hot_pursuit(shkp);
(void) angry_guards(FALSE); (void) angry_guards(FALSE);
} }
return (value); return value;
} }
/* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */ /* 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); display_nhwindow(datawin, FALSE);
quit: quit:
destroy_nhwindow(datawin); destroy_nhwindow(datawin);
return (0); return 0;
} }
#define HUNGRY 2 #define HUNGRY 2
@@ -3150,13 +3152,13 @@ register xchar x, y;
register struct monst *shkp; register struct monst *shkp;
if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp)) if (!(shkp = shop_keeper(inside_shop(x, y))) || !inhishop(shkp))
return (0); return 0;
if (shkp->mcanmove && !shkp->msleeping if (shkp->mcanmove && !shkp->msleeping
&& (*u.ushops != ESHK(shkp)->shoproom || !inside_shop(u.ux, u.uy)) && (*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 */ /* 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)) if (mnearto(shkp, x, y, TRUE) && !muteshk(shkp))
verbalize("Out of my way, scum!"); verbalize("Out of my way, scum!");
if (cansee(x, y)) { if (cansee(x, y)) {
@@ -3271,9 +3273,9 @@ boolean croaked;
if (cansee(x, y)) { if (cansee(x, y)) {
if (IS_WALL(levl[x][y].typ)) { if (IS_WALL(levl[x][y].typ)) {
saw_walls++; 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 */ /* an existing door here implies trap removal */
!(old_doormask & (D_ISOPEN | D_CLOSED))) { && !(old_doormask & (D_ISOPEN | D_CLOSED))) {
saw_door = TRUE; saw_door = TRUE;
} else if (disposition == 3) { /* untrapped */ } else if (disposition == 3) { /* untrapped */
saw_untrap++; saw_untrap++;
@@ -3356,24 +3358,24 @@ boolean catchup; /* restoring a level */
register struct trap *ttmp; register struct trap *ttmp;
if ((monstermoves - tmp_dam->when) < REPAIR_DELAY) if ((monstermoves - tmp_dam->when) < REPAIR_DELAY)
return (0); return 0;
if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following) if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following)
return (0); return 0;
x = tmp_dam->place.x; x = tmp_dam->place.x;
y = tmp_dam->place.y; y = tmp_dam->place.y;
if (!IS_ROOM(tmp_dam->typ)) { if (!IS_ROOM(tmp_dam->typ)) {
if (x == u.ux && y == u.uy) if (x == u.ux && y == u.uy)
if (!Passes_walls) if (!Passes_walls)
return (0); return 0;
if (x == shkp->mx && y == shkp->my) if (x == shkp->mx && y == shkp->my)
return (0); return 0;
if ((mtmp = m_at(x, y)) && (!passes_walls(mtmp->data))) if ((mtmp = m_at(x, y)) && (!passes_walls(mtmp->data)))
return (0); return 0;
} }
if ((ttmp = t_at(x, y)) != 0) { if ((ttmp = t_at(x, y)) != 0) {
if (x == u.ux && y == u.uy) if (x == u.ux && y == u.uy)
if (!Passes_walls) if (!Passes_walls)
return (0); return 0;
if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) { if (ttmp->ttyp == LANDMINE || ttmp->ttyp == BEAR_TRAP) {
/* convert to an object */ /* convert to an object */
otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP, otmp = mksobj((ttmp->ttyp == LANDMINE) ? LAND_MINE : BEARTRAP,
@@ -3391,16 +3393,16 @@ boolean catchup; /* restoring a level */
block_point(x, y); block_point(x, y);
} }
newsym(x, y); newsym(x, y);
return (3); return 3;
} }
if (IS_ROOM(tmp_dam->typ)) { if (IS_ROOM(tmp_dam->typ)) {
/* No messages, because player already filled trap door */ /* No messages, because player already filled trap door */
return (1); return 1;
} }
if ((tmp_dam->typ == levl[x][y].typ) if ((tmp_dam->typ == levl[x][y].typ)
&& (!IS_DOOR(tmp_dam->typ) || (levl[x][y].doormask > D_BROKEN))) && (!IS_DOOR(tmp_dam->typ) || (levl[x][y].doormask > D_BROKEN)))
/* No messages if player already replaced shop door */ /* No messages if player already replaced shop door */
return (1); return 1;
levl[x][y].typ = tmp_dam->typ; levl[x][y].typ = tmp_dam->typ;
(void) memset((genericptr_t) litter, 0, sizeof(litter)); (void) memset((genericptr_t) litter, 0, sizeof(litter));
if ((otmp = level.objects[x][y]) != 0) { if ((otmp = level.objects[x][y]) != 0) {
@@ -3466,7 +3468,7 @@ boolean catchup; /* restoring a level */
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
if (litter[i] & NEED_UPDATE) if (litter[i] & NEED_UPDATE)
newsym(x + horiz(i), y + vert(i)); newsym(x + horiz(i), y + vert(i));
return (2); return 2;
#undef NEED_UPDATE #undef NEED_UPDATE
#undef OPEN #undef OPEN
#undef INSHOP #undef INSHOP
@@ -3500,7 +3502,7 @@ register struct monst *shkp;
if (Displaced) if (Displaced)
Your("displaced image doesn't fool %s!", mon_nam(shkp)); Your("displaced image doesn't fool %s!", mon_nam(shkp));
(void) mattacku(shkp); (void) mattacku(shkp);
return (0); return 0;
} }
if (eshkp->following) { if (eshkp->following) {
if (strncmp(eshkp->customer, plname, PL_NSIZ)) { 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), verbalize("%s, %s! I was looking for %s.", Hello(shkp),
plname, eshkp->customer); plname, eshkp->customer);
eshkp->following = 0; eshkp->following = 0;
return (0); return 0;
} }
if (moves > followmsg + 4) { if (moves > followmsg + 4) {
if (!muteshk(shkp)) if (!muteshk(shkp))
@@ -3522,7 +3524,7 @@ register struct monst *shkp;
} }
} }
if (udist < 2) if (udist < 2)
return (0); return 0;
} }
} }
@@ -3539,7 +3541,7 @@ register struct monst *shkp;
invent, triggering billing impossibilities on the invent, triggering billing impossibilities on the
next level once the character fell through the hole.] */ next level once the character fell through the hole.] */
if (udist > 4 && eshkp->following && !eshkp->billct) if (udist > 4 && eshkp->following && !eshkp->billct)
return (-1); /* leave it to m_move */ return -1; /* leave it to m_move */
gx = u.ux; gx = u.ux;
gy = u.uy; gy = u.uy;
} else if (ANGRY(shkp)) { } else if (ANGRY(shkp)) {
@@ -3561,7 +3563,7 @@ register struct monst *shkp;
|| (Fast && (sobj_at(PICK_AXE, u.ux, u.uy) || (Fast && (sobj_at(PICK_AXE, u.ux, u.uy)
|| sobj_at(DWARVISH_MATTOCK, u.ux, u.uy)))); || sobj_at(DWARVISH_MATTOCK, u.ux, u.uy))));
if (satdoor && badinv) if (satdoor && badinv)
return (0); return 0;
avoid = !badinv; avoid = !badinv;
} else { } else {
avoid = (*u.ushops && distu(gx, gy) > 8); avoid = (*u.ushops && distu(gx, gy) > 8);
@@ -3571,7 +3573,7 @@ register struct monst *shkp;
if (((!eshkp->robbed && !eshkp->billct && !eshkp->debit) || avoid) if (((!eshkp->robbed && !eshkp->billct && !eshkp->debit) || avoid)
&& GDIST(omx, omy) < 3) { && GDIST(omx, omy) < 3) {
if (!badinv && !onlineu(omx, omy)) if (!badinv && !onlineu(omx, omy))
return (0); return 0;
if (satdoor) if (satdoor)
appr = gx = gy = 0; appr = gx = gy = 0;
} }
@@ -3606,7 +3608,7 @@ boolean
is_fshk(mtmp) is_fshk(mtmp)
register struct monst *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. */ /* You are digging in the shop. */
@@ -3896,17 +3898,17 @@ boolean
costly_spot(x, y) costly_spot(x, y)
register xchar x, y; register xchar x, y;
{ {
register struct monst *shkp; struct monst *shkp;
struct eshk *eshkp;
if (!level.flags.has_shop) if (!level.flags.has_shop)
return FALSE; return FALSE;
shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)); shkp = shop_keeper(*in_rooms(x, y, SHOPBASE));
if (!shkp || !inhishop(shkp)) if (!shkp || !inhishop(shkp))
return (FALSE); return FALSE;
eshkp = ESHK(shkp);
return ( return (boolean) (inside_shop(x, y)
(boolean)(inside_shop(x, y) && !(x == eshkp->shk.x && y == eshkp->shk.y));
&& !(x == ESHK(shkp)->shk.x && y == ESHK(shkp)->shk.y)));
} }
/* called by dotalk(sounds.c) when #chatting; returns obj if location /* called by dotalk(sounds.c) when #chatting; returns obj if location
@@ -3925,8 +3927,8 @@ register xchar x, y;
if (otmp->oclass != COIN_CLASS) if (otmp->oclass != COIN_CLASS)
break; break;
/* note: otmp might have ->no_charge set, but that's ok */ /* note: otmp might have ->no_charge set, but that's ok */
return (otmp && costly_spot(x, y) && NOTANGRY(shkp) && shkp->mcanmove return (otmp && costly_spot(x, y)
&& !shkp->msleeping) && NOTANGRY(shkp) && shkp->mcanmove && !shkp->msleeping)
? otmp ? otmp
: (struct obj *) 0; : (struct obj *) 0;
} }
@@ -4121,7 +4123,7 @@ boolean altusage; /* some items have an "alternate" use with different cost */
long tmp = 0L; long tmp = 0L;
if (!shkp || !inhishop(shkp)) if (!shkp || !inhishop(shkp))
return (0L); /* insurance */ return 0L; /* insurance */
tmp = get_cost(otmp, shkp); tmp = get_cost(otmp, shkp);
/* The idea is to make the exhaustive use of */ /* 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) { } else if (otmp->otyp == POT_OIL) {
tmp /= 5L; tmp /= 5L;
} }
return (tmp); return tmp;
} }
/* Charge the player for partial use of an unpaid object. /* Charge the player for partial use of an unpaid object.
@@ -4273,14 +4275,14 @@ register xchar x, y;
register struct monst *shkp; register struct monst *shkp;
if (roomno < 0 || !IS_SHOP(roomno)) if (roomno < 0 || !IS_SHOP(roomno))
return (FALSE); return FALSE;
if (!IS_DOOR(levl[x][y].typ)) if (!IS_DOOR(levl[x][y].typ))
return (FALSE); return FALSE;
if (roomno != *u.ushops) if (roomno != *u.ushops)
return (FALSE); return FALSE;
if (!(shkp = shop_keeper((char) roomno)) || !inhishop(shkp)) 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 if (shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y
/* Actually, the shk should be made to block _any_ /* 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)) { && (ESHK(shkp)->debit || ESHK(shkp)->billct || ESHK(shkp)->robbed)) {
pline("%s%s blocks your way!", shkname(shkp), pline("%s%s blocks your way!", shkname(shkp),
Invis ? " senses your motion and" : ""); Invis ? " senses your motion and" : "");
return (TRUE); return TRUE;
} }
return (FALSE); return FALSE;
} }
/* used in domove to block diagonal shop-entry */ /* 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) if (!(IS_DOOR(levl[u.ux][u.uy].typ)
&& levl[u.ux][u.uy].doormask == D_BROKEN)) && levl[u.ux][u.uy].doormask == D_BROKEN))
return (FALSE); return FALSE;
roomno = *in_rooms(x, y, SHOPBASE); roomno = *in_rooms(x, y, SHOPBASE);
if (roomno < 0 || !IS_SHOP(roomno)) if (roomno < 0 || !IS_SHOP(roomno))
return (FALSE); return FALSE;
if (!(shkp = shop_keeper((char) roomno)) || !inhishop(shkp)) 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) if (ESHK(shkp)->shd.x != u.ux || ESHK(shkp)->shd.y != u.uy)
return (FALSE); return FALSE;
sx = ESHK(shkp)->shk.x; sx = ESHK(shkp)->shk.x;
sy = ESHK(shkp)->shk.y; sy = ESHK(shkp)->shk.y;
@@ -4330,9 +4332,9 @@ register xchar x, y;
|| u.usteed)) { || u.usteed)) {
pline("%s%s blocks your way!", shkname(shkp), pline("%s%s blocks your way!", shkname(shkp),
Invis ? " senses your motion and" : ""); Invis ? " senses your motion and" : "");
return (TRUE); return TRUE;
} }
return (FALSE); return FALSE;
} }
/* "your " or "Foobar's " (note the trailing space) */ /* "your " or "Foobar's " (note the trailing space) */
+16 -7
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
#include "artifact.h" #include "artifact.h"
/* take away the hero's money */
void void
take_gold() take_gold()
{ {
struct obj *otmp, *nobj; struct obj *otmp, *nobj;
int lost_money = 0; int lost_money = 0;
for (otmp = invent; otmp; otmp = nobj) { for (otmp = invent; otmp; otmp = nobj) {
nobj = otmp->nobj; nobj = otmp->nobj;
if (otmp->oclass == COIN_CLASS) { if (otmp->oclass == COIN_CLASS) {
@@ -26,6 +29,7 @@ take_gold()
} }
} }
/* #sit command */
int int
dosit() dosit()
{ {
@@ -35,7 +39,7 @@ dosit()
if (u.usteed) { if (u.usteed) {
You("are already sitting on %s.", mon_nam(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) if (u.uundetected && is_hider(youmonst.data) && u.umonnum != PM_TRAPPER)
u.uundetected = 0; /* no longer on the ceiling */ u.uundetected = 0; /* no longer on the ceiling */
@@ -60,9 +64,9 @@ dosit()
goto in_water; 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 */ /* ensure we're not standing on the precipice */
!uteetering_at_seen_pit(trap)) { && !uteetering_at_seen_pit(trap)) {
register struct obj *obj; register struct obj *obj;
obj = level.objects[u.ux][u.uy]; obj = level.objects[u.ux][u.uy];
@@ -306,10 +310,12 @@ dosit()
} else { } else {
pline("Having fun sitting on the %s?", surface(u.ux, u.uy)); 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 nobj = 0;
int cnt, onum; 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)) { switch (rnd(11)) {
case 1: case 1:
@@ -438,6 +446,7 @@ void attrcurse() /* remove a random INTRINSIC ability */
break; break;
} }
case 10: case 10:
/* intrinsic protection is just disabled, not set back to 0 */
if (HProtection & INTRINSIC) { if (HProtection & INTRINSIC) {
HProtection &= ~INTRINSIC; HProtection &= ~INTRINSIC;
You_feel("vulnerable."); You_feel("vulnerable.");
+54 -57
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 */ /* Copyright (c) 1989 Janet Walz, Mike Threepoint */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -180,14 +180,14 @@ dosounds()
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (is_mercenary(mtmp->data) && if (is_mercenary(mtmp->data)
#if 0 /* don't bother excluding these */ #if 0 /* don't bother excluding these */
!strstri(mtmp->data->mname, "watch") && && !strstri(mtmp->data->mname, "watch")
!strstri(mtmp->data->mname, "guard") && && !strstri(mtmp->data->mname, "guard")
#endif #endif
mon_in_room(mtmp, BARRACKS) && && mon_in_room(mtmp, BARRACKS)
/* sleeping implies not-yet-disturbed (usually) */ /* sleeping implies not-yet-disturbed (usually) */
(mtmp->msleeping || ++count > 5)) { && (mtmp->msleeping || ++count > 5)) {
You_hear1(barracks_msg[rn2(3) + hallu]); You_hear1(barracks_msg[rn2(3) + hallu]);
return; return;
} }
@@ -229,11 +229,11 @@ dosounds()
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
continue; continue;
if (mtmp->ispriest && inhistemple(mtmp) && if (mtmp->ispriest && inhistemple(mtmp)
/* priest must be active */ /* priest must be active */
mtmp->mcanmove && !mtmp->msleeping && && mtmp->mcanmove && !mtmp->msleeping
/* hero must be outside this temple */ /* hero must be outside this temple */
temple_occupied(u.urooms) != EPRI(mtmp)->shroom) && temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
break; break;
} }
if (mtmp) { if (mtmp) {
@@ -483,7 +483,7 @@ struct monst *mon;
/* result depends upon whether map spot shows a gecko, which will /* result depends upon whether map spot shows a gecko, which will
be due to hallucination or to mimickery since mon isn't one */ be due to hallucination or to mimickery since mon isn't one */
glyph = glyph_at(mon->mx, mon->my); 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 STATIC_OVL int
@@ -499,9 +499,9 @@ register struct monst *mtmp;
/* presumably nearness and sleep checks have already been made */ /* presumably nearness and sleep checks have already been made */
if (Deaf) if (Deaf)
return (0); return 0;
if (is_silent(ptr)) if (is_silent(ptr))
return (0); return 0;
/* leader might be poly'd; if he can still speak, give leader speech */ /* 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) 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)] verbl_msg = mtmp->mpeaceful ? soldier_pax_msg[rn2(3)]
: soldier_foe_msg[rn2(3)]; : soldier_foe_msg[rn2(3)];
} break; break;
}
case MS_RIDER: case MS_RIDER:
/* 3.6.0 tribute */ /* 3.6.0 tribute */
if (ptr == &mons[PM_DEATH] && if (ptr == &mons[PM_DEATH]
!context.tribute.Deathnotice && u_have_novel()) { && !context.tribute.Deathnotice && u_have_novel()) {
struct obj *book = u_have_novel(); struct obj *book = u_have_novel();
const char *tribtitle = (char *)0; const char *tribtitle = (char *)0;
if (book) { if (book) {
int novelidx = book->novelidx; int novelidx = book->novelidx;
tribtitle = noveltitle(&novelidx); tribtitle = noveltitle(&novelidx);
} }
if (tribtitle) { if (tribtitle) {
Sprintf(verbuf, "Ah, so you have a copy of /%s/.", tribtitle); Sprintf(verbuf, "Ah, so you have a copy of /%s/.", tribtitle);
/* no Death featured in these two, so exclude them */ /* no Death featured in these two, so exclude them */
if (!(strcmpi(tribtitle, "Snuff") == 0 || if (!(strcmpi(tribtitle, "Snuff") == 0
strcmpi(tribtitle, "The Wee Free Men") == 0)) || strcmpi(tribtitle, "The Wee Free Men") == 0))
Strcat(verbuf, " I may have been misquoted there."); Strcat(verbuf, " I may have been misquoted there.");
verbl_msg = verbuf; verbl_msg = verbuf;
context.tribute.Deathnotice = 1; context.tribute.Deathnotice = 1;
} }
} else if (ptr == &mons[PM_DEATH] && } else if (ptr == &mons[PM_DEATH]
!rn2(2) && Death_quote(verbuf, BUFSZ)) { && !rn2(2) && Death_quote(verbuf, BUFSZ)) {
verbl_msg = verbuf; verbl_msg = verbuf;
} }
/* end of tribute addition */ /* end of tribute addition */
@@ -952,9 +954,10 @@ register struct monst *mtmp;
verbalize1(verbl_msg); verbalize1(verbl_msg);
} }
} }
return (1); return 1;
} }
/* #chat command */
int int
dotalk() dotalk()
{ {
@@ -967,29 +970,29 @@ dotalk()
STATIC_OVL int STATIC_OVL int
dochat() dochat()
{ {
register struct monst *mtmp; struct monst *mtmp;
register int tx, ty; int tx, ty;
struct obj *otmp; struct obj *otmp;
if (is_silent(youmonst.data)) { if (is_silent(youmonst.data)) {
pline("As %s, you cannot speak.", an(youmonst.data->mname)); pline("As %s, you cannot speak.", an(youmonst.data->mname));
return (0); return 0;
} }
if (Strangled) { if (Strangled) {
You_cant("speak. You're choking!"); You_cant("speak. You're choking!");
return (0); return 0;
} }
if (u.uswallow) { if (u.uswallow) {
pline("They won't hear you out there."); pline("They won't hear you out there.");
return (0); return 0;
} }
if (Underwater) { if (Underwater) {
Your("speech is unintelligible underwater."); Your("speech is unintelligible underwater.");
return (0); return 0;
} }
if (Deaf) { if (Deaf) {
pline("How can you hold a conversation when you cannot hear?"); 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) { 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 a shop, but that shouldn't matter much. shop_object() returns an
object iff inside a shop and the shopkeeper is present and willing object iff inside a shop and the shopkeeper is present and willing
(not angry) and able (not asleep) to speak and the position (not angry) and able (not asleep) to speak and the position
contains contains any objects other than just gold.
any objects other than just gold.
*/ */
price_quote(otmp); price_quote(otmp);
return (1); return 1;
} }
if (!getdir("Talk to whom? (in what direction)")) { if (!getdir("Talk to whom? (in what direction)")) {
/* decided not to chat */ /* decided not to chat */
return (0); return 0;
} }
if (u.usteed && u.dz > 0) { if (u.usteed && u.dz > 0) {
if (!u.usteed->mcanmove || u.usteed->msleeping) { if (!u.usteed->mcanmove || u.usteed->msleeping) {
pline("%s seems not to notice you.", Monnam(u.usteed)); pline("%s seems not to notice you.", Monnam(u.usteed));
return (1); return 1;
} else } else
return (domonnoise(u.usteed)); return domonnoise(u.usteed);
} }
if (u.dz) { if (u.dz) {
pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down"); pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
return (0); return 0;
} }
if (u.dx == 0 && u.dy == 0) { if (u.dx == 0 && u.dy == 0) {
/* /*
* Let's not include this. It raises all sorts of questions: can you * Let's not include this.
wear * It raises all sorts of questions: can you wear
* 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith, * 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
* etc... --KAA * etc... --KAA
if (u.umonnum == PM_ETTIN) { if (u.umonnum == PM_ETTIN) {
You("discover that your other head makes boring You("discover that your other head makes boring conversation.");
conversation."); return 1;
return(1); }
} */
*/
pline("Talking to yourself is a bad habit for a dungeoneer."); pline("Talking to yourself is a bad habit for a dungeoneer.");
return (0); return 0;
} }
tx = u.ux + u.dx; tx = u.ux + u.dx;
ty = u.uy + u.dy; ty = u.uy + u.dy;
if (!isok(tx, ty)) if (!isok(tx, ty))
return (0); return 0;
mtmp = m_at(tx, ty); mtmp = m_at(tx, ty);
if ((!mtmp || mtmp->mundetected) && (otmp = vobj_at(tx, ty)) if ((!mtmp || mtmp->mundetected)
&& otmp->otyp == STATUE) { && (otmp = vobj_at(tx, ty)) != 0 && otmp->otyp == STATUE) {
/* Talking to a statue */ /* Talking to a statue */
if (!Blind) { if (!Blind) {
if (Hallucination) { pline_The("%s seems not to notice you.",
/* if you're hallucinating, you can't tell it's a statue */ /* if hallucinating, you can't tell it's a statue */
pline_The("%s seems not to notice you.", rndmonnam(NULL)); Hallucination ? rndmonnam((char *) 0) : "statue");
} else {
pline_The("statue seems not to notice you.");
}
} }
return (0); return 0;
} }
if (!mtmp || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE if (!mtmp || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE
|| mtmp->m_ap_type == M_AP_OBJECT) || mtmp->m_ap_type == M_AP_OBJECT)
return (0); return 0;
/* sleeping monsters won't talk, except priests (who wake up) */ /* sleeping monsters won't talk, except priests (who wake up) */
if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) { if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) {
@@ -1072,7 +1069,7 @@ dochat()
not noticing him and just not existing, so skip the message. */ not noticing him and just not existing, so skip the message. */
if (canspotmon(mtmp)) if (canspotmon(mtmp))
pline("%s seems not to notice you.", Monnam(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 this monster is waiting for something, prod it into action */
@@ -1082,7 +1079,7 @@ dochat()
if (!canspotmon(mtmp)) if (!canspotmon(mtmp))
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
pline("%s is eating noisily.", Monnam(mtmp)); pline("%s is eating noisily.", Monnam(mtmp));
return (0); return 0;
} }
return domonnoise(mtmp); return domonnoise(mtmp);
+207 -129
View File
File diff suppressed because it is too large Load Diff
+37 -40
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 */ /* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -49,8 +49,7 @@ STATIC_DCL const char *FDECL(spelltypemnemonic, (int));
* Reasoning: * Reasoning:
* spelbase, spelheal: * spelbase, spelheal:
* Arc are aware of magic through historical research * Arc are aware of magic through historical research
* Bar abhor magic (Conan finds it "interferes with his animal * Bar abhor magic (Conan finds it "interferes with his animal instincts")
*instincts")
* Cav are ignorant to magic * Cav are ignorant to magic
* Hea are very aware of healing magic through medical research * Hea are very aware of healing magic through medical research
* Kni are moderately aware of healing from Paladin training * Kni are moderately aware of healing from Paladin training
@@ -343,19 +342,19 @@ learn(VOID_ARGS)
multi_reason = "reading a book"; multi_reason = "reading a book";
nomovemsg = 0; nomovemsg = 0;
context.spbook.delay = 0; context.spbook.delay = 0;
return (0); return 0;
} }
if (context if (context
.spbook.delay) { /* not if (context.spbook.delay++), so at end .spbook.delay) { /* not if (context.spbook.delay++), so at end
delay == 0 */ delay == 0 */
context.spbook.delay++; context.spbook.delay++;
return (1); /* still busy */ return 1; /* still busy */
} }
exercise(A_WIS, TRUE); /* you're studying. */ exercise(A_WIS, TRUE); /* you're studying. */
booktype = book->otyp; booktype = book->otyp;
if (booktype == SPE_BOOK_OF_THE_DEAD) { if (booktype == SPE_BOOK_OF_THE_DEAD) {
deadbook(book); deadbook(book);
return (0); return 0;
} }
Sprintf(splname, Sprintf(splname,
@@ -419,7 +418,7 @@ learn(VOID_ARGS)
check_unpaid(book); check_unpaid(book);
context.spbook.book = 0; context.spbook.book = 0;
context.spbook.o_id = 0; context.spbook.o_id = 0;
return (0); return 0;
} }
int int
@@ -453,20 +452,17 @@ register struct obj *spellbook;
} }
if (context.spbook.delay && !confused && spellbook == context.spbook.book if (context.spbook.delay && !confused && spellbook == context.spbook.book
&& /* handle the sequence: start reading, get interrupted, have
/* handle the sequence: start reading, get interrupted, context.spbook.book become erased somehow, resume reading it */
have context.spbook.book become erased somehow, resume reading it && booktype != SPE_BLANK_PAPER) {
*/ You("continue your efforts to %s.",
booktype != SPE_BLANK_PAPER) { (booktype == SPE_NOVEL) ? "read the novel" : "memorize the spell");
You("continue your efforts to %s.", (booktype == SPE_NOVEL)
? "read the novel"
: "memorize the spell");
} else { } else {
/* KMH -- Simplified this code */ /* KMH -- Simplified this code */
if (booktype == SPE_BLANK_PAPER) { if (booktype == SPE_BLANK_PAPER) {
pline("This spellbook is all blank."); pline("This spellbook is all blank.");
makeknown(booktype); makeknown(booktype);
return (1); return 1;
} }
/* 3.6.0 tribute */ /* 3.6.0 tribute */
@@ -483,7 +479,7 @@ register struct obj *spellbook;
u.uevent.read_tribute = 1; /* only once */ u.uevent.read_tribute = 1; /* only once */
} }
} }
return (1); return 1;
} }
switch (objects[booktype].oc_level) { switch (objects[booktype].oc_level) {
@@ -529,7 +525,7 @@ register struct obj *spellbook;
(read_ability < 12 ? "very " : "")); (read_ability < 12 ? "very " : ""));
if (yn(qbuf) != 'y') { if (yn(qbuf) != 'y') {
spellbook->in_use = FALSE; spellbook->in_use = FALSE;
return (1); return 1;
} }
} }
/* its up to random luck now */ /* its up to random luck now */
@@ -555,7 +551,7 @@ register struct obj *spellbook;
useup(spellbook); useup(spellbook);
} else } else
spellbook->in_use = FALSE; spellbook->in_use = FALSE;
return (1); return 1;
} else if (confused) { } else if (confused) {
if (!confused_book(spellbook)) { if (!confused_book(spellbook)) {
spellbook->in_use = FALSE; spellbook->in_use = FALSE;
@@ -564,7 +560,7 @@ register struct obj *spellbook;
multi_reason = "reading a book"; multi_reason = "reading a book";
nomovemsg = 0; nomovemsg = 0;
context.spbook.delay = 0; context.spbook.delay = 0;
return (1); return 1;
} }
spellbook->in_use = FALSE; spellbook->in_use = FALSE;
@@ -576,7 +572,7 @@ register struct obj *spellbook;
if (context.spbook.book) if (context.spbook.book)
context.spbook.o_id = context.spbook.book->o_id; context.spbook.o_id = context.spbook.book->o_id;
set_occupation(learn, "studying", 0); set_occupation(learn, "studying", 0);
return (1); return 1;
} }
/* a spellbook has been destroyed or the character has changed levels; /* a spellbook has been destroyed or the character has changed levels;
@@ -714,7 +710,7 @@ int
spell_skilltype(booktype) spell_skilltype(booktype)
int booktype; int booktype;
{ {
return (objects[booktype].oc_skill); return objects[booktype].oc_skill;
} }
STATIC_OVL void STATIC_OVL void
@@ -849,7 +845,7 @@ boolean atme;
Your("knowledge of this spell is twisted."); Your("knowledge of this spell is twisted.");
pline("It invokes nightmarish images in your mind..."); pline("It invokes nightmarish images in your mind...");
spell_backfire(spell); spell_backfire(spell);
return (0); return 0;
} else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */ } else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */
You("strain to recall the spell."); You("strain to recall the spell.");
} else if (spellknow(spell) <= KEEN / 40) { /* 500 turns left */ } else if (spellknow(spell) <= KEEN / 40) { /* 500 turns left */
@@ -863,16 +859,16 @@ boolean atme;
if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) { if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) {
You("are too hungry to cast that spell."); You("are too hungry to cast that spell.");
return (0); return 0;
} else if (ACURR(A_STR) < 4 && spellid(spell) != SPE_RESTORE_ABILITY) { } else if (ACURR(A_STR) < 4 && spellid(spell) != SPE_RESTORE_ABILITY) {
You("lack the strength to cast spells."); You("lack the strength to cast spells.");
return (0); return 0;
} else if (check_capacity("Your concentration falters while carrying so " } else if (check_capacity("Your concentration falters while carrying so "
"much stuff.")) { "much stuff.")) {
return (1); return 1;
} else if (!freehand()) { } else if (!freehand()) {
Your("arms are not free to cast!"); Your("arms are not free to cast!");
return (0); return 0;
} }
if (u.uhave.amulet) { if (u.uhave.amulet) {
@@ -881,7 +877,7 @@ boolean atme;
} }
if (energy > u.uen) { if (energy > u.uen) {
You("don't have enough energy to cast that spell."); You("don't have enough energy to cast that spell.");
return (0); return 0;
} else { } else {
if (spellid(spell) != SPE_DETECT_FOOD) { if (spellid(spell) != SPE_DETECT_FOOD) {
int hungr = energy * 2; int hungr = energy * 2;
@@ -938,7 +934,7 @@ boolean atme;
You("fail to cast the spell correctly."); You("fail to cast the spell correctly.");
u.uen -= energy / 2; u.uen -= energy / 2;
context.botl = 1; context.botl = 1;
return (1); return 1;
} }
u.uen -= energy; u.uen -= energy;
@@ -948,10 +944,10 @@ boolean atme;
pseudo = mksobj(spellid(spell), FALSE, FALSE); pseudo = mksobj(spellid(spell), FALSE, FALSE);
pseudo->blessed = pseudo->cursed = 0; pseudo->blessed = pseudo->cursed = 0;
pseudo->quan = 20L; /* do not let useup get it */ pseudo->quan = 20L; /* do not let useup get it */
/* /*
* Find the skill the hero has in a spell type category. * Find the skill the hero has in a spell type category.
* See spell_skilltype for categories. * See spell_skilltype for categories.
*/ */
skill = spell_skilltype(pseudo->otyp); skill = spell_skilltype(pseudo->otyp);
role_skill = P_SKILL(skill); role_skill = P_SKILL(skill);
@@ -978,11 +974,12 @@ boolean atme;
losehp(damage, buf, NO_KILLER_PREFIX); losehp(damage, buf, NO_KILLER_PREFIX);
} }
} else { } else {
explode( explode(u.dx, u.dy,
u.dx, u.dy, pseudo->otyp - SPE_MAGIC_MISSILE + 10, pseudo->otyp - SPE_MAGIC_MISSILE + 10,
spell_damage_bonus(u.ulevel / 2 + 1), 0, spell_damage_bonus(u.ulevel / 2 + 1), 0,
(pseudo->otyp == SPE_CONE_OF_COLD) ? EXPL_FROSTY (pseudo->otyp == SPE_CONE_OF_COLD)
: EXPL_FIERY); ? EXPL_FROSTY
: EXPL_FIERY);
} }
u.dx = cc.x + rnd(3) - 2; u.dx = cc.x + rnd(3) - 2;
u.dy = cc.y + rnd(3) - 2; u.dy = cc.y + rnd(3) - 2;
@@ -1100,14 +1097,14 @@ boolean atme;
default: default:
impossible("Unknown spell %d attempted.", spell); impossible("Unknown spell %d attempted.", spell);
obfree(pseudo, (struct obj *) 0); obfree(pseudo, (struct obj *) 0);
return (0); return 0;
} }
/* gain skill for successful cast */ /* gain skill for successful cast */
use_skill(skill, spellev(spell)); use_skill(skill, spellev(spell));
obfree(pseudo, (struct obj *) 0); /* now, get rid of it */ obfree(pseudo, (struct obj *) 0); /* now, get rid of it */
return (1); return 1;
} }
/* Choose location where spell takes effect. */ /* Choose location where spell takes effect. */
+13 -14
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -253,7 +253,7 @@ char *objnambuf;
*objnambuf = '\0'; *objnambuf = '\0';
/* the following is true if successful on first of two attacks. */ /* the following is true if successful on first of two attacks. */
if (!monnear(mtmp, u.ux, u.uy)) if (!monnear(mtmp, u.ux, u.uy))
return (0); return 0;
/* food being eaten might already be used up but will not have /* food being eaten might already be used up but will not have
been removed from inventory yet; we don't want to steal that, been removed from inventory yet; we don't want to steal that,
@@ -269,7 +269,7 @@ char *objnambuf;
else else
pline("%s tries to rob you, but there is nothing to steal!", pline("%s tries to rob you, but there is nothing to steal!",
Monnam(mtmp)); Monnam(mtmp));
return (1); /* let her flee */ return 1; /* let her flee */
} }
monkey_business = is_animal(mtmp->data); monkey_business = is_animal(mtmp->data);
@@ -301,7 +301,7 @@ retry:
} }
if (!otmp) { if (!otmp) {
impossible("Steal fails!"); impossible("Steal fails!");
return (0); return 0;
} }
/* can't steal ring(s) while wearing gloves */ /* can't steal ring(s) while wearing gloves */
if ((otmp == uleft || otmp == uright) && uarmg) if ((otmp == uleft || otmp == uright) && uarmg)
@@ -320,7 +320,7 @@ retry:
gotobj: gotobj:
if (otmp->o_id == stealoid) if (otmp->o_id == stealoid)
return (0); return 0;
if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) { if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) {
if (!retrycnt++) if (!retrycnt++)
@@ -337,10 +337,10 @@ gotobj:
else if (otmp == uquiver || (otmp == uswapwep && !u.twoweap)) else if (otmp == uquiver || (otmp == uswapwep && !u.twoweap))
ostuck = FALSE; /* not really worn; curse doesn't matter */ ostuck = FALSE; /* not really worn; curse doesn't matter */
else else
ostuck = ((otmp->cursed && otmp->owornmask) || ostuck = ((otmp->cursed && otmp->owornmask)
/* nymphs can steal rings from under /* nymphs can steal rings from under
cursed weapon but animals can't */ cursed weapon but animals can't */
(otmp == uright && welded(uwep)) || (otmp == uright && welded(uwep))
|| (otmp == uleft && welded(uwep) && bimanual(uwep))); || (otmp == uleft && welded(uwep) && bimanual(uwep)));
if (ostuck || can_carry(mtmp, otmp) == 0) { if (ostuck || can_carry(mtmp, otmp) == 0) {
@@ -433,7 +433,7 @@ gotobj:
stealoid = otmp->o_id; stealoid = otmp->o_id;
stealmid = mtmp->m_id; stealmid = mtmp->m_id;
afternmv = stealarm; afternmv = stealarm;
return (0); return 0;
} }
} }
break; break;
@@ -463,7 +463,7 @@ gotobj:
minstapetrify(mtmp, TRUE); minstapetrify(mtmp, TRUE);
return -1; return -1;
} }
return ((multi < 0) ? 0 : 1); return (multi < 0) ? 0 : 1;
} }
/* Returns 1 if otmp is free'd, 0 otherwise. */ /* 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 /* don't charge for an owned saddle on dead steed (provided
that the hero is within the same shop at the time) */ that the hero is within the same shop at the time) */
} else if (mon->mtame && (obj->owornmask & W_SADDLE) && !obj->unpaid } else if (mon->mtame && (obj->owornmask & W_SADDLE) && !obj->unpaid
&& costly_spot(omx, omy) && && costly_spot(omx, omy)
/* being at a costly_spot guarantees lev->roomno is not 0 /* being at costly_spot guarantees lev->roomno is not 0 */
*/ && index(in_rooms(u.ux, u.uy, SHOPBASE),
index(in_rooms(u.ux, u.uy, SHOPBASE), levl[omx][omy].roomno)) {
levl[omx][omy].roomno)) {
obj->no_charge = 1; obj->no_charge = 1;
} }
/* this should be done even if the monster has died */ /* this should be done even if the monster has died */
+3 -3
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. */ /* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -676,9 +676,9 @@ place_monster(mon, x, y)
struct monst *mon; struct monst *mon;
int x, y; int x, y;
{ {
if (mon == u.usteed || if (mon == u.usteed
/* special case is for convoluted vault guard handling */ /* 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?", impossible("placing %s onto map?",
(mon == u.usteed) ? "steed" : "defunct monster"); (mon == u.usteed) ? "steed" : "defunct monster");
return; return;