formatting: more casts

This commit is contained in:
PatR
2015-11-07 20:02:04 -08:00
parent 3b83b2bd50
commit c09fe294dd
8 changed files with 110 additions and 107 deletions
+35 -33
View File
@@ -1,5 +1,5 @@
/* NetHack 3.6 dbridge.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $ */ /* NetHack 3.6 dbridge.c $NHDT-Date: 1446955279 2015/11/08 04:01:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/* /*
@@ -143,22 +143,22 @@ int x, y;
lev = &levl[x][y]; lev = &levl[x][y];
if (lev->typ != DOOR && lev->typ != DBWALL) if (lev->typ != DOOR && lev->typ != DBWALL)
return (-1); return -1;
if (IS_DRAWBRIDGE(levl[x + 1][y].typ) if (IS_DRAWBRIDGE(levl[x + 1][y].typ)
&& (levl[x + 1][y].drawbridgemask & DB_DIR) == DB_WEST) && (levl[x + 1][y].drawbridgemask & DB_DIR) == DB_WEST)
return (DB_WEST); return DB_WEST;
if (IS_DRAWBRIDGE(levl[x - 1][y].typ) if (IS_DRAWBRIDGE(levl[x - 1][y].typ)
&& (levl[x - 1][y].drawbridgemask & DB_DIR) == DB_EAST) && (levl[x - 1][y].drawbridgemask & DB_DIR) == DB_EAST)
return (DB_EAST); return DB_EAST;
if (IS_DRAWBRIDGE(levl[x][y - 1].typ) if (IS_DRAWBRIDGE(levl[x][y - 1].typ)
&& (levl[x][y - 1].drawbridgemask & DB_DIR) == DB_SOUTH) && (levl[x][y - 1].drawbridgemask & DB_DIR) == DB_SOUTH)
return (DB_SOUTH); return DB_SOUTH;
if (IS_DRAWBRIDGE(levl[x][y + 1].typ) if (IS_DRAWBRIDGE(levl[x][y + 1].typ)
&& (levl[x][y + 1].drawbridgemask & DB_DIR) == DB_NORTH) && (levl[x][y + 1].drawbridgemask & DB_DIR) == DB_NORTH)
return (DB_NORTH); return DB_NORTH;
return (-1); return -1;
} }
/* /*
@@ -170,7 +170,7 @@ boolean
is_db_wall(x, y) is_db_wall(x, y)
int x, y; int x, y;
{ {
return ((boolean)(levl[x][y].typ == DBWALL)); return (boolean) (levl[x][y].typ == DBWALL);
} }
/* /*
@@ -261,14 +261,14 @@ boolean flag;
break; break;
default: default:
impossible("bad direction in create_drawbridge"); impossible("bad direction in create_drawbridge");
/* fall through */ /*FALLTHRU*/
case DB_WEST: case DB_WEST:
horiz = FALSE; horiz = FALSE;
x2--; x2--;
break; break;
} }
if (!IS_WALL(levl[x2][y2].typ)) if (!IS_WALL(levl[x2][y2].typ))
return (FALSE); return FALSE;
if (flag) { /* We want the bridge open */ if (flag) { /* We want the bridge open */
levl[x][y].typ = DRAWBRIDGE_DOWN; levl[x][y].typ = DRAWBRIDGE_DOWN;
levl[x2][y2].typ = DOOR; levl[x2][y2].typ = DOOR;
@@ -284,7 +284,7 @@ boolean flag;
levl[x][y].drawbridgemask = dir; levl[x][y].drawbridgemask = dir;
if (lava) if (lava)
levl[x][y].drawbridgemask |= DB_LAVA; levl[x][y].drawbridgemask |= DB_LAVA;
return (TRUE); return TRUE;
} }
struct entity { struct entity {
@@ -312,8 +312,8 @@ int x, y;
#ifdef D_DEBUG #ifdef D_DEBUG
wait_synch(); wait_synch();
#endif #endif
return ((entitycnt == ENTITIES) ? (struct entity *) 0 return (entitycnt == ENTITIES) ? (struct entity *) 0
: &(occupants[entitycnt])); : &(occupants[entitycnt]);
} }
STATIC_OVL void STATIC_OVL void
@@ -372,7 +372,7 @@ STATIC_OVL const char *
e_nam(etmp) e_nam(etmp)
struct entity *etmp; struct entity *etmp;
{ {
return (is_u(etmp) ? "you" : mon_nam(etmp->emon)); return is_u(etmp) ? "you" : mon_nam(etmp->emon);
} }
/* /*
@@ -389,13 +389,13 @@ const char *verb;
Strcpy(wholebuf, is_u(etmp) ? "You" : Monnam(etmp->emon)); Strcpy(wholebuf, is_u(etmp) ? "You" : Monnam(etmp->emon));
if (!*verb) if (!*verb)
return (wholebuf); return wholebuf;
Strcat(wholebuf, " "); Strcat(wholebuf, " ");
if (is_u(etmp)) if (is_u(etmp))
Strcat(wholebuf, verb); Strcat(wholebuf, verb);
else else
Strcat(wholebuf, vtense((char *) 0, verb)); Strcat(wholebuf, vtense((char *) 0, verb));
return (wholebuf); return wholebuf;
} }
/* /*
@@ -408,20 +408,22 @@ struct entity *etmp;
int x, y; int x, y;
{ {
if (noncorporeal(etmp->edata)) if (noncorporeal(etmp->edata))
return (TRUE); return TRUE;
if (is_pool(x, y)) if (is_pool(x, y))
return (boolean)((is_u(etmp) && (Wwalking || Amphibious || Swimming return (boolean) ((is_u(etmp) && (Wwalking || Amphibious || Swimming
|| Flying || Levitation)) || Flying || Levitation))
|| is_swimmer(etmp->edata) || is_flyer(etmp->edata) || is_swimmer(etmp->edata)
|| is_floater(etmp->edata)); || is_flyer(etmp->edata)
|| is_floater(etmp->edata));
/* must force call to lava_effects in e_died if is_u */ /* must force call to lava_effects in e_died if is_u */
if (is_lava(x, y)) if (is_lava(x, y))
return (boolean)((is_u(etmp) && (Levitation || Flying)) return (boolean) ((is_u(etmp) && (Levitation || Flying))
|| likes_lava(etmp->edata) || is_flyer(etmp->edata)); || likes_lava(etmp->edata)
|| is_flyer(etmp->edata));
if (is_db_wall(x, y)) if (is_db_wall(x, y))
return ( return (boolean) (is_u(etmp) ? Passes_walls
(boolean)(is_u(etmp) ? Passes_walls : passes_walls(etmp->edata))); : passes_walls(etmp->edata));
return (TRUE); return TRUE;
} }
STATIC_OVL void STATIC_OVL void
@@ -492,8 +494,8 @@ STATIC_OVL boolean
automiss(etmp) automiss(etmp)
struct entity *etmp; struct entity *etmp;
{ {
return (boolean)((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata)) return (boolean) ((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata))
|| noncorporeal(etmp->edata)); || noncorporeal(etmp->edata));
} }
/* /*
@@ -510,7 +512,7 @@ boolean chunks;
if (chunks) if (chunks)
debugpline0("Do chunks miss?"); debugpline0("Do chunks miss?");
if (automiss(etmp)) if (automiss(etmp))
return (TRUE); return TRUE;
if (is_flyer(etmp->edata) if (is_flyer(etmp->edata)
&& (is_u(etmp) ? !Unaware && (is_u(etmp) ? !Unaware
@@ -530,7 +532,7 @@ boolean chunks;
debugpline1("Miss chance = %d (out of 8)", misses); debugpline1("Miss chance = %d (out of 8)", misses);
return ((boolean)((misses >= rnd(8)) ? TRUE : FALSE)); return (misses >= rnd(8)) ? TRUE : FALSE;
} }
/* /*
@@ -546,7 +548,7 @@ struct entity *etmp;
if (is_u(etmp) ? (Unaware || Fumbling) if (is_u(etmp) ? (Unaware || Fumbling)
: (!etmp->emon->mcanmove || etmp->emon->msleeping : (!etmp->emon->mcanmove || etmp->emon->msleeping
|| !etmp->edata->mmove || etmp->emon->wormno)) || !etmp->edata->mmove || etmp->emon->wormno))
return (FALSE); return FALSE;
if (is_u(etmp) ? Confusion : etmp->emon->mconf) if (is_u(etmp) ? Confusion : etmp->emon->mconf)
tmp -= 2; tmp -= 2;
@@ -558,7 +560,7 @@ struct entity *etmp;
tmp -= 2; /* less room to maneuver */ tmp -= 2; /* less room to maneuver */
debugpline2("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp); debugpline2("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
return ((boolean)((tmp >= rnd(10)) ? TRUE : FALSE)); return (tmp >= rnd(10)) ? TRUE : FALSE;
} }
STATIC_OVL void STATIC_OVL void
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dokick.c $NHDT-Date: 1446808441 2015/11/06 11:14:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */ /* NetHack 3.6 dokick.c $NHDT-Date: 1446955295 2015/11/08 04:01:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.104 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -213,13 +213,13 @@ xchar x, y;
} else if (tmp > (kickdieroll = rnd(20))) { } else if (tmp > (kickdieroll = rnd(20))) {
You("kick %s.", mon_nam(mon)); You("kick %s.", mon_nam(mon));
sum = damageum(mon, uattk); sum = damageum(mon, uattk);
(void) passive(mon, (boolean)(sum > 0), (sum != 2), AT_KICK, (void) passive(mon, (boolean) (sum > 0), (sum != 2), AT_KICK,
FALSE); FALSE);
if (sum == 2) if (sum == 2)
break; /* Defender died */ break; /* Defender died */
} else { } else {
missum(mon, uattk, (tmp + armorpenalty > kickdieroll)); missum(mon, uattk, (tmp + armorpenalty > kickdieroll));
(void) passive(mon, 0, 1, AT_KICK, FALSE); (void) passive(mon, FALSE, 1, AT_KICK, FALSE);
} }
} }
return; return;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1446808442 2015/11/06 11:14:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */ /* NetHack 3.6 dungeon.c $NHDT-Date: 1446955297 2015/11/08 04:01:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.68 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2539,7 +2539,7 @@ int why, reason, *lastdun_p;
/* only print out info for a level or a dungeon if interest */ /* only print out info for a level or a dungeon if interest */
if (why > 0 || interest_mapseen(mptr)) { if (why > 0 || interest_mapseen(mptr)) {
showheader = (boolean)(mptr->lev.dnum != *lastdun_p); showheader = (boolean) (mptr->lev.dnum != *lastdun_p);
print_mapseen(win, mptr, why, reason, showheader); print_mapseen(win, mptr, why, reason, showheader);
*lastdun_p = mptr->lev.dnum; *lastdun_p = mptr->lev.dnum;
} }
+30 -31
View File
@@ -1,5 +1,5 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1445388916 2015/10/21 00:55:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.43 $ */ /* NetHack 3.6 explode.c $NHDT-Date: 1446955298 2015/11/08 04:01:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
/* Copyright (C) 1990 by Ken Arromdee */ /* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
@@ -18,11 +18,11 @@ static int explosion[3][3] = { { S_explode1, S_explode4, S_explode7 },
* these disadvantages.... * these disadvantages....
* *
* Important note about Half_physical_damage: * Important note about Half_physical_damage:
* Unlike losehp() , explode() makes the Half_physical_damage adjustments * Unlike losehp(), explode() makes the Half_physical_damage adjustments
* itself, so the caller should never have done that ahead of time. * itself, so the caller should never have done that ahead of time.
* It has to be done this way because the damage value is applied to * It has to be done this way because the damage value is applied to
* things beside the player. Care is taken within explode() to ensure * things beside the player. Care is taken within explode() to ensure
* that Half_physical_damage only affects the damage applied to the hero. * that Half_physical_damage only affects the damage applied to the hero.
*/ */
void void
explode(x, y, type, dam, olet, expltype) explode(x, y, type, dam, olet, expltype)
@@ -48,8 +48,8 @@ int expltype;
short exploding_wand_typ = 0; short exploding_wand_typ = 0;
if (olet == WAND_CLASS) { /* retributive strike */ if (olet == WAND_CLASS) { /* retributive strike */
/* 'type' is passed as (wand's object type * -1); save /* 'type' is passed as (wand's object type * -1); save
object type and convert 'type' itself to zap-type */ object type and convert 'type' itself to zap-type */
if (type < 0) { if (type < 0) {
type = -type; type = -type;
exploding_wand_typ = (short) type; exploding_wand_typ = (short) type;
@@ -100,9 +100,8 @@ int expltype;
adtyp = AD_MAGM; adtyp = AD_MAGM;
break; break;
case 1: case 1:
str = olet == BURNING_OIL ? "burning oil" : olet == SCROLL_CLASS str = (olet == BURNING_OIL) ? "burning oil"
? "tower of flame" : (olet == SCROLL_CLASS) ? "tower of flame" : "fireball";
: "fireball";
/* fire damage, not physical damage */ /* fire damage, not physical damage */
adtyp = AD_FIRE; adtyp = AD_FIRE;
break; break;
@@ -111,8 +110,8 @@ int expltype;
adtyp = AD_COLD; adtyp = AD_COLD;
break; break;
case 4: case 4:
str = str = (olet == WAND_CLASS) ? "death field"
(olet == WAND_CLASS) ? "death field" : "disintegration field"; : "disintegration field";
adtyp = AD_DISN; adtyp = AD_DISN;
break; break;
case 5: case 5:
@@ -296,8 +295,8 @@ int expltype;
continue; continue;
idamres = idamnonres = 0; idamres = idamnonres = 0;
if (type >= 0 && !u.uswallow) if (type >= 0 && !u.uswallow)
(void) zap_over_floor((xchar)(i + x - 1), (void) zap_over_floor((xchar) (i + x - 1),
(xchar)(j + y - 1), type, (xchar) (j + y - 1), type,
&shopdamage, exploding_wand_typ); &shopdamage, exploding_wand_typ);
mtmp = m_at(i + x - 1, j + y - 1); mtmp = m_at(i + x - 1, j + y - 1);
@@ -520,31 +519,31 @@ int expltype;
} }
struct scatter_chain { struct scatter_chain {
struct scatter_chain *next; /* pointer to next scatter item */ struct scatter_chain *next; /* pointer to next scatter item */
struct obj *obj; /* pointer to the object */ struct obj *obj; /* pointer to the object */
xchar ox; /* location of */ xchar ox; /* location of */
xchar oy; /* item */ xchar oy; /* item */
schar dx; /* direction of */ schar dx; /* direction of */
schar dy; /* travel */ schar dy; /* travel */
int range; /* range of object */ int range; /* range of object */
boolean stopped; /* flag for in-motion/stopped */ boolean stopped; /* flag for in-motion/stopped */
}; };
/* /*
* scflags: * scflags:
* VIS_EFFECTS Add visual effects to display * VIS_EFFECTS Add visual effects to display
* MAY_HITMON Objects may hit monsters * MAY_HITMON Objects may hit monsters
* MAY_HITYOU Objects may hit hero * MAY_HITYOU Objects may hit hero
* MAY_HIT Objects may hit you or monsters * MAY_HIT Objects may hit you or monsters
* MAY_DESTROY Objects may be destroyed at random * MAY_DESTROY Objects may be destroyed at random
* MAY_FRACTURE Stone objects can be fractured (statues, boulders) * MAY_FRACTURE Stone objects can be fractured (statues, boulders)
*/ */
/* returns number of scattered objects */ /* returns number of scattered objects */
long long
scatter(sx, sy, blastforce, scflags, obj) scatter(sx, sy, blastforce, scflags, obj)
int sx, sy; /* location of objects to scatter */ int sx, sy; /* location of objects to scatter */
int blastforce; /* force behind the scattering */ int blastforce; /* force behind the scattering */
unsigned int scflags; unsigned int scflags;
struct obj *obj; /* only scatter this obj */ struct obj *obj; /* only scatter this obj */
{ {
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1446854228 2015/11/06 23:57:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.185 $ */ /* NetHack 3.6 files.c $NHDT-Date: 1446955299 2015/11/08 04:01:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.186 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3572,7 +3572,7 @@ char *nowin_buf;
putstr(tribwin, 0, line); putstr(tribwin, 0, line);
Strcpy(lastline, line); Strcpy(lastline, line);
} else if (nowin_buf) { } else if (nowin_buf) {
if ((int)strlen(line) < bufsz-1) if ((int) strlen(line) < bufsz - 1)
Strcpy(nowin_buf, line); Strcpy(nowin_buf, line);
} }
} }
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1446808444 2015/11/06 11:14:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */ /* NetHack 3.6 lock.c $NHDT-Date: 1446955300 2015/11/08 04:01:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -144,7 +144,7 @@ boolean destroyit;
struct monst *shkp = (*u.ushops && costly_spot(u.ux, u.uy)) struct monst *shkp = (*u.ushops && costly_spot(u.ux, u.uy))
? shop_keeper(*u.ushops) ? shop_keeper(*u.ushops)
: 0; : 0;
boolean costly = (boolean)(shkp != 0), boolean costly = (boolean) (shkp != 0),
peaceful_shk = costly && (boolean) shkp->mpeaceful; peaceful_shk = costly && (boolean) shkp->mpeaceful;
long loss = 0L; long loss = 0L;
@@ -212,7 +212,7 @@ forcelock(VOID_ARGS)
return 1; /* still busy */ return 1; /* still busy */
You("succeed in forcing the lock."); You("succeed in forcing the lock.");
breakchestlock(xlock.box, (boolean)(!xlock.picktyp && !rn2(3))); breakchestlock(xlock.box, (boolean) (!xlock.picktyp && !rn2(3)));
exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE); exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((xlock.usedtime = 0)); return ((xlock.usedtime = 0));
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1446808445 2015/11/06 11:14:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.100 $ */ /* NetHack 3.6 makemon.c $NHDT-Date: 1446955301 2015/11/08 04:01:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1274,7 +1274,7 @@ int mmflags;
mtmp->isminion = 1; /* make priest be a roamer */ mtmp->isminion = 1; /* make priest be a roamer */
eminp->min_align = rn2(3) - 1; /* no A_NONE */ eminp->min_align = rn2(3) - 1; /* no A_NONE */
eminp->renegade = (boolean)((mmflags & MM_ANGRY) ? 1 : !rn2(3)); eminp->renegade = (boolean) ((mmflags & MM_ANGRY) ? 1 : !rn2(3));
mtmp->mpeaceful = (eminp->min_align == u.ualign.type) mtmp->mpeaceful = (eminp->min_align == u.ualign.type)
? !eminp->renegade ? !eminp->renegade
: eminp->renegade; : eminp->renegade;
+33 -31
View File
@@ -1,5 +1,5 @@
/* NetHack 3.6 mapglyph.c $NHDT-Date: 1432512766 2015/05/25 00:12:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */ /* NetHack 3.6 mapglyph.c $NHDT-Date: 1446955302 2015/11/08 04:01:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
#include "hack.h" #include "hack.h"
@@ -67,14 +67,14 @@ unsigned *ospecial;
unsigned special = 0; unsigned special = 0;
/* condense multiple tests in macro version down to single */ /* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS; boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS;
boolean has_rogue_color = boolean has_rogue_color = (has_rogue_ibm_graphics
(has_rogue_ibm_graphics && (symset[currentgraphics].nocolor == 0)); && symset[currentgraphics].nocolor == 0);
/* /*
* Map the glyph back to a character and color. * Map the glyph back to a character and color.
* *
* Warning: For speed, this makes an assumption on the order of * Warning: For speed, this makes an assumption on the order of
* offsets. The order is set in display.h. * offsets. The order is set in display.h.
*/ */
if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */ if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */
idx = mons[offset].mlet + SYM_OFF_M; idx = mons[offset].mlet + SYM_OFF_M;
@@ -83,10 +83,9 @@ unsigned *ospecial;
else else
obj_color(STATUE); obj_color(STATUE);
special |= MG_STATUE; special |= MG_STATUE;
if (level.objects[x][y] && level.objects[x][y]->nexthere) if (level.objects[x][y] && level.objects[x][y]->nexthere)
special |= MG_OBJPILE; special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_WARNING_OFF)) } else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* warn flash */
>= 0) { /* a warning flash */
idx = offset + SYM_OFF_W; idx = offset + SYM_OFF_W;
if (has_rogue_color) if (has_rogue_color)
color = NO_COLOR; color = NO_COLOR;
@@ -151,8 +150,9 @@ unsigned *ospecial;
} }
} else } else
obj_color(offset); obj_color(offset);
if (offset != BOULDER && level.objects[x][y] && level.objects[x][y]->nexthere) if (offset != BOULDER && level.objects[x][y]
special |= MG_OBJPILE; && level.objects[x][y]->nexthere)
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */ } else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */
idx = mons[offset].mlet + SYM_OFF_M; idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color) if (has_rogue_color)
@@ -170,8 +170,8 @@ unsigned *ospecial;
else else
mon_color(offset); mon_color(offset);
special |= MG_CORPSE; special |= MG_CORPSE;
if (level.objects[x][y] && level.objects[x][y]->nexthere) if (level.objects[x][y] && level.objects[x][y]->nexthere)
special |= MG_OBJPILE; special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */ } else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */
idx = mons[offset].mlet + SYM_OFF_M; idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color) if (has_rogue_color)
@@ -199,17 +199,16 @@ unsigned *ospecial;
idx = mons[glyph].mlet + SYM_OFF_M; idx = mons[glyph].mlet + SYM_OFF_M;
if (has_rogue_color && iflags.use_color) { if (has_rogue_color && iflags.use_color) {
if (x == u.ux && y == u.uy) if (x == u.ux && y == u.uy)
/* actually player should be yellow-on-gray if in a corridor /* actually player should be yellow-on-gray if in corridor */
*/
color = CLR_YELLOW; color = CLR_YELLOW;
else else
color = NO_COLOR; color = NO_COLOR;
} else { } else {
mon_color(glyph); mon_color(glyph);
/* special case the hero for `showrace' option */
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (iflags.use_color && x == u.ux && y == u.uy && flags.showrace /* special case the hero for `showrace' option */
&& !Upolyd) if (iflags.use_color && x == u.ux && y == u.uy
&& flags.showrace && !Upolyd)
color = HI_DOMESTIC; color = HI_DOMESTIC;
#endif #endif
} }
@@ -235,6 +234,7 @@ encglyph(glyph)
int glyph; int glyph;
{ {
static char encbuf[20]; static char encbuf[20];
Sprintf(encbuf, "\\G%04X%04X", context.rndencode, glyph); Sprintf(encbuf, "\\G%04X%04X", context.rndencode, glyph);
return encbuf; return encbuf;
} }
@@ -242,7 +242,7 @@ int glyph;
/* /*
* This differs from putstr() because the str parameter can * This differs from putstr() because the str parameter can
* contain a sequence of characters representing: * contain a sequence of characters representing:
* \GXXXXNNNN a glyph value, encoded by encglyph(). * \GXXXXNNNN a glyph value, encoded by encglyph().
* *
* For window ports that haven't yet written their own * For window ports that haven't yet written their own
* XXX_putmixed() routine, this general one can be used. * XXX_putmixed() routine, this general one can be used.
@@ -260,6 +260,7 @@ const char *str;
char buf[BUFSZ]; char buf[BUFSZ];
const char *cp = str; const char *cp = str;
char *put = buf; char *put = buf;
while (*cp) { while (*cp) {
if (*cp == '\\') { if (*cp == '\\') {
int rndchk = 0, so = 0, gv = 0, ch, oc, dcount; int rndchk = 0, so = 0, gv = 0, ch, oc, dcount;
@@ -288,18 +289,19 @@ const char *str;
} }
break; break;
#if 0 #if 0
case 'S': /* symbol offset */ case 'S': /* symbol offset */
dcount = 0; dcount = 0;
for (++cp; *cp && (dp = index(hex, *cp)) && (dcount++ < 4); cp++) for (++cp; *cp && (dp = index(hex, *cp)) != 0 && dcount++ < 4;
rndchk = (int)((rndchk * 16) + ((int)(dp - hex) / 2)); cp++)
rndchk = (int) ((rndchk * 16) + ((int) (dp - hex) / 2));
if (rndchk == context.rndencode) { if (rndchk == context.rndencode) {
dcount = 0; dcount = 0;
for (; *cp && (dp = index(hex, *cp)) && (dcount++ < 2); cp++) for (; *cp && (dp = index(hex, *cp)) != 0 && dcount++ < 2;
so = (int)((so * 16) + ((int)(dp - hex) / 2)); cp++)
} so = (int) ((so * 16) + ((int) (dp - hex) / 2));
*put++ = showsyms[so]; }
break; *put++ = showsyms[so];
break;
#endif #endif
case '\\': case '\\':
break; break;