src/ formatting

Clean up quite a bit of minor things found with simple grep patterns:
operator at end of continued line instead of beginning of continuation
(and a few comments which produced false matches, so that they won't
do so next time), trailing spaces (only one or two of those), tabs (a
dozen or so of those), several casts which didn't have a space between
the type and the expression (I wasn't systematic about finding these).

I think the only code change was in the function for the help command.
This commit is contained in:
PatR
2018-11-17 16:40:53 -08:00
parent 8f4c2d2a82
commit 27fe555bc1
17 changed files with 98 additions and 105 deletions
+27 -27
View File
@@ -91,8 +91,9 @@ check_gold_symbol()
int goldch, goldoc; int goldch, goldoc;
unsigned int goldos; unsigned int goldos;
int goldglyph = objnum_to_glyph(GOLD_PIECE); int goldglyph = objnum_to_glyph(GOLD_PIECE);
(void) mapglyph(goldglyph, &goldch, &goldoc, &goldos, 0, 0); (void) mapglyph(goldglyph, &goldch, &goldoc, &goldos, 0, 0);
iflags.invis_goldsym = ((char)goldch <= ' '); iflags.invis_goldsym = ((char) goldch <= ' ');
} }
char * char *
@@ -829,8 +830,7 @@ boolean *valsetlist;
* the display, call status_update() with BL_FLUSH. * the display, call status_update() with BL_FLUSH.
* *
*/ */
if (context.botlx && if (context.botlx && (windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
(windowprocs.wincap2 & WC2_RESET_STATUS) != 0L)
status_update(BL_RESET, (genericptr_t) 0, 0, 0, status_update(BL_RESET, (genericptr_t) 0, 0, 0,
NO_COLOR, &cond_hilites[0]); NO_COLOR, &cond_hilites[0]);
else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L) else if ((windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
@@ -2091,33 +2091,33 @@ boolean from_configfile;
} }
const struct condmap valid_conditions[] = { const struct condmap valid_conditions[] = {
{"stone", BL_MASK_STONE}, { "stone", BL_MASK_STONE },
{"slime", BL_MASK_SLIME}, { "slime", BL_MASK_SLIME },
{"strngl", BL_MASK_STRNGL}, { "strngl", BL_MASK_STRNGL },
{"foodPois", BL_MASK_FOODPOIS}, { "foodPois", BL_MASK_FOODPOIS },
{"termIll", BL_MASK_TERMILL}, { "termIll", BL_MASK_TERMILL },
{"blind", BL_MASK_BLIND}, { "blind", BL_MASK_BLIND },
{"deaf", BL_MASK_DEAF}, { "deaf", BL_MASK_DEAF },
{"stun", BL_MASK_STUN}, { "stun", BL_MASK_STUN },
{"conf", BL_MASK_CONF}, { "conf", BL_MASK_CONF },
{"hallu", BL_MASK_HALLU}, { "hallu", BL_MASK_HALLU },
{"lev", BL_MASK_LEV}, { "lev", BL_MASK_LEV },
{"fly", BL_MASK_FLY}, { "fly", BL_MASK_FLY },
{"ride", BL_MASK_RIDE}, { "ride", BL_MASK_RIDE },
}; };
const struct condmap condition_aliases[] = { const struct condmap condition_aliases[] = {
{"strangled", BL_MASK_STRNGL}, { "strangled", BL_MASK_STRNGL },
{"all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL | { "all", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL
BL_MASK_FOODPOIS | BL_MASK_TERMILL | | BL_MASK_FOODPOIS | BL_MASK_TERMILL
BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN | | BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN
BL_MASK_CONF | BL_MASK_HALLU | | BL_MASK_CONF | BL_MASK_HALLU
BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE }, | BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE },
{"major_troubles", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL | { "major_troubles", BL_MASK_STONE | BL_MASK_SLIME | BL_MASK_STRNGL
BL_MASK_FOODPOIS | BL_MASK_TERMILL}, | BL_MASK_FOODPOIS | BL_MASK_TERMILL },
{"minor_troubles", BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN | { "minor_troubles", BL_MASK_BLIND | BL_MASK_DEAF | BL_MASK_STUN
BL_MASK_CONF | BL_MASK_HALLU}, | BL_MASK_CONF | BL_MASK_HALLU },
{"movement", BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE} { "movement", BL_MASK_LEV | BL_MASK_FLY | BL_MASK_RIDE }
}; };
unsigned long unsigned long
+2 -2
View File
@@ -989,7 +989,7 @@ int x, y;
/* Erase (reset) from source to end */ /* Erase (reset) from source to end */
for (i = 0; i < tglyph->sidx; i++) for (i = 0; i < tglyph->sidx; i++)
newsym(tglyph->saved[i].x, tglyph->saved[i].y); newsym(tglyph->saved[i].x, tglyph->saved[i].y);
} else if (tglyph->style == DISP_TETHER) { } else if (tglyph->style == DISP_TETHER) {
int i; int i;
if (y == BACKTRACK && tglyph->sidx > 1) { if (y == BACKTRACK && tglyph->sidx > 1) {
@@ -1028,7 +1028,7 @@ int x, y;
tglyph->saved[tglyph->sidx].x = x; tglyph->saved[tglyph->sidx].x = x;
tglyph->saved[tglyph->sidx].y = y; tglyph->saved[tglyph->sidx].y = y;
tglyph->sidx += 1; tglyph->sidx += 1;
} else if (tglyph->style == DISP_TETHER) { } else if (tglyph->style == DISP_TETHER) {
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) if (tglyph->sidx >= TMP_AT_MAX_GLYPHS)
break; /* too many locations */ break; /* too many locations */
if (tglyph->sidx) { if (tglyph->sidx) {
+3 -7
View File
@@ -651,10 +651,8 @@ int maxdist;
if (targ) { if (targ) {
/* Is the monster visible to the pet? */ /* Is the monster visible to the pet? */
if ((!targ->minvis || perceives(mtmp->data)) && if ((!targ->minvis || perceives(mtmp->data)) && !targ->mundetected)
!targ->mundetected)
break; break;
/* If the pet can't see it, it assumes it aint there */ /* If the pet can't see it, it assumes it aint there */
targ = 0; targ = 0;
} }
@@ -1107,12 +1105,10 @@ int after; /* this is extra fast monster movement */
/* This causes unintended issues for pets trying to follow /* This causes unintended issues for pets trying to follow
the hero. Thus, only run it if not leashed and >5 tiles the hero. Thus, only run it if not leashed and >5 tiles
away. */ away. */
if (!mtmp->mleashed && if (!mtmp->mleashed && distmin(mtmp->mx, mtmp->my, u.ux, u.uy) > 5) {
distmin(mtmp->mx, mtmp->my, u.ux, u.uy) > 5) {
k = has_edog ? uncursedcnt : cnt; k = has_edog ? uncursedcnt : cnt;
for (j = 0; j < MTSZ && j < k - 1; j++) for (j = 0; j < MTSZ && j < k - 1; j++)
if (nx == mtmp->mtrack[j].x && if (nx == mtmp->mtrack[j].x && ny == mtmp->mtrack[j].y)
ny == mtmp->mtrack[j].y)
if (rn2(MTSZ * (k - j))) if (rn2(MTSZ * (k - j)))
goto nxti; goto nxti;
} }
+4 -4
View File
@@ -495,13 +495,13 @@ xchar x, y;
return 0; return 0;
if ((trap = t_at(x, y)) != 0) { if ((trap = t_at(x, y)) != 0) {
if ((is_pit(trap->ttyp) && !Passes_walls) if ((is_pit(trap->ttyp) && !Passes_walls) || trap->ttyp == WEB) {
|| trap->ttyp == WEB) {
if (!trap->tseen) if (!trap->tseen)
find_trap(trap); find_trap(trap);
You_cant("kick %s that's in a %s!", something, You_cant("kick %s that's in a %s!", something,
Hallucination ? "tizzy" : Hallucination ? "tizzy"
(trap->ttyp == WEB) ? "web" : "pit"); : (trap->ttyp == WEB) ? "web"
: "pit");
return 1; return 1;
} }
if (trap->ttyp == STATUE_TRAP) { if (trap->ttyp == STATUE_TRAP) {
+3 -2
View File
@@ -1287,9 +1287,10 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
pline("%s returns to your hand!", The(xname(thrownobj))); pline("%s returns to your hand!", The(xname(thrownobj)));
thrownobj = addinv(thrownobj); thrownobj = addinv(thrownobj);
(void) encumber_msg(); (void) encumber_msg();
if (thrownobj->owornmask & W_QUIVER) /* in case addinv() autoquivered */ /* in case addinv() autoquivered */
if (thrownobj->owornmask & W_QUIVER)
setuqwep((struct obj *) 0); setuqwep((struct obj *) 0);
setuwep(thrownobj); setuwep(thrownobj);
} else { } else {
/* ball is not picked up by monster */ /* ball is not picked up by monster */
if (obj != uball) if (obj != uball)
+9 -10
View File
@@ -632,7 +632,7 @@ char *s;
} }
#define ORC_LEADER 1 #define ORC_LEADER 1
static const char *orcfruit[] = {"paddle cactus", "dwarven root"}; static const char *orcfruit[] = { "paddle cactus", "dwarven root" };
void void
migrate_orc(mtmp, mflags) migrate_orc(mtmp, mflags)
@@ -643,8 +643,8 @@ unsigned long mflags;
d_level dest; d_level dest;
cur_depth = (int) depth(&u.uz); cur_depth = (int) depth(&u.uz);
max_depth = dunlevs_in_dungeon(&u.uz) + max_depth = dunlevs_in_dungeon(&u.uz)
(dungeons[u.uz.dnum].depth_start - 1); + (dungeons[u.uz.dnum].depth_start - 1);
if (mflags == ORC_LEADER) { if (mflags == ORC_LEADER) {
/* Note that the orc leader will take possession of any /* Note that the orc leader will take possession of any
* remaining stuff not already delivered to other * remaining stuff not already delivered to other
@@ -695,8 +695,7 @@ struct monst *mtmp;
} }
if (is_captain || !rn2(8)) { if (is_captain || !rn2(8)) {
otyp = shiny_obj(RING_CLASS); otyp = shiny_obj(RING_CLASS);
if ((otyp != STRANGE_OBJECT) && if (otyp != STRANGE_OBJECT && (otmp = mksobj(otyp, FALSE, FALSE)) != 0)
(otmp = mksobj(otyp, FALSE, FALSE)) != 0)
add_to_minv(mtmp, otmp); add_to_minv(mtmp, otmp);
} }
} }
@@ -754,11 +753,11 @@ stolen_booty(VOID_ARGS)
for (i = 0; i < cnt; ++i) { for (i = 0; i < cnt; ++i) {
/* Food items - but no lembas! (or some other weird things) */ /* Food items - but no lembas! (or some other weird things) */
otyp = rn2((TIN - TRIPE_RATION) + 1) + TRIPE_RATION; otyp = rn2((TIN - TRIPE_RATION) + 1) + TRIPE_RATION;
if (otyp != LEMBAS_WAFER && otyp != GLOB_OF_GRAY_OOZE && if (otyp != LEMBAS_WAFER && otyp != GLOB_OF_GRAY_OOZE
otyp != GLOB_OF_BROWN_PUDDING && otyp != GLOB_OF_GREEN_SLIME && && otyp != GLOB_OF_BROWN_PUDDING && otyp != GLOB_OF_GREEN_SLIME
otyp != GLOB_OF_BLACK_PUDDING && otyp != MEAT_STICK && && otyp != GLOB_OF_BLACK_PUDDING && otyp != MEAT_STICK
otyp != MEATBALL && otyp != MEAT_STICK && otyp != MEAT_RING && && otyp != MEATBALL && otyp != MEAT_STICK && otyp != MEAT_RING
otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE) && otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE)
migr_booty_item(otyp, gang); migr_booty_item(otyp, gang);
} }
migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang); migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang);
+1 -1
View File
@@ -804,7 +804,7 @@ struct attack *mattk;
if ((typ >= AD_MAGM) && (typ <= AD_ACID)) { if ((typ >= AD_MAGM) && (typ <= AD_ACID)) {
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]); pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]);
dobuzz((int) (-20 - (typ - 1)), (int)mattk->damn, dobuzz((int) (-20 - (typ - 1)), (int) mattk->damn,
mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), FALSE); mtmp->mx, mtmp->my, sgn(tbx), sgn(tby), FALSE);
nomul(0); nomul(0);
/* breath runs out sometimes. Also, give monster some /* breath runs out sometimes. Also, give monster some
+3 -3
View File
@@ -2484,8 +2484,6 @@ badman(basestr, to_plural)
const char *basestr; const char *basestr;
boolean to_plural; /* true => makeplural, false => makesingular */ boolean to_plural; /* true => makeplural, false => makesingular */
{ {
int i, al;
char *endstr, *spot;
/* these are all the prefixes for *man that don't have a *men plural */ /* these are all the prefixes for *man that don't have a *men plural */
static const char *no_men[] = { static const char *no_men[] = {
"albu", "antihu", "anti", "ata", "auto", "bildungsro", "cai", "cay", "albu", "antihu", "anti", "ata", "auto", "bildungsro", "cai", "cay",
@@ -2501,11 +2499,13 @@ boolean to_plural; /* true => makeplural, false => makesingular */
"tegu", "vela", "da", "hy", "lu", "no", "nu", "ra", "ru", "se", "vi", "tegu", "vela", "da", "hy", "lu", "no", "nu", "ra", "ru", "se", "vi",
"ya", "o", "a", "ya", "o", "a",
}; };
int i, al;
const char *endstr, *spot;
if (!basestr || strlen(basestr) < 4) if (!basestr || strlen(basestr) < 4)
return FALSE; return FALSE;
endstr = eos((char *)basestr); endstr = eos((char *) basestr);
if (to_plural) { if (to_plural) {
for (i = 0; i < SIZE(no_men); i++) { for (i = 0; i < SIZE(no_men); i++) {
+2 -2
View File
@@ -3293,8 +3293,8 @@ boolean tinitial, tfrom_file;
/* WINCAP /* WINCAP
* *
* map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12| * map_mode:[tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|ascii7x12
* ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen] * |ascii8x12|ascii16x12|ascii12x16|ascii10x18|fit_to_screen]
*/ */
fullname = "map_mode"; fullname = "map_mode";
if (match_optname(opts, fullname, sizeof("map_mode") - 1, TRUE)) { if (match_optname(opts, fullname, sizeof("map_mode") - 1, TRUE)) {
+9 -11
View File
@@ -18,7 +18,8 @@ STATIC_DCL struct permonst *FDECL(lookat, (int, int, char *, char *));
STATIC_DCL void FDECL(checkfile, (char *, struct permonst *, STATIC_DCL void FDECL(checkfile, (char *, struct permonst *,
BOOLEAN_P, BOOLEAN_P, char *)); BOOLEAN_P, BOOLEAN_P, char *));
STATIC_DCL void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P)); STATIC_DCL void FDECL(look_all, (BOOLEAN_P,BOOLEAN_P));
STATIC_DCL void FDECL(do_supplemental_info, (char *, struct permonst *,BOOLEAN_P)); STATIC_DCL void FDECL(do_supplemental_info, (char *, struct permonst *,
BOOLEAN_P));
STATIC_DCL void NDECL(whatdoes_help); STATIC_DCL void NDECL(whatdoes_help);
STATIC_DCL void NDECL(docontact); STATIC_DCL void NDECL(docontact);
STATIC_DCL void NDECL(dispfile_help); STATIC_DCL void NDECL(dispfile_help);
@@ -1352,9 +1353,8 @@ boolean without_asking;
* meant to support in-game mythology, and not * meant to support in-game mythology, and not
* available from data.base or other sources. * available from data.base or other sources.
*/ */
if (name && pm && is_orc(pm) && if (name && pm && is_orc(pm) && (strlen(name) < (BUFSZ - 1))
(strlen(name) < (BUFSZ - 1)) && && (bp = strstri(name, " of ")) != 0) {
(bp = strstri(name, " of ")) != 0) {
char fullname[BUFSZ]; char fullname[BUFSZ];
Strcpy(fullname, name); Strcpy(fullname, name);
@@ -1880,7 +1880,7 @@ domenucontrols()
/* data for dohelp() */ /* data for dohelp() */
static struct { static struct {
void (*f)(); void NDECL((*f));
const char *text; const char *text;
} help_menu_items[] = { } help_menu_items[] = {
{ hmenu_doextversion, "About NetHack (version information)." }, { hmenu_doextversion, "About NetHack (version information)." },
@@ -1900,7 +1900,7 @@ static struct {
{ port_help, "%s-specific help and commands." }, { port_help, "%s-specific help and commands." },
#endif #endif
{ dispfile_debughelp, "List of wizard-mode commands." }, { dispfile_debughelp, "List of wizard-mode commands." },
{ NULL, (char *) 0 } { (void NDECL((*))) 0, (char *) 0 }
}; };
/* the '?' command */ /* the '?' command */
@@ -1913,7 +1913,6 @@ dohelp()
menu_item *selected; menu_item *selected;
anything any; anything any;
int sel; int sel;
char *bufptr;
any = zeroany; /* zero all bits */ any = zeroany; /* zero all bits */
start_menu(tmpwin); start_menu(tmpwin);
@@ -1923,13 +1922,12 @@ dohelp()
continue; continue;
if (help_menu_items[i].text[0] == '%') { if (help_menu_items[i].text[0] == '%') {
Sprintf(helpbuf, help_menu_items[i].text, PORT_ID); Sprintf(helpbuf, help_menu_items[i].text, PORT_ID);
bufptr = helpbuf;
} else { } else {
bufptr = (char *)help_menu_items[i].text; Strcpy(helpbuf, help_menu_items[i].text);
} }
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
bufptr, MENU_UNSELECTED); helpbuf, MENU_UNSELECTED);
} }
end_menu(tmpwin, "Select one item:"); end_menu(tmpwin, "Select one item:");
n = select_menu(tmpwin, PICK_ONE, &selected); n = select_menu(tmpwin, PICK_ONE, &selected);
@@ -1937,7 +1935,7 @@ dohelp()
if (n > 0) { if (n > 0) {
sel = selected[0].item.a_int - 1; sel = selected[0].item.a_int - 1;
free((genericptr_t) selected); free((genericptr_t) selected);
(void)(*help_menu_items[sel].f)(); (void) (*help_menu_items[sel].f)();
} }
return 0; return 0;
} }
+4 -5
View File
@@ -597,8 +597,7 @@ register struct obj *otmp;
the spell or with a unihorn; this is better than full healing the spell or with a unihorn; this is better than full healing
in that it can restore all of them, not just half, and a in that it can restore all of them, not just half, and a
blessed potion restores them all at once */ blessed potion restores them all at once */
if (otmp->otyp == POT_RESTORE_ABILITY && if (otmp->otyp == POT_RESTORE_ABILITY && u.ulevel < u.ulevelmax) {
u.ulevel < u.ulevelmax) {
do { do {
pluslvl(FALSE); pluslvl(FALSE);
} while (u.ulevel < u.ulevelmax && otmp->blessed); } while (u.ulevel < u.ulevelmax && otmp->blessed);
@@ -608,9 +607,9 @@ register struct obj *otmp;
case POT_HALLUCINATION: case POT_HALLUCINATION:
if (Hallucination || Halluc_resistance) if (Hallucination || Halluc_resistance)
nothing++; nothing++;
(void) make_hallucinated( (void) make_hallucinated(itimeout_incr(HHallucination,
itimeout_incr(HHallucination, rn1(200, 600 - 300 * bcsign(otmp))), rn1(200, 600 - 300 * bcsign(otmp))),
TRUE, 0L); TRUE, 0L);
break; break;
case POT_WATER: case POT_WATER:
if (!otmp->blessed && !otmp->cursed) { if (!otmp->blessed && !otmp->cursed) {
+2 -2
View File
@@ -2370,8 +2370,8 @@ struct obj *sobj;
uball->spe = 1; /* special ball (see save) */ uball->spe = 1; /* special ball (see save) */
/* /*
* Place ball & chain if not swallowed. If swallowed, the ball & * Place ball & chain if not swallowed. If swallowed, the ball & chain
* chain variables will be set at the next call to placebc(). * variables will be set at the next call to placebc().
*/ */
if (!u.uswallow) { if (!u.uswallow) {
placebc(); placebc();
+9 -8
View File
@@ -1703,14 +1703,15 @@ plnamesuffix()
/* some generic user names will be ignored in favor of prompting */ /* some generic user names will be ignored in favor of prompting */
if (sysopt.genericusers) { if (sysopt.genericusers) {
if (*sysopt.genericusers == '*') *plname = '\0'; if (*sysopt.genericusers == '*') {
else { *plname = '\0';
i = (int)strlen(plname); } else {
if ((sptr = strstri(sysopt.genericusers, plname)) != 0 i = (int) strlen(plname);
&& (sptr == sysopt.genericusers || sptr[-1] == ' ') if ((sptr = strstri(sysopt.genericusers, plname)) != 0
&& (sptr[i] == ' ' || sptr[i] == '\0')) && (sptr == sysopt.genericusers || sptr[-1] == ' ')
*plname = '\0'; /* call askname() */ && (sptr[i] == ' ' || sptr[i] == '\0'))
} *plname = '\0'; /* call askname() */
}
} }
do { do {
+6 -6
View File
@@ -231,7 +231,7 @@ struct splevstack *st;
st->depth = 0; st->depth = 0;
st->depth_alloc = SPLEV_STACK_RESERVE; st->depth_alloc = SPLEV_STACK_RESERVE;
st->stackdata = st->stackdata =
(struct opvar **) alloc(st->depth_alloc * sizeof(struct opvar *)); (struct opvar **) alloc(st->depth_alloc * sizeof (struct opvar *));
} }
} }
@@ -284,7 +284,7 @@ struct opvar *v;
if (st->depth >= st->depth_alloc) { if (st->depth >= st->depth_alloc) {
struct opvar **tmp = (struct opvar **) alloc( struct opvar **tmp = (struct opvar **) alloc(
(st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof(struct opvar *)); (st->depth_alloc + SPLEV_STACK_RESERVE) * sizeof (struct opvar *));
(void) memcpy(tmp, st->stackdata, (void) memcpy(tmp, st->stackdata,
st->depth_alloc * sizeof(struct opvar *)); st->depth_alloc * sizeof(struct opvar *));
@@ -352,7 +352,7 @@ struct opvar *
opvar_new_str(s) opvar_new_str(s)
char *s; char *s;
{ {
struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar));
tmpov->spovartyp = SPOVAR_STRING; tmpov->spovartyp = SPOVAR_STRING;
if (s) { if (s) {
@@ -370,7 +370,7 @@ struct opvar *
opvar_new_int(i) opvar_new_int(i)
long i; long i;
{ {
struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar));
tmpov->spovartyp = SPOVAR_INT; tmpov->spovartyp = SPOVAR_INT;
tmpov->vardata.l = i; tmpov->vardata.l = i;
@@ -381,7 +381,7 @@ struct opvar *
opvar_new_coord(x, y) opvar_new_coord(x, y)
int x, y; int x, y;
{ {
struct opvar *tmpov = (struct opvar *) alloc(sizeof(struct opvar)); struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar));
tmpov->spovartyp = SPOVAR_COORD; tmpov->spovartyp = SPOVAR_COORD;
tmpov->vardata.l = SP_COORD_PACK(x, y); tmpov->vardata.l = SP_COORD_PACK(x, y);
@@ -393,7 +393,7 @@ struct opvar *
opvar_new_region(x1,y1,x2,y2) opvar_new_region(x1,y1,x2,y2)
int x1,y1,x2,y2; int x1,y1,x2,y2;
{ {
struct opvar *tmpov = (struct opvar *)alloc(sizeof (struct opvar)); struct opvar *tmpov = (struct opvar *) alloc(sizeof (struct opvar));
tmpov->spovartyp = SPOVAR_REGION; tmpov->spovartyp = SPOVAR_REGION;
tmpov->vardata.l = SP_REGION_PACK(x1,y1,x2,y2); tmpov->vardata.l = SP_REGION_PACK(x1,y1,x2,y2);
+4 -5
View File
@@ -5033,10 +5033,10 @@ struct trap *adjtrap;
{ {
struct trap *trap_with_u = t_at(u.ux0, u.uy0); struct trap *trap_with_u = t_at(u.ux0, u.uy0);
if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT && if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT
is_pit(trap_with_u->ttyp) && && is_pit(trap_with_u->ttyp) && is_pit(adjtrap->ttyp)) {
is_pit(adjtrap->ttyp)) {
int idx; int idx;
for (idx = 0; idx < 8; idx++) { for (idx = 0; idx < 8; idx++) {
if (xdir[idx] == u.dx && ydir[idx] == u.dy) if (xdir[idx] == u.dx && ydir[idx] == u.dy)
return TRUE; return TRUE;
@@ -5063,8 +5063,7 @@ struct trap *trap;
x = trap->tx + xdir[diridx]; x = trap->tx + xdir[diridx];
y = trap->ty + ydir[diridx]; y = trap->ty + ydir[diridx];
if (isok(x, y)) { if (isok(x, y)) {
if ((t = t_at(x, y)) != 0 if ((t = t_at(x, y)) != 0 && is_pit(t->ttyp)) {
&& is_pit(t->ttyp)) {
trap->conjoined |= (1 << diridx); trap->conjoined |= (1 << diridx);
join_adjacent_pits(t); join_adjacent_pits(t);
} else } else
+9 -9
View File
@@ -379,8 +379,8 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int));
* @ <-- hero --> @ * @ <-- hero --> @
* *
* *
* We fake the above check by only checking if the horizontal & * We fake the above check by only checking if the horizontal
* vertical positions adjacent to the crosswall and T wall are * & vertical positions adjacent to the crosswall and T wall are
* unblocked. Then, _in general_ we can see beyond. Generally, * unblocked. Then, _in general_ we can see beyond. Generally,
* this is good enough. * this is good enough.
* *
@@ -388,8 +388,8 @@ STATIC_DCL int FDECL(new_angle, (struct rm *, unsigned char *, int, int));
* information (we're doing a top down scan in vision_recalc). * information (we're doing a top down scan in vision_recalc).
* We would need to scan once to set all IN_SIGHT and COULD_SEE * We would need to scan once to set all IN_SIGHT and COULD_SEE
* bits, then again to correctly set the seenv bits. * bits, then again to correctly set the seenv bits.
* + I'm trying to make this as cheap as possible. The display & * + I'm trying to make this as cheap as possible. The display
* vision eat up too much CPU time. * & vision eat up too much CPU time.
* *
* *
* Note: Even as I write this, I'm still not convinced. There are too * Note: Even as I write this, I'm still not convinced. There are too
@@ -877,11 +877,11 @@ int x, y;
} }
/*==========================================================================*\ /*==========================================================================*\
| | : :
| Everything below this line uses (y,x) instead of (x,y) --- the | : Everything below this line uses (y,x) instead of (x,y) --- the :
| algorithms are faster if they are less recursive and can scan | : algorithms are faster if they are less recursive and can scan :
| on a row longer. | : on a row longer. :
| | : :
\*==========================================================================*/ \*==========================================================================*/
/* ======================================================================= *\ /* ======================================================================= *\
+1 -1
View File
@@ -587,7 +587,7 @@ struct monst *summoner;
} while (summoner } while (summoner
&& ((attacktype(&mons[makeindex], AT_MAGC) && ((attacktype(&mons[makeindex], AT_MAGC)
&& mons[makeindex].difficulty && mons[makeindex].difficulty
>= mons[summoner->mnum].difficulty) >= mons[summoner->mnum].difficulty)
|| (s_cls == S_DEMON && m_cls == S_ANGEL) || (s_cls == S_DEMON && m_cls == S_ANGEL)
|| (s_cls == S_ANGEL && m_cls == S_DEMON))); || (s_cls == S_ANGEL && m_cls == S_DEMON)));
/* do this after picking the monster to place */ /* do this after picking the monster to place */