some reformatting (2 of 4)
This commit is contained in:
@@ -2195,7 +2195,7 @@ handler_rebind_keys_add(boolean keyfirst)
|
||||
ec = &extcmdlist[i-1];
|
||||
cmdstr = ec->ef_txt;
|
||||
}
|
||||
bindit:
|
||||
bindit:
|
||||
if (!key) {
|
||||
pline("Bind which key? ");
|
||||
key = pgetchar();
|
||||
@@ -2229,8 +2229,7 @@ handler_rebind_keys(void)
|
||||
menu_item *picks = (menu_item *) 0;
|
||||
int clr = NO_COLOR;
|
||||
|
||||
redo_rebind:
|
||||
|
||||
redo_rebind:
|
||||
win = create_nhwindow(NHW_MENU);
|
||||
start_menu(win, MENU_BEHAVE_STANDARD);
|
||||
any = cg.zeroany;
|
||||
|
||||
20
src/do.c
20
src/do.c
@@ -1201,7 +1201,8 @@ dodown(void)
|
||||
return ECMD_TIME;
|
||||
} else if (!trap || !is_hole(trap->ttyp)
|
||||
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
|
||||
if (flags.autodig && !svc.context.nopick && uwep && is_pick(uwep)) {
|
||||
if (flags.autodig && !svc.context.nopick
|
||||
&& uwep && is_pick(uwep)) {
|
||||
return use_pick_axe2(uwep);
|
||||
} else {
|
||||
You_cant("go down here%s.",
|
||||
@@ -1532,7 +1533,7 @@ goto_level(
|
||||
that drops faster, on average, when being sent down farther so
|
||||
while the impact is reduced for everybody compared to earlier
|
||||
versions, it is reduced least for chaotics, most for lawfuls */
|
||||
svc.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */
|
||||
svc.context.mysteryforce += rn2(diff + 2); /* L:0-4,N:0-3,C:0-2 */
|
||||
|
||||
if (on_level(newlevel, &u.uz)) {
|
||||
(void) safe_teleds(TELEDS_NO_FLAGS);
|
||||
@@ -1989,7 +1990,8 @@ temperature_change_msg(schar prev_temperature)
|
||||
void
|
||||
maybe_lvltport_feedback(void)
|
||||
{
|
||||
if (gd.dfr_post_msg && !strncmpi(gd.dfr_post_msg, "You materialize", 15)) {
|
||||
if (gd.dfr_post_msg
|
||||
&& !strncmpi(gd.dfr_post_msg, "You materialize", 15)) {
|
||||
/* "You materialize on a different level." */
|
||||
pline("%s", gd.dfr_post_msg);
|
||||
free((genericptr_t) gd.dfr_post_msg), gd.dfr_post_msg = 0;
|
||||
@@ -2011,8 +2013,10 @@ final_level(void)
|
||||
|
||||
/* change levels at the end of this turn, after monsters finish moving */
|
||||
void
|
||||
schedule_goto(d_level *tolev, int utotype_flags,
|
||||
const char *pre_msg, const char *post_msg)
|
||||
schedule_goto(
|
||||
d_level *tolev,
|
||||
int utotype_flags,
|
||||
const char *pre_msg, const char *post_msg)
|
||||
{
|
||||
/* UTOTYPE_DEFERRED is used, so UTOTYPE_NONE can trigger deferred_goto() */
|
||||
u.utotype = utotype_flags | UTOTYPE_DEFERRED;
|
||||
@@ -2096,9 +2100,9 @@ revive_corpse(struct obj *corpse)
|
||||
struct monst *mtmp2;
|
||||
|
||||
container = corpse->ocontainer;
|
||||
mtmp2 = get_container_location(container, &container_where, (int *) 0);
|
||||
/* container_where is the outermost container's location even if
|
||||
* nested */
|
||||
mtmp2 = get_container_location(container, &container_where,
|
||||
(int *) 0);
|
||||
/* container_where is outermost container's location even if nested */
|
||||
if (container_where == OBJ_MINVENT && mtmp2)
|
||||
mcarry = mtmp2;
|
||||
}
|
||||
|
||||
@@ -225,9 +225,12 @@ makedog(void)
|
||||
if (!svc.context.startingpet_mid) {
|
||||
svc.context.startingpet_mid = mtmp->m_id;
|
||||
if (!u.uroleplay.pauper) {
|
||||
/* initial horses already wear a saddle (unless hero is a pauper) */
|
||||
if (pettype == PM_PONY && !!(otmp = mksobj(SADDLE, TRUE, FALSE))) {
|
||||
otmp->dknown = otmp->bknown = otmp->rknown = 1;
|
||||
/* initial horses already wear saddle (unless hero is a pauper) */
|
||||
if (pettype == PM_PONY
|
||||
&& (otmp = mksobj(SADDLE, TRUE, FALSE)) != 0) {
|
||||
/* pseudo initial inventory; saddle is not actually in hero's
|
||||
* invent so assume that update_inventory() isn't needed */
|
||||
fully_identify_obj(otmp);
|
||||
put_saddle_on_mon(otmp, mtmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,8 @@ dog_eat(struct monst *mtmp,
|
||||
oprice = unpaid_cost(obj, COST_CONTENTS);
|
||||
pline("That %s will cost you %ld %s.", objnambuf, oprice,
|
||||
currency(oprice));
|
||||
/* m_consume_obj->delobj->obfree will handle actual shop billing update */
|
||||
/* m_consume_obj -> delobj -> obfree will actual handle shop
|
||||
billing update */
|
||||
}
|
||||
m_consume_obj(mtmp, obj);
|
||||
}
|
||||
@@ -1338,7 +1339,10 @@ could_reach_item(struct monst *mon, coordxy nx, coordxy ny)
|
||||
* calls deep.
|
||||
*/
|
||||
staticfn boolean
|
||||
can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordxy fy)
|
||||
can_reach_location(
|
||||
struct monst *mon,
|
||||
coordxy mx, coordxy my,
|
||||
coordxy fx, coordxy fy)
|
||||
{
|
||||
int i, j;
|
||||
int dist;
|
||||
|
||||
11
src/dokick.c
11
src/dokick.c
@@ -200,7 +200,8 @@ kick_monster(struct monst *mon, coordxy x, coordxy y)
|
||||
continue;
|
||||
|
||||
kickdieroll = rnd(20);
|
||||
specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
|
||||
specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF,
|
||||
(long *) 0);
|
||||
if (mon->data == &mons[PM_SHADE] && !specialdmg) {
|
||||
/* doesn't matter whether it would have hit or missed,
|
||||
and shades have no passive counterattack */
|
||||
@@ -493,8 +494,9 @@ kick_object(coordxy x, coordxy y, char *kickobjnam)
|
||||
/* if a pile, the "top" object gets kicked */
|
||||
gk.kickedobj = svl.level.objects[x][y];
|
||||
if (gk.kickedobj) {
|
||||
/* kick object; if doing is fatal, done() will clean up gk.kickedobj */
|
||||
Strcpy(kickobjnam, killer_xname(gk.kickedobj)); /* matters iff res==0 */
|
||||
/* formatted object name matters iff res==0 */
|
||||
Strcpy(kickobjnam, killer_xname(gk.kickedobj));
|
||||
/* kick object; if fatal, done() will clean up kickedobj */
|
||||
res = really_kick_object(x, y);
|
||||
gk.kickedobj = (struct obj *) 0;
|
||||
}
|
||||
@@ -924,7 +926,8 @@ kick_door(coordxy x, coordxy y, int avrg_attrib)
|
||||
exercise(A_DEX, TRUE);
|
||||
doorbuster = Upolyd && is_giant(gy.youmonst.data);
|
||||
/* door is known to be CLOSED or LOCKED */
|
||||
if (doorbuster || (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) {
|
||||
if (doorbuster
|
||||
|| (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) {
|
||||
boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
|
||||
|
||||
/* break the door */
|
||||
|
||||
@@ -141,7 +141,8 @@ throw_obj(struct obj *obj, int shotlimit)
|
||||
/* throwing with one hand, but pluralize since the
|
||||
expression "with your bare hands" sounds better */
|
||||
makeplural(body_part(HAND)));
|
||||
Sprintf(svk.killer.name, "throwing %s bare-handed", killer_xname(obj));
|
||||
Sprintf(svk.killer.name, "throwing %s bare-handed",
|
||||
killer_xname(obj));
|
||||
instapetrify(svk.killer.name);
|
||||
}
|
||||
if (welded(obj)) {
|
||||
@@ -1058,7 +1059,8 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y)
|
||||
}
|
||||
/* and whether hero is turned to stone by being touched by 'mon' */
|
||||
if (touch_petrifies(mon->data) && !(uarmu || uarm || uarmc)) {
|
||||
Snprintf(svk.killer.name, sizeof svk.killer.name, "being hit by %s",
|
||||
Snprintf(svk.killer.name, sizeof svk.killer.name,
|
||||
"being hit by %s",
|
||||
/* combine m_monnam() and noname_monnam():
|
||||
"{your,a} hurtling cockatrice" w/o assigned name */
|
||||
x_monnam(mon, mon->mtame ? ARTICLE_YOUR : ARTICLE_A,
|
||||
@@ -1346,8 +1348,8 @@ toss_up(struct obj *obj, boolean hitsroof)
|
||||
|
||||
if (obj->oartifact && !harmless)
|
||||
/* need a fake die roll here; rn1(18,2) avoids 1 and 20 */
|
||||
artimsg = artifact_hit((struct monst *) 0, &gy.youmonst, obj, &dmg,
|
||||
rn1(18, 2));
|
||||
artimsg = artifact_hit((struct monst *) 0, &gy.youmonst, obj,
|
||||
&dmg, rn1(18, 2));
|
||||
|
||||
if (!dmg) { /* probably wasn't a weapon; base damage on weight */
|
||||
dmg = ((int) obj->owt + 99) / 100;
|
||||
@@ -1399,7 +1401,8 @@ toss_up(struct obj *obj, boolean hitsroof)
|
||||
&& polymon(PM_STONE_GOLEM))) {
|
||||
petrify:
|
||||
svk.killer.format = KILLED_BY;
|
||||
Strcpy(svk.killer.name, "elementary physics"); /* what goes up... */
|
||||
/* what goes up... */
|
||||
Strcpy(svk.killer.name, "elementary physics");
|
||||
You("turn to stone.");
|
||||
if (obj)
|
||||
dropy(obj); /* bypass most of hitfloor() */
|
||||
@@ -1760,7 +1763,8 @@ throwit(struct obj *obj,
|
||||
if (!Deaf && !Underwater) {
|
||||
/* Some sound effects when item lands in water or lava */
|
||||
if (is_pool(gb.bhitpos.x, gb.bhitpos.y)
|
||||
|| (is_lava(gb.bhitpos.x, gb.bhitpos.y) && !is_flammable(obj))) {
|
||||
|| (is_lava(gb.bhitpos.x, gb.bhitpos.y)
|
||||
&& !is_flammable(obj))) {
|
||||
Soundeffect(se_splash, 50);
|
||||
pline((weight(obj) > 9) ? "Splash!" : "Plop!");
|
||||
}
|
||||
@@ -2658,7 +2662,8 @@ throw_gold(struct obj *obj)
|
||||
/* see if the gold has a place to move into */
|
||||
odx = u.ux + u.dx;
|
||||
ody = u.uy + u.dy;
|
||||
if (!isok(odx, ody) || !ZAP_POS(levl[odx][ody].typ) || closed_door(odx, ody)) {
|
||||
if (!isok(odx, ody)
|
||||
|| !ZAP_POS(levl[odx][ody].typ) || closed_door(odx, ody)) {
|
||||
gb.bhitpos.x = u.ux;
|
||||
gb.bhitpos.y = u.uy;
|
||||
} else {
|
||||
|
||||
@@ -38,7 +38,8 @@ staticfn void Fread(genericptr_t, int, int, dlb *);
|
||||
staticfn xint16 dname_to_dnum(const char *);
|
||||
staticfn int find_branch(const char *, struct proto_dungeon *);
|
||||
staticfn xint16 parent_dnum(const char *, struct proto_dungeon *);
|
||||
staticfn int level_range(xint16, int, int, int, struct proto_dungeon *, int *);
|
||||
staticfn int level_range(xint16, int, int, int, struct proto_dungeon *,
|
||||
int *);
|
||||
staticfn xint16 parent_dlevel(const char *, struct proto_dungeon *);
|
||||
staticfn int correct_branch_type(struct tmpbranch *);
|
||||
staticfn branch *add_branch(int, int, struct proto_dungeon *);
|
||||
@@ -1006,7 +1007,8 @@ init_dungeon_dungeons(
|
||||
int dgn_base, dgn_range, dgn_align, dgn_entry, dgn_chance, dgn_flags;
|
||||
|
||||
dgn_name = get_table_str(L, "name");
|
||||
dgn_bonetag = get_table_str_opt(L, "bonetag", emptystr); /* TODO: single char or "none" */
|
||||
/* TODO: accept single char or "none" for bonetag */
|
||||
dgn_bonetag = get_table_str_opt(L, "bonetag", emptystr);
|
||||
dgn_protoname = get_table_str_opt(L, "protofile", emptystr);
|
||||
dgn_base = get_table_int(L, "base");
|
||||
dgn_range = get_table_int_opt(L, "range", 0);
|
||||
@@ -1059,10 +1061,12 @@ init_dungeon_dungeons(
|
||||
pd->tmpdungeon[dngidx].chance = dgn_chance;
|
||||
pd->tmpdungeon[dngidx].entry_lev = dgn_entry;
|
||||
|
||||
Strcpy(svd.dungeons[dngidx].fill_lvl, dgn_fill); /* FIXME: fill_lvl len */
|
||||
Strcpy(svd.dungeons[dngidx].dname, dgn_name); /* FIXME: dname length */
|
||||
Strcpy(svd.dungeons[dngidx].proto, dgn_protoname); /* FIXME: proto length */
|
||||
Strcpy(svd.dungeons[dngidx].themerms, dgn_themerms); /* FIXME: length */
|
||||
/* FIXME: these should have length checks */
|
||||
Strcpy(svd.dungeons[dngidx].fill_lvl, dgn_fill);
|
||||
Strcpy(svd.dungeons[dngidx].dname, dgn_name);
|
||||
Strcpy(svd.dungeons[dngidx].proto, dgn_protoname);
|
||||
Strcpy(svd.dungeons[dngidx].themerms, dgn_themerms);
|
||||
/* FIXME: accept "none", convert that to '\0' */
|
||||
svd.dungeons[dngidx].boneid = *dgn_bonetag ? *dgn_bonetag : 0;
|
||||
free((genericptr) dgn_fill);
|
||||
/* free((genericptr) dgn_protoname); -- stored in pd.tmpdungeon[] */
|
||||
@@ -1079,8 +1083,9 @@ init_dungeon_dungeons(
|
||||
svd.dungeons[dngidx].depth_start = 1;
|
||||
svd.dungeons[dngidx].dunlev_ureached = 1;
|
||||
} else {
|
||||
svd.dungeons[dngidx].ledger_start = svd.dungeons[dngidx - 1].ledger_start
|
||||
+ svd.dungeons[dngidx - 1].num_dunlevs;
|
||||
svd.dungeons[dngidx].ledger_start
|
||||
= svd.dungeons[dngidx - 1].ledger_start
|
||||
+ svd.dungeons[dngidx - 1].num_dunlevs;
|
||||
svd.dungeons[dngidx].dunlev_ureached = 0;
|
||||
}
|
||||
|
||||
@@ -1403,8 +1408,8 @@ ledger_to_dnum(xint16 ledgerno)
|
||||
/* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */
|
||||
for (i = 0; i < svn.n_dgns; i++)
|
||||
if (svd.dungeons[i].ledger_start < ledgerno
|
||||
&& (ledgerno
|
||||
<= svd.dungeons[i].ledger_start + svd.dungeons[i].num_dunlevs))
|
||||
&& ledgerno <= (svd.dungeons[i].ledger_start
|
||||
+ svd.dungeons[i].num_dunlevs))
|
||||
return i;
|
||||
|
||||
panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno);
|
||||
@@ -1475,7 +1480,7 @@ builds_up(d_level *lev)
|
||||
branch *br;
|
||||
if (dptr->num_dunlevs > 1)
|
||||
return (boolean) (dptr->entry_lev == dptr->num_dunlevs);
|
||||
/* else, single-level branch; find the branch connection that connects this
|
||||
/* else, single-level branch; find branch connection that connects this
|
||||
* dungeon from a parent dungeon and determine whether it builds up from
|
||||
* that */
|
||||
for (br = svb.branches; br; br = br->next) {
|
||||
@@ -1981,7 +1986,7 @@ boolean
|
||||
Invocation_lev(d_level *lev)
|
||||
{
|
||||
return (boolean) (In_hell(lev)
|
||||
&& lev->dlevel == svd.dungeons[lev->dnum].num_dunlevs - 1);
|
||||
&& lev->dlevel == svd.dungeons[lev->dnum].num_dunlevs - 1);
|
||||
}
|
||||
|
||||
/* use instead of depth() wherever a degree of difficulty is made
|
||||
@@ -2104,7 +2109,7 @@ lev_by_name(const char *nam)
|
||||
/* either wizard mode or else seen and not forgotten;
|
||||
note: used to be '(flags & (FORGOTTEN|VISITED)) == VISITED'
|
||||
back when amnesia could cause levels to be forgotten */
|
||||
&& (wizard || (svl.level_info[idx].flags & (VISITED)) == VISITED)) {
|
||||
&& (wizard || (svl.level_info[idx].flags & VISITED) == VISITED)) {
|
||||
lev = depth(&dlev);
|
||||
}
|
||||
} else { /* not a specific level; try branch names */
|
||||
@@ -2116,9 +2121,10 @@ lev_by_name(const char *nam)
|
||||
if (idx >= 0) {
|
||||
idxtoo = (idx >> 8) & 0x00FF;
|
||||
idx &= 0x00FF;
|
||||
/* either wizard mode, or else _both_ sides of branch seen */
|
||||
if (wizard || (((svl.level_info[idx].flags & (VISITED)) == VISITED)
|
||||
&& ((svl.level_info[idxtoo].flags & (VISITED))
|
||||
/* either wizard mode, or else _both_ sides of branch seen; */
|
||||
/* (flags & VISITED)==VISITED: see comment about amnesia above */
|
||||
if (wizard || (((svl.level_info[idx].flags & VISITED) == VISITED)
|
||||
&& ((svl.level_info[idxtoo].flags & VISITED)
|
||||
== VISITED))) {
|
||||
if (ledger_to_dnum(idxtoo) == u.uz.dnum)
|
||||
idx = idxtoo;
|
||||
@@ -2586,7 +2592,8 @@ load_exclusions(NHFILE *nhfp)
|
||||
while (nez-- > 0) {
|
||||
ez = (struct exclusion_zone *) alloc(sizeof *ez);
|
||||
if (nhfp->structlevel) {
|
||||
mread(nhfp->fd, (genericptr_t) &ez->zonetype, sizeof ez->zonetype);
|
||||
mread(nhfp->fd, (genericptr_t) &ez->zonetype,
|
||||
sizeof ez->zonetype);
|
||||
mread(nhfp->fd, (genericptr_t) &ez->lx, sizeof ez->lx);
|
||||
mread(nhfp->fd, (genericptr_t) &ez->ly, sizeof ez->ly);
|
||||
mread(nhfp->fd, (genericptr_t) &ez->hx, sizeof ez->hx);
|
||||
@@ -2827,11 +2834,13 @@ init_mapseen(d_level *lev)
|
||||
init->lev.dlevel = lev->dlevel;
|
||||
|
||||
/* walk until we get to the place where we should insert init */
|
||||
for (mptr = svm.mapseenchn, prev = 0; mptr; prev = mptr, mptr = mptr->next)
|
||||
for (mptr = svm.mapseenchn, prev = 0; mptr;
|
||||
prev = mptr, mptr = mptr->next) {
|
||||
if (mptr->lev.dnum > init->lev.dnum
|
||||
|| (mptr->lev.dnum == init->lev.dnum
|
||||
&& mptr->lev.dlevel > init->lev.dlevel))
|
||||
break;
|
||||
}
|
||||
if (!prev) {
|
||||
init->next = svm.mapseenchn;
|
||||
svm.mapseenchn = init;
|
||||
@@ -3232,7 +3241,8 @@ recalc_mapseen(void)
|
||||
}
|
||||
|
||||
/*ARGUSED*/
|
||||
/* valley and sanctum levels get automatic annotation once temple is entered */
|
||||
/* valley and sanctum levels get automatic annotation once their temple
|
||||
is entered */
|
||||
void
|
||||
mapseen_temple(
|
||||
struct monst *priest UNUSED) /* not used; might be useful someday */
|
||||
|
||||
33
src/eat.c
33
src/eat.c
@@ -261,7 +261,7 @@ choke(struct obj *food)
|
||||
return;
|
||||
}
|
||||
You("stuff yourself and then vomit voluminously.");
|
||||
morehungry(Hunger ? (u.uhunger - 60) : 1000); /* you just got *very* sick! */
|
||||
morehungry(Hunger ? (u.uhunger - 60) : 1000); /* just got very sick! */
|
||||
vomit();
|
||||
} else {
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
@@ -1177,13 +1177,14 @@ cpostfx(int pm)
|
||||
tmp += 20;
|
||||
if (gy.youmonst.data->mlet != S_MIMIC && !Unchanging) {
|
||||
char buf[BUFSZ];
|
||||
const char *tempshape = !Hallucination ? "a pile of gold"
|
||||
: "an orange";
|
||||
|
||||
if (!u.uconduct.polyselfs++) /* you're changing form */
|
||||
livelog_printf(LL_CONDUCT,
|
||||
"changed form for the first time by mimicking %s",
|
||||
Hallucination ? "an orange" : "a pile of gold");
|
||||
You_cant("resist the temptation to mimic %s.",
|
||||
Hallucination ? "an orange" : "a pile of gold");
|
||||
tempshape);
|
||||
You_cant("resist the temptation to mimic %s.", tempshape);
|
||||
/* A pile of gold can't ride. */
|
||||
if (u.usteed)
|
||||
dismount_steed(DISMOUNT_FELL);
|
||||
@@ -1665,7 +1666,8 @@ start_tin(struct obj *otmp)
|
||||
access); 1 turn delay case is non-deterministic: getting
|
||||
interrupted and retrying might yield another 1 turn delay
|
||||
or might open immediately on 2nd (or 3rd, 4th, ...) try */
|
||||
tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0 : rn2(2);
|
||||
tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0
|
||||
: rn2(2);
|
||||
if (!tmp)
|
||||
mesg = "The tin opens like magic!";
|
||||
else
|
||||
@@ -2491,7 +2493,8 @@ fpostfx(struct obj *otmp)
|
||||
if (!Stoned) {
|
||||
Sprintf(svk.killer.name, "%s egg",
|
||||
mons[otmp->corpsenm].pmnames[NEUTRAL]);
|
||||
make_stoned(5L, (char *) 0, KILLED_BY_AN, svk.killer.name);
|
||||
make_stoned(5L, (char *) 0, KILLED_BY_AN,
|
||||
svk.killer.name);
|
||||
}
|
||||
}
|
||||
/* note: no "tastes like chicken" message for eggs */
|
||||
@@ -2697,15 +2700,15 @@ doeat_nonfood(struct obj *otmp)
|
||||
|| material == DRAGON_HIDE || material == WAX) {
|
||||
if (!u.uconduct.unvegan++ && !ll_conduct) {
|
||||
livelog_printf(LL_CONDUCT,
|
||||
"consumed animal products for the first time, by eating %s",
|
||||
an(food_xname(otmp, FALSE)));
|
||||
"consumed animal products for the first time, by eating %s",
|
||||
an(food_xname(otmp, FALSE)));
|
||||
ll_conduct++;
|
||||
}
|
||||
if (material != WAX) {
|
||||
if (!u.uconduct.unvegetarian && !ll_conduct)
|
||||
livelog_printf(LL_CONDUCT,
|
||||
"tasted meat by-products for the first time, by eating %s",
|
||||
an(food_xname(otmp, FALSE)));
|
||||
"tasted meat by-products for the first time, by eating %s",
|
||||
an(food_xname(otmp, FALSE)));
|
||||
violated_vegetarian();
|
||||
}
|
||||
}
|
||||
@@ -3565,12 +3568,12 @@ floorfood(
|
||||
pline("%s but you %s eat them.", qbuf,
|
||||
nodig ? "cannot" : "are too full to");
|
||||
} else {
|
||||
Strcat(qbuf, ((!svc.context.digging.chew
|
||||
|| svc.context.digging.pos.x != u.ux
|
||||
|| svc.context.digging.pos.y != u.uy
|
||||
|| !on_level(&svc.context.digging.level, &u.uz))
|
||||
Strcat(qbuf, (!svc.context.digging.chew
|
||||
|| !u_at(svc.context.digging.pos.x,
|
||||
svc.context.digging.pos.y)
|
||||
|| !on_level(&svc.context.digging.level, &u.uz))
|
||||
? "; eat them?"
|
||||
: "; resume eating them?"));
|
||||
: "; resume eating them?");
|
||||
c = yn_function(qbuf, ynqchars, 'n', TRUE);
|
||||
}
|
||||
if (c == 'y')
|
||||
|
||||
12
src/end.c
12
src/end.c
@@ -1622,7 +1622,7 @@ container_contents(
|
||||
| (flags.sortpack ? SORTLOOT_PACK : 0));
|
||||
sortedcobj = sortloot(&box->cobj, sortflags, FALSE,
|
||||
(boolean (*)(OBJ_P)) 0);
|
||||
for (srtc = sortedcobj; ((obj = srtc->obj) != 0); ++srtc) {
|
||||
for (srtc = sortedcobj; (obj = srtc->obj) != 0; ++srtc) {
|
||||
if (identified) {
|
||||
discover_object(obj->otyp, TRUE, FALSE);
|
||||
obj->known = obj->bknown = obj->dknown
|
||||
@@ -1748,9 +1748,9 @@ save_killers(NHFILE *nhfp)
|
||||
struct kinfo *kptr;
|
||||
|
||||
if (perform_bwrite(nhfp)) {
|
||||
for (kptr = &svk.killer; kptr != (struct kinfo *) 0; kptr = kptr->next) {
|
||||
for (kptr = &svk.killer; kptr; kptr = kptr->next) {
|
||||
if (nhfp->structlevel)
|
||||
bwrite(nhfp->fd, (genericptr_t) kptr, sizeof(struct kinfo));
|
||||
bwrite(nhfp->fd, (genericptr_t) kptr, sizeof (struct kinfo));
|
||||
}
|
||||
}
|
||||
if (release_data(nhfp)) {
|
||||
@@ -1904,9 +1904,11 @@ NH_abort(char *why USED_FOR_CRASHREPORT)
|
||||
gdb_prio++;
|
||||
|
||||
if (gdb_prio > libc_prio) {
|
||||
(void) (NH_panictrace_gdb() || (libc_prio && NH_panictrace_libc()));
|
||||
(void) (NH_panictrace_gdb()
|
||||
|| (libc_prio && NH_panictrace_libc()));
|
||||
} else {
|
||||
(void) (NH_panictrace_libc() || (gdb_prio && NH_panictrace_gdb()));
|
||||
(void) (NH_panictrace_libc()
|
||||
|| (gdb_prio && NH_panictrace_gdb()));
|
||||
}
|
||||
|
||||
#else /* VMS */
|
||||
|
||||
@@ -1186,8 +1186,8 @@ doengrave(void)
|
||||
}
|
||||
|
||||
/* Engraving will always take at least one action via being run as an
|
||||
* occupation, so do not count this setup as taking time. */
|
||||
doengr_exit:
|
||||
occupation, so do not count this setup as taking time. */
|
||||
doengr_exit:
|
||||
if (de->disprefresh)
|
||||
newsym(u.ux, u.uy);
|
||||
retval = de->ret;
|
||||
|
||||
@@ -296,8 +296,8 @@ explode(
|
||||
*/
|
||||
|
||||
if (olet == MON_EXPLODE && !you_exploding) {
|
||||
/* when explode() is called recursively, svk.killer.name might change so
|
||||
we need to retain a copy of the current value for this explosion */
|
||||
/* when explode() is called recursively, svk.killer.name might change
|
||||
so retain a copy of the current value for this explosion */
|
||||
str = strcpy(killr_buf, svk.killer.name);
|
||||
do_hallu = (Hallucination
|
||||
&& (strstri(str, "'s explosion")
|
||||
@@ -515,19 +515,19 @@ explode(
|
||||
}
|
||||
|
||||
if ((explmask[i][j] & EXPL_MON) != 0) {
|
||||
/* damage from ring/wand explosion isn't itself
|
||||
* electrical in nature, nor is damage from freezing potion
|
||||
* really cold in nature, nor is damage from boiling potion
|
||||
* or exploding oil; only burning items damage is the "same
|
||||
* type" as the explosion. Because this is imperfect and
|
||||
* marginal (burning items only deal 1 damage), ignore it
|
||||
* for golemeffects(). */
|
||||
/* Damage from ring/wand explosion isn't itself
|
||||
* electrical in nature, nor is damage from freezing
|
||||
* potion really cold in nature, nor is damage from
|
||||
* boiling potion or exploding oil; only burning items
|
||||
* damage is the "same type" as the explosion. Because
|
||||
* this is imperfect and marginal (burning items only
|
||||
* deal 1 damage), ignore it for golemeffects(). */
|
||||
golemeffects(mtmp, (int) adtyp, dam);
|
||||
mtmp->mhp -= itemdmg; /* item destruction dmg */
|
||||
} else {
|
||||
/* call resist with 0 and do damage manually so 1) we can
|
||||
/* Call resist with 0 and do damage manually so 1) we can
|
||||
* get out the message before doing the damage, and 2) we
|
||||
* can call mondied, not killed, if it's not your blast
|
||||
* can call mondied, not killed, if it's not your blast.
|
||||
*/
|
||||
int mdam = dam;
|
||||
|
||||
@@ -644,7 +644,7 @@ explode(
|
||||
} else {
|
||||
if (olet == MON_EXPLODE) {
|
||||
if (generic) /* explosion was unseen; str=="explosion", */
|
||||
; /* svk.killer.name=="gas spore's explosion". */
|
||||
; /* svk.killer.name=="gas spore's explosion". */
|
||||
else if (str != svk.killer.name && str != hallu_buf)
|
||||
Strcpy(svk.killer.name, str);
|
||||
svk.killer.format = KILLED_BY_AN;
|
||||
@@ -745,7 +745,8 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
|
||||
if (shop_origin)
|
||||
credit_report(shkp, 0, TRUE); /* establish baseline, without msgs */
|
||||
|
||||
while ((otmp = (individual_object ? obj : svl.level.objects[sx][sy])) != 0) {
|
||||
while ((otmp = (individual_object ? obj
|
||||
: svl.level.objects[sx][sy])) != 0) {
|
||||
if (otmp == uball || otmp == uchain) {
|
||||
boolean waschain = (otmp == uchain);
|
||||
|
||||
@@ -917,7 +918,8 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
|
||||
retrieve the item and drop it back inside the shop,
|
||||
the owed charges will only be reduced at that point
|
||||
by the lesser shopkeeper buying-price.
|
||||
The non-gold situation will likely get adjusted further.
|
||||
The non-gold situation will likely get adjusted
|
||||
further.
|
||||
*/
|
||||
if (stmp->obj->otyp == GOLD_PIECE) {
|
||||
addtobill(stmp->obj, FALSE, FALSE, TRUE);
|
||||
@@ -1006,12 +1008,14 @@ adtyp_to_expltype(const int adtyp)
|
||||
}
|
||||
}
|
||||
|
||||
/* A monster explodes in a way that produces a real explosion (e.g. a sphere or
|
||||
* gas spore, not a yellow light or similar).
|
||||
/* A monster explodes in a way that produces a real explosion (e.g. a sphere
|
||||
* or gas spore, not a yellow light or similar).
|
||||
* This is some common code between explmu() and explmm().
|
||||
*/
|
||||
void
|
||||
mon_explodes(struct monst *mon, struct attack *mattk)
|
||||
mon_explodes(
|
||||
struct monst *mon,
|
||||
struct attack *mattk)
|
||||
{
|
||||
int dmg;
|
||||
int type;
|
||||
@@ -1029,8 +1033,9 @@ mon_explodes(struct monst *mon, struct attack *mattk)
|
||||
type = PHYS_EXPL_TYPE;
|
||||
}
|
||||
else if (mattk->adtyp >= AD_MAGM && mattk->adtyp <= AD_SPC2) {
|
||||
/* The -1, +20, *-1 math is to set it up as a 'monster breath' type for
|
||||
* the explosions (it isn't, but this is the closest analogue). */
|
||||
/* The -1, +20, *-1 math is to set it up as a 'monster breath' type
|
||||
* for the explosions (it isn't, but this is the closest analogue). */
|
||||
/* FIXME: there are macros for kind of thing... */
|
||||
type = -((mattk->adtyp - 1) + 20);
|
||||
}
|
||||
else {
|
||||
@@ -1039,8 +1044,8 @@ mon_explodes(struct monst *mon, struct attack *mattk)
|
||||
}
|
||||
|
||||
/* Kill it now so it won't appear to be caught in its own explosion.
|
||||
* Must check to see if already dead - which happens if this is called from
|
||||
* an AT_BOOM attack upon death. */
|
||||
* Must check to see if already dead - which happens if this is called
|
||||
* from an AT_BOOM attack upon death. */
|
||||
if (!DEADMONSTER(mon)) {
|
||||
mondead(mon);
|
||||
}
|
||||
|
||||
72
src/files.c
72
src/files.c
@@ -318,7 +318,8 @@ fname_encode(
|
||||
(void) sprintf(op, "%c%02X", quotechar, *sp);
|
||||
op += 3;
|
||||
cnt += 3;
|
||||
} else if ((strchr(legal, *sp) != 0) || (strchr(hexdigits, *sp) != 0)) {
|
||||
} else if ((strchr(legal, *sp) != 0)
|
||||
|| (strchr(hexdigits, *sp) != 0)) {
|
||||
*op++ = *sp;
|
||||
*op = '\0';
|
||||
cnt++;
|
||||
@@ -965,8 +966,8 @@ set_savefile_name(boolean regularize_it)
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
if (regularize_it) {
|
||||
static const char okchars[] =
|
||||
"*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.";
|
||||
static const char okchars[]
|
||||
= "*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.";
|
||||
const char *legal = okchars;
|
||||
|
||||
++legal; /* skip '*' wildcard character */
|
||||
@@ -1049,7 +1050,8 @@ set_savefile_name(boolean regularize_it)
|
||||
}
|
||||
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
|
||||
if (overflow)
|
||||
impossible("set_savefile_name() couldn't complete without overflow %d",
|
||||
impossible("set_savefile_name() couldn't complete"
|
||||
" without overflow %d",
|
||||
overflow);
|
||||
#endif
|
||||
}
|
||||
@@ -1946,7 +1948,8 @@ lock_file(const char *filename, int whichprefix,
|
||||
#ifdef USE_FCNTL
|
||||
lockfd = open(filename, O_RDWR);
|
||||
if (lockfd == -1) {
|
||||
HUP raw_printf("Cannot open file %s. Is NetHack installed correctly?",
|
||||
HUP raw_printf("Cannot open file %s. "
|
||||
" Is NetHack installed correctly?",
|
||||
filename);
|
||||
gn.nesting--;
|
||||
return FALSE;
|
||||
@@ -1970,8 +1973,8 @@ lock_file(const char *filename, int whichprefix,
|
||||
|
||||
#ifdef USE_FCNTL
|
||||
if (retryct--) {
|
||||
HUP raw_printf(
|
||||
"Waiting for release of fcntl lock on %s. (%d retries left.)",
|
||||
HUP raw_printf("Waiting for release of fcntl lock on %s. "
|
||||
" (%d retries left.)",
|
||||
filename, retryct);
|
||||
sleep(1);
|
||||
} else {
|
||||
@@ -1987,7 +1990,8 @@ lock_file(const char *filename, int whichprefix,
|
||||
switch (errnosv) { /* George Barbanis */
|
||||
case EEXIST:
|
||||
if (retryct--) {
|
||||
HUP raw_printf("Waiting for access to %s. (%d retries left).",
|
||||
HUP raw_printf("Waiting for access to %s. "
|
||||
" (%d retries left).",
|
||||
filename, retryct);
|
||||
#if defined(SYSV) || defined(ULTRIX) || defined(VMS)
|
||||
(void)
|
||||
@@ -2022,8 +2026,8 @@ lock_file(const char *filename, int whichprefix,
|
||||
/* take a wild guess at the underlying cause */
|
||||
HUP perror(lockname);
|
||||
HUP raw_printf("Cannot lock %s.", filename);
|
||||
HUP raw_printf(
|
||||
"(Perhaps you are running NetHack from inside the distribution package?).");
|
||||
HUP raw_printf("(Perhaps you are running NetHack from"
|
||||
" inside the distribution package?).");
|
||||
gn.nesting--;
|
||||
return FALSE;
|
||||
default:
|
||||
@@ -2174,8 +2178,8 @@ do_write_config_file(void)
|
||||
wait_synch();
|
||||
pline("Some settings are not saved!");
|
||||
wait_synch();
|
||||
pline(
|
||||
"All manual customization and comments are removed from the file!");
|
||||
pline("All manual customization and comments are removed"
|
||||
" from the file!");
|
||||
wait_synch();
|
||||
}
|
||||
#define overwrite_prompt "Overwrite config file %.*s?"
|
||||
@@ -2534,7 +2538,8 @@ handle_config_section(char *buf)
|
||||
}
|
||||
if (*sect) { /* got a section name */
|
||||
gc.config_section_current = dupstr(sect);
|
||||
debugpline1("set config section: '%s'", gc.config_section_current);
|
||||
debugpline1("set config section: '%s'",
|
||||
gc.config_section_current);
|
||||
} else { /* empty section name => end of sections */
|
||||
free_config_sections();
|
||||
debugpline0("unset config section");
|
||||
@@ -2981,8 +2986,8 @@ cnf_line_MAX_STATUENAME_RANK(char *bufp)
|
||||
int n = atoi(bufp);
|
||||
|
||||
if (n < 1) {
|
||||
config_error_add(
|
||||
"Illegal value in MAX_STATUENAME_RANK (minimum is 1)");
|
||||
config_error_add("Illegal value in MAX_STATUENAME_RANK"
|
||||
" (minimum is 1)");
|
||||
n = 10;
|
||||
}
|
||||
sysopt.tt_oname_maxrank = n;
|
||||
@@ -2998,8 +3003,8 @@ cnf_line_LIVELOG(char *bufp)
|
||||
long L = strtol(bufp, NULL, 0);
|
||||
|
||||
if (L < 0L || L > 0xffffL) {
|
||||
config_error_add(
|
||||
"Illegal value for LIVELOG (must be between 0 and 0xFFFF).");
|
||||
config_error_add("Illegal value for LIVELOG"
|
||||
" (must be between 0 and 0xFFFF).");
|
||||
return 0;
|
||||
}
|
||||
sysopt.livelog = L;
|
||||
@@ -3109,8 +3114,8 @@ cnf_line_PORTABLE_DEVICE_PATHS(char *bufp)
|
||||
int n = atoi(bufp);
|
||||
|
||||
if (n < 0 || n > 1) {
|
||||
config_error_add(
|
||||
"Illegal value in PORTABLE_DEVICE_PATHS (not 0,1)");
|
||||
config_error_add("Illegal value in PORTABLE_DEVICE_PATHS"
|
||||
" (not 0 or 1)");
|
||||
n = 0;
|
||||
}
|
||||
sysopt.portable_device_paths = n;
|
||||
@@ -3733,7 +3738,8 @@ parse_conf_buf(struct _cnf_parser_state *p, boolean (*proc)(char *arg))
|
||||
char *bufp = find_optparam(p->buf);
|
||||
|
||||
if (!bufp) {
|
||||
config_error_add("Format is CHOOSE=section1,section2,...");
|
||||
config_error_add("Format is CHOOSE=section1"
|
||||
",section2,...");
|
||||
p->rv = FALSE;
|
||||
free(p->buf), p->buf = (char *) 0;
|
||||
return;
|
||||
@@ -3915,8 +3921,8 @@ fopen_wizkit_file(void)
|
||||
else if (errno != ENOENT) {
|
||||
/* e.g., problems when setuid NetHack can't search home
|
||||
* directory restricted to user */
|
||||
raw_printf("Couldn't open default gw.wizkit file %s (%d).", tmp_wizkit,
|
||||
errno);
|
||||
raw_printf("Couldn't open default gw.wizkit file %s (%d).",
|
||||
tmp_wizkit, errno);
|
||||
wait_synch();
|
||||
}
|
||||
#endif
|
||||
@@ -4047,7 +4053,7 @@ read_sym_file(int which_set)
|
||||
clear_symsetentry(which_set, TRUE);
|
||||
config_error_done();
|
||||
|
||||
/* If name was defined, it was invalid. Then we're loading fallback */
|
||||
/* If name was defined, it was invalid. Then we're loading fallback */
|
||||
if (gs.symset[which_set].name) {
|
||||
gs.symset[which_set].explicitly = FALSE;
|
||||
return 0;
|
||||
@@ -4087,8 +4093,8 @@ check_recordfile(const char *dir UNUSED_if_not_OS2_CODEVIEW)
|
||||
if (fd >= 0) {
|
||||
#ifdef VMS /* must be stream-lf to use UPDATE_RECORD_IN_PLACE */
|
||||
if (!file_is_stmlf(fd)) {
|
||||
raw_printf(
|
||||
"Warning: scoreboard file '%s' is not in stream_lf format",
|
||||
raw_printf("Warning: scoreboard file '%s'"
|
||||
" is not in stream_lf format",
|
||||
fq_record);
|
||||
wait_synch();
|
||||
}
|
||||
@@ -4280,16 +4286,18 @@ recover_savefile(void)
|
||||
}
|
||||
if (read(gnhfp->fd, (genericptr_t) &hpid, sizeof hpid) != sizeof hpid) {
|
||||
raw_printf("\n%s\n%s\n",
|
||||
"Checkpoint data incompletely written or subsequently clobbered.",
|
||||
"Checkpoint data incompletely written"
|
||||
" or subsequently clobbered.",
|
||||
"Recovery impossible.");
|
||||
close_nhfile(gnhfp);
|
||||
return FALSE;
|
||||
}
|
||||
if (read(gnhfp->fd, (genericptr_t) &savelev, sizeof(savelev))
|
||||
!= sizeof(savelev)) {
|
||||
raw_printf(
|
||||
"\nCheckpointing was not in effect for %s -- recovery impossible.\n",
|
||||
gl.lock);
|
||||
raw_printf("\n%s %s %s\n",
|
||||
"Checkpointing was not in effect for",
|
||||
gl.lock,
|
||||
"-- recovery impossible.");
|
||||
close_nhfile(gnhfp);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4304,7 +4312,8 @@ recover_savefile(void)
|
||||
|| (read(gnhfp->fd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi)
|
||||
|| (read(gnhfp->fd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz)
|
||||
!= sizeof pltmpsiz) || (pltmpsiz > PL_NSIZ)
|
||||
|| (read(gnhfp->fd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz)) {
|
||||
|| (read(gnhfp->fd, (genericptr_t) &tmpplbuf, pltmpsiz)
|
||||
!= pltmpsiz)) {
|
||||
raw_printf("\nError reading %s -- can't recover.\n", gl.lock);
|
||||
close_nhfile(gnhfp);
|
||||
return FALSE;
|
||||
@@ -4832,7 +4841,8 @@ choose_passage(int passagecnt, /* total of available passages */
|
||||
res = (int) svc.context.novel.pasg[idx];
|
||||
/* move the last slot's passage index into the slot just used
|
||||
and reduce the number of passages available */
|
||||
svc.context.novel.pasg[idx] = svc.context.novel.pasg[--svc.context.novel.count];
|
||||
svc.context.novel.pasg[idx]
|
||||
= svc.context.novel.pasg[--svc.context.novel.count];
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,8 @@ dipfountain(struct obj *obj)
|
||||
|
||||
if (u.ualign.type != A_LAWFUL) {
|
||||
/* Ha! Trying to cheat her. */
|
||||
pline("A freezing mist rises from the %s and envelopes the sword.",
|
||||
pline("A freezing mist rises from the %s"
|
||||
" and envelopes the sword.",
|
||||
hliquid("water"));
|
||||
pline_The("fountain disappears!");
|
||||
curse(obj);
|
||||
|
||||
16
src/glyphs.c
16
src/glyphs.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 glyphs.c */
|
||||
/* NetHack 3.7 glyphs.c TODO: add NHDT branch/date/revision tags */
|
||||
/* Copyright (c) Michael Allison, 2021. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -82,7 +82,8 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
|
||||
static int glyphnag = 0;
|
||||
|
||||
if (!glyphnag++)
|
||||
config_error_add("Unimplemented customization feature, ignoring for now");
|
||||
config_error_add("Unimplemented customization feature,"
|
||||
" ignoring for now");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -94,7 +95,8 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat)
|
||||
static int colornag = 0;
|
||||
|
||||
if (!colornag++)
|
||||
config_error_add("Unimplemented customization feature, ignoring for now");
|
||||
config_error_add("Unimplemented customization feature,"
|
||||
" ignoring for now");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +210,8 @@ glyph_find_core(const char *id, struct find_struct *findwhat)
|
||||
break;
|
||||
case find_pm:
|
||||
if (glyph_is_monster(glyph)
|
||||
&& monsym(&mons[glyph_to_mon(glyph)]) == findwhat->val)
|
||||
&& monsym(&mons[glyph_to_mon(glyph)])
|
||||
== findwhat->val)
|
||||
do_callback = TRUE;
|
||||
break;
|
||||
case find_oc:
|
||||
@@ -517,7 +520,7 @@ apply_customizations(
|
||||
if (sc->custtype == custom_nhcolor) {
|
||||
gmap = &glyphmap[details->content.ccolor.glyphidx];
|
||||
(void) set_map_customcolor(gmap,
|
||||
details->content.ccolor.nhcolor);
|
||||
details->content.ccolor.nhcolor);
|
||||
}
|
||||
}
|
||||
details = details->next;
|
||||
@@ -683,7 +686,8 @@ find_matching_customization(
|
||||
enum customization_types custtype,
|
||||
enum graphics_sets which_set)
|
||||
{
|
||||
struct symset_customization *gdc = &gs.sym_customizations[which_set][custtype];
|
||||
struct symset_customization *gdc
|
||||
= &gs.sym_customizations[which_set][custtype];
|
||||
|
||||
if ((gdc->custtype == custtype) && gdc->customization_name
|
||||
&& (strcmp(customization_name, gdc->customization_name) == 0))
|
||||
|
||||
55
src/hack.c
55
src/hack.c
@@ -14,7 +14,8 @@ staticfn int moverock(void);
|
||||
staticfn void dosinkfall(void);
|
||||
staticfn boolean findtravelpath(int);
|
||||
staticfn boolean trapmove(coordxy, coordxy, struct trap *);
|
||||
staticfn int QSORTCALLBACK notice_mons_cmp(const genericptr, const genericptr);
|
||||
staticfn int QSORTCALLBACK notice_mons_cmp(const genericptr,
|
||||
const genericptr) NONNULLPTRS;
|
||||
staticfn schar u_simple_floortyp(coordxy, coordxy);
|
||||
staticfn boolean swim_move_danger(coordxy, coordxy);
|
||||
staticfn boolean domove_bump_mon(struct monst *, int) NONNULLARG1;
|
||||
@@ -483,17 +484,19 @@ moverock(void)
|
||||
newsym(sx, sy);
|
||||
}
|
||||
/* maybe adjust bill if boulder was pushed across shop boundary;
|
||||
normally otmp->unpaid would not apply because otmp isn't in hero's
|
||||
inventory, but addtobill() sets it and subfrombill() clears it */
|
||||
normally otmp->unpaid would not apply because otmp isn't in
|
||||
hero's inventory, but addtobill() sets it and subfrombill()
|
||||
clears it */
|
||||
if (costly && !costly_spot(rx, ry)) {
|
||||
/* pushing from inside the shop to its boundary (or free spot) */
|
||||
/* pushing from inside shop to its boundary (or free spot) */
|
||||
addtobill(otmp, FALSE, FALSE, FALSE);
|
||||
} else if (!costly && costly_spot(rx, ry) && otmp->unpaid
|
||||
&& ((shkp = shop_keeper(*in_rooms(rx, ry, SHOPBASE))) != 0)
|
||||
&& ((shkp = shop_keeper(*in_rooms(rx, ry, SHOPBASE)))
|
||||
!= 0)
|
||||
&& onshopbill(otmp, shkp, TRUE)) {
|
||||
/* this can happen if hero pushes boulder from farther inside
|
||||
the shop into shop's free spot (which will add it to the bill),
|
||||
then teleports or Passes_walls to the doorway (without exiting
|
||||
shop into shop's free spot (which will add it to the bill),
|
||||
then teleports or Passes_walls to doorway (without exiting
|
||||
the shop), and then pushes the boulder from the free spot
|
||||
back into the shop; it's contingent upon the shopkeeper not
|
||||
"muttering an incantation" to fracture the boulder while it
|
||||
@@ -589,7 +592,7 @@ still_chewing(coordxy x, coordxy y)
|
||||
struct obj *boulder = sobj_at(BOULDER, x, y);
|
||||
const char *digtxt = (char *) 0, *dmgtxt = (char *) 0;
|
||||
|
||||
if (svc.context.digging.down) /* not continuing previous dig (w/ pick-axe) */
|
||||
if (svc.context.digging.down) /* not continuing prev dig (w/ pick-axe) */
|
||||
(void) memset((genericptr_t) &svc.context.digging, 0,
|
||||
sizeof (struct dig_info));
|
||||
|
||||
@@ -967,7 +970,8 @@ test_move(
|
||||
You("cannot pass through the bars.");
|
||||
return FALSE;
|
||||
}
|
||||
} else if (tunnels(gy.youmonst.data) && !needspick(gy.youmonst.data)) {
|
||||
} else if (tunnels(gy.youmonst.data)
|
||||
&& !needspick(gy.youmonst.data)) {
|
||||
/* Eat the rock. */
|
||||
if (mode == DO_MOVE && still_chewing(x, y))
|
||||
return FALSE;
|
||||
@@ -988,7 +992,8 @@ test_move(
|
||||
} else if (flags.mention_walls) {
|
||||
char buf[BUFSZ];
|
||||
int glyph = back_to_glyph(x, y),
|
||||
sym = glyph_is_cmap(glyph) ? glyph_to_cmap(glyph) : -1;
|
||||
sym = glyph_is_cmap(glyph) ? glyph_to_cmap(glyph)
|
||||
: -1;
|
||||
|
||||
if (sym == S_stone)
|
||||
Strcpy(buf, "solid stone");
|
||||
@@ -1318,12 +1323,13 @@ findtravelpath(int mode)
|
||||
|| (!Blind && couldsee(nx, ny)))) {
|
||||
if (nx == ux && ny == uy) {
|
||||
if (mode == TRAVP_TRAVEL || mode == TRAVP_VALID) {
|
||||
boolean visited =
|
||||
selection_getpoint(x, y, gt.travelmap);
|
||||
boolean visited
|
||||
= selection_getpoint(x, y, gt.travelmap);
|
||||
u.dx = x - ux;
|
||||
u.dy = y - uy;
|
||||
if (mode == TRAVP_TRAVEL
|
||||
&& ((x == u.tx && y == u.ty) || visited)) {
|
||||
&& ((x == u.tx && y == u.ty)
|
||||
|| visited)) {
|
||||
nomul(0);
|
||||
/* reset run so domove run checks work */
|
||||
svc.context.run = 8;
|
||||
@@ -1333,7 +1339,8 @@ findtravelpath(int mode)
|
||||
iflags.travelcc.x
|
||||
= iflags.travelcc.y = 0;
|
||||
}
|
||||
selection_setpoint(u.ux, u.uy, gt.travelmap, 1);
|
||||
selection_setpoint(u.ux, u.uy,
|
||||
gt.travelmap, 1);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (!travel[nx][ny]) {
|
||||
@@ -1687,7 +1694,8 @@ notice_all_mons(boolean reset)
|
||||
}
|
||||
|
||||
if (i) {
|
||||
qsort((genericptr_t) arr, (size_t) i, sizeof *arr, notice_mons_cmp);
|
||||
qsort((genericptr_t) arr, (size_t) i, sizeof *arr,
|
||||
notice_mons_cmp);
|
||||
|
||||
for (j = 0; j < i; j++)
|
||||
notice_mon(arr[j]);
|
||||
@@ -2060,7 +2068,7 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y)
|
||||
|| t_at(u.ux0, u.uy0) != NULL
|
||||
|| mundisplaceable(mtmp))) {
|
||||
/* displacing peaceful into unsafe or trapped space, or trying to
|
||||
displace quest leader, Oracle, shopkeeper, priest, or vault guard */
|
||||
displace quest leader, Oracle, shk, priest, or vault guard */
|
||||
You("stop. %s doesn't want to swap places.", YMonnam(mtmp));
|
||||
didnt_move = TRUE;
|
||||
} else {
|
||||
@@ -2145,7 +2153,8 @@ domove_fight_empty(coordxy x, coordxy y)
|
||||
/* specifying 'F' with no monster wastes a turn */
|
||||
if (svc.context.forcefight
|
||||
/* remembered an 'I' && didn't use a move command */
|
||||
|| (glyph_is_invisible(glyph) && !m_at(x, y) && !svc.context.nopick)) {
|
||||
|| (glyph_is_invisible(glyph) && !m_at(x, y)
|
||||
&& !svc.context.nopick)) {
|
||||
struct obj *boulder = 0;
|
||||
boolean explo = (Upolyd && attacktype(gy.youmonst.data, AT_EXPL)),
|
||||
solid = (off_edge || (!accessible(x, y)
|
||||
@@ -2225,7 +2234,7 @@ domove_fight_empty(coordxy x, coordxy y)
|
||||
nomul(0);
|
||||
if (explo) {
|
||||
struct attack *attk
|
||||
= attacktype_fordmg(gy.youmonst.data, AT_EXPL, AD_ANY);
|
||||
= attacktype_fordmg(gy.youmonst.data, AT_EXPL, AD_ANY);
|
||||
|
||||
/* no monster has been attacked so we have bypassed explum() */
|
||||
wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as explum() */
|
||||
@@ -2775,7 +2784,8 @@ domove_core(void)
|
||||
|
||||
if (mtmp) {
|
||||
if (displaceu) {
|
||||
boolean noticed_it = (canspotmon(mtmp) || glyph_is_invisible(glyph)
|
||||
boolean noticed_it = (canspotmon(mtmp)
|
||||
|| glyph_is_invisible(glyph)
|
||||
|| glyph_is_warning(glyph));
|
||||
|
||||
remove_monster(u.ux, u.uy);
|
||||
@@ -2810,7 +2820,7 @@ domove_core(void)
|
||||
&& !(is_hider(mtmp->data) && mtmp->mundetected)) {
|
||||
if (!domove_swap_with_pet(mtmp, x, y)) {
|
||||
u.ux = u.ux0, u.uy = u.uy0; /* didn't move after all */
|
||||
/* could skip this bit since we're about to call u_on_newpos() */
|
||||
/* could skip this since we're about to call u_on_newpos() */
|
||||
if (u.usteed)
|
||||
u.usteed->mx = u.ux, u.usteed->my = u.uy;
|
||||
}
|
||||
@@ -3739,7 +3749,8 @@ lookaround(void)
|
||||
continue;
|
||||
|
||||
/* stop for traps, sometimes */
|
||||
if (avoid_moving_on_trap(x, y, (infront && svc.context.run > 1))) {
|
||||
if (avoid_moving_on_trap(x, y,
|
||||
(infront && svc.context.run > 1))) {
|
||||
if (svc.context.run == 1)
|
||||
goto bcorr; /* if you must */
|
||||
if (infront)
|
||||
@@ -3762,7 +3773,7 @@ lookaround(void)
|
||||
}
|
||||
goto stop;
|
||||
}
|
||||
/* we're orthogonal to a closed door, consider it a corridor */
|
||||
/* orthogonal to a closed door, consider it a corridor */
|
||||
goto bcorr;
|
||||
} else if (levl[x][y].typ == CORR) {
|
||||
/* corridor */
|
||||
|
||||
@@ -106,7 +106,8 @@ static struct ll_achieve_msg achieve_msg [] = {
|
||||
#define you_are(attr, ps) enl_msg(You_, are, were, (attr), (ps))
|
||||
#define you_have(attr, ps) enl_msg(You_, have, had, (attr), (ps))
|
||||
#define you_can(attr, ps) enl_msg(You_, can, could, (attr), (ps))
|
||||
#define you_have_been(goodthing) enl_msg(You_, have_been, were, (goodthing), "")
|
||||
#define you_have_been(goodthing) \
|
||||
enl_msg(You_, have_been, were, (goodthing), "")
|
||||
#define you_have_never(badthing) \
|
||||
enl_msg(You_, have_never, never, (badthing), "")
|
||||
#define you_have_X(something) \
|
||||
@@ -603,7 +604,8 @@ background_enlightenment(int unused_mode UNUSED, int final)
|
||||
you_have("just started your adventure", "");
|
||||
} else {
|
||||
/* 'turns' grates on the nerves in this context... */
|
||||
Sprintf(buf, "the dungeon %ld turn%s ago", svm.moves, plur(svm.moves));
|
||||
Sprintf(buf, "the dungeon %ld turn%s ago",
|
||||
svm.moves, plur(svm.moves));
|
||||
/* same phrasing for current and final: "entered" is unconditional */
|
||||
enlght_line(You_, "entered ", buf, "");
|
||||
}
|
||||
@@ -1501,7 +1503,8 @@ attributes_enlightenment(
|
||||
item_resistance_message(AD_DISN, " protected from disintegration", final);
|
||||
if (Shock_resistance)
|
||||
you_are("shock resistant", from_what(SHOCK_RES));
|
||||
item_resistance_message(AD_ELEC, " protected from electric shocks", final);
|
||||
item_resistance_message(AD_ELEC, " protected from electric shocks",
|
||||
final);
|
||||
if (Poison_resistance)
|
||||
you_are("poison resistant", from_what(POISON_RES));
|
||||
if (Acid_resistance) {
|
||||
@@ -1548,23 +1551,19 @@ attributes_enlightenment(
|
||||
Sprintf(buf, "aware of the presence of %s",
|
||||
(svc.context.warntype.obj & M2_ORC) ? "orcs"
|
||||
: (svc.context.warntype.obj & M2_ELF) ? "elves"
|
||||
: (svc.context.warntype.obj & M2_DEMON) ? "demons" : something);
|
||||
: (svc.context.warntype.obj & M2_DEMON) ? "demons"
|
||||
: something);
|
||||
you_are(buf, from_what(WARN_OF_MON));
|
||||
}
|
||||
if (Warn_of_mon && svc.context.warntype.polyd) {
|
||||
Sprintf(buf, "aware of the presence of %s",
|
||||
((svc.context.warntype.polyd & (M2_HUMAN | M2_ELF))
|
||||
== (M2_HUMAN | M2_ELF))
|
||||
? "humans and elves"
|
||||
: (svc.context.warntype.polyd & M2_HUMAN)
|
||||
? "humans"
|
||||
: (svc.context.warntype.polyd & M2_ELF)
|
||||
? "elves"
|
||||
: (svc.context.warntype.polyd & M2_ORC)
|
||||
? "orcs"
|
||||
: (svc.context.warntype.polyd & M2_DEMON)
|
||||
? "demons"
|
||||
: "certain monsters");
|
||||
== (M2_HUMAN | M2_ELF)) ? "humans and elves"
|
||||
: (svc.context.warntype.polyd & M2_HUMAN) ? "humans"
|
||||
: (svc.context.warntype.polyd & M2_ELF) ? "elves"
|
||||
: (svc.context.warntype.polyd & M2_ORC) ? "orcs"
|
||||
: (svc.context.warntype.polyd & M2_DEMON) ? "demons"
|
||||
: "certain monsters");
|
||||
you_are(buf, "");
|
||||
}
|
||||
warnspecies = svc.context.warntype.speciesidx;
|
||||
@@ -2800,7 +2799,7 @@ list_vanquished(char defquery, boolean ask)
|
||||
if (c == 'q')
|
||||
done_stopprint++;
|
||||
if (c == 'y' || c == 'a') {
|
||||
if (c == 'a' && ntypes > 1) { /* ask player to choose sort order */
|
||||
if (c == 'a' && ntypes > 1) { /* ask user to choose sort order */
|
||||
/* choose value for vanq_sortmode via menu; ESC cancels list
|
||||
of vanquished monsters but does not set 'done_stopprint' */
|
||||
if (set_vanq_order(TRUE) < 0)
|
||||
|
||||
39
src/invent.c
39
src/invent.c
@@ -404,7 +404,8 @@ invletter_value(char c)
|
||||
: ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26)
|
||||
: (c == '$') ? 1
|
||||
: (c == '#') ? 1 + invlet_basic + 1
|
||||
: 1 + invlet_basic + 1 + 1; /* none of the above (shouldn't happen) */
|
||||
: 1 + invlet_basic + 1 + 1; /* none of the above
|
||||
* (shouldn't happen) */
|
||||
}
|
||||
|
||||
/* qsort comparison routine for sortloot() */
|
||||
@@ -1006,11 +1007,11 @@ addinv_core1(struct obj *obj)
|
||||
dumplog, originally just recorded in XLOGFILE */
|
||||
if (is_mines_prize(obj)) {
|
||||
record_achievement(ACH_MINE_PRIZE);
|
||||
svc.context.achieveo.mines_prize_oid = 0; /* done with luckstone o_id */
|
||||
svc.context.achieveo.mines_prize_oid = 0; /* done w/ luckstone o_id */
|
||||
obj->nomerge = 0; /* was set in create_object(sp_lev.c) */
|
||||
} else if (is_soko_prize(obj)) {
|
||||
record_achievement(ACH_SOKO_PRIZE);
|
||||
svc.context.achieveo.soko_prize_oid = 0; /* done with bag/amulet o_id */
|
||||
svc.context.achieveo.soko_prize_oid = 0; /* done w/ bag/amulet o_id */
|
||||
obj->nomerge = 0; /* (got set in sp_lev.c) */
|
||||
}
|
||||
}
|
||||
@@ -1794,8 +1795,9 @@ getobj(
|
||||
*bp++ = ' '; /* put a space after the '-' in the prompt */
|
||||
break;
|
||||
case GETOBJ_DOWNPLAY: /* acceptable but not shown as likely choice */
|
||||
case GETOBJ_EXCLUDE_INACCESS: /* nothing currently gives this for '-' but
|
||||
* theoretically could if wearing gloves */
|
||||
case GETOBJ_EXCLUDE_INACCESS: /* nothing currently gives this for '-'
|
||||
* but theoretically could if wearing
|
||||
* gloves */
|
||||
case GETOBJ_EXCLUDE_SELECTABLE: /* ditto, I think... */
|
||||
allownone = TRUE;
|
||||
*ap++ = HANDS_SYM;
|
||||
@@ -2186,7 +2188,8 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
||||
ofilter = not_fully_identified;
|
||||
}
|
||||
|
||||
iletct = collect_obj_classes(ilets, gi.invent, FALSE, ofilter, &itemcount);
|
||||
iletct = collect_obj_classes(ilets, gi.invent, FALSE, ofilter,
|
||||
&itemcount);
|
||||
unpaid = count_unpaid(gi.invent);
|
||||
|
||||
if (ident && !iletct) {
|
||||
@@ -3119,11 +3122,13 @@ itemactions(struct obj *otmp)
|
||||
if (otmp->oclass == COIN_CLASS)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Flip a coin");
|
||||
else if (otmp->otyp == CREAM_PIE)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Hit yourself with this cream pie");
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a',
|
||||
"Hit yourself with this cream pie");
|
||||
else if (otmp->otyp == BULLWHIP)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Lash out with this whip");
|
||||
else if (otmp->otyp == GRAPPLING_HOOK)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Grapple something with this hook");
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a',
|
||||
"Grapple something with this hook");
|
||||
else if (otmp->otyp == BAG_OF_TRICKS && objects[otmp->otyp].oc_name_known)
|
||||
/* bag of tricks skips this unless discovered */
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Reach into this bag");
|
||||
@@ -3187,7 +3192,8 @@ itemactions(struct obj *otmp)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Make this figurine transform");
|
||||
else if (otmp->otyp == UNICORN_HORN)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Use this unicorn horn");
|
||||
else if (otmp->otyp == HORN_OF_PLENTY && objects[otmp->otyp].oc_name_known)
|
||||
else if (otmp->otyp == HORN_OF_PLENTY
|
||||
&& objects[otmp->otyp].oc_name_known)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Blow into the horn of plenty");
|
||||
else if (otmp->otyp >= WOODEN_FLUTE && otmp->otyp <= DRUM_OF_EARTHQUAKE)
|
||||
ia_addmenu(win, IA_APPLY_OBJ, 'a', "Play this musical instrument");
|
||||
@@ -3417,7 +3423,8 @@ itemactions(struct obj *otmp)
|
||||
ia_addmenu(win, IA_SWAPWEAPON, 'x',
|
||||
"Ready this as an alternate weapon");
|
||||
else if (otmp == uswapwep)
|
||||
ia_addmenu(win, IA_SWAPWEAPON, 'x', "Swap this with your main weapon");
|
||||
ia_addmenu(win, IA_SWAPWEAPON, 'x',
|
||||
"Swap this with your main weapon");
|
||||
|
||||
/* this is based on TWOWEAPOK() in wield.c; we don't call can_two_weapon()
|
||||
because it is very verbose; attempting to two-weapon might be rejected
|
||||
@@ -3997,7 +4004,8 @@ display_used_invlets(char avoidlet)
|
||||
tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng);
|
||||
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
|
||||
add_menu(win, &tmpglyphinfo, &any, ilet, 0,
|
||||
ATR_NONE, clr, doname(otmp), MENU_ITEMFLAGS_NONE);
|
||||
ATR_NONE, clr, doname(otmp),
|
||||
MENU_ITEMFLAGS_NONE);
|
||||
}
|
||||
}
|
||||
if (flags.sortpack && *++invlet)
|
||||
@@ -4866,7 +4874,8 @@ stackobj(struct obj *obj)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
for (otmp = svl.level.objects[obj->ox][obj->oy]; otmp; otmp = otmp->nexthere)
|
||||
for (otmp = svl.level.objects[obj->ox][obj->oy]; otmp;
|
||||
otmp = otmp->nexthere)
|
||||
if (otmp != obj && merged(&obj, &otmp))
|
||||
break;
|
||||
return;
|
||||
@@ -5565,7 +5574,7 @@ doorganize_core(struct obj *obj)
|
||||
char let;
|
||||
#define GOLD_INDX 0
|
||||
#define GOLD_OFFSET 1
|
||||
#define OVRFLW_INDX (GOLD_OFFSET + invlet_basic) /* past gold & 2*26 letters */
|
||||
#define OVRFLW_INDX (GOLD_OFFSET + invlet_basic) /* past gold+2*26 letters */
|
||||
char lets[1 + invlet_basic + 1 + 1]; /* room for '$a-zA-Z#\0' */
|
||||
char qbuf[QBUFSZ];
|
||||
char *objname, *otmpname;
|
||||
@@ -5671,7 +5680,9 @@ doorganize_core(struct obj *obj)
|
||||
|
||||
collect = (let == obj->invlet);
|
||||
/* change the inventory and print the resulting item */
|
||||
adj_type = collect ? "Collecting:" : !splitting ? "Moving:" : "Splitting:";
|
||||
adj_type = collect ? "Collecting:"
|
||||
: !splitting ? "Moving:"
|
||||
: "Splitting:";
|
||||
|
||||
/*
|
||||
* don't use freeinv/addinv to avoid double-touching artifacts,
|
||||
|
||||
Reference in New Issue
Block a user