formatting: src/e*.c - l*.c continuation lines

Relatively small number of continuation fixes needed for this subset.

Quite a bit of mangling to engrave.c unrelated to continuation lines,
with three or four coding changes.
This commit is contained in:
PatR
2015-10-20 17:55:26 -07:00
parent 581b1830ff
commit b7b9d8faa9
5 changed files with 146 additions and 175 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1440120655 2015/08/21 01:30:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.144 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1445388914 2015/10/21 00:55:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.149 $ */
/* 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. */
@@ -91,10 +91,10 @@ register struct obj *obj;
if (metallivorous(youmonst.data) && is_metallic(obj) if (metallivorous(youmonst.data) && is_metallic(obj)
&& (youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj))) && (youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
return TRUE; return TRUE;
if (u.umonnum == PM_GELATINOUS_CUBE && is_organic(obj) && if (u.umonnum == PM_GELATINOUS_CUBE && is_organic(obj)
/* [g.cubes can eat containers and retain all contents /* [g.cubes can eat containers and retain all contents
as engulfed items, but poly'd player can't do that] */ as engulfed items, but poly'd player can't do that] */
!Has_contents(obj)) && !Has_contents(obj))
return TRUE; return TRUE;
/* return((boolean)(!!index(comestibles, obj->oclass))); */ /* return((boolean)(!!index(comestibles, obj->oclass))); */
@@ -601,12 +601,12 @@ boolean allowmsg;
return FALSE; return FALSE;
ate_brains = moves; /* ate_anything, not just brains... */ ate_brains = moves; /* ate_anything, not just brains... */
if (!CANNIBAL_ALLOWED() && if (!CANNIBAL_ALLOWED()
/* non-cannibalistic heroes shouldn't eat own species ever /* non-cannibalistic heroes shouldn't eat own species ever
and also shouldn't eat current species when polymorphed and also shouldn't eat current species when polymorphed
(even if having the form of something which doesn't care (even if having the form of something which doesn't care
about cannibalism--hero's innate traits aren't altered) */ about cannibalism--hero's innate traits aren't altered) */
(your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) { && (your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) {
if (allowmsg) { if (allowmsg) {
if (Upolyd && your_race(fptr)) if (Upolyd && your_race(fptr))
You("have a bad feeling deep inside."); You("have a bad feeling deep inside.");
+123 -152
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 engrave.c $NHDT-Date: 1436753512 2015/07/13 02:11:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.57 $ */ /* NetHack 3.6 engrave.c $NHDT-Date: 1445388915 2015/10/21 00:55:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* 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. */
@@ -14,11 +14,9 @@ char *outbuf;
const char *rumor; const char *rumor;
/* a random engraving may come from the "rumors" file, /* a random engraving may come from the "rumors" file,
or from the list above */ or from the "engrave" file (formerly in an array here) */
if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor) { if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor)
char buf[BUFSZ]; (void) get_rnd_text(ENGRAVEFILE, outbuf);
Strcpy(outbuf, get_rnd_text(ENGRAVEFILE, buf));
}
wipeout_text(outbuf, (int) (strlen(outbuf) / 4), 0); wipeout_text(outbuf, (int) (strlen(outbuf) / 4), 0);
return outbuf; return outbuf;
@@ -77,6 +75,7 @@ static const struct {
{ '7', "/" }, { '7', "/" },
{ '8', "3o" } }; { '8', "3o" } };
/* degrade some of the characters in a string */
void void
wipeout_text(engr, cnt, seed) wipeout_text(engr, cnt, seed)
char *engr; char *engr;
@@ -137,7 +136,7 @@ unsigned seed; /* for semi-controlled randomization */
/* trim trailing spaces */ /* trim trailing spaces */
while (lth && engr[lth - 1] == ' ') while (lth && engr[lth - 1] == ' ')
engr[--lth] = 0; engr[--lth] = '\0';
} }
/* check whether hero can reach something at ground level */ /* check whether hero can reach something at ground level */
@@ -152,14 +151,14 @@ boolean check_pit;
/* Restricted/unskilled riders can't reach the floor */ /* Restricted/unskilled riders can't reach the floor */
if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
return FALSE; return FALSE;
if (check_pit && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t) if (check_pit && !Flying
&& !Flying) && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t))
return FALSE; return FALSE;
return (boolean)( return (boolean) ((!Levitation || Is_airlevel(&u.uz)
(!Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) || Is_waterlevel(&u.uz))
&& (!u.uundetected || !is_hider(youmonst.data) && (!u.uundetected || !is_hider(youmonst.data)
|| u.umonnum == PM_TRAPPER)); || u.umonnum == PM_TRAPPER));
} }
/* give a message after caller has determined that hero can't reach */ /* give a message after caller has determined that hero can't reach */
@@ -181,7 +180,7 @@ register int x, y;
{ {
register struct rm *lev = &levl[x][y]; register struct rm *lev = &levl[x][y];
if ((x == u.ux) && (y == u.uy) && u.uswallow && is_animal(u.ustuck->data)) if (x == u.ux && y == u.uy && u.uswallow && is_animal(u.ustuck->data))
return "maw"; return "maw";
else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz)) else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz))
return "air"; return "air";
@@ -199,8 +198,8 @@ register int x, y;
return "headstone"; return "headstone";
else if (IS_FOUNTAIN(levl[x][y].typ)) else if (IS_FOUNTAIN(levl[x][y].typ))
return "fountain"; return "fountain";
else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz)) || IS_WALL(lev->typ) else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz))
|| IS_DOOR(lev->typ) || lev->typ == SDOOR) || IS_WALL(lev->typ) || IS_DOOR(lev->typ) || lev->typ == SDOOR)
return "floor"; return "floor";
else else
return "ground"; return "ground";
@@ -229,8 +228,8 @@ register int x, y;
what = "sky"; what = "sky";
else if (Underwater) else if (Underwater)
what = "water's surface"; what = "water's surface";
else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz)) || IS_WALL(lev->typ) else if ((IS_ROOM(lev->typ) && !Is_earthlevel(&u.uz))
|| IS_DOOR(lev->typ) || lev->typ == SDOOR) || IS_WALL(lev->typ) || IS_DOOR(lev->typ) || lev->typ == SDOOR)
what = "ceiling"; what = "ceiling";
else else
what = "rock cavern"; what = "rock cavern";
@@ -246,14 +245,14 @@ xchar x, y;
while (ep) { while (ep) {
if (x == ep->engr_x && y == ep->engr_y) if (x == ep->engr_x && y == ep->engr_y)
return (ep); return ep;
ep = ep->nxt_engr; ep = ep->nxt_engr;
} }
return ((struct engr *) 0); return (struct engr *) 0;
} }
/* Decide whether a particular string is engraved at a specified /* Decide whether a particular string is engraved at a specified
* location; a case-insensitive substring match used. * location; a case-insensitive substring match is used.
* Ignore headstones, in case the player names herself "Elbereth". * Ignore headstones, in case the player names herself "Elbereth".
* *
* If strict checking is requested, the word is only considered to be * If strict checking is requested, the word is only considered to be
@@ -277,7 +276,7 @@ boolean strict;
void void
u_wipe_engr(cnt) u_wipe_engr(cnt)
register int cnt; int cnt;
{ {
if (can_reach_floor(TRUE)) if (can_reach_floor(TRUE))
wipe_engr_at(u.ux, u.uy, cnt, FALSE); wipe_engr_at(u.ux, u.uy, cnt, FALSE);
@@ -285,7 +284,7 @@ register int cnt;
void void
wipe_engr_at(x, y, cnt, magical) wipe_engr_at(x, y, cnt, magical)
register xchar x, y, cnt, magical; xchar x, y, cnt, magical;
{ {
register struct engr *ep = engr_at(x, y); register struct engr *ep = engr_at(x, y);
@@ -308,10 +307,10 @@ register xchar x, y, cnt, magical;
void void
read_engr_at(x, y) read_engr_at(x, y)
register int x, y; int x, y;
{ {
register struct engr *ep = engr_at(x, y); register struct engr *ep = engr_at(x, y);
register int sensed = 0; int sensed = 0;
char buf[BUFSZ]; char buf[BUFSZ];
/* Sensing an engraving does not require sight, /* Sensing an engraving does not require sight,
@@ -379,12 +378,12 @@ register int x, y;
void void
make_engr_at(x, y, s, e_time, e_type) make_engr_at(x, y, s, e_time, e_type)
register int x, y; int x, y;
register const char *s; const char *s;
register long e_time; long e_time;
register xchar e_type; xchar e_type;
{ {
register struct engr *ep; struct engr *ep;
if ((ep = engr_at(x, y)) != 0) if ((ep = engr_at(x, y)) != 0)
del_engr(ep); del_engr(ep);
@@ -422,11 +421,6 @@ freehand()
{ {
return (!uwep || !welded(uwep) return (!uwep || !welded(uwep)
|| (!bimanual(uwep) && (!uarms || !uarms->cursed))); || (!bimanual(uwep) && (!uarms || !uarms->cursed)));
/* if ((uwep && bimanual(uwep)) ||
(uwep && uarms))
return(0);
else
return(1);*/
} }
static NEARDATA const char styluses[] = { ALL_CLASSES, ALLOW_NONE, static NEARDATA const char styluses[] = { ALL_CLASSES, ALLOW_NONE,
@@ -441,7 +435,7 @@ static NEARDATA const char styluses[] = { ALL_CLASSES, ALLOW_NONE,
* 4 - Fluorite 9 - Corundum * 4 - Fluorite 9 - Corundum
* 5 - Apatite 10 - Diamond * 5 - Apatite 10 - Diamond
* *
* Since granite is a igneous rock hardness ~ 7, anything >= 8 should * Since granite is an igneous rock hardness ~ 7, anything >= 8 should
* probably be able to scratch the rock. * probably be able to scratch the rock.
* Devaluation of less hard gems is not easily possible because obj struct * Devaluation of less hard gems is not easily possible because obj struct
* does not contain individual oc_cost currently. 7/91 * does not contain individual oc_cost currently. 7/91
@@ -504,22 +498,22 @@ doengrave()
if (u.uswallow) { if (u.uswallow) {
if (is_animal(u.ustuck->data)) { if (is_animal(u.ustuck->data)) {
pline("What would you write? \"Jonah was here\"?"); pline("What would you write? \"Jonah was here\"?");
return (0); return 0;
} else if (is_whirly(u.ustuck->data)) { } else if (is_whirly(u.ustuck->data)) {
cant_reach_floor(u.ux, u.uy, FALSE, FALSE); cant_reach_floor(u.ux, u.uy, FALSE, FALSE);
return (0); return 0;
} else } else
jello = TRUE; jello = TRUE;
} else if (is_lava(u.ux, u.uy)) { } else if (is_lava(u.ux, u.uy)) {
You_cant("write on the %s!", surface(u.ux, u.uy)); You_cant("write on the %s!", surface(u.ux, u.uy));
return (0); return 0;
} else if (is_pool(u.ux, u.uy) || IS_FOUNTAIN(levl[u.ux][u.uy].typ)) { } else if (is_pool(u.ux, u.uy) || IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
You_cant("write on the %s!", surface(u.ux, u.uy)); You_cant("write on the %s!", surface(u.ux, u.uy));
return (0); return 0;
} }
if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) /* in bubble */) { if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz) /* in bubble */) {
You_cant("write in thin air!"); You_cant("write in thin air!");
return (0); return 0;
} else if (!accessible(u.ux, u.uy)) { } else if (!accessible(u.ux, u.uy)) {
/* stone, tree, wall, secret corridor, pool, lava, bars */ /* stone, tree, wall, secret corridor, pool, lava, bars */
You_cant("write here."); You_cant("write here.");
@@ -527,18 +521,18 @@ doengrave()
} }
if (cantwield(youmonst.data)) { if (cantwield(youmonst.data)) {
You_cant("even hold anything!"); You_cant("even hold anything!");
return (0); return 0;
} }
if (check_capacity((char *) 0)) if (check_capacity((char *) 0))
return (0); return 0;
/* One may write with finger, or weapon, or wand, or..., or... /* One may write with finger, or weapon, or wand, or..., or...
* Edited by GAN 10/20/86 so as not to change weapon wielded. * Edited by GAN 10/20/86 so as not to change weapon wielded.
*/ */
otmp = getobj(styluses, "write with"); otmp = getobj(styluses, "write with");
if (!otmp) if (!otmp) /* otmp == zeroobj if fingers */
return (0); /* otmp == zeroobj if fingers */ return 0;
if (otmp == &zeroobj) { if (otmp == &zeroobj) {
Strcat(strcpy(fbuf, "your "), makeplural(body_part(FINGER))); Strcat(strcpy(fbuf, "your "), makeplural(body_part(FINGER)));
@@ -551,34 +545,34 @@ doengrave()
*/ */
if (!freehand() && otmp != uwep && !otmp->owornmask) { if (!freehand() && otmp != uwep && !otmp->owornmask) {
You("have no free %s to write with!", body_part(HAND)); You("have no free %s to write with!", body_part(HAND));
return (0); return 0;
} }
if (jello) { if (jello) {
You("tickle %s with %s.", mon_nam(u.ustuck), writer); You("tickle %s with %s.", mon_nam(u.ustuck), writer);
Your("message dissolves..."); Your("message dissolves...");
return (0); return 0;
} }
if (otmp->oclass != WAND_CLASS && !can_reach_floor(TRUE)) { if (otmp->oclass != WAND_CLASS && !can_reach_floor(TRUE)) {
cant_reach_floor(u.ux, u.uy, FALSE, TRUE); cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
return (0); return 0;
} }
if (IS_ALTAR(levl[u.ux][u.uy].typ)) { if (IS_ALTAR(levl[u.ux][u.uy].typ)) {
You("make a motion towards the altar with %s.", writer); You("make a motion towards the altar with %s.", writer);
altar_wrath(u.ux, u.uy); altar_wrath(u.ux, u.uy);
return (0); return 0;
} }
if (IS_GRAVE(levl[u.ux][u.uy].typ)) { if (IS_GRAVE(levl[u.ux][u.uy].typ)) {
if (otmp == &zeroobj) { /* using only finger */ if (otmp == &zeroobj) { /* using only finger */
You("would only make a small smudge on the %s.", You("would only make a small smudge on the %s.",
surface(u.ux, u.uy)); surface(u.ux, u.uy));
return (0); return 0;
} else if (!levl[u.ux][u.uy].disturbed) { } else if (!levl[u.ux][u.uy].disturbed) {
You("disturb the undead!"); You("disturb the undead!");
levl[u.ux][u.uy].disturbed = 1; levl[u.ux][u.uy].disturbed = 1;
(void) makemon(&mons[PM_GHOUL], u.ux, u.uy, NO_MM_FLAGS); (void) makemon(&mons[PM_GHOUL], u.ux, u.uy, NO_MM_FLAGS);
exercise(A_WIS, FALSE); exercise(A_WIS, FALSE);
return (1); return 1;
} }
} }
@@ -591,9 +585,8 @@ doengrave()
case POTION_CLASS: case POTION_CLASS:
case COIN_CLASS: case COIN_CLASS:
break; break;
case RING_CLASS: case RING_CLASS:
/* "diamond" rings and others should work */ /* "diamond" rings and others should work */
case GEM_CLASS: case GEM_CLASS:
/* diamonds & other hard gems should work */ /* diamonds & other hard gems should work */
if (objects[otmp->otyp].oc_tough) { if (objects[otmp->otyp].oc_tough) {
@@ -601,20 +594,18 @@ doengrave()
break; break;
} }
break; break;
case ARMOR_CLASS: case ARMOR_CLASS:
if (is_boots(otmp)) { if (is_boots(otmp)) {
type = DUST; type = DUST;
break; break;
} }
/* fall through */ /*FALLTHRU*/
/* Objects too large to engrave with */ /* Objects too large to engrave with */
case BALL_CLASS: case BALL_CLASS:
case ROCK_CLASS: case ROCK_CLASS:
You_cant("engrave with such a large object!"); You_cant("engrave with such a large object!");
ptext = FALSE; ptext = FALSE;
break; break;
/* Objects too silly to engrave with */ /* Objects too silly to engrave with */
case FOOD_CLASS: case FOOD_CLASS:
case SCROLL_CLASS: case SCROLL_CLASS:
@@ -623,7 +614,6 @@ doengrave()
is_ice(u.ux, u.uy) ? "all frosty" : "too dirty"); is_ice(u.ux, u.uy) ? "all frosty" : "too dirty");
ptext = FALSE; ptext = FALSE;
break; break;
case RANDOM_CLASS: /* This should mean fingers */ case RANDOM_CLASS: /* This should mean fingers */
break; break;
@@ -649,7 +639,6 @@ doengrave()
/* DUST wands */ /* DUST wands */
default: default:
break; break;
/* NODIR wands */ /* NODIR wands */
case WAN_LIGHT: case WAN_LIGHT:
case WAN_SECRET_DOOR_DETECTION: case WAN_SECRET_DOOR_DETECTION:
@@ -658,14 +647,12 @@ doengrave()
case WAN_ENLIGHTENMENT: case WAN_ENLIGHTENMENT:
zapnodir(otmp); zapnodir(otmp);
break; break;
/* IMMEDIATE wands */ /* IMMEDIATE wands */
/* If wand is "IMMEDIATE", remember to affect the /* If wand is "IMMEDIATE", remember to affect the
* previous engraving even if turning to dust. * previous engraving even if turning to dust.
*/ */
case WAN_STRIKING: case WAN_STRIKING:
Strcpy( Strcpy(post_engr_text,
post_engr_text,
"The wand unsuccessfully fights your attempt to write!"); "The wand unsuccessfully fights your attempt to write!");
break; break;
case WAN_SLOW_MONSTER: case WAN_SLOW_MONSTER:
@@ -695,7 +682,6 @@ doengrave()
case WAN_LOCKING: case WAN_LOCKING:
case WAN_PROBING: case WAN_PROBING:
break; break;
/* RAY wands */ /* RAY wands */
case WAN_MAGIC_MISSILE: case WAN_MAGIC_MISSILE:
ptext = TRUE; ptext = TRUE;
@@ -705,7 +691,6 @@ doengrave()
surface(u.ux, u.uy)); surface(u.ux, u.uy));
} }
break; break;
/* can't tell sleep from death - Eric Backus */ /* can't tell sleep from death - Eric Backus */
case WAN_SLEEP: case WAN_SLEEP:
case WAN_DEATH: case WAN_DEATH:
@@ -714,7 +699,6 @@ doengrave()
surface(u.ux, u.uy)); surface(u.ux, u.uy));
} }
break; break;
case WAN_COLD: case WAN_COLD:
if (!Blind) if (!Blind)
Strcpy(post_engr_text, Strcpy(post_engr_text,
@@ -738,7 +722,6 @@ doengrave()
teleengr = TRUE; teleengr = TRUE;
} }
break; break;
/* type = ENGRAVE wands */ /* type = ENGRAVE wands */
case WAN_DIGGING: case WAN_DIGGING:
ptext = TRUE; ptext = TRUE;
@@ -748,21 +731,18 @@ doengrave()
pline("This %s is a wand of digging!", xname(otmp)); pline("This %s is a wand of digging!", xname(otmp));
doknown = TRUE; doknown = TRUE;
} }
if (!Blind) Strcpy(post_engr_text,
Strcpy( Blind
post_engr_text, ? "You hear drilling!"
IS_GRAVE(levl[u.ux][u.uy].typ) : IS_GRAVE(levl[u.ux][u.uy].typ)
? "Chips fly out from the headstone." ? "Chips fly out from the headstone."
: is_ice(u.ux, u.uy) : is_ice(u.ux, u.uy)
? "Ice chips fly up from the ice surface!" ? "Ice chips fly up from the ice surface!"
: (level.locations[u.ux][u.uy].typ : (level.locations[u.ux][u.uy].typ
== DRAWBRIDGE_DOWN) == DRAWBRIDGE_DOWN)
? "Splinters fly up from the bridge." ? "Splinters fly up from the bridge."
: "Gravel flies up from the floor."); : "Gravel flies up from the floor.");
else
Strcpy(post_engr_text, "You hear drilling!");
break; break;
/* type = BURN wands */ /* type = BURN wands */
case WAN_FIRE: case WAN_FIRE:
ptext = TRUE; ptext = TRUE;
@@ -790,14 +770,14 @@ doengrave()
Strcpy(post_engr_text, "You hear crackling!"); Strcpy(post_engr_text, "You hear crackling!");
break; break;
/* type = MARK wands */ /* type = MARK wands */
/* type = ENGR_BLOOD wands */ /* type = ENGR_BLOOD wands */
} }
} else { /* end if zappable */ } else { /* end if zappable */
/* failing to wrest one last charge takes time */ /* failing to wrest one last charge takes time */
ptext = FALSE; /* use "early exit" below, return 1 */ ptext = FALSE; /* use "early exit" below, return 1 */
/* give feedback here if we won't be getting the /* give feedback here if we won't be getting the
"can't reach floor" message below */ "can't reach floor" message below */
if (can_reach_floor(TRUE)) { if (can_reach_floor(TRUE)) {
/* cancelled wand turns to dust */ /* cancelled wand turns to dust */
if (otmp->spe < 0) if (otmp->spe < 0)
@@ -822,7 +802,7 @@ doengrave()
if (otmp == ublindf) { if (otmp == ublindf) {
pline( pline(
"That is a bit difficult to engrave with, don't you think?"); "That is a bit difficult to engrave with, don't you think?");
return (0); return 0;
} }
switch (otmp->otyp) { switch (otmp->otyp) {
case MAGIC_MARKER: case MAGIC_MARKER:
@@ -835,8 +815,11 @@ doengrave()
/* Can't really engrave with a towel */ /* Can't really engrave with a towel */
ptext = FALSE; ptext = FALSE;
if (oep) if (oep)
if ((oep->engr_type == DUST) || (oep->engr_type == ENGR_BLOOD) if (oep->engr_type == DUST
|| (oep->engr_type == MARK)) { || oep->engr_type == ENGR_BLOOD
|| oep->engr_type == MARK) {
if (is_wet_towel(otmp))
dry_a_towel(otmp, -1, TRUE);
if (!Blind) if (!Blind)
You("wipe out the message here."); You("wipe out the message here.");
else else
@@ -859,24 +842,27 @@ doengrave()
pline("Writing a poison pen letter??"); pline("Writing a poison pen letter??");
break; break;
} }
/*FALLTHRU*/
case ILLOBJ_CLASS: case ILLOBJ_CLASS:
impossible("You're engraving with an illegal object!"); impossible("You're engraving with an illegal object!");
break; break;
} }
if (IS_GRAVE(levl[u.ux][u.uy].typ)) { if (IS_GRAVE(levl[u.ux][u.uy].typ)) {
if (type == ENGRAVE || type == 0) if (type == ENGRAVE || type == 0) {
type = HEADSTONE; type = HEADSTONE;
else { } else {
/* ensures the "cannot wipe out" case */ /* ensures the "cannot wipe out" case */
type = DUST; type = DUST;
dengr = FALSE; dengr = FALSE;
teleengr = FALSE; teleengr = FALSE;
buf[0] = (char) 0; buf[0] = '\0';
} }
} }
/* End of implement setup */ /*
* End of implement setup
*/
/* Identify stylus */ /* Identify stylus */
if (doknown) { if (doknown) {
@@ -884,24 +870,20 @@ doengrave()
if (objects[otmp->otyp].oc_name_known) if (objects[otmp->otyp].oc_name_known)
more_experienced(0, 10); more_experienced(0, 10);
} }
if (teleengr) { if (teleengr) {
rloc_engr(oep); rloc_engr(oep);
oep = (struct engr *) 0; oep = (struct engr *) 0;
} }
if (dengr) { if (dengr) {
del_engr(oep); del_engr(oep);
oep = (struct engr *) 0; oep = (struct engr *) 0;
} }
/* Something has changed the engraving here */ /* Something has changed the engraving here */
if (*buf) { if (*buf) {
make_engr_at(u.ux, u.uy, buf, moves, type); make_engr_at(u.ux, u.uy, buf, moves, type);
pline_The("engraving now reads: \"%s\".", buf); pline_The("engraving now reads: \"%s\".", buf);
ptext = FALSE; ptext = FALSE;
} }
if (zapwand && (otmp->spe < 0)) { if (zapwand && (otmp->spe < 0)) {
pline("%s %sturns to dust.", The(xname(otmp)), pline("%s %sturns to dust.", The(xname(otmp)),
Blind ? "" : "glows violently, then "); Blind ? "" : "glows violently, then ");
@@ -913,39 +895,38 @@ doengrave()
otmp = 0; /* wand is now gone */ otmp = 0; /* wand is now gone */
ptext = FALSE; ptext = FALSE;
} }
/* Early exit for some implements. */
if (!ptext) { /* Early exit for some implements. */ if (!ptext) {
if (otmp && otmp->oclass == WAND_CLASS && !can_reach_floor(TRUE)) if (otmp && otmp->oclass == WAND_CLASS && !can_reach_floor(TRUE))
cant_reach_floor(u.ux, u.uy, FALSE, TRUE); cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
return (1); return 1;
} }
/*
/* Special effects should have deleted the current engraving (if * Special effects should have deleted the current engraving (if
* possible) by now. * possible) by now.
*/ */
if (oep) { if (oep) {
register char c = 'n'; register char c = 'n';
/* Give player the choice to add to engraving. */ /* Give player the choice to add to engraving. */
if (type == HEADSTONE) { if (type == HEADSTONE) {
/* no choice, only append */ /* no choice, only append */
c = 'y'; c = 'y';
} else if ((type == oep->engr_type) } else if (type == oep->engr_type
&& (!Blind || (oep->engr_type == BURN) && (!Blind || oep->engr_type == BURN
|| (oep->engr_type == ENGRAVE))) { || oep->engr_type == ENGRAVE)) {
c = yn_function("Do you want to add to the current engraving?", c = yn_function("Do you want to add to the current engraving?",
ynqchars, 'y'); ynqchars, 'y');
if (c == 'q') { if (c == 'q') {
pline1(Never_mind); pline1(Never_mind);
return (0); return 0;
} }
} }
if (c == 'n' || Blind) { if (c == 'n' || Blind) {
if ((oep->engr_type == DUST) || (oep->engr_type == ENGR_BLOOD) if (oep->engr_type == DUST
|| (oep->engr_type == MARK)) { || oep->engr_type == ENGR_BLOOD
|| oep->engr_type == MARK) {
if (!Blind) { if (!Blind) {
You("wipe out the message that was %s here.", You("wipe out the message that was %s here.",
(oep->engr_type == DUST) (oep->engr_type == DUST)
@@ -959,15 +940,14 @@ doengrave()
/* Don't delete engr until after we *know* we're engraving /* Don't delete engr until after we *know* we're engraving
*/ */
eow = TRUE; eow = TRUE;
} else if ((type == DUST) || (type == MARK) } else if (type == DUST || type == MARK || type == ENGR_BLOOD) {
|| (type == ENGR_BLOOD)) {
You("cannot wipe out the message that is %s the %s here.", You("cannot wipe out the message that is %s the %s here.",
oep->engr_type == BURN oep->engr_type == BURN
? (is_ice(u.ux, u.uy) ? "melted into" : "burned into") ? (is_ice(u.ux, u.uy) ? "melted into" : "burned into")
: "engraved in", : "engraved in",
surface(u.ux, u.uy)); surface(u.ux, u.uy));
return (1); return 1;
} else if ((type != oep->engr_type) || (c == 'n')) { } else if (type != oep->engr_type || c == 'n') {
if (!Blind || can_reach_floor(TRUE)) if (!Blind || can_reach_floor(TRUE))
You("will overwrite the current message."); You("will overwrite the current message.");
eow = TRUE; eow = TRUE;
@@ -1029,10 +1009,10 @@ doengrave()
if (!Blind) if (!Blind)
pline("%s, then %s.", Tobjnam(otmp, "glow"), pline("%s, then %s.", Tobjnam(otmp, "glow"),
otense(otmp, "fade")); otense(otmp, "fade"));
return (1); return 1;
} else { } else {
pline1(Never_mind); pline1(Never_mind);
return (0); return 0;
} }
} }
@@ -1075,15 +1055,14 @@ doengrave()
case HEADSTONE: case HEADSTONE:
case ENGRAVE: case ENGRAVE:
multi = -(len / 10); multi = -(len / 10);
if ((otmp->oclass == WEAPON_CLASS) if (otmp->oclass == WEAPON_CLASS
&& ((otmp->otyp != ATHAME) || otmp->cursed)) { && (otmp->otyp != ATHAME || otmp->cursed)) {
multi = -len; multi = -len;
maxelen = ((otmp->spe + 3) * 2) + 1; maxelen = ((otmp->spe + 3) * 2) + 1;
/* -2 = 3, -1 = 5, 0 = 7, +1 = 9, +2 = 11 /* -2 => 3, -1 => 5, 0 => 7, +1 => 9, +2 => 11
* Note: this does not allow a +0 anything (except * Note: this does not allow a +0 anything (except an athame)
* an athame) to engrave "Elbereth" all at once. * to engrave "Elbereth" all at once.
* However, you could now engrave "Elb", then * However, you can engrave "Elb", then "ere", then "th".
* "ere", then "th".
*/ */
pline("%s dull.", Yobjnam2(otmp, "get")); pline("%s dull.", Yobjnam2(otmp, "get"));
costly_alteration(otmp, COST_DEGRD); costly_alteration(otmp, COST_DEGRD);
@@ -1094,9 +1073,9 @@ doengrave()
otmp->spe -= len >> 1; otmp->spe -= len >> 1;
else else
otmp->spe -= 1; /* Prevent infinite engraving */ otmp->spe -= 1; /* Prevent infinite engraving */
} else if ((otmp->oclass == RING_CLASS) } else if (otmp->oclass == RING_CLASS || otmp->oclass == GEM_CLASS) {
|| (otmp->oclass == GEM_CLASS))
multi = -len; multi = -len;
}
if (multi) if (multi)
nomovemsg = "You finish engraving."; nomovemsg = "You finish engraving.";
break; break;
@@ -1109,8 +1088,8 @@ doengrave()
break; break;
case MARK: case MARK:
multi = -(len / 10); multi = -(len / 10);
if ((otmp->oclass == TOOL_CLASS) && (otmp->otyp == MAGIC_MARKER)) { if (otmp->otyp == MAGIC_MARKER) {
maxelen = (otmp->spe) * 2; /* one charge / 2 letters */ maxelen = otmp->spe * 2; /* one charge / 2 letters */
if (len > maxelen) { if (len > maxelen) {
Your("marker dries out."); Your("marker dries out.");
otmp->spe = 0; otmp->spe = 0;
@@ -1132,36 +1111,32 @@ doengrave()
/* Chop engraving down to size if necessary */ /* Chop engraving down to size if necessary */
if (len > maxelen) { if (len > maxelen) {
for (sp = ebuf; (maxelen && *sp); sp++) for (sp = ebuf; maxelen && *sp; sp++)
if (*sp == ' ') if (*sp == ' ')
maxelen--; maxelen--;
if (!maxelen && *sp) { if (!maxelen && *sp) {
*sp = (char) 0; *sp = '\0';
if (multi) if (multi)
nomovemsg = "You cannot write any more."; nomovemsg = "You cannot write any more.";
You("are only able to write \"%s\".", ebuf); You("are only able to write \"%s\".", ebuf);
} }
} }
/* Add to existing engraving */ if (oep) /* add to existing engraving */
if (oep)
Strcpy(buf, oep->engr_txt); Strcpy(buf, oep->engr_txt);
(void) strncat(buf, ebuf, BUFSZ - (int) strlen(buf) - 1);
(void) strncat(buf, ebuf, (BUFSZ - (int) strlen(buf) - 1)); /* Put the engraving onto the map */
make_engr_at(u.ux, u.uy, buf, moves - multi, type);
make_engr_at(u.ux, u.uy, buf, (moves - multi), type);
if (post_engr_text[0]) if (post_engr_text[0])
pline1(post_engr_text); pline("%s", post_engr_text);
if (doblind && !resists_blnd(&youmonst)) { if (doblind && !resists_blnd(&youmonst)) {
You("are blinded by the flash!"); You("are blinded by the flash!");
make_blinded((long) rnd(50), FALSE); make_blinded((long) rnd(50), FALSE);
if (!Blind) if (!Blind)
Your1(vision_clears); Your1(vision_clears);
} }
return 1;
return (1);
} }
/* while loading bones, clean up text which might accidentally /* while loading bones, clean up text which might accidentally
@@ -1180,19 +1155,17 @@ void
save_engravings(fd, mode) save_engravings(fd, mode)
int fd, mode; int fd, mode;
{ {
register struct engr *ep = head_engr; struct engr *ep, *ep2;
register struct engr *ep2;
unsigned no_more_engr = 0; unsigned no_more_engr = 0;
while (ep) { for (ep = head_engr; ep; ep = ep2) {
ep2 = ep->nxt_engr; ep2 = ep->nxt_engr;
if (ep->engr_lth && ep->engr_txt[0] && perform_bwrite(mode)) { if (ep->engr_lth && ep->engr_txt[0] && perform_bwrite(mode)) {
bwrite(fd, (genericptr_t) & (ep->engr_lth), sizeof(ep->engr_lth)); bwrite(fd, (genericptr_t) &ep->engr_lth, sizeof ep->engr_lth);
bwrite(fd, (genericptr_t) ep, sizeof(struct engr) + ep->engr_lth); bwrite(fd, (genericptr_t) ep, sizeof (struct engr) + ep->engr_lth);
} }
if (release_data(mode)) if (release_data(mode))
dealloc_engr(ep); dealloc_engr(ep);
ep = ep2;
} }
if (perform_bwrite(mode)) if (perform_bwrite(mode))
bwrite(fd, (genericptr_t) &no_more_engr, sizeof no_more_engr); bwrite(fd, (genericptr_t) &no_more_engr, sizeof no_more_engr);
@@ -1204,22 +1177,23 @@ void
rest_engravings(fd) rest_engravings(fd)
int fd; int fd;
{ {
register struct engr *ep; struct engr *ep;
unsigned lth; unsigned lth;
head_engr = 0; head_engr = 0;
while (1) { while (1) {
mread(fd, (genericptr_t) &lth, sizeof(unsigned)); mread(fd, (genericptr_t) &lth, sizeof lth);
if (lth == 0) if (lth == 0)
return; return;
ep = newengr(lth); ep = newengr(lth);
mread(fd, (genericptr_t) ep, sizeof(struct engr) + lth); mread(fd, (genericptr_t) ep, sizeof (struct engr) + lth);
ep->nxt_engr = head_engr; ep->nxt_engr = head_engr;
head_engr = ep; head_engr = ep;
ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */ ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */
/* mark as finished for bones levels -- no problem for /* Mark as finished for bones levels -- no problem for
* normal levels as the player must have finished engraving * normal levels as the player must have finished engraving
* to be able to move again */ * to be able to move again.
*/
ep->engr_time = moves; ep->engr_time = moves;
} }
} }
@@ -1272,21 +1246,18 @@ make_grave(x, y, str)
int x, y; int x, y;
const char *str; const char *str;
{ {
char buf[BUFSZ];
/* Can we put a grave here? */ /* Can we put a grave here? */
if ((levl[x][y].typ != ROOM && levl[x][y].typ != GRAVE) || t_at(x, y)) if ((levl[x][y].typ != ROOM && levl[x][y].typ != GRAVE) || t_at(x, y))
return; return;
/* Make the grave */ /* Make the grave */
levl[x][y].typ = GRAVE; levl[x][y].typ = GRAVE;
/* Engrave the headstone */ /* Engrave the headstone */
del_engr_at(x, y); del_engr_at(x, y);
if (str) if (!str)
make_engr_at(x, y, str, 0L, HEADSTONE); str = get_rnd_text(EPITAPHFILE, buf);
else { make_engr_at(x, y, str, 0L, HEADSTONE);
char buf[BUFSZ];
make_engr_at(x, y, get_rnd_text(EPITAPHFILE, buf), 0L, HEADSTONE);
}
return; return;
} }
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1432512769 2015/05/25 00:12:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.42 $ */ /* NetHack 3.6 explode.c $NHDT-Date: 1445388916 2015/10/21 00:55:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.43 $ */
/* Copyright (C) 1990 by Ken Arromdee */ /* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -55,8 +55,8 @@ int expltype;
exploding_wand_typ = (short) type; exploding_wand_typ = (short) type;
/* most attack wands produce specific explosions; /* most attack wands produce specific explosions;
other types produce a generic magical explosion */ other types produce a generic magical explosion */
if (objects[type].oc_dir == RAY && type != WAN_DIGGING && if (objects[type].oc_dir == RAY
type != WAN_SLEEP) { && type != WAN_DIGGING && type != WAN_SLEEP) {
type -= WAN_MAGIC_MISSILE; type -= WAN_MAGIC_MISSILE;
if (type < 0 || type > 9) { if (type < 0 || type > 9) {
impossible("explode: wand has bad zap type (%d).", type); impossible("explode: wand has bad zap type (%d).", type);
+9 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.c $NHDT-Date: 1436753514 2015/07/13 02:11:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */ /* NetHack 3.6 hack.c $NHDT-Date: 1445388917 2015/10/21 00:55:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.154 $ */
/* 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. */
@@ -1421,9 +1421,9 @@ domove()
} }
/* specifying 'F' with no monster wastes a turn */ /* specifying 'F' with no monster wastes a turn */
if (context.forcefight || if (context.forcefight
/* remembered an 'I' && didn't use a move command */ /* remembered an 'I' && didn't use a move command */
(glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) { || (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
struct obj *boulder = 0; struct obj *boulder = 0;
boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)), boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
solid = !accessible(x, y); solid = !accessible(x, y);
@@ -1441,11 +1441,11 @@ domove()
/* force fight at boulder/statue or wall/door while wielding /* force fight at boulder/statue or wall/door while wielding
pick: start digging to break the boulder or wall */ pick: start digging to break the boulder or wall */
if (context.forcefight && if (context.forcefight
/* can we dig? */ /* can we dig? */
uwep && dig_typ(uwep, x, y) && && uwep && dig_typ(uwep, x, y)
/* should we dig? */ /* should we dig? */
!glyph_is_invisible(glyph) && !glyph_is_monster(glyph)) { && !glyph_is_invisible(glyph) && !glyph_is_monster(glyph)) {
(void) use_pick_axe2(uwep); (void) use_pick_axe2(uwep);
return; return;
} }
@@ -1884,11 +1884,11 @@ boolean pick;
/* prevent recursion from affecting the hero all over again /* prevent recursion from affecting the hero all over again
[hero poly'd to iron golem enters water here, drown() inflicts [hero poly'd to iron golem enters water here, drown() inflicts
damage that triggers rehumanize() which calls spoteffects()...] */ damage that triggers rehumanize() which calls spoteffects()...] */
if (inspoteffects && u.ux == spotloc.x && u.uy == spotloc.y && if (inspoteffects && u.ux == spotloc.x && u.uy == spotloc.y
/* except when reason is transformed terrain (ice -> water) */ /* except when reason is transformed terrain (ice -> water) */
spotterrain == levl[u.ux][u.uy].typ && && spotterrain == levl[u.ux][u.uy].typ
/* or transformed trap (land mine -> pit) */ /* or transformed trap (land mine -> pit) */
(!spottrap || !trap || trap->ttyp == spottraptyp)) && (!spottrap || !trap || trap->ttyp == spottraptyp))
return; return;
++inspoteffects; ++inspoteffects;
+6 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1445215019 2015/10/19 00:36:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.174 $ */ /* NetHack 3.6 invent.c $NHDT-Date: 1445388918 2015/10/21 00:55:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.175 $ */
/* 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. */
@@ -1114,9 +1114,9 @@ register const char *let, *word;
&& *let == GEM_CLASS && otmp->dknown && *let == GEM_CLASS && otmp->dknown
&& objects[otyp].oc_name_known) && objects[otyp].oc_name_known)
/* suppress corpses on astral, amulets elsewhere */ /* suppress corpses on astral, amulets elsewhere */
|| (!strcmp(word, "sacrifice") && || (!strcmp(word, "sacrifice")
/* (!astral && amulet) || (astral && !amulet) */ /* (!astral && amulet) || (astral && !amulet) */
(!Is_astralevel(&u.uz) ^ (otmp->oclass != AMULET_CLASS))) && (!Is_astralevel(&u.uz) ^ (otmp->oclass != AMULET_CLASS)))
/* suppress container being stashed into */ /* suppress container being stashed into */
|| (!strcmp(word, "stash") && !ck_bag(otmp)) || (!strcmp(word, "stash") && !ck_bag(otmp))
/* worn armor or accessory covered by cursed worn armor */ /* worn armor or accessory covered by cursed worn armor */
@@ -3327,7 +3327,7 @@ doorganize() /* inventory organizer by Del Lamb */
/* get 'to' slot to use as destination */ /* get 'to' slot to use as destination */
Sprintf(qbuf, "Adjust letter to what [%s]%s?", buf, Sprintf(qbuf, "Adjust letter to what [%s]%s?", buf,
invent ? " (? see used letters)" : ""); invent ? " (? see used letters)" : "");
for (trycnt = 1;; ++trycnt) { for (trycnt = 1; ; ++trycnt) {
let = yn_function(qbuf, (char *) 0, '\0'); let = yn_function(qbuf, (char *) 0, '\0');
if (let == '?' || let == '*') { if (let == '?' || let == '*') {
let = display_used_invlets(splitting ? obj->invlet : 0); let = display_used_invlets(splitting ? obj->invlet : 0);
@@ -3336,11 +3336,11 @@ doorganize() /* inventory organizer by Del Lamb */
if (let == '\033') if (let == '\033')
goto noadjust; goto noadjust;
} }
if (index(quitchars, let) || if (index(quitchars, let)
/* adjusting to same slot is meaningful since all /* adjusting to same slot is meaningful since all
compatible stacks get collected along the way, compatible stacks get collected along the way,
but splitting to same slot is not */ but splitting to same slot is not */
(splitting && let == obj->invlet)) { || (splitting && let == obj->invlet)) {
noadjust: noadjust:
if (splitting) if (splitting)
(void) merged(&splitting, &obj); (void) merged(&splitting, &obj);