diff options
-rw-r--r-- | crawl-ref/source/acr.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/directn.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 25 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 2 |
7 files changed, 20 insertions, 31 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 455722b514..b055fb1a8b 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3175,7 +3175,7 @@ static void _close_door(coord_def move) { // Need to make sure that turn_is_over is set if creature is // invisible. - if (!player_monster_visible(mon)) + if (!you.can_see(mon)) { mprf("Something is blocking the %sway!", noun); you.turn_is_over = true; diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 1f0896085f..31070006d1 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3494,7 +3494,7 @@ void bolt::affect_player_enchantment() if (thrower != KILL_YOU_MISSILE && !invalid_monster_index(beam_source)) { monsters *mon = &menv[beam_source]; - if (!player_monster_visible(mon)) + if (!you.can_see(mon)) { mpr("Something tries to affect you, but you resist."); need_msg = false; @@ -4179,7 +4179,7 @@ void bolt::enchantment_affect_monster(monsters* mon) if (is_sanctuary(mon->pos()) || is_sanctuary(you.pos())) remove_sanctuary(true); - set_attack_conducts(conducts, mon, player_monster_visible(mon)); + set_attack_conducts(conducts, mon, you.can_see(mon)); if (you.religion == GOD_BEOGH && mons_species(mon->type) == MONS_ORC @@ -4446,7 +4446,7 @@ void bolt::affect_monster(monsters* mon) // It's not the player's fault if he didn't see the monster or // the monster was caught in an unexpected blast of ?immolation. const bool okay = - (!player_monster_visible(mon) + (!you.can_see(mon) || aux_source == "reading a scroll of immolation" && !effect_known); @@ -4500,7 +4500,7 @@ void bolt::affect_monster(monsters* mon) mprf("The %s %s %s.", name.c_str(), engulfs ? "engulfs" : "hits", - player_monster_visible(mon) ? + you.can_see(mon) ? mon->name(DESC_NOCAP_THE).c_str() : "something"); } diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index f3eed0efec..c75aa88657 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -267,7 +267,7 @@ static void draw_ray_glyph(const coord_def &pos, int colour, { if (mons->alive() && player_monster_visible(mons)) { - glych = get_screen_glyph(pos.x, pos.y); + glych = get_screen_glyph(pos); colour = mcol; } } @@ -413,13 +413,10 @@ static void _direction_again(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)) { moves.isCancel = true; - crawl_state.cancel_cmd_all("Your target is gone."); - return; } else if (!_is_target_in_range(montarget->pos(), range)) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 7c0ca403f9..439233d59a 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1964,8 +1964,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, && mons_is_submerged(&mon); // Handle non-visible case first. - if (!force_seen && !player_monster_visible(&mon) - && !arena_submerged) + if (!force_seen && !you.can_see(&mon) && !arena_submerged) { switch (desc) { @@ -8306,8 +8305,6 @@ std::string do_mon_str_replacements(const std::string &in_msg, const actor* foe = (mons_wont_attack(monster) && invalid_monster_index(monster->foe)) ? &you : monster->get_foe(); - const monsters* m_foe = (foe && foe->atype() == ACT_MONSTER) ? - dynamic_cast<const monsters*>(foe) : NULL; if (s_type < 0 || s_type >= NUM_LOUDNESS || s_type == NUM_SHOUTS) s_type = mons_shouts(monster->type); @@ -8341,16 +8338,17 @@ std::string do_mon_str_replacements(const std::string &in_msg, else { std::string foe_name; - if (you.can_see(m_foe) || crawl_state.arena) + const monsters* m_foe = dynamic_cast<const monsters*>(foe); + if (you.can_see(foe) || crawl_state.arena) { if (m_foe->attitude == ATT_FRIENDLY && !mons_is_unique(m_foe->type) && !crawl_state.arena) { - foe_name = m_foe->name(DESC_NOCAP_YOUR); + foe_name = foe->name(DESC_NOCAP_YOUR); } else - foe_name = m_foe->name(DESC_NOCAP_THE); + foe_name = foe->name(DESC_NOCAP_THE); } else foe_name = "something"; @@ -8368,16 +8366,14 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@Foe@", upcase_first(foe_name)); if (m_foe->is_named()) - msg = replace_all(msg, "@foe_name@", - m_foe->name(DESC_PLAIN, true)); + msg = replace_all(msg, "@foe_name@", foe->name(DESC_PLAIN, true)); std::string species = mons_type_name(mons_species(m_foe->type), DESC_PLAIN); msg = replace_all(msg, "@foe_species@", species); - std::string genus = mons_type_name(mons_genus(m_foe->type), - DESC_PLAIN); + std::string genus = mons_type_name(mons_genus(m_foe->type), DESC_PLAIN); msg = replace_all(msg, "@foe_genus@", genus); msg = replace_all(msg, "@foe_genus_plural@", pluralise(genus)); @@ -8387,7 +8383,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, description_level_type nocap = DESC_NOCAP_THE, cap = DESC_CAP_THE; - if (monster->is_named() && player_monster_visible(monster)) + if (monster->is_named() && you.can_see(monster)) { std::string name = monster->name(DESC_CAP_THE); @@ -8399,7 +8395,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, else if (monster->attitude == ATT_FRIENDLY && !mons_is_unique(monster->type) && !crawl_state.arena - && player_monster_visible(monster)) + && you.can_see(monster)) { nocap = DESC_PLAIN; cap = DESC_PLAIN; @@ -8432,8 +8428,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@feature@", "buggy unseen feature"); } - - if (player_monster_visible(monster)) + if (you.can_see(monster)) { std::string something = monster->name(DESC_PLAIN); msg = replace_all(msg, "@something@", something); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index cf51843c19..90efb07d3b 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -598,8 +598,7 @@ static bool _ely_protect_ally(monsters *monster) if (mons_holiness(monster) != MH_NATURAL && mons_holiness(monster) != MH_HOLY || !mons_friendly(monster) - || !mons_near(monster) - || !player_monster_visible(monster) // for simplicity + || !you.can_see(monster) // for simplicity || !one_chance_in(20)) { return (false); @@ -5714,7 +5713,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) noisy(12, monster->pos(), NULL, true); bool did_resist = false; - if (player_monster_visible(monster)) + if (you.can_see(monster)) { simple_monster_message(monster, make_stringf(" chants %s song.", diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 405ff8eafe..478f4b41f4 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -1553,7 +1553,7 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used) viewwindow(true, false); pbolt.fire(); msg::stream << "The weapon returns " - << (player_monster_visible(monster)? + << (you.can_see(monster)? ("to " + monster->name(DESC_NOCAP_THE)) : "whence it came from") << "!" << std::endl; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 75b19b6c5b..cbb320f2b4 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1263,7 +1263,6 @@ void monster_grid(bool do_updates) // monster, then make sure that the mgrd is set correctly. if (mgrd(monster->pos()) != s) { -#ifdef DEBUG_DIAGNOSTICS // If this mprf triggers for you, please note any special // circumstances so we can track down where this is coming // from. @@ -1271,7 +1270,6 @@ void monster_grid(bool do_updates) "improperly placed. Updating mgrd.", monster->name(DESC_PLAIN, true).c_str(), s, monster->pos().x, monster->pos().y); -#endif ASSERT(mgrd(monster->pos()) == NON_MONSTER); mgrd(monster->pos()) = s; } |