some reformatting (4 of 4)

This commit is contained in:
PatR
2024-09-05 16:49:42 -07:00
parent cc1066b1ff
commit 993c3b303f
22 changed files with 185 additions and 129 deletions

View File

@@ -693,14 +693,15 @@ pickup(int what) /* should be a long */
t = t_at(u.ux, u.uy);
if (!can_reach_floor(t && is_pit(t->ttyp))) {
(void) describe_decor(); /* even when !flags.mention_decor */
if ((gm.multi && !svc.context.run) || (autopickup && !flags.pickup)
if ((gm.multi && !svc.context.run)
|| (autopickup && !flags.pickup)
|| (t && (uteetering_at_seen_pit(t) || uescaped_shaft(t))))
read_engr_at(u.ux, u.uy);
return 0;
}
/* multi && !svc.context.run means they are in the middle of some other
* action, or possibly paralyzed, sleeping, etc.... and they just
* teleported onto the object. They shouldn't pick it up.
/* multi && !svc.context.run means they are in the middle of some
* other action, or possibly paralyzed, sleeping, etc.... and they
* just teleported onto the object. They shouldn't pick it up.
*/
if ((gm.multi && !svc.context.run)
|| (autopickup && !flags.pickup)
@@ -2117,7 +2118,8 @@ do_loot_cont(
&& res != ECMD_TIME
&& ccount == 1 && u_have_forceable_weapon()) {
/* single container, and we could #force it open... */
cmdq_add_ec(CQ_CANNED, doforce); /* doforce asks for confirmation */
/* note: doforce asks for confirmation */
cmdq_add_ec(CQ_CANNED, doforce);
ga.abort_looting = TRUE;
}
}
@@ -2227,8 +2229,8 @@ doloot_core(void)
cobj = cobj->nexthere)
if (Is_container(cobj)) {
any.a_obj = cobj;
add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, clr, doname(cobj), MENU_ITEMFLAGS_NONE);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
doname(cobj), MENU_ITEMFLAGS_NONE);
}
end_menu(win, "Loot which containers?");
n = select_menu(win, PICK_ANY, &pick_list);
@@ -2334,7 +2336,8 @@ reverse_loot(void)
if (!rn2(3)) {
/* n objects: 1/(n+1) chance per object, 1/(n+1) to fall off end */
for (n = inv_cnt(TRUE), otmp = gi.invent; otmp; --n, otmp = otmp->nobj)
for (n = inv_cnt(TRUE), otmp = gi.invent; otmp;
--n, otmp = otmp->nobj)
if (!rn2(n + 1)) {
prinv("You find old loot:", otmp, 0L);
return TRUE;
@@ -2363,7 +2366,7 @@ reverse_loot(void)
if (g_at(x, y))
pline("Ok, now there is loot here.");
} else {
/* find original coffers chest if present, otherwise use nearest one */
/* find original coffers chest if present, otherwise use nearest */
otmp = 0;
for (coffers = fobj; coffers; coffers = coffers->nobj)
if (coffers->otyp == CHEST) {
@@ -2646,7 +2649,7 @@ in_container(struct obj *obj)
obfree(obj, (struct obj *) 0);
/* if carried, shop goods will be flagged 'unpaid' and obfree() will
handle bill issues, but if on floor, we need to put them on bill
before deleting them (non-shop items will be flagged 'no_charge') */
before deleting them (non-shop items will be flagged 'no_charge')*/
if (floor_container && costly_spot(gc.current_container->ox,
gc.current_container->oy)) {
struct obj save_no_charge;
@@ -3302,7 +3305,8 @@ menu_loot(int retry, boolean put_in)
n_looted += res;
}
}
} else if (put_in && loot_justpicked && count_justpicked(gi.invent) == 1) {
} else if (put_in && loot_justpicked
&& count_justpicked(gi.invent) == 1) {
otmp = find_justpicked(gi.invent);
if (otmp) {
n_looted = 1;
@@ -3415,7 +3419,8 @@ in_or_out_menu(
if (more_containers) {
any.a_int = 7; /* 'n' */
add_menu(win, &nul_glyphinfo, &any, menuselector[any.a_int], 0,
ATR_NONE, clr, "loot next container", MENU_ITEMFLAGS_SELECTED);
ATR_NONE, clr, "loot next container",
MENU_ITEMFLAGS_SELECTED);
}
any.a_int = 8; /* 'q' */
Strcpy(buf, alreadyused ? "done" : "do nothing");
@@ -3560,7 +3565,8 @@ dotip(void)
return res;
/* else pick-from-gi.invent below */
} else {
for (cobj = svl.level.objects[cc.x][cc.y]; cobj; cobj = nobj) {
for (cobj = svl.level.objects[cc.x][cc.y]; cobj;
cobj = nobj) {
nobj = cobj->nexthere;
if (!Is_container(cobj))
continue;
@@ -3683,7 +3689,8 @@ tipcontainer(struct obj *box) /* or bag */
if (tipcontainer_checks(box, targetbox, FALSE) != TIPCHECK_OK)
return;
if (targetbox && tipcontainer_checks(targetbox, NULL, TRUE) != TIPCHECK_OK)
if (targetbox
&& tipcontainer_checks(targetbox, NULL, TRUE) != TIPCHECK_OK)
return;
{

View File

@@ -443,7 +443,8 @@ fix_worst_trouble(int trouble)
if ((otmp = stuck_ring(uleft, RIN_SUSTAIN_ABILITY)) != 0) {
if (otmp == uleft)
what = leftglow;
} else if ((otmp = stuck_ring(uright, RIN_SUSTAIN_ABILITY)) != 0) {
} else if ((otmp = stuck_ring(uright, RIN_SUSTAIN_ABILITY))
!= 0) {
if (otmp == uright)
what = rightglow;
}
@@ -848,7 +849,8 @@ gcrownu(void)
case A_CHAOTIC:
u.uevent.uhand_of_elbereth = 3;
in_hand = u_wield_art(ART_STORMBRINGER);
already_exists = exist_artifact(RUNESWORD, artiname(ART_STORMBRINGER));
already_exists = exist_artifact(RUNESWORD,
artiname(ART_STORMBRINGER));
what = (((already_exists && !in_hand) || class_gift != STRANGE_OBJECT)
? "take lives"
: "steal souls");
@@ -1859,8 +1861,8 @@ dosacrifice(void)
/* KMH, conduct */
if (!u.uconduct.gnostic++)
livelog_printf(LL_CONDUCT,
"rejected atheism by offering %s on an altar of %s",
livelog_printf(LL_CONDUCT, "rejected atheism"
" by offering %s on an altar of %s",
corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
a_gname());
@@ -2066,9 +2068,9 @@ can_pray(boolean praying) /* false means no messages should be given */
if (gp.p_aligntyp == A_NONE) /* praying to Moloch */
gp.p_type = -2;
else if ((gp.p_trouble > 0) ? (u.ublesscnt > 200) /* big trouble */
: (gp.p_trouble < 0) ? (u.ublesscnt > 100) /* minor difficulties */
: (u.ublesscnt > 0)) /* not in trouble */
else if ((gp.p_trouble > 0) ? (u.ublesscnt > 200) /* big trouble */
: (gp.p_trouble < 0) ? (u.ublesscnt > 100) /* minor difficulty */
: (u.ublesscnt > 0)) /* not in trouble */
gp.p_type = 0; /* too soon... */
else if ((int) Luck < 0 || u.ugangr || alignment < 0)
gp.p_type = 1; /* too naughty... */
@@ -2119,7 +2121,8 @@ dopray(void)
* than just "y" (will also require "no" to decline).
*/
if (ParanoidPray) {
ok = paranoid_query(ParanoidConfirm, "Are you sure you want to pray?");
ok = paranoid_query(ParanoidConfirm,
"Are you sure you want to pray?");
/* clear command recall buffer; otherwise ^A to repeat p(ray) would
do so without confirmation (if 'ok') or do nothing (if '!ok') */

View File

@@ -2472,7 +2472,8 @@ litroom(
int rx, ry;
if (rnum >= 0) {
for (rx = svr.rooms[rnum].lx - 1; rx <= svr.rooms[rnum].hx + 1; rx++)
for (rx = svr.rooms[rnum].lx - 1; rx <= svr.rooms[rnum].hx + 1;
rx++)
for (ry = svr.rooms[rnum].ly - 1;
ry <= svr.rooms[rnum].hy + 1; ry++)
set_lit(rx, ry,
@@ -2738,7 +2739,8 @@ do_genocide(
pline1(thats_enough_tries);
return;
}
Strcpy(promptbuf, "What type of monster do you want to genocide?");
Strcpy(promptbuf,
"What type of monster do you want to genocide?");
if (i > 0)
Snprintf(eos(promptbuf), sizeof promptbuf - strlen(promptbuf),
" [enter %s]",
@@ -2803,8 +2805,10 @@ do_genocide(
* aren't supposed to be hampered by deafness....
*/
if (flags.verbose)
pline("A thunderous voice booms through the caverns:");
pline("A thunderous voice booms"
" through the caverns:");
SetVoice((struct monst *) 0, 0, 80, voice_deity);
/* FIXME? shouldn't this override deafness? */
verbalize("No, mortal! That will not be done.");
}
continue;

View File

@@ -745,12 +745,14 @@ save_regions(NHFILE *nhfp)
for (i = 0; i < svn.n_regions; i++) {
r = gr.regions[i];
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &r->bounding_box, sizeof (NhRect));
bwrite(nhfp->fd, (genericptr_t) &r->bounding_box,
sizeof (NhRect));
bwrite(nhfp->fd, (genericptr_t) &r->nrects, sizeof (short));
}
for (j = 0; j < r->nrects; j++) {
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &r->rects[j], sizeof (NhRect));
bwrite(nhfp->fd, (genericptr_t) &r->rects[j],
sizeof (NhRect));
}
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &r->attach_2_u, sizeof (boolean));
@@ -931,7 +933,7 @@ region_stats(
/* other stats formats take one parameter; this takes two */
Sprintf(hdrbuf, hdrfmt, (long) sizeof (NhRegion), (long) sizeof (NhRect));
*count = (long) svn.n_regions; /* might be 0 even though max_regions isn't */
*count = (long) svn.n_regions; /* might be 0 even tho max_regions isn't */
*size = (long) gm.max_regions * (long) sizeof (NhRegion);
for (i = 0; i < svn.n_regions; ++i) {
rg = gr.regions[i];

View File

@@ -533,7 +533,7 @@ restgamestate(NHFILE *nhfp)
svc.context.warntype.species = (ismnum(svc.context.warntype.speciesidx))
? &mons[svc.context.warntype.speciesidx]
: (struct permonst *) 0;
/* svc.context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
/* context.victual.piece, .tin.tin, .spellbook.book, and .polearm.hitmon
are pointers which get set to Null during save and will be recovered
via corresponding o_id or m_id while objs or mons are being restored */
@@ -1413,7 +1413,8 @@ reset_oattached_mids(boolean ghostly)
returns 1: use svp.plname[], 0: new game, -1: quit */
int
restore_menu(
winid bannerwin) /* if not WIN_ERR, clear window and show copyright in menu */
winid bannerwin) /* if not WIN_ERR, clear window
* and show copyright in menu */
{
winid tmpwin;
anything any;

View File

@@ -58,7 +58,8 @@ static const char *const rip_txt[] = {
" | | | Ascended |",
" | 1001 | | |",
" * | * * * | * * | * * * | *",
" _____)/\\|\\__//(\\/(/\\)/\\//\\/|_)________)/|\\\\_/_/(\\/(/\\)/\\/\\/|_)____",
(" _____)/\\|\\__//(\\/(/\\)/\\//\\/|_)___"
"_____)/|\\\\_/_/(\\/(/\\)/\\/\\/|_)____"),
0
};
#define STONE_LINE_CENT 19 /* char[] element of center of stone face */

View File

@@ -1683,7 +1683,8 @@ plnamesuffix(void)
do {
if (!svp.plname[0]) {
askname(); /* fill svp.plname[] if necessary, or set defer_plname */
askname(); /* fill svp.plname[] if necessary, or set
* defer_plname */
gp.plnamelen = 0; /* plname[] might have -role-race-&c attached */
}
@@ -1733,7 +1734,8 @@ role_selection_prolog(int which, winid where)
allowmask = roles[r].allow;
if ((allowmask & ROLE_RACEMASK) == MH_HUMAN)
c = 0; /* races[human] */
else if (IndexOkT(c, races) && !(allowmask & ROLE_RACEMASK & races[c].allow))
else if (IndexOkT(c, races)
&& !(allowmask & ROLE_RACEMASK & races[c].allow))
c = ROLE_RANDOM;
if ((allowmask & ROLE_GENDMASK) == ROLE_MALE)
gend = 0; /* role forces male (hypothetical) */
@@ -1848,8 +1850,8 @@ role_menu_extra(int which, winid where, boolean preselect)
if (c >= 0) {
constrainer = "role";
forcedvalue = races[c].noun;
} else if (f >= 0
&& (allowmask & ~gr.rfilter.mask) == races[f].selfmask) {
} else if (f >= 0 && ((allowmask & ~gr.rfilter.mask)
== races[f].selfmask)) {
/* if there is only one race choice available due to user
options disallowing others, race menu entry is disabled */
constrainer = "filter";
@@ -1870,8 +1872,8 @@ role_menu_extra(int which, winid where, boolean preselect)
if (gend >= 0) {
constrainer = "role";
forcedvalue = genders[gend].adj;
} else if (f >= 0
&& (allowmask & ~gr.rfilter.mask) == genders[f].allow) {
} else if (f >= 0 && ((allowmask & ~gr.rfilter.mask)
== genders[f].allow)) {
/* if there is only one gender choice available due to user
options disallowing other, gender menu entry is disabled */
constrainer = "filter";
@@ -2535,7 +2537,9 @@ genl_player_setup(int screenheight)
} /* picking gender */
if (nextpick == RS_ALGNMNT) {
nextpick = (ROLE < 0) ? RS_ROLE : (RACE < 0) ? RS_RACE : RS_GENDER;
nextpick = (ROLE < 0) ? RS_ROLE
: (RACE < 0) ? RS_RACE
: RS_GENDER;
/* Select an alignment, if necessary;
force compatibility with role/race/gender. */
if (ALGN < 0 || !validalign(ROLE, RACE, ALGN)) {
@@ -2651,7 +2655,8 @@ genl_player_setup(int screenheight)
if (iflags.renameallowed) {
any.a_int = 3;
add_menu(win, &nul_glyphinfo, &any, 'a', 0, ATR_NONE,
clr, "Not yet; choose another name", MENU_ITEMFLAGS_NONE);
clr, "Not yet; choose another name",
MENU_ITEMFLAGS_NONE);
}
any.a_int = -1;
add_menu(win, &nul_glyphinfo, &any, 'q', 0,
@@ -2680,10 +2685,12 @@ genl_player_setup(int screenheight)
iflags.renameinprogress = TRUE; /* affects main() in unixmain.c */
/* plnamesuffix() can change any or all of ROLE, RACE,
GEND, ALGN; we'll override that and honor only the name */
saveROLE = ROLE, saveRACE = RACE, saveGEND = GEND, saveALGN = ALGN;
saveROLE = ROLE, saveRACE = RACE,
saveGEND = GEND, saveALGN = ALGN;
svp.plname[0] = '\0';
plnamesuffix(); /* calls askname() when svp.plname[] is empty */
ROLE = saveROLE, RACE = saveRACE, GEND = saveGEND, ALGN = saveALGN;
ROLE = saveROLE, RACE = saveRACE,
GEND = saveGEND, ALGN = saveALGN;
break; /* getconfirmation is still True */
}
case 2: /* 'n' */

View File

@@ -414,12 +414,14 @@ savestateinlock(void)
}
nhfp->mode = WRITING;
if (nhfp->structlevel)
(void) write(nhfp->fd, (genericptr_t) &svh.hackpid, sizeof svh.hackpid);
(void) write(nhfp->fd, (genericptr_t) &svh.hackpid,
sizeof svh.hackpid);
if (flags.ins_chkpt) {
int currlev = ledger_no(&u.uz);
if (nhfp->structlevel)
(void) write(nhfp->fd, (genericptr_t) &currlev, sizeof currlev);
(void) write(nhfp->fd, (genericptr_t) &currlev,
sizeof currlev);
save_savefile_name(nhfp);
store_version(nhfp);
store_savefileinfo(nhfp);
@@ -526,13 +528,16 @@ savelev_core(NHFILE *nhfp, xint8 lev)
savelevl(nhfp, ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP));
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) svl.lastseentyp, sizeof svl.lastseentyp);
bwrite(nhfp->fd, (genericptr_t) svl.lastseentyp,
sizeof svl.lastseentyp);
bwrite(nhfp->fd, (genericptr_t) &svm.moves, sizeof svm.moves);
save_stairs(nhfp);
bwrite(nhfp->fd, (genericptr_t) &svu.updest, sizeof (dest_area));
bwrite(nhfp->fd, (genericptr_t) &svd.dndest, sizeof (dest_area));
bwrite(nhfp->fd, (genericptr_t) &svl.level.flags, sizeof svl.level.flags);
bwrite(nhfp->fd, (genericptr_t) &svd.doors_alloc, sizeof svd.doors_alloc);
bwrite(nhfp->fd, (genericptr_t) &svl.level.flags,
sizeof svl.level.flags);
bwrite(nhfp->fd, (genericptr_t) &svd.doors_alloc,
sizeof svd.doors_alloc);
/* don't rely on underlying write() behavior to write
* nothing if count arg is 0, just skip it */
if (svd.doors_alloc)
@@ -980,7 +985,7 @@ savemonchn(NHFILE *nhfp, struct monst *mtmp)
}
}
/* save traps; gf.ftrap is the only trap chain so the 2nd arg is superfluous */
/* save traps; gf.ftrap is the only trap chain so 2nd arg is superfluous */
staticfn void
savetrapchn(NHFILE *nhfp, struct trap *trap)
{

View File

@@ -761,9 +761,10 @@ selection_size_description(struct selectionvar *sel, char *buf)
selection_getbounds(sel, &rect);
dx = rect.hx - rect.lx + 1;
dy = rect.hy - rect.ly + 1;
Sprintf(buf, "%s %i by %i", selection_is_irregular(sel) ? "irregularly shaped"
Sprintf(buf, "%s %i by %i",
selection_is_irregular(sel) ? "irregularly shaped"
: (dx == dy) ? "square"
: "rectangular",
: "rectangular",
dx, dy);
return buf;
}

View File

@@ -275,7 +275,8 @@ dosit(void)
You("are already sitting on %s.", mon_nam(u.usteed));
return ECMD_OK;
}
if (u.uundetected && is_hider(gy.youmonst.data) && u.umonnum != PM_TRAPPER)
if (u.uundetected && is_hider(gy.youmonst.data)
&& u.umonnum != PM_TRAPPER) /* trapper can stay hidden on floor */
u.uundetected = 0; /* no longer on the ceiling */
if (!can_reach_floor(FALSE)) {
@@ -320,7 +321,8 @@ dosit(void)
pline("Squelch!");
}
useupf(obj, obj->quan);
} else if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
} else if (!(Is_box(obj)
|| objects[obj->otyp].oc_material == CLOTH))
pline("It's not very comfortable...");
}
} else if (trap != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) {

View File

@@ -792,12 +792,13 @@ domonnoise(struct monst *mtmp)
int vampindex;
if (kindred) {
verbl_msg =
"This is my hunting ground that you dare to prowl!";
verbl_msg = "This is my hunting ground"
" that you dare to prowl!";
} else if (gy.youmonst.data == &mons[PM_SILVER_DRAGON]
|| gy.youmonst.data == &mons[PM_BABY_SILVER_DRAGON]) {
/* Silver dragons are silver in color, not made of silver */
Sprintf(verbuf, "%s! Your silver sheen does not frighten me!",
Sprintf(verbuf,
"%s! Your silver sheen"" does not frighten me!",
(gy.youmonst.data == &mons[PM_SILVER_DRAGON])
? "Fool"
: "Young Fool");
@@ -1067,11 +1068,12 @@ domonnoise(struct monst *mtmp)
Phase 1 Phase 2 Phase 3
Collect underpants ? Profit
and they never verbalize step 2 so we don't either */
verbl_msg = (gnomeplan == 1) ? "Phase one, collect underpants."
: "Phase three, profit!";
verbl_msg = (gnomeplan == 1)
? "Phase one, collect underpants."
: "Phase three, profit!";
} else {
verbl_msg =
"Many enter the dungeon, and few return to the sunlit lands.";
verbl_msg = "Many enter the dungeon,"
" and few return to the sunlit lands.";
}
} else
switch (monsndx(ptr)) {
@@ -1334,7 +1336,8 @@ dochat(void)
Hallucination ? rndmonnam((char *) 0) : "statue");
return ECMD_OK;
}
if (!Deaf && (IS_WALL(levl[tx][ty].typ) || levl[tx][ty].typ == SDOOR)) {
if (!Deaf && (IS_WALL(levl[tx][ty].typ)
|| levl[tx][ty].typ == SDOOR)) {
/* Talking to a wall; secret door remains hidden by behaving
like a wall; IS_WALL() test excludes solid rock even when
that serves as a wall bordering a corridor */
@@ -1561,9 +1564,11 @@ add_sound_mapping(const char *mapping)
text[sizeof text - 1] = '\0';
if (sscanf(mapping, "MESG \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d %d",
text, filename, &volume, &idx) == 4
|| sscanf(mapping, "MESG %10[^\"] \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d %d",
|| sscanf(mapping,
"MESG %10[^\"] \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d %d",
msgtyp, text, filename, &volume, &idx) == 5
|| sscanf(mapping, "MESG %10[^\"] \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d",
|| sscanf(mapping,
"MESG %10[^\"] \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d",
msgtyp, text, filename, &volume) == 4
|| sscanf(mapping, "MESG \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d",
text, filename, &volume) == 3) {
@@ -1587,7 +1592,8 @@ add_sound_mapping(const char *mapping)
if (!regex_compile(text, new_map->regex)) {
char errbuf[BUFSZ];
char *re_error_desc = regex_error_desc(new_map->regex, errbuf);
char *re_error_desc
= regex_error_desc(new_map->regex, errbuf);
regex_free(new_map->regex);
free((genericptr_t) new_map->filename);
@@ -2134,7 +2140,11 @@ base_soundname_to_filename(
#endif
void
set_voice(struct monst *mtmp SPEECHONLY, int32_t tone SPEECHONLY, int32_t volume SPEECHONLY, int32_t moreinfo SPEECHONLY)
set_voice(
struct monst *mtmp SPEECHONLY,
int32_t tone SPEECHONLY,
int32_t volume SPEECHONLY,
int32_t moreinfo SPEECHONLY)
{
#ifdef SND_SPEECH
int32_t gender = (mtmp && mtmp->female) ? FEMALE : MALE;

View File

@@ -55,7 +55,8 @@ staticfn unsigned int sp_amask_to_amask(unsigned int sp_amask);
staticfn void create_monster(monster *, struct mkroom *);
staticfn struct obj *create_object(object *, struct mkroom *);
staticfn void create_altar(altar *, struct mkroom *);
staticfn boolean search_door(struct mkroom *, coordxy *, coordxy *, xint16, int);
staticfn boolean search_door(struct mkroom *, coordxy *, coordxy *, xint16,
int) NONNULLPTRS;
staticfn void create_corridor(corridor *);
staticfn struct mkroom *build_room(room *, struct mkroom *);
staticfn void light_region(region *);
@@ -102,7 +103,8 @@ staticfn void sel_set_ter(coordxy, coordxy, genericptr_t);
staticfn void sel_set_door(coordxy, coordxy, genericptr_t);
staticfn void sel_set_feature(coordxy, coordxy, genericptr_t);
staticfn void levregion_add(lev_region *);
staticfn void get_table_xy_or_coord(lua_State *, lua_Integer *, lua_Integer *);
staticfn void get_table_xy_or_coord(lua_State *, lua_Integer *,
lua_Integer *) NONNULLPTRS;
staticfn int get_table_region(lua_State *, const char *, lua_Integer *,
lua_Integer *, lua_Integer *, lua_Integer *, boolean);
staticfn void set_wallprop_in_selection(lua_State *, int);
@@ -1535,7 +1537,8 @@ create_room(
+ rn2(hx - (lx > 0 ? lx : 3) - dx - xborder + 1);
yabs = ly + (ly > 0 ? ylim : 2)
+ rn2(hy - (ly > 0 ? ly : 2) - dy - yborder + 1);
if (ly == 0 && hy >= (ROWNO - 1) && (!svn.nroom || !rn2(svn.nroom))
if (ly == 0 && hy >= ROWNO - 1
&& (!svn.nroom || !rn2(svn.nroom))
&& (yabs + dy > ROWNO / 2)) {
yabs = rn1(3, 2);
if (svn.nroom < 4 && dy > 1)
@@ -4617,7 +4620,8 @@ lspo_door(lua_State *L)
get_table_xy_or_coord(L, &dx, &dy);
x = dx, y = dy;
msk = doorstates2i[get_table_option(L, "state", "random", doorstates)];
msk = doorstates2i[get_table_option(L, "state", "random",
doorstates)];
}
typ = (msk == -1) ? rnddoor() : (coordxy) msk;
@@ -5358,7 +5362,7 @@ l_get_lregion(lua_State *L, lev_region *tmplregion)
/* teleport_region({ region = { x1,y1, x2,y2 } }); */
/* teleport_region({ region = { x1,y1, x2,y2 }, [ region_islev = 1, ]
* exclude = { x1,y1, x2,y2 }, [ exclude_islen = 1, ] [ dir = "up" ] }); */
* exclude = { x1,y1, x2,y2 }, [ exclude_islen = 1, ] [ dir = "up" ] }); */
/* TODO: maybe allow using selection, with a new method "getextents()"? */
int
lspo_teleport_region(lua_State *L)
@@ -5507,8 +5511,8 @@ lspo_region(lua_State *L)
if (argc <= 1) {
lcheck_param_table(L);
/* TODO: "unfilled" ==> filled=0, "filled" ==> filled=1, and
* "lvflags_only" ==> filled=2, probably in a get_table_needfill_opt */
/* TODO: "unfilled" => filled=0, "filled" => filled=1, and
* "lvflags_only" => filled=2, probably in a get_table_needfill_opt */
needfill = get_table_int_opt(L, "filled", 0);
irregular = get_table_boolean_opt(L, "irregular", 0);
joined = get_table_boolean_opt(L, "joined", TRUE);

View File

@@ -4,7 +4,7 @@
#include "hack.h"
/* spellmenu arguments; 0 thru n-1 used as svs.spl_book[] index when swapping */
/* spellmenu arguments; 0..n-1 used as svs.spl_book[] index when swapping */
#define SPELLMENU_CAST (-2)
#define SPELLMENU_VIEW (-1)
#define SPELLMENU_SORT (MAXSPELL) /* special menu entry */
@@ -498,7 +498,8 @@ study_book(struct obj *spellbook)
svc.context.spbook.book become erased somehow, resume reading it */
&& booktype != SPE_BLANK_PAPER) {
You("continue your efforts to %s.",
(booktype == SPE_NOVEL) ? "read the novel" : "memorize the spell");
(booktype == SPE_NOVEL) ? "read the novel"
: "memorize the spell");
} else {
/* KMH -- Simplified this code */
if (booktype == SPE_BLANK_PAPER) {
@@ -516,7 +517,8 @@ study_book(struct obj *spellbook)
spellbook->o_id)) {
if (!u.uconduct.literate++)
livelog_printf(LL_CONDUCT,
"became literate by reading %s", tribtitle);
"became literate by reading %s",
tribtitle);
check_unpaid(spellbook);
makeknown(booktype);
@@ -2033,7 +2035,8 @@ DISABLE_WARNING_FORMAT_NONLITERAL
staticfn boolean
dospellmenu(
const char *prompt,
int splaction, /* SPELLMENU_CAST, SPELLMENU_VIEW, or svs.spl_book[] index */
int splaction, /* SPELLMENU_CAST, SPELLMENU_VIEW, or
* svs.spl_book[] index */
int *spell_no)
{
winid tmpwin;

View File

@@ -1531,22 +1531,25 @@ rloc_pos_ok(
if (svd.dndest.nlx && On_W_tower_level(&u.uz))
return (((yy & 2) != 0)
/* inside xor not within */
^ !within_bounded_area(x, y, svd.dndest.nlx, svd.dndest.nly,
^ !within_bounded_area(x, y,
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy));
if (svu.updest.lx && (yy & 1) != 0) /* moving up */
return (within_bounded_area(x, y, svu.updest.lx, svu.updest.ly,
return (within_bounded_area(x, y,
svu.updest.lx, svu.updest.ly,
svu.updest.hx, svu.updest.hy)
&& (!svu.updest.nlx
|| !within_bounded_area(x, y,
svu.updest.nlx, svu.updest.nly,
svu.updest.nhx, svu.updest.nhy)));
svu.updest.nlx, svu.updest.nly,
svu.updest.nhx, svu.updest.nhy)));
if (svd.dndest.lx && (yy & 1) == 0) /* moving down */
return (within_bounded_area(x, y, svd.dndest.lx, svd.dndest.ly,
return (within_bounded_area(x, y,
svd.dndest.lx, svd.dndest.ly,
svd.dndest.hx, svd.dndest.hy)
&& (!svd.dndest.nlx
|| !within_bounded_area(x, y,
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy)));
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy)));
} else {
/* [try to] prevent a shopkeeper or temple priest from being
sent out of his room (caller might resort to goodpos() if
@@ -1906,7 +1909,8 @@ mtele_trap(struct monst *mtmp, struct trap *trap, int in_sight)
* possible space - instead it just doesn't work. */
if (!(m_at(trap->teledest.x, trap->teledest.y)
|| u_at(trap->teledest.x, trap->teledest.y))) {
rloc_to_core(mtmp, trap->teledest.x, trap->teledest.y, RLOC_MSG);
rloc_to_core(mtmp, trap->teledest.x, trap->teledest.y,
RLOC_MSG);
}
} else
(void) rloc(mtmp, RLOC_NONE);
@@ -2041,16 +2045,18 @@ rloco(struct obj *obj)
break;
} while (!goodpos(tx, ty, (struct monst *) 0, 0)
|| (restricted_fall
&& (!within_bounded_area(tx, ty, svd.dndest.lx, svd.dndest.ly,
&& (!within_bounded_area(tx, ty,
svd.dndest.lx, svd.dndest.ly,
svd.dndest.hx, svd.dndest.hy)
|| (svd.dndest.nlx
&& within_bounded_area(tx, ty,
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy))))
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy))))
/* on the Wizard Tower levels, objects inside should
stay inside and objects outside should stay outside */
|| (svd.dndest.nlx && On_W_tower_level(&u.uz)
&& within_bounded_area(tx, ty, svd.dndest.nlx, svd.dndest.nly,
&& within_bounded_area(tx, ty,
svd.dndest.nlx, svd.dndest.nly,
svd.dndest.nhx, svd.dndest.nhy)
!= within_bounded_area(otx, oty,
svd.dndest.nlx, svd.dndest.nly,

View File

@@ -2611,7 +2611,8 @@ save_timers(NHFILE *nhfp, int range)
if (perform_bwrite(nhfp)) {
if (range == RANGE_GLOBAL) {
if (nhfp->structlevel)
bwrite(nhfp->fd, (genericptr_t) &svt.timer_id, sizeof(svt.timer_id));
bwrite(nhfp->fd, (genericptr_t) &svt.timer_id,
sizeof svt.timer_id);
}
count = maybe_write_timer(nhfp, range, FALSE);
if (nhfp->structlevel)
@@ -2651,7 +2652,8 @@ restore_timers(NHFILE *nhfp, int range, long adjust)
if (range == RANGE_GLOBAL) {
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) &svt.timer_id, sizeof svt.timer_id);
mread(nhfp->fd, (genericptr_t) &svt.timer_id,
sizeof svt.timer_id);
}
/* restore elements */

View File

@@ -76,8 +76,10 @@ save_track(NHFILE *nhfp)
bwrite(nhfp->fd, (genericptr_t) &utcnt, sizeof utcnt);
bwrite(nhfp->fd, (genericptr_t) &utpnt, sizeof utpnt);
for (i = 0; i < utcnt; i++) {
bwrite(nhfp->fd, (genericptr_t) &utrack[i].x, sizeof utrack[i].x);
bwrite(nhfp->fd, (genericptr_t) &utrack[i].y, sizeof utrack[i].y);
bwrite(nhfp->fd, (genericptr_t) &utrack[i].x,
sizeof utrack[i].x);
bwrite(nhfp->fd, (genericptr_t) &utrack[i].y,
sizeof utrack[i].y);
}
}
}

View File

@@ -535,9 +535,9 @@ maketrap(coordxy x, coordxy y, int typ)
else if (lev->typ == STONE || lev->typ == SCORR)
(void) set_levltyp(x, y, CORR);
else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
(void) set_levltyp(x, y, svl.level.flags.is_maze_lev ? ROOM
: svl.level.flags.is_cavernous_lev ? CORR
: DOOR);
(void) set_levltyp(x, y, svl.level.flags.is_maze_lev ? ROOM
: svl.level.flags.is_cavernous_lev ? CORR
: DOOR);
unearth_objs(x, y);
break;
@@ -788,7 +788,8 @@ animate_statue(
comes_to_life = !canspotmon(mon) ? "disappears"
: golem_xform ? "turns into flesh"
: (nonliving(mon->data) || is_vampshifter(mon)) ? "moves"
: (nonliving(mon->data) || is_vampshifter(mon))
? "moves"
: "comes to life";
if (u_at(x, y) || cause == ANIMATE_SPELL) {
/* "the|your|Manlobbi's statue [of a wombat]" */
@@ -3333,7 +3334,8 @@ launch_obj(
/*FALLTHRU*/
case TELEP_TRAP:
if (cansee(x, y))
pline_xy(x, y, "Suddenly the rolling boulder disappears!");
pline_xy(x, y,
"Suddenly the rolling boulder disappears!");
else if (!Deaf)
You_hear("a rumbling stop abruptly.");
singleobj->otrapped = 0;
@@ -3666,7 +3668,8 @@ mintrap(struct monst *mtmp, unsigned mintrapflags)
if (mtmp == u.usteed) {
; /* true when called from dotrap, inescapable is not an option */
} else if (Sokoban && (is_pit(tt) || is_hole(tt)) && !trap->madeby_u) {
} else if (Sokoban && (is_pit(tt) || is_hole(tt))
&& !trap->madeby_u) {
; /* nothing here, the trap effects will handle messaging */
} else if (!forcetrap) {
if (floor_trigger(tt) && check_in_air(mtmp, mintrapflags)) {
@@ -3850,7 +3853,8 @@ float_up(void)
} else {
You("start to float in the air!");
}
if (u.usteed && !is_floater(u.usteed->data) && !is_flyer(u.usteed->data)) {
if (u.usteed && !is_floater(u.usteed->data)
&& !is_flyer(u.usteed->data)) {
if (Lev_at_will) {
pline("%s magically floats up!", Monnam(u.usteed));
} else {
@@ -6211,7 +6215,8 @@ chest_trap(
case 17:
pline("A cloud of noxious gas billows from %s.", the(xname(obj)));
if (rn2(3))
poisoned("gas cloud", A_STR, "cloud of poison gas", 15, FALSE);
poisoned("gas cloud", A_STR, "cloud of poison gas", 15,
FALSE);
else
create_gas_cloud(obj->ox, obj->oy, 1, 8);
exercise(A_CON, FALSE);
@@ -6753,7 +6758,8 @@ lava_effects(void)
boil_away = !Fire_resistance;
/* if not fire resistant, sink_into_lava() will quickly be fatal;
hero needs to escape immediately */
set_utrap((unsigned) (rn1(4, 4) + ((boil_away ? 2 : rn1(4, 12)) << 8)),
set_utrap((unsigned) (rn1(4, 4) + ((boil_away ? 2
: rn1(4, 12)) << 8)),
TT_LAVA);
You("sink into the %s%s!", waterbody_name(u.ux, u.uy),
!boil_away ? ", but it only burns slightly"

View File

@@ -193,7 +193,7 @@ static struct trobj Blindfold[] = { { BLINDFOLD, 0, TOOL_CLASS, 1, 0 },
{ 0, 0, 0, 0, 0 } };
static struct trobj Instrument[] = { { WOODEN_FLUTE, 0, TOOL_CLASS, 1, 0 },
{ 0, 0, 0, 0, 0 } };
static struct trobj Xtra_food[] = { { UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 2, 0 },
static struct trobj Xtra_food[] = { { UNDEF_TYP, UNDEF_SPE, FOOD_CLASS, 2, 0},
{ 0, 0, 0, 0, 0 } };
static struct trobj Leash[] = { { LEASH, 0, TOOL_CLASS, 1, 0 },
{ 0, 0, 0, 0, 0 } };
@@ -621,7 +621,7 @@ u_init_role(void)
/* the program used to check moves<=1 && invent==NULL do decide whether
a new game has started, but due to the 'pauper' option/conduct, can't
rely on invent becoming non-Null anymore; instead, initialize moves
to 0 instead of 1 and then set it to 1 here, where invent init occurs */
to 0 instead of 1, then set it to 1 here, where invent init occurs */
svm.moves = 1L;
switch (Role_switch) {
@@ -722,8 +722,9 @@ u_init_role(void)
ini_inv(Rogue);
if (!rn2(5))
ini_inv(Blindfold);
knows_object(SACK, FALSE); /* FALSE: don't override pauper here, but sack
* will be made known in pauper_reinit() */
knows_object(SACK, FALSE); /* FALSE: don't override pauper here,
* but sack will be made known in
* pauper_reinit() */
knows_class(WEAPON_CLASS); /* daggers only */
skill_init(Skill_R);
break;
@@ -1324,8 +1325,8 @@ ini_inv(struct trobj *trop)
if (obj->oclass == RING_CLASS || obj->oclass == SPBOOK_CLASS)
gn.nocreate4 = otyp;
}
/* Put post-creation object adjustments that don't depend on whether it
* was UNDEF_TYP or not after this. */
/* Put post-creation object adjustments that don't depend on whether
* it was UNDEF_TYP or not after this. */
otyp = ini_inv_obj_substitution(trop, obj);

View File

@@ -153,7 +153,8 @@ add_custom_urep_entry(
const uint8 *utf8str,
enum graphics_sets which_set)
{
struct symset_customization *gdc = &gs.sym_customizations[which_set][custom_ureps];
struct symset_customization *gdc
= &gs.sym_customizations[which_set][custom_ureps];
struct customization_detail *details, *newdetails = 0;
@@ -164,7 +165,7 @@ add_custom_urep_entry(
gdc->details_end = 0;
}
details = find_matching_customization(customization_name,
custom_ureps, which_set); /* FIXME */
custom_ureps, which_set); /* FIXME */
if (details) {
while (details) {
if (details->content.urep.glyphidx == glyphidx) {

View File

@@ -166,24 +166,8 @@ doextversion(void)
done_rt = FALSE,
done_dlb = FALSE,
prolog;
#if 0 /* moved to util/mdlib.c and rendered via do_runtime_info() */
const char *lua_info[] = {
"About Lua: Copyright (c) 1994-2017 Lua.org, PUC-Rio.",
/* 1 2 3 4 5 6 7
1234567890123456789012345678901234567890123456789012345678901234567890123456789
*/
" \"Permission is hereby granted, free of charge, to any person obtaining",
" a copy of this software and associated documentation files (the ",
" \"Software\"), to deal in the Software without restriction including",
" without limitation the rights to use, copy, modify, merge, publish,",
" distribute, sublicense, and/or sell copies of the Software, and to ",
" permit persons to whom the Software is furnished to do so, subject to",
" the following conditions:",
" The above copyright notice and this permission notice shall be",
" included in all copies or substantial portions of the Software.\"",
(const char *) 0
};
#endif /*0*/
/* lua_info[] moved to util/mdlib.c and rendered via do_runtime_info() */
#if defined(OPTIONS_AT_RUNTIME)
use_dlb = FALSE;
#else

View File

@@ -1196,7 +1196,8 @@ dump_fmtstr(
break;
case 'n': /* player name */
if (fullsubs)
Sprintf(tmpbuf, "%s", *svp.plname ? svp.plname : "unknown");
Sprintf(tmpbuf, "%s",
*svp.plname ? svp.plname : "unknown");
else
Strcpy(tmpbuf, "{hero name}");
break;
@@ -1672,7 +1673,8 @@ choose_classes_menu(const char *prompt,
case 0:
idx = def_char_to_monclass(*class_list);
if (!IndexOk(idx, def_monsyms)) {
panic("choose_classes_menu: invalid monclass '%c'", *class_list);
panic("choose_classes_menu: invalid monclass '%c'",
*class_list);
/*NOTREACHED*/
}
text = def_monsyms[idx].explain;
@@ -1682,7 +1684,8 @@ choose_classes_menu(const char *prompt,
case 1:
idx = def_char_to_objclass(*class_list);
if (!IndexOk(idx, def_oc_syms)) {
panic("choose_classes_menu: invalid objclass '%c'", *class_list);
panic("choose_classes_menu: invalid objclass '%c'",
*class_list);
/*NOTREACHED*/
}
text = def_oc_syms[idx].explain;

View File

@@ -7,7 +7,8 @@
staticfn void m_lose_armor(struct monst *, struct obj *, boolean) NONNULLPTRS;
staticfn void clear_bypass(struct obj *) NO_NNARGS;
staticfn void m_dowear_type(struct monst *, long, boolean, boolean) NONNULLARG1;
staticfn void m_dowear_type(struct monst *, long, boolean, boolean)
NONNULLARG1;
staticfn int extra_pref(struct monst *, struct obj *) NONNULLARG1;
static const struct worn {