summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-21 23:16:42 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-21 23:16:42 +0000
commitbf946a85fe99dda39802fd242474264101ddd14f (patch)
treeb82d5360b43986f6fd6162c6d394227d4bb2d18d
parent476b01632e0b94acf85a25dbad32782720cde555 (diff)
downloadcrawl-ref-bf946a85fe99dda39802fd242474264101ddd14f.tar.gz
crawl-ref-bf946a85fe99dda39802fd242474264101ddd14f.zip
For 2089989, reallow friendlies to walk into your damaging clouds in
some cases, regardless of god. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9145 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/cloud.cc39
-rw-r--r--crawl-ref/source/directn.cc5
-rw-r--r--crawl-ref/source/effects.cc7
-rw-r--r--crawl-ref/source/mon-util.cc3
-rw-r--r--crawl-ref/source/monplace.cc4
-rw-r--r--crawl-ref/source/monstuff.cc135
-rw-r--r--crawl-ref/source/monstuff.h31
-rw-r--r--crawl-ref/source/mstuff2.cc5
-rw-r--r--crawl-ref/source/overmap.cc99
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/religion.cc2
-rw-r--r--crawl-ref/source/traps.cc2
-rw-r--r--crawl-ref/source/view.cc2
14 files changed, 118 insertions, 220 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index ce90cc914e..1f0896085f 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2719,7 +2719,7 @@ void mimic_alert(monsters *mimic)
return;
bool should_id = !testbits(mimic->flags, MF_KNOWN_MIMIC)
- && player_monster_visible(mimic) && mons_near(mimic);
+ && you.can_see(mimic);
// If we got here, we at least got a resists message, if not
// a full wounds printing. Thus, might as well id the mimic.
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index a102053972..921cb9cfc7 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -413,32 +413,19 @@ beam_type cloud2beam(cloud_type flavour)
switch (flavour)
{
default:
- case CLOUD_NONE:
- return BEAM_NONE;
- case CLOUD_FIRE:
- return BEAM_FIRE;
- case CLOUD_STINK:
- return BEAM_POTION_STINKING_CLOUD;
- case CLOUD_COLD:
- return BEAM_COLD;
- case CLOUD_POISON:
- return BEAM_POISON;
- case CLOUD_BLACK_SMOKE:
- return BEAM_POTION_BLACK_SMOKE;
- case CLOUD_GREY_SMOKE:
- return BEAM_POTION_GREY_SMOKE;
- case CLOUD_BLUE_SMOKE:
- return BEAM_POTION_BLUE_SMOKE;
- case CLOUD_PURP_SMOKE:
- return BEAM_POTION_PURP_SMOKE;
- case CLOUD_STEAM:
- return BEAM_STEAM;
- case CLOUD_MIASMA:
- return BEAM_MIASMA;
- case CLOUD_CHAOS:
- return BEAM_CHAOS;
- case CLOUD_RANDOM:
- return BEAM_RANDOM;
+ case CLOUD_NONE: return BEAM_NONE;
+ case CLOUD_FIRE: return BEAM_FIRE;
+ case CLOUD_STINK: return BEAM_POTION_STINKING_CLOUD;
+ case CLOUD_COLD: return BEAM_COLD;
+ case CLOUD_POISON: return BEAM_POISON;
+ case CLOUD_BLACK_SMOKE: return BEAM_POTION_BLACK_SMOKE;
+ case CLOUD_GREY_SMOKE: return BEAM_POTION_GREY_SMOKE;
+ case CLOUD_BLUE_SMOKE: return BEAM_POTION_BLUE_SMOKE;
+ case CLOUD_PURP_SMOKE: return BEAM_POTION_PURP_SMOKE;
+ case CLOUD_STEAM: return BEAM_STEAM;
+ case CLOUD_MIASMA: return BEAM_MIASMA;
+ case CLOUD_CHAOS: return BEAM_CHAOS;
+ case CLOUD_RANDOM: return BEAM_RANDOM;
}
}
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 6eaa8913ac..f3eed0efec 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -943,7 +943,7 @@ void direction(dist& moves, targeting_type restricts,
if (you.prev_targ != MHITNOT && you.prev_targ != MHITYOU)
{
const monsters *montarget = &menv[you.prev_targ];
- if (mons_near(montarget) && player_monster_visible(montarget)
+ if (you.can_see(montarget)
&& !mons_friendly(montarget) // not made friendly since then
&& _is_target_in_range(montarget->pos(), range))
{
@@ -1235,8 +1235,7 @@ void direction(dist& moves, targeting_type restricts,
{
const monsters *montarget = &menv[you.prev_targ];
- if (!mons_near(montarget)
- || !player_monster_visible( montarget ))
+ if (!you.can_see(montarget))
{
mpr("You can't see that creature any more.",
MSGCH_EXAMINE_FILTER);
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 5d07fb3786..b14caada0a 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -678,7 +678,7 @@ bool lose_stat(unsigned char which_stat, unsigned char stat_loss,
if (cause == NULL || invalid_monster(cause))
return lose_stat(which_stat, stat_loss, force, NULL, true);
- bool vis = mons_near(cause) && player_monster_visible(cause);
+ bool vis = you.can_see(cause);
std::string name = cause->name(DESC_NOCAP_A, true);
if (cause->has_ench(ENCH_SHAPESHIFTER))
@@ -2078,9 +2078,8 @@ void yell(bool force)
std::string previous;
if (!(you.prev_targ == MHITNOT || you.prev_targ == MHITYOU))
{
- monsters *target = &menv[you.prev_targ];
- if (target->alive() && mons_near(target)
- && player_monster_visible(target))
+ const monsters *target = &menv[you.prev_targ];
+ if (target->alive() && you.can_see(target))
{
previous = " p - Attack previous target.";
targ_prev = true;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 0cec23aca5..0d679856c9 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -7424,8 +7424,7 @@ bool monsters::sicken(int amount)
if (holiness() != MH_NATURAL || (amount /= 2) < 1)
return (false);
- if (!has_ench(ENCH_SICK)
- && mons_near(this) && player_monster_visible(this))
+ if (!has_ench(ENCH_SICK) && you.can_see(this))
{
// Yes, could be confused with poisoning.
mprf("%s looks sick.", name(DESC_CAP_THE).c_str());
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 90f8738603..33ee9a13b1 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1201,7 +1201,7 @@ static int _place_monster_aux(const mgen_data &mg,
mark_interesting_monst(&menv[id], mg.behaviour);
- if (player_monster_visible(&menv[id]) && mons_near(&menv[id]))
+ if (you.can_see(&menv[id]))
seen_monster(&menv[id]);
if (crawl_state.arena)
@@ -2422,7 +2422,7 @@ bool player_angers_monster(monsters *mon)
mon->del_ench(ENCH_CHARM);
behaviour_event(mon, ME_ALERT, MHITYOU);
- if (see_grid(mon->pos()) && player_monster_visible(mon))
+ if (you.can_see(mon))
{
std::string aura;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index c77d13af2c..e94825f761 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2091,7 +2091,7 @@ bool monster_polymorph(monsters *monster, monster_type targetc,
mark_interesting_monst(monster);
// If new monster is visible to player, then we've seen it.
- if (player_monster_visible(monster) && mons_near(monster))
+ if (you.can_see(monster))
{
seen_monster(monster);
// If the player saw both the begining and end results of a shifter
@@ -3003,7 +3003,7 @@ void make_mons_leave_level(monsters *mon)
{
if (mons_is_pacified(mon))
{
- if (mons_near(mon) && player_monster_visible(mon))
+ if (you.can_see(mon))
_mons_indicate_level_exit(mon);
// Pacified monsters leaving the level take their stuff with
@@ -4931,8 +4931,10 @@ static bool _is_player_or_mon_sanct(const monsters* monster)
}
bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
- bool placement, bool extra_careful)
+ bool placement)
{
+ bool extra_careful = placement;
+
if (placement)
extra_careful = true;
@@ -5016,9 +5018,8 @@ bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
return (true);
}
-// Like the above, but prevents monsters from moving into cloud if it
-// would anger the player's god, and also allows a monster to move from
-// one damaging cloud to another, even if they're of different types.
+// Like the above, but allow a monster to move from one damaging cloud
+// to another, even if they're of different types.
bool mons_avoids_cloud(const monsters *monster, int cloud_num,
cloud_type *cl_type, bool placement)
{
@@ -5035,12 +5036,8 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
if (cl_type != NULL)
*cl_type = cloud.type;
- const bool careful_friendly
- = YOU_KILL(cloud.killer) && mons_friendly(monster)
- && god_hates_attacking_friend(you.religion, monster);
-
// Is the target cloud okay?
- if (!mons_avoids_cloud(monster, cloud.type, placement, careful_friendly))
+ if (!mons_avoids_cloud(monster, cloud.type, placement))
return (false);
// If we're already in a cloud that we'd want to avoid then moving
@@ -5055,13 +5052,7 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
const cloud_struct &our_cloud = env.cloud[our_cloud_num];
- // Don't move monster from a cloud that won't anger their god to one
- // that will.
- if (!YOU_KILL(our_cloud.killer) && careful_friendly)
- return (true);
-
- return (!mons_avoids_cloud(monster, our_cloud.type, true,
- careful_friendly));
+ return (!mons_avoids_cloud(monster, our_cloud.type, true));
}
//---------------------------------------------------------------
@@ -5886,11 +5877,8 @@ static bool _handle_reaching(monsters *monster)
}
// Player saw the item reach.
- if (ret && !is_artefact(mitm[wpn]) && mons_near(monster)
- && player_monster_visible(monster))
- {
+ if (ret && !is_artefact(mitm[wpn]) && you.can_see(monster))
set_ident_flags(mitm[wpn], ISFLAG_KNOW_TYPE);
- }
return ret;
}
@@ -5917,8 +5905,7 @@ static bool _handle_scroll(monsters *monster)
bool read = false;
item_type_id_state_type ident = ID_UNKNOWN_TYPE;
- bool was_visible =
- mons_near(monster) && player_monster_visible(monster);
+ bool was_visible = you.can_see(monster);
// Notice how few cases are actually accounted for here {dlb}:
const int scroll_type = mitm[monster->inv[MSLOT_SCROLL]].sub_type;
@@ -6013,7 +6000,7 @@ static bool _handle_wand(monsters *monster, bolt &beem)
bool niceWand = false;
bool zap = false;
- bool was_visible = (mons_near(monster) && player_monster_visible(monster));
+ bool was_visible = you.can_see(monster);
item_def &wand(mitm[monster->inv[MSLOT_WAND]]);
@@ -8190,7 +8177,6 @@ static void _find_good_alternate_move(monsters *monster,
static bool _monster_move(monsters *monster)
{
FixedArray<bool, 3, 3> good_move;
- int count_x, count_y, count;
const habitat_type habitat = mons_primary_habitat(monster);
bool deep_water_available = false;
@@ -8226,7 +8212,7 @@ static bool _monster_move(monsters *monster)
int noise_level = get_shout_noise_level(mons_shouts(monster->type));
if (noise_level > 0)
{
- if (mons_near(monster) && player_monster_visible(monster))
+ if (you.can_see(monster))
{
if (one_chance_in(10))
{
@@ -8264,8 +8250,8 @@ static bool _monster_move(monsters *monster)
if (mmov.origin())
return (false);
- for (count_x = 0; count_x < 3; count_x++)
- for (count_y = 0; count_y < 3; count_y++)
+ for (int count_x = 0; count_x < 3; count_x++)
+ for (int count_y = 0; count_y < 3; count_y++)
{
const int targ_x = monster->pos().x + count_x - 1;
const int targ_y = monster->pos().y + count_y - 1;
@@ -8342,21 +8328,19 @@ static bool _monster_move(monsters *monster)
&& (one_chance_in(3)
|| monster->hit_points <= (monster->max_hit_points * 3) / 4))
{
- count = 0;
+ int count = 0;
- for (count_x = 0; count_x < 3; count_x++)
- for (count_y = 0; count_y < 3; count_y++)
+ for (int cx = 0; cx < 3; cx++)
+ for (int cy = 0; cy < 3; cy++)
{
- if (good_move[count_x][count_y]
- && grd[monster->pos().x + count_x - 1][monster->pos().y + count_y - 1]
+ if (good_move[cx][cy]
+ && grd[monster->pos().x + cx - 1][monster->pos().y + cy - 1]
== DNGN_DEEP_WATER)
{
- count++;
-
- if (one_chance_in( count ))
+ if (one_chance_in(++count))
{
- mmov.x = count_x - 1;
- mmov.y = count_y - 1;
+ mmov.x = cx - 1;
+ mmov.y = cy - 1;
}
}
}
@@ -8496,7 +8480,10 @@ static void _mons_in_cloud(monsters *monster)
switch (cloud.type)
{
case CLOUD_DEBUGGING:
- end(1, false, "Fatal error: monster steps on nonexistent cloud!");
+ mprf(MSGCH_ERROR,
+ "Monster %s stepped on a nonexistent cloud at (%d,%d)",
+ monster->name(DESC_PLAIN, true).c_str(),
+ monster->pos().x, monster->pos().y);
return;
case CLOUD_FIRE:
@@ -8632,7 +8619,7 @@ static void _mons_in_cloud(monsters *monster)
}
}
-bool monster_descriptor(int which_class, unsigned char which_descriptor)
+bool monster_descriptor(int which_class, mon_desc_type which_descriptor)
{
if (which_descriptor == MDSC_LEAVES_HIDE)
{
@@ -8708,20 +8695,18 @@ bool message_current_target()
if (you.prev_targ == MHITNOT || you.prev_targ == MHITYOU)
return (false);
- const monsters *montarget = &menv[you.prev_targ];
- return (you.prev_targ != MHITNOT && you.prev_targ != MHITYOU
- && mons_near(montarget) && player_monster_visible(montarget));
+ return (you.can_see(&menv[you.prev_targ]));
}
if (you.prev_targ != MHITNOT && you.prev_targ != MHITYOU)
{
const monsters *montarget = &menv[you.prev_targ];
- if (mons_near(montarget) && player_monster_visible(montarget))
+ if (you.can_see(montarget))
{
- mprf( MSGCH_PROMPT, "Current target: %s "
- "(use p or f to fire at it again.)",
- montarget->name(DESC_PLAIN).c_str() );
+ mprf(MSGCH_PROMPT, "Current target: %s "
+ "(use p or f to fire at it again.)",
+ montarget->name(DESC_PLAIN).c_str());
return (true);
}
@@ -8777,40 +8762,23 @@ static spell_type _map_wand_to_mspell(int wand_type)
{
switch (wand_type)
{
- case WAND_FLAME:
- return SPELL_THROW_FLAME;
- case WAND_FROST:
- return SPELL_THROW_FROST;
- case WAND_SLOWING:
- return SPELL_SLOW;
- case WAND_HASTING:
- return SPELL_HASTE;
- case WAND_MAGIC_DARTS:
- return SPELL_MAGIC_DART;
- case WAND_HEALING:
- return SPELL_LESSER_HEALING;
- case WAND_PARALYSIS:
- return SPELL_PARALYSE;
- case WAND_FIRE:
- return SPELL_BOLT_OF_FIRE;
- case WAND_COLD:
- return SPELL_BOLT_OF_COLD;
- case WAND_CONFUSION:
- return SPELL_CONFUSE;
- case WAND_INVISIBILITY:
- return SPELL_INVISIBILITY;
- case WAND_TELEPORTATION:
- return SPELL_TELEPORT_OTHER;
- case WAND_LIGHTNING:
- return SPELL_LIGHTNING_BOLT;
- case WAND_DRAINING:
- return SPELL_BOLT_OF_DRAINING;
- case WAND_DISINTEGRATION:
- return SPELL_DISINTEGRATE;
- case WAND_POLYMORPH_OTHER:
- return SPELL_POLYMORPH_OTHER;
- default:
- return SPELL_NO_SPELL;
+ case WAND_FLAME: return SPELL_THROW_FLAME;
+ case WAND_FROST: return SPELL_THROW_FROST;
+ case WAND_SLOWING: return SPELL_SLOW;
+ case WAND_HASTING: return SPELL_HASTE;
+ case WAND_MAGIC_DARTS: return SPELL_MAGIC_DART;
+ case WAND_HEALING: return SPELL_LESSER_HEALING;
+ case WAND_PARALYSIS: return SPELL_PARALYSE;
+ case WAND_FIRE: return SPELL_BOLT_OF_FIRE;
+ case WAND_COLD: return SPELL_BOLT_OF_COLD;
+ case WAND_CONFUSION: return SPELL_CONFUSE;
+ case WAND_INVISIBILITY: return SPELL_INVISIBILITY;
+ case WAND_TELEPORTATION: return SPELL_TELEPORT_OTHER;
+ case WAND_LIGHTNING: return SPELL_LIGHTNING_BOLT;
+ case WAND_DRAINING: return SPELL_BOLT_OF_DRAINING;
+ case WAND_DISINTEGRATION: return SPELL_DISINTEGRATE;
+ case WAND_POLYMORPH_OTHER: return SPELL_POLYMORPH_OTHER;
+ default: return SPELL_NO_SPELL;
}
}
@@ -8870,10 +8838,9 @@ bool shift_monster(monsters *mon, coord_def p)
if (count > 0)
{
- const int mon_index = mgrd(mon->pos());
mgrd(mon->pos()) = NON_MONSTER;
- mgrd(result) = mon_index;
mon->moveto(result);
+ mgrd(result) = mon->mindex();
}
return (count > 0);
diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h
index 42ad3d480c..614b639ef9 100644
--- a/crawl-ref/source/monstuff.h
+++ b/crawl-ref/source/monstuff.h
@@ -157,35 +157,14 @@ monsters *choose_random_monster_on_level(
bool in_sight = true, bool near_by = false,
bool prefer_named = false, bool prefer_priest = false);
-/* ***********************************************************************
- * called from: acr
- * *********************************************************************** */
bool swap_places(monsters *monster);
bool swap_places(monsters *monster, const coord_def &loc);
bool swap_check(monsters *monster, coord_def &loc, bool quiet = false);
-/* ***********************************************************************
- * called from: bang - beam - direct - fight - spells1 - spells2 - spells3
- * *********************************************************************** */
void print_wounds(const monsters *monster);
-
-
-/* ***********************************************************************
- * called from: acr
- * *********************************************************************** */
void handle_monsters(void);
-
-
-/* ***********************************************************************
- * called from: misc
- * *********************************************************************** */
-bool monster_descriptor(int which_class, unsigned char which_descriptor);
-
-
-/* ***********************************************************************
- * called from: direct - item_use - spells1
- * *********************************************************************** */
+bool monster_descriptor(int which_class, mon_desc_type which_descriptor);
bool message_current_target(void);
unsigned int monster_index(const monsters *monster);
@@ -209,12 +188,10 @@ int mons_thrown_weapon_damage(const item_def *weap);
int mons_natural_regen_rate(monsters *monster);
bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
- bool placement = false,
- bool extra_careful = false);
+ bool placement = false);
-// Like the above, but prevents monsters from moving into cloud if it
-// would anger the player's god, and also allows a monster to move from
-// one damaging cloud to another.
+// Like the above, but allow a monster to move from one damaging cloud
+// to another.
bool mons_avoids_cloud(const monsters *monster, int cloud_num,
cloud_type *cl_type = NULL, bool placement = false);
#endif
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 99670d1611..405ff8eafe 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1130,8 +1130,7 @@ void monster_teleport(monsters *monster, bool instan, bool silent)
return;
}
- bool was_seen = player_monster_visible(monster) && mons_near(monster)
- && !mons_is_lurking(monster);
+ bool was_seen = you.can_see(monster) && !mons_is_lurking(monster);
if (!silent)
simple_monster_message(monster, " disappears!");
@@ -2449,7 +2448,7 @@ static bool _make_monster_angry(const monsters *mon, monsters *targ)
if (victim.distance_from(targ->pos()) > victim.distance_from(mon->pos()))
return (false);
- if (mons_near(mon) && player_monster_visible(mon))
+ if (you.can_see(mon))
{
mprf("%s goads %s on!", mon->name(DESC_CAP_THE).c_str(),
targ->name(DESC_NOCAP_THE).c_str());
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index d491f551e8..3890c33b95 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -109,18 +109,13 @@ bool move_notable_thing(const coord_def& orig, const coord_def& dest)
static dungeon_feature_type portal_to_feature(portal_type p)
{
- switch ( p )
+ switch (p)
{
- case PORTAL_LABYRINTH:
- return DNGN_ENTER_LABYRINTH;
- case PORTAL_HELL:
- return DNGN_ENTER_HELL;
- case PORTAL_ABYSS:
- return DNGN_ENTER_ABYSS;
- case PORTAL_PANDEMONIUM:
- return DNGN_ENTER_PANDEMONIUM;
- default:
- return DNGN_FLOOR;
+ case PORTAL_LABYRINTH: return DNGN_ENTER_LABYRINTH;
+ case PORTAL_HELL: return DNGN_ENTER_HELL;
+ case PORTAL_ABYSS: return DNGN_ENTER_ABYSS;
+ case PORTAL_PANDEMONIUM: return DNGN_ENTER_PANDEMONIUM;
+ default: return DNGN_FLOOR;
}
}
@@ -128,16 +123,11 @@ static const char* portaltype_to_string(portal_type p)
{
switch ( p )
{
- case PORTAL_LABYRINTH:
- return "<cyan>Labyrinth:</cyan>";
- case PORTAL_HELL:
- return "<red>Hell:</red>";
- case PORTAL_ABYSS:
- return "<magenta>Abyss:</magenta>";
- case PORTAL_PANDEMONIUM:
- return "<blue>Pan:</blue>";
- default:
- return "<lightred>Buggy:</lightred>";
+ case PORTAL_LABYRINTH: return "<cyan>Labyrinth:</cyan>";
+ case PORTAL_HELL: return "<red>Hell:</red>";
+ case PORTAL_ABYSS: return "<magenta>Abyss:</magenta>";
+ case PORTAL_PANDEMONIUM: return "<blue>Pan:</blue>";
+ default: return "<lightred>Buggy:</lightred>";
}
}
@@ -145,32 +135,19 @@ static std::string shoptype_to_string(shop_type s)
{
switch ( s )
{
- case SHOP_WEAPON:
- return "(";
- case SHOP_WEAPON_ANTIQUE:
- return "<yellow>(</yellow>";
- case SHOP_ARMOUR:
- return "[";
- case SHOP_ARMOUR_ANTIQUE:
- return "<yellow>[</yellow>";
- case SHOP_GENERAL:
- return "*";
- case SHOP_GENERAL_ANTIQUE:
- return "<yellow>*</yellow>";
- case SHOP_JEWELLERY:
- return "=";
- case SHOP_WAND:
- return "/";
- case SHOP_BOOK:
- return "+";
- case SHOP_FOOD:
- return "%";
- case SHOP_DISTILLERY:
- return "!";
- case SHOP_SCROLL:
- return "?";
- default:
- return "x";
+ case SHOP_WEAPON: return "(";
+ case SHOP_WEAPON_ANTIQUE: return "<yellow>(</yellow>";
+ case SHOP_ARMOUR: return "[";
+ case SHOP_ARMOUR_ANTIQUE: return "<yellow>[</yellow>";
+ case SHOP_GENERAL: return "*";
+ case SHOP_GENERAL_ANTIQUE: return "<yellow>*</yellow>";
+ case SHOP_JEWELLERY: return "=";
+ case SHOP_WAND: return "/";
+ case SHOP_BOOK: return "+";
+ case SHOP_FOOD: return "%";
+ case SHOP_DISTILLERY: return "!";
+ case SHOP_SCROLL: return "?";
+ default: return "x";
}
}
@@ -664,16 +641,11 @@ portal_type feature_to_portal( unsigned char feat )
{
switch (feat)
{
- case DNGN_ENTER_LABYRINTH:
- return PORTAL_LABYRINTH;
- case DNGN_ENTER_HELL:
- return PORTAL_HELL;
- case DNGN_ENTER_ABYSS:
- return PORTAL_ABYSS;
- case DNGN_ENTER_PANDEMONIUM:
- return PORTAL_PANDEMONIUM;
- default:
- return PORTAL_NONE;
+ case DNGN_ENTER_LABYRINTH: return PORTAL_LABYRINTH;
+ case DNGN_ENTER_HELL: return PORTAL_HELL;
+ case DNGN_ENTER_ABYSS: return PORTAL_ABYSS;
+ case DNGN_ENTER_PANDEMONIUM: return PORTAL_PANDEMONIUM;
+ default: return PORTAL_NONE;
}
}
@@ -729,8 +701,7 @@ void _seen_other_thing( dungeon_feature_type which_thing, const coord_def& pos )
////////////////////////////////////////////////////////////////////////
-void set_level_annotation(std::string str,
- level_id li)
+void set_level_annotation(std::string str, level_id li)
{
if (str.empty())
{
@@ -756,8 +727,7 @@ std::string get_level_annotation(level_id li)
return (i->second);
}
-bool level_annotation_has(std::string find,
- level_id li)
+bool level_annotation_has(std::string find, level_id li)
{
std::string str = get_level_annotation(li);
@@ -791,19 +761,20 @@ void annotate_level()
li = li2;
}
- if (get_level_annotation(li).length() > 0)
+ if (!get_level_annotation(li).empty())
{
mpr("Current level annotation is:", MSGCH_PROMPT);
mpr(get_level_annotation(li).c_str() );
}
- mpr( "Set level annotation to what (using ! forces prompt)? ", MSGCH_PROMPT );
+ mpr("Set level annotation to what (using ! forces prompt)? ",
+ MSGCH_PROMPT);
char buf[77];
if (cancelable_get_line( buf, sizeof(buf) ))
return;
- if (strlen(buf) == 0)
+ if (buf[0] == 0)
{
if (get_level_annotation(li).length() > 0)
{
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e315003737..f5eee7b98a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4758,7 +4758,7 @@ void modify_stat(stat_type which_stat, char amount, bool suppress_msg,
return;
}
- bool vis = mons_near(cause) && player_monster_visible(cause);
+ bool vis = you.can_see(cause);
std::string name = cause->name(DESC_NOCAP_A, true);
if (cause->has_ench(ENCH_SHAPESHIFTER))
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index c5a4e71e95..6fb2d174ee 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1822,7 +1822,7 @@ blessing_done:
whom = "you";
else
{
- if (mons_near(follower) && player_monster_visible(follower))
+ if (you.can_see(follower))
whom = follower->name(DESC_NOCAP_THE);
else
whom = "a follower";
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index b46a9c59d6..0f36222956 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -235,7 +235,7 @@ void monster_caught_in_net(monsters *mon, bolt &pbolt)
if (mons_is_insubstantial(mon->type))
{
- if (mons_near(mon) && player_monster_visible(mon))
+ if (you.can_see(mon))
{
mprf("The net passes right through %s!",
mon->name(DESC_NOCAP_THE).c_str());
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index b07df850cf..75b19b6c5b 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -5007,7 +5007,7 @@ void view_update_at(const coord_def &pos)
void flash_monster_colour(const monsters *mon, unsigned char fmc_colour,
int fmc_delay)
{
- if (mons_near(mon) && player_monster_visible(mon))
+ if (you.can_see(mon))
{
unsigned char old_flash_colour = you.flash_colour;
coord_def c(mon->pos());