Qt c++ function name shadow warnings
We have a struct called mkroom and a function called mkroom() so c++ complains about the mkroom() function hiding the initializer for the struct. Similarly, we have a struct called attack and a function called attack(). There may be a more elegant way of eliminating those two warnings, but renaming mkroom() to do_mkroom() and attack() to do_attack() was straightforward enough.
This commit is contained in:
@@ -1347,7 +1347,7 @@ extern struct obj *init_dummyobj(struct obj *, short, long);
|
||||
|
||||
/* ### mkroom.c ### */
|
||||
|
||||
extern void mkroom(int);
|
||||
extern void do_mkroom(int);
|
||||
extern void fill_zoo(struct mkroom *);
|
||||
extern struct permonst *antholemon(void);
|
||||
extern boolean nexttodoor(int, int);
|
||||
@@ -2630,7 +2630,7 @@ extern void erode_armor(struct monst *, int);
|
||||
extern boolean attack_checks(struct monst *, struct obj *);
|
||||
extern void check_caitiff(struct monst *);
|
||||
extern int find_roll_to_hit(struct monst *, uchar, struct obj *, int *, int *);
|
||||
extern boolean attack(struct monst *);
|
||||
extern boolean do_attack(struct monst *);
|
||||
extern boolean hmon(struct monst *, struct obj *, int, int);
|
||||
extern boolean shade_miss(struct monst *, struct monst *, struct obj *,
|
||||
boolean, boolean);
|
||||
|
||||
@@ -2732,7 +2732,7 @@ use_whip(struct obj *obj)
|
||||
if (proficient < 0)
|
||||
proficient = 0;
|
||||
|
||||
if (u.uswallow && attack(u.ustuck)) {
|
||||
if (u.uswallow && do_attack(u.ustuck)) {
|
||||
There("is not enough room to flick your bullwhip.");
|
||||
|
||||
} else if (Underwater) {
|
||||
@@ -2806,7 +2806,7 @@ use_whip(struct obj *obj)
|
||||
if (bigmonst(mtmp->data)) {
|
||||
wrapped_what = strcpy(buf, mon_nam(mtmp));
|
||||
} else if (proficient) {
|
||||
if (attack(mtmp))
|
||||
if (do_attack(mtmp))
|
||||
return 1;
|
||||
else
|
||||
pline1(msg_snap);
|
||||
@@ -2936,7 +2936,7 @@ use_whip(struct obj *obj)
|
||||
else
|
||||
You("flick your bullwhip towards %s.", mon_nam(mtmp));
|
||||
if (proficient) {
|
||||
if (attack(mtmp))
|
||||
if (do_attack(mtmp))
|
||||
return 1;
|
||||
else
|
||||
pline1(msg_snap);
|
||||
|
||||
@@ -1029,7 +1029,7 @@ use_pick_axe2(struct obj *obj)
|
||||
boolean ispick = is_pick(obj);
|
||||
const char *verbing = ispick ? "digging" : "chopping";
|
||||
|
||||
if (u.uswallow && attack(u.ustuck)) {
|
||||
if (u.uswallow && do_attack(u.ustuck)) {
|
||||
; /* return 1 */
|
||||
} else if (Underwater) {
|
||||
pline("Turbulence torpedoes your %s attempts.", verbing);
|
||||
@@ -1060,7 +1060,7 @@ use_pick_axe2(struct obj *obj)
|
||||
return 1;
|
||||
}
|
||||
lev = &levl[rx][ry];
|
||||
if (MON_AT(rx, ry) && attack(m_at(rx, ry)))
|
||||
if (MON_AT(rx, ry) && do_attack(m_at(rx, ry)))
|
||||
return 1;
|
||||
dig_target = dig_typ(obj, rx, ry);
|
||||
if (dig_target == DIGTYP_UNDIGGABLE) {
|
||||
|
||||
14
src/hack.c
14
src/hack.c
@@ -1612,22 +1612,22 @@ domove_core(void)
|
||||
/* attack monster */
|
||||
if (mtmp) {
|
||||
/* don't stop travel when displacing pets; if the
|
||||
displace fails for some reason, attack() in uhitm.c
|
||||
displace fails for some reason, do_attack() in uhitm.c
|
||||
will stop travel rather than domove */
|
||||
if (!is_safemon(mtmp) || g.context.forcefight)
|
||||
nomul(0);
|
||||
/* only attack if we know it's there */
|
||||
/* or if we used the 'F' command to fight blindly */
|
||||
/* or if it hides_under, in which case we call attack() to print
|
||||
/* or if it hides_under, in which case we call do_attack() to print
|
||||
* the Wait! message.
|
||||
* This is different from ceiling hiders, who aren't handled in
|
||||
* attack().
|
||||
* do_attack().
|
||||
*/
|
||||
|
||||
/* If they used a 'm' command, trying to move onto a monster
|
||||
* prints the below message and wastes a turn. The exception is
|
||||
* if the monster is unseen and the player doesn't remember an
|
||||
* invisible monster--then, we fall through to attack() and
|
||||
* invisible monster--then, we fall through to do_attack() and
|
||||
* attack_check(), which still wastes a turn, but prints a
|
||||
* different message and makes the player remember the monster.
|
||||
*/
|
||||
@@ -1663,7 +1663,7 @@ domove_core(void)
|
||||
|
||||
/* try to attack; note that it might evade;
|
||||
also, we don't attack tame when _safepet_ */
|
||||
else if (attack(mtmp))
|
||||
else if (do_attack(mtmp))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1826,7 +1826,7 @@ domove_core(void)
|
||||
|
||||
/*
|
||||
* If safepet at destination then move the pet to the hero's
|
||||
* previous location using the same conditions as in attack().
|
||||
* previous location using the same conditions as in do_attack().
|
||||
* there are special extenuating circumstances:
|
||||
* (1) if the pet dies then your god angers,
|
||||
* (2) if the pet gets trapped then your god may disapprove.
|
||||
@@ -2062,7 +2062,7 @@ boolean
|
||||
overexertion(void)
|
||||
{
|
||||
/* this used to be part of domove() when moving to a monster's
|
||||
position, but is now called by attack() so that it doesn't
|
||||
position, but is now called by do_attack() so that it doesn't
|
||||
execute if you decline to attack a peaceful monster */
|
||||
gethungry();
|
||||
if ((g.moves % 3L) != 0L && near_capacity() >= HVY_ENCUMBER) {
|
||||
|
||||
@@ -197,7 +197,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef,
|
||||
if (m_at(fx, fy) != magr || m_at(tx, ty) != mdef)
|
||||
return MM_MISS;
|
||||
|
||||
/* The 1 in 7 failure below matches the chance in attack()
|
||||
/* The 1 in 7 failure below matches the chance in do_attack()
|
||||
* for pet displacement.
|
||||
*/
|
||||
if (!rn2(7))
|
||||
|
||||
24
src/mklev.c
24
src/mklev.c
@@ -923,34 +923,34 @@ makelevel(void)
|
||||
* note that mkroom doesn't guarantee a room gets created, and that this
|
||||
* step only sets the room's rtype - it doesn't fill it yet. */
|
||||
if (wizard && nh_getenv("SHOPTYPE"))
|
||||
mkroom(SHOPBASE);
|
||||
do_mkroom(SHOPBASE);
|
||||
else if (u_depth > 1 && u_depth < depth(&medusa_level)
|
||||
&& g.nroom >= room_threshold && rn2(u_depth) < 3)
|
||||
mkroom(SHOPBASE);
|
||||
do_mkroom(SHOPBASE);
|
||||
else if (u_depth > 4 && !rn2(6))
|
||||
mkroom(COURT);
|
||||
do_mkroom(COURT);
|
||||
else if (u_depth > 5 && !rn2(8)
|
||||
&& !(g.mvitals[PM_LEPRECHAUN].mvflags & G_GONE))
|
||||
mkroom(LEPREHALL);
|
||||
do_mkroom(LEPREHALL);
|
||||
else if (u_depth > 6 && !rn2(7))
|
||||
mkroom(ZOO);
|
||||
do_mkroom(ZOO);
|
||||
else if (u_depth > 8 && !rn2(5))
|
||||
mkroom(TEMPLE);
|
||||
do_mkroom(TEMPLE);
|
||||
else if (u_depth > 9 && !rn2(5)
|
||||
&& !(g.mvitals[PM_KILLER_BEE].mvflags & G_GONE))
|
||||
mkroom(BEEHIVE);
|
||||
do_mkroom(BEEHIVE);
|
||||
else if (u_depth > 11 && !rn2(6))
|
||||
mkroom(MORGUE);
|
||||
do_mkroom(MORGUE);
|
||||
else if (u_depth > 12 && !rn2(8) && antholemon())
|
||||
mkroom(ANTHOLE);
|
||||
do_mkroom(ANTHOLE);
|
||||
else if (u_depth > 14 && !rn2(4)
|
||||
&& !(g.mvitals[PM_SOLDIER].mvflags & G_GONE))
|
||||
mkroom(BARRACKS);
|
||||
do_mkroom(BARRACKS);
|
||||
else if (u_depth > 15 && !rn2(6))
|
||||
mkroom(SWAMP);
|
||||
do_mkroom(SWAMP);
|
||||
else if (u_depth > 16 && !rn2(8)
|
||||
&& !(g.mvitals[PM_COCKATRICE].mvflags & G_GONE))
|
||||
mkroom(COCKNEST);
|
||||
do_mkroom(COCKNEST);
|
||||
|
||||
skip0:
|
||||
/* Place multi-dungeon branch. */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
/*
|
||||
* Entry points:
|
||||
* mkroom() -- make and stock a room of a given type
|
||||
* do_mkroom() -- make and stock a room of a given type
|
||||
* nexttodoor() -- return TRUE if adjacent to a door
|
||||
* has_dnstairs() -- return TRUE if given room has a down staircase
|
||||
* has_upstairs() -- return TRUE if given room has an up staircase
|
||||
@@ -43,7 +43,7 @@ isbig(struct mkroom* sroom)
|
||||
|
||||
/* make and stock a room of a given type */
|
||||
void
|
||||
mkroom(int roomtype)
|
||||
do_mkroom(int roomtype)
|
||||
{
|
||||
if (roomtype >= SHOPBASE)
|
||||
mkshop(); /* someday, we should be able to specify shop type */
|
||||
|
||||
@@ -93,7 +93,7 @@ erode_armor(struct monst *mdef, int hurt)
|
||||
/* FALSE means it's OK to attack */
|
||||
boolean
|
||||
attack_checks(struct monst *mtmp,
|
||||
struct obj *wep) /* uwep for attack(), null for kick_monster() */
|
||||
struct obj *wep) /* uwep for do_attack(), null for kick_monster() */
|
||||
{
|
||||
int glyph;
|
||||
|
||||
@@ -319,7 +319,7 @@ find_roll_to_hit(struct monst *mtmp,
|
||||
/* try to attack; return False if monster evaded;
|
||||
u.dx and u.dy must be set */
|
||||
boolean
|
||||
attack(struct monst *mtmp)
|
||||
do_attack(struct monst *mtmp)
|
||||
{
|
||||
register struct permonst *mdat = mtmp->data;
|
||||
|
||||
@@ -571,7 +571,8 @@ hitum_cleave(struct monst *target, /* non-Null; forcefight at nothing doesn't
|
||||
&attknum, &armorpenalty);
|
||||
dieroll = rnd(20);
|
||||
mhit = (tmp > dieroll);
|
||||
g.bhitpos.x = tx, g.bhitpos.y = ty; /* normally set up by attack() */
|
||||
g.bhitpos.x = tx, g.bhitpos.y = ty; /* normally set up by
|
||||
do_attack() */
|
||||
(void) known_hitum(mtmp, uwep, &mhit, tmp, armorpenalty,
|
||||
uattk, dieroll);
|
||||
(void) passive(mtmp, uwep, mhit, !DEADMONSTER(mtmp), AT_WEAP, !uwep);
|
||||
|
||||
Reference in New Issue
Block a user