start with.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@762 c06c8d41-db1a-0410-9941-cceddc491573
R325RPUV26YH65VIJKYEFZ2XCVXQHO5N3ELPX6RNQ5TSI3JJNQGQC
ZP2KE7A2LE7Z2S7AC45WE4CXDSEVDTWIMV2EM4IBUKXYJIDU6R7QC
3YK4G4IQBXW63HPGU5WRTV6L2FCMKAK4DOTCHFK2FNSB5B3Y3PVQC
3WRAJZ5ZLOSIZHFBUH5552QC4F3GAK7AXF6VIQFVN6VY7PUO6HPQC
NKX44AETZPMMRL4WO3OAVR2PSPTTX5PBEM77JH3L3DIPRZZJ34RQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
for ( int y = ystart; y < yend; ++y ) {
for ( int x = xstart; x < xend; ++x ) {
/* if you can see a nonfriendly monster then you feel
unsafe */
if ( see_grid(x,y) ) {
const unsigned char targ_monst = mgrd[x][y];
if ( targ_monst != NON_MONSTER ) {
struct monsters *mon = &menv[targ_monst];
if ( !mons_friendly(mon) &&
player_monster_visible(mon) &&
!mons_is_mimic(mon->type) &&
(!Options.safe_zero_exp ||
!mons_class_flag( mon->type, M_NO_EXP_GAIN ))) {
return false;
}
}
}
}
for ( int y = ystart; y < yend; ++y )
{
for ( int x = xstart; x < xend; ++x )
{
/* if you can see a nonfriendly monster then you feel
unsafe */
if ( see_grid(x,y) )
{
const unsigned char targ_monst = mgrd[x][y];
if ( targ_monst != NON_MONSTER )
{
struct monsters *mon = &menv[targ_monst];
if ( !mons_friendly(mon) &&
player_monster_visible(mon) &&
!mons_is_mimic(mon->type) &&
(!Options.safe_zero_exp ||
!mons_class_flag( mon->type, M_NO_EXP_GAIN )))
{
if (announce)
mons.push_back(mon);
else
return false;
}
}
}
}
}
if (announce)
{
if (mons.size() == 1)
{
const monsters *m = mons[0];
switch (random2(3))
{
case 0:
mprf(MSGCH_WARN, "Not with %s in view!",
ptr_monam(m, DESC_NOCAP_A));
break;
case 1:
mprf(MSGCH_WARN, "There's %s right there!",
ptr_monam(m, DESC_NOCAP_A));
break;
case 2:
mprf(MSGCH_WARN, "Wait, there's %s in sight!",
ptr_monam(m, DESC_NOCAP_A));
break;
}
}
else if (mons.size() > 1)
{
mprf(MSGCH_WARN, "Not with these monsters around!");
}
return (mons.empty());