Unify blind feel_location or newsym info single func

This commit is contained in:
Pasi Kallinen
2015-11-09 21:37:28 +02:00
parent 7132f56901
commit 2c0f24896f
8 changed files with 29 additions and 44 deletions

View File

@@ -306,6 +306,7 @@ E void FDECL(map_object, (struct obj *, int));
E void FDECL(map_invisible, (XCHAR_P, XCHAR_P));
E void FDECL(unmap_object, (int, int));
E void FDECL(map_location, (int, int, int));
E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P));
E void FDECL(feel_location, (XCHAR_P, XCHAR_P));
E void FDECL(newsym, (int, int));
E void FDECL(shieldeff, (XCHAR_P, XCHAR_P));

View File

@@ -401,19 +401,13 @@ register struct obj *obj;
case SDOOR:
You_hear(hollow_str, "door");
cvt_sdoor_to_door(lev); /* ->typ = DOOR */
if (Blind)
feel_location(rx, ry);
else
newsym(rx, ry);
feel_newsym(rx, ry);
return res;
case SCORR:
You_hear(hollow_str, "passage");
lev->typ = CORR;
unblock_point(rx, ry);
if (Blind)
feel_location(rx, ry);
else
newsym(rx, ry);
feel_newsym(rx, ry);
return res;
}

View File

@@ -1291,10 +1291,7 @@ struct trap *trap;
trap->tseen = 1;
exercise(A_WIS, TRUE);
if (Blind)
feel_location(trap->tx, trap->ty);
else
newsym(trap->tx, trap->ty);
feel_newsym(trap->tx, trap->ty);
if (levl[trap->tx][trap->ty].glyph != trap_to_glyph(trap)) {
/* There's too much clutter to see your find otherwise */

View File

@@ -81,10 +81,7 @@ boolean waslit, rockit;
lev->typ = (rockit ? STONE : ROOM);
if (dist >= 3)
impossible("mkcavepos called with dist %d", dist);
if (Blind)
feel_location(x, y);
else
newsym(x, y);
feel_newsym(x, y);
}
STATIC_OVL void
@@ -437,10 +434,7 @@ dig(VOID_ARGS)
if (!does_block(dpx, dpy, &levl[dpx][dpy]))
unblock_point(dpx, dpy); /* vision: can see through */
if (Blind)
feel_location(dpx, dpy);
else
newsym(dpx, dpy);
feel_newsym(dpx, dpy);
if (digtxt && !context.digging.quiet)
pline1(digtxt); /* after newsym */
if (dmgtxt)

View File

@@ -486,6 +486,23 @@ register struct monst *mon;
show_glyph(x, y, glyph);
}
/*
* feel_newsym()
*
* When hero knows what happened to location, even when blind.
*/
void
feel_newsym(x, y)
xchar x, y;
{
if (Blind)
feel_location(x, y);
else
newsym(x, y);
}
/*
* feel_location()
*

View File

@@ -973,10 +973,7 @@ dokick()
} else if (maploc->doormask != D_NODOOR
&& !(maploc->doormask & D_LOCKED))
maploc->doormask = D_ISOPEN;
if (Blind)
feel_location(x, y); /* we know it's gone */
else
newsym(x, y);
feel_newsym(x, y); /* we know it's gone */
if (maploc->doormask == D_ISOPEN
|| maploc->doormask == D_NODOOR)
unblock_point(x, y); /* vision */
@@ -989,10 +986,7 @@ dokick()
pline("Crash! You kick open a secret passage!");
exercise(A_DEX, TRUE);
maploc->typ = CORR;
if (Blind)
feel_location(x, y); /* we know it's gone */
else
newsym(x, y);
feel_newsym(x, y); /* we know it's gone */
unblock_point(x, y); /* vision */
return 1;
} else
@@ -1267,10 +1261,7 @@ dokick()
exercise(A_STR, TRUE);
maploc->doormask = D_BROKEN;
}
if (Blind)
feel_location(x, y); /* we know we broke it */
else
newsym(x, y);
feel_newsym(x, y); /* we know we broke it */
unblock_point(x, y); /* vision */
if (shopdoor) {
add_damage(x, y, 400L);

View File

@@ -648,10 +648,7 @@ int x, y;
add_damage(cc.x, cc.y, 0L);
} else
door->doormask = D_ISOPEN;
if (Blind)
feel_location(cc.x, cc.y); /* the hero knows she opened it */
else
newsym(cc.x, cc.y);
feel_newsym(cc.x, cc.y); /* the hero knows she opened it */
unblock_point(cc.x, cc.y); /* vision: new see through there */
} else {
exercise(A_STR, TRUE);
@@ -781,10 +778,7 @@ doclose()
|| rn2(25) < (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 3) {
pline_The("door closes.");
door->doormask = D_CLOSED;
if (Blind)
feel_location(x, y); /* the hero knows she closed it */
else
newsym(x, y);
feel_newsym(x, y); /* the hero knows she closed it */
block_point(x, y); /* vision: no longer see there */
} else {
exercise(A_STR, TRUE);

View File

@@ -760,10 +760,7 @@ boolean shatter;
otmp = nxtobj(otmp, STATUE, TRUE);
}
if (Blind)
feel_location(x, y);
else
newsym(x, y);
feel_newsym(x, y);
return mtmp;
}