From 241ceb5971b5c87b58e7f28f9fee417230561a5d Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 17 Oct 2009 00:16:20 +0200 Subject: Globally replace see_grid by see_cell. --- crawl-ref/source/acr.cc | 2 +- crawl-ref/source/beam.cc | 44 +++++++++++++++---------------- crawl-ref/source/cloud.cc | 2 +- crawl-ref/source/dat/clua/lm_monst.lua | 6 ++--- crawl-ref/source/dat/clua/lm_timed.lua | 2 +- crawl-ref/source/dat/clua/lm_tmsg.lua | 2 +- crawl-ref/source/directn.cc | 16 ++++++------ crawl-ref/source/dungeon.cc | 2 +- crawl-ref/source/effects.cc | 10 +++---- crawl-ref/source/externs.h | 2 +- crawl-ref/source/fight.cc | 8 +++--- crawl-ref/source/it_use3.cc | 2 +- crawl-ref/source/los.cc | 18 ++++++------- crawl-ref/source/los.h | 18 ++++++------- crawl-ref/source/luadgn.cc | 14 +++++----- crawl-ref/source/misc.cc | 6 ++--- crawl-ref/source/mon-util.cc | 18 ++++++------- crawl-ref/source/monplace.cc | 8 +++--- crawl-ref/source/monstuff.cc | 48 +++++++++++++++++----------------- crawl-ref/source/mstuff2.cc | 4 +-- crawl-ref/source/ouch.cc | 2 +- crawl-ref/source/player.cc | 2 +- crawl-ref/source/religion.cc | 4 +-- crawl-ref/source/spells1.cc | 8 +++--- crawl-ref/source/spells2.cc | 14 +++++----- crawl-ref/source/spells3.cc | 20 +++++++------- crawl-ref/source/spells4.cc | 6 ++--- crawl-ref/source/spl-cast.cc | 2 +- crawl-ref/source/spl-util.cc | 2 +- crawl-ref/source/stash.cc | 2 +- crawl-ref/source/state.cc | 4 +-- crawl-ref/source/stuff.cc | 4 +-- crawl-ref/source/terrain.cc | 20 +++++++------- crawl-ref/source/test/findray.lua | 2 +- crawl-ref/source/test/los_maps.lua | 2 +- crawl-ref/source/test/los_symm.lua | 4 +-- crawl-ref/source/tilepick.cc | 4 +-- crawl-ref/source/tilereg.cc | 4 +-- crawl-ref/source/traps.cc | 8 +++--- crawl-ref/source/travel.cc | 4 +-- crawl-ref/source/tutorial.cc | 2 +- crawl-ref/source/view.cc | 22 ++++++++-------- crawl-ref/source/xom.cc | 14 +++++----- 43 files changed, 194 insertions(+), 194 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 9654654652..abe9ec0ec8 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1879,7 +1879,7 @@ void process_command( command_type cmd ) } else if (cme.right_clicked()) { - if (see_grid(dest)) + if (see_cell(dest)) full_describe_square(dest); else mpr("You can't see that place."); diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index e0c7dc5f99..224ac15eb0 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -144,7 +144,7 @@ static void _zap_animation(int colour, const monsters *mon = NULL, p = mon->pos(); } - if (!see_grid(p)) + if (!see_cell(p)) return; const coord_def drawp = grid2view(p); @@ -1529,7 +1529,7 @@ void bolt::initialise_fire() message_cache.clear(); // seen might be set by caller to supress this. - if (!seen && see_grid(source) && range > 0 && !invisible() ) + if (!seen && see_cell(source) && range > 0 && !invisible() ) { seen = true; const monsters* mon = monster_at(source); @@ -1547,7 +1547,7 @@ void bolt::initialise_fire() // Visible self-targeted beams are always seen, even though they don't // leave a path. - if (see_grid(source) && target == source && !invisible()) + if (see_cell(source) && target == source && !invisible()) seen = true; // Scale draw_delay to match change in arena_delay. @@ -1600,7 +1600,7 @@ void bolt::choose_ray() // Draw the bolt at p if needed. void bolt::draw(const coord_def& p) { - if (is_tracer || is_enchantment() || !see_grid(p)) + if (is_tracer || is_enchantment() || !see_cell(p)) return; // We don't clean up the old position. @@ -1719,7 +1719,7 @@ void bolt::fire_wall_effect() // No actual effect. if (flavour != BEAM_HELLFIRE && feat == DNGN_WAX_WALL) { - if (see_grid(pos())) + if (see_cell(pos())) { emit_message(MSGCH_PLAIN, "The wax appears to soften slightly."); @@ -1732,7 +1732,7 @@ void bolt::fire_wall_effect() { // Destroy the wall. grd(pos()) = DNGN_FLOOR; - if (see_grid(pos())) + if (see_cell(pos())) emit_message(MSGCH_PLAIN, "The wax bubbles and burns!"); else if (player_can_smell()) emit_message(MSGCH_PLAIN, "You smell burning wax."); @@ -1746,7 +1746,7 @@ void bolt::fire_wall_effect() { // Destroy the wall. grd(pos()) = DNGN_FLOOR; - if (see_grid(pos())) + if (see_cell(pos())) emit_message(MSGCH_PLAIN, "The tree burns like a torch!"); else if (player_can_smell()) emit_message(MSGCH_PLAIN, "You smell burning wood."); @@ -1796,7 +1796,7 @@ void bolt::nuke_wall_effect() if (player_can_hear(pos())) { - if (!see_grid(pos())) + if (!see_cell(pos())) mpr("You hear a hideous screaming!", MSGCH_SOUND); else { @@ -1804,7 +1804,7 @@ void bolt::nuke_wall_effect() MSGCH_SOUND); } } - else if (see_grid(pos())) + else if (see_cell(pos())) mpr("The statue twists and shakes as its substance crumbles away!"); if (feat == DNGN_ORCISH_IDOL && beam_source == NON_MONSTER) @@ -1852,7 +1852,7 @@ void bolt::hit_wall() if (is_tracer && YOU_KILL(thrower) && in_bounds(target) && !passed_target && pos() != target && pos() != source && foe_info.count == 0 && flavour != BEAM_DIGGING && flavour <= BEAM_LAST_REAL - && bounces == 0 && reflections == 0 && see_grid(target) + && bounces == 0 && reflections == 0 && see_cell(target) && !grid_is_solid(grd(target))) { // Okay, with all those tests passed, this is probably an instance @@ -2116,7 +2116,7 @@ void bolt::do_fire() || is_tracer && affects_wall(grd(pos()))); const bool was_seen = seen; - if (!was_seen && range > 0 && !invisible() && see_grid(pos())) + if (!was_seen && range > 0 && !invisible() && see_cell(pos())) seen = true; if (flavour != BEAM_VISUAL && !was_seen && seen && !is_tracer) @@ -3011,7 +3011,7 @@ void bolt::drop_object() // Summoned creatures' thrown items disappear. if (item->flags & ISFLAG_SUMMONED) { - if (see_grid(pos())) + if (see_cell(pos())) { mprf("%s %s!", item->name(DESC_CAP_THE).c_str(), @@ -3076,7 +3076,7 @@ void bolt::affect_ground() MHITNOT, MG_FORCE_PLACE)); - if (rc != -1 && see_grid(pos())) + if (rc != -1 && see_cell(pos())) mpr("A fungus suddenly grows."); } @@ -4265,7 +4265,7 @@ bool bolt::determine_damage(monsters* mon, int& preac, int& postac, int& final, // Electricity is ineffective. if (flavour == BEAM_ELECTRICITY) { - if (!is_tracer && see_grid(mon->pos())) + if (!is_tracer && see_cell(mon->pos())) mprf("The %s arcs harmlessly into the water.", name.c_str()); finish_beam(); return (false); @@ -4366,7 +4366,7 @@ void bolt::tracer_affect_monster(monsters* mon) { // Ignore unseen monsters. if (!can_see_invis && mon->invisible() - || (YOU_KILL(thrower) && !see_grid(mon->pos()))) + || (YOU_KILL(thrower) && !see_cell(mon->pos()))) { return; } @@ -4526,7 +4526,7 @@ bool bolt::attempt_block(monsters* mon) shield->name(DESC_PLAIN).c_str()); _ident_reflector(shield); } - else if (see_grid(pos())) + else if (see_cell(pos())) mprf("The %s bounces off of thin air!", name.c_str()); reflect(); @@ -4556,7 +4556,7 @@ bool bolt::handle_statue_disintegration(monsters* mon) // Disintegrate the statue. if (!silenced(you.pos())) { - if (!see_grid(mon->pos())) + if (!see_cell(mon->pos())) mpr("You hear a hideous screaming!", MSGCH_SOUND); else { @@ -4564,7 +4564,7 @@ bool bolt::handle_statue_disintegration(monsters* mon) MSGCH_SOUND); } } - else if (see_grid(mon->pos())) + else if (see_cell(mon->pos())) { mpr("The statue twists and shakes as its substance " "crumbles away!"); @@ -5453,7 +5453,7 @@ void bolt::refine_for_explosion() if (!is_tracer && *seeMsg && *hearMsg) { // Check for see/hear/no msg. - if (see_grid(target) || target == you.pos()) + if (see_cell(target) || target == you.pos()) mpr(seeMsg); else { @@ -5519,7 +5519,7 @@ bool bolt::explode(bool show_more, bool hole_in_the_middle) if (is_sanctuary(pos())) { - if (!is_tracer && see_grid(pos()) && !name.empty()) + if (!is_tracer && see_cell(pos()) && !name.empty()) { mprf(MSGCH_GOD, "By Zin's power, the %s is contained.", name.c_str()); @@ -5599,7 +5599,7 @@ bool bolt::explode(bool show_more, bool hole_in_the_middle) if (exp_map(delta + centre) < INT_MAX) { - if (see_grid(delta + pos())) + if (see_cell(delta + pos())) ++cells_seen; explosion_affect_cell(delta + pos()); @@ -5631,7 +5631,7 @@ bool bolt::explode(bool show_more, bool hole_in_the_middle) void bolt::explosion_draw_cell(const coord_def& p) { - if (see_grid(p)) + if (see_cell(p)) { const coord_def drawpos = grid2view(p); #ifdef USE_TILE diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 4e66215059..ce99e8de5c 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -153,7 +153,7 @@ static void _spread_fire(const cloud_struct &cloud) // every neighbouring square gets a separate roll if (grd(*ai) == DNGN_TREES && one_chance_in(20)) { - if (see_grid(*ai)) + if (see_cell(*ai)) mpr("The forest fire spreads!"); grd(*ai) = DNGN_FLOOR; _place_new_cloud( cloud.type, *ai, random2(30)+25, cloud.whose, diff --git a/crawl-ref/source/dat/clua/lm_monst.lua b/crawl-ref/source/dat/clua/lm_monst.lua index 6700026fb4..f26e73e89b 100644 --- a/crawl-ref/source/dat/clua/lm_monst.lua +++ b/crawl-ref/source/dat/clua/lm_monst.lua @@ -98,13 +98,13 @@ function MonsterOnTrigger:event(marker, ev) -- command, since then no turns will have been taken and the LOS info -- won't have been updated. you.losight() - local see_grid = you.see_grid(x, y) + local see_cell = you.see_cell(x, y) if (not dgn.create_monster(x, y, self.new_monster)) then return - elseif self.message_seen ~= "" and see_grid then + elseif self.message_seen ~= "" and see_cell then crawl.mpr(self.message_seen) - elseif self.message_unseen ~= "" and not see_grid then + elseif self.message_unseen ~= "" and not see_cell then crawl.mpr(self.message_unseen) end diff --git a/crawl-ref/source/dat/clua/lm_timed.lua b/crawl-ref/source/dat/clua/lm_timed.lua index 2174e01589..b2e1b482c4 100644 --- a/crawl-ref/source/dat/clua/lm_timed.lua +++ b/crawl-ref/source/dat/clua/lm_timed.lua @@ -70,7 +70,7 @@ function TimedMarker:timeout(marker, verbose, affect_player) end if verbose then - if you.see_grid(marker:pos()) then + if you.see_cell(marker:pos()) then crawl.mpr( util.expand_entity(self.props.entity, self.props.disappear) or dgn.feature_desc_at(x, y, "The") .. " disappears!") else diff --git a/crawl-ref/source/dat/clua/lm_tmsg.lua b/crawl-ref/source/dat/clua/lm_tmsg.lua index 91b3bfdb9b..0783b76e93 100644 --- a/crawl-ref/source/dat/clua/lm_tmsg.lua +++ b/crawl-ref/source/dat/clua/lm_tmsg.lua @@ -73,7 +73,7 @@ function TimedMessaging:perceptible(cm) end if self.visible then - return you.see_grid(cm:pos()) + return you.see_cell(cm:pos()) else return you.hear_pos(cm:pos()) end diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 45aaacbdcb..44459c2131 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -299,7 +299,7 @@ static bool _mon_submerged_in_water(const monsters *mon) return (false); return (grd(mon->pos()) == DNGN_SHALLOW_WATER - && see_grid(mon->pos()) + && see_cell(mon->pos()) && !player_monster_visible(mon) && !mons_flies(mon)); } @@ -381,7 +381,7 @@ static void _direction_again(dist& moves, targetting_type restricts, if (you.prev_grd_targ != coord_def(0, 0)) { - if (!see_grid(you.prev_grd_targ)) + if (!see_cell(you.prev_grd_targ)) { moves.isCancel = true; @@ -909,7 +909,7 @@ bool _dist_ok(const dist& moves, int range, targ_mode_type mode, { if (!moves.isCancel && moves.isTarget) { - if (!see_grid(moves.target)) + if (!see_cell(moves.target)) { mpr("Sorry, you can't target what you can't see.", MSGCH_EXAMINE_FILTER); @@ -1758,7 +1758,7 @@ std::string get_terse_square_desc(const coord_def &gc) desc = you.your_name; else if (!map_bounds(gc)) desc = unseen_desc; - else if (!see_grid(gc)) + else if (!see_cell(gc)) { if (is_terrain_seen(gc)) { @@ -1794,7 +1794,7 @@ std::string get_terse_square_desc(const coord_def &gc) void terse_describe_square(const coord_def &c, bool in_range) { - if (!see_grid(c)) + if (!see_cell(c)) _describe_oos_square(c); else if (in_bounds(c) ) _describe_cell(c, in_range); @@ -1806,7 +1806,7 @@ void get_square_desc(const coord_def &c, describe_info &inf, // NOTE: Keep this function in sync with full_describe_square. // Don't give out information for things outside LOS - if (!see_grid(c)) + if (!see_cell(c)) return; const monsters* mons = monster_at(c); @@ -1849,7 +1849,7 @@ void full_describe_square(const coord_def &c) // NOTE: Keep this function in sync with get_square_desc. // Don't give out information for things outside LOS - if (!see_grid(c)) + if (!see_cell(c)) return; const monsters* mons = monster_at(c); @@ -2049,7 +2049,7 @@ static bool _find_monster( const coord_def& where, int mode, bool need_path, return (false); // Monster in LOS but only via glass walls, so no direct path. - if (need_path && !see_grid_no_trans(where)) + if (need_path && !see_cell_no_trans(where)) return (false); if (!_mons_is_valid_target(mon, mode, range)) diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index eef78183be..517c5cf10d 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4248,7 +4248,7 @@ bool dgn_place_map(const map_def *mdef, bool clobber, bool make_no_exits, for (int i = 0, size = markers.size(); i < size; ++i) markers[i]->activate(); - if (!see_grid(x, y)) + if (!see_cell(x, y)) set_terrain_changed(x, y); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 76b26a88c3..2647a39a63 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -4256,7 +4256,7 @@ int place_ring(std::vector & ring_points, if (mushroom != -1) { spawned_count++; - if (see_grid(ring_points.at(i))) + if (see_cell(ring_points.at(i))) seen_count++; } } @@ -4324,7 +4324,7 @@ void collect_radius_points(std::vector > &radius_points, coord_dist temp(*i, current.second); // If the grid is out of LOS, skip it. - if (!see_grid(losgrid, origin, temp.first)) + if (!see_cell(losgrid, origin, temp.first)) continue; coord_def local = temp.first - origin; @@ -4440,7 +4440,7 @@ int spawn_corpse_mushrooms(item_def &corpse, { corpse.special = 0; - if (see_grid(corpse.pos)) + if (see_cell(corpse.pos)) mpr("A ring of toadstools grows before your very eyes."); else if (ring_seen > 1) mpr("Some toadstools grow in a peculiar arc."); @@ -4510,7 +4510,7 @@ int spawn_corpse_mushrooms(item_def &corpse, } placed_targets++; - if (see_grid(current)) + if (see_cell(current)) seen_targets++; } else @@ -4618,7 +4618,7 @@ static void _maybe_spawn_mushroom(item_def & corpse, int rot_time) int seen_spawns; spawn_corpse_mushrooms(corpse, success_count, seen_spawns); - mushroom_spawn_message(seen_spawns, see_grid(corpse.pos) ? 1 : 0); + mushroom_spawn_message(seen_spawns, see_cell(corpse.pos) ? 1 : 0); } //--------------------------------------------------------------- diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 80517c81c7..bf8cf2df53 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1486,7 +1486,7 @@ public: bool invisible() const; bool can_see_invisible() const; bool visible_to(const actor *looker) const; - bool mon_see_grid(const coord_def& pos, bool reach = false) const; + bool mon_see_cell(const coord_def& pos, bool reach = false) const; bool can_see(const actor *target) const; bool is_icy() const; bool is_fiery() const; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 2500800143..8f8f67f64a 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -390,11 +390,11 @@ void melee_attack::init_attack() water_attack = is_water_attack(attacker, defender); attacker_visible = attacker->visible() || crawl_state.arena; - attacker_invisible = (!attacker_visible && see_grid(attacker->pos())); + attacker_invisible = (!attacker_visible && see_cell(attacker->pos())); defender_visible = (defender && (defender->visible() || crawl_state.arena)); defender_invisible = (!defender_visible && defender - && see_grid(defender->pos())); + && see_cell(defender->pos())); needs_message = (attacker_visible || defender_visible); if (defender && defender->atype() == ACT_MONSTER) @@ -2323,7 +2323,7 @@ void melee_attack::chaos_affects_defender() miscast_chance *= 2; // Inform player that something is up. - if (see_grid(defender->pos())) + if (see_cell(defender->pos())) { if (defender->atype() == ACT_PLAYER) mpr("You give off a flash of multicoloured light!"); @@ -2559,7 +2559,7 @@ static bool _move_stairs(const actor* attacker, const actor* defender) // Don't move around notable terrain the player is aware of if it's // out of sight. if (is_notable_terrain(stair_feat) - && is_terrain_known(orig_pos.x, orig_pos.y) && !see_grid(orig_pos)) + && is_terrain_known(orig_pos.x, orig_pos.y) && !see_cell(orig_pos)) { return (false); } diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 2d22aaa6b7..cdaedb3ad2 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -206,7 +206,7 @@ static bool _reaching_weapon_attack(const item_def& wpn) mpr("Your weapon cannot reach that far!"); return (false); } - else if (!see_grid_no_trans(beam.target) + else if (!see_cell_no_trans(beam.target) && grd(middle) <= DNGN_MAX_NONREACH) { // Might also be a granite statue/orcish idol which you diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 9dbe3bc23d..ad0798f697 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -939,7 +939,7 @@ void calc_show_los() } } -bool see_grid(const env_show_grid &show, +bool see_cell(const env_show_grid &show, const coord_def &c, const coord_def &pos) { @@ -956,23 +956,23 @@ bool see_grid(const env_show_grid &show, return (false); } -// Answers the question: "Is a grid within character's line of sight?" -bool see_grid(const coord_def &p) +// Answers the question: "Is a cell within character's line of sight?" +bool see_cell(const coord_def &p) { return ((crawl_state.arena || crawl_state.arena_suspended) && crawl_view.in_grid_los(p)) - || see_grid(env.show, you.pos(), p); + || see_cell(env.show, you.pos(), p); } -// Answers the question: "Would a grid be within character's line of sight, +// Answers the question: "Would a cell be within character's line of sight, // even if all translucent/clear walls were made opaque?" -bool see_grid_no_trans(const coord_def &p) +bool see_cell_no_trans(const coord_def &p) { - return see_grid(env.no_trans_show, you.pos(), p); + return see_cell(env.no_trans_show, you.pos(), p); } -// Is the grid visible, but a translucent wall is in the way? +// Is the cell visible, but a translucent wall is in the way? bool trans_wall_blocking(const coord_def &p) { - return see_grid(p) && !see_grid_no_trans(p); + return see_cell(p) && !see_cell_no_trans(p); } diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h index 92d00090e0..7fcc406878 100644 --- a/crawl-ref/source/los.h +++ b/crawl-ref/source/los.h @@ -43,21 +43,21 @@ void losight(env_show_grid& sh, const coord_def& center, void losight(env_show_grid& sh, const los_param& param); void calc_show_los(); -bool see_grid( const env_show_grid &show, - const coord_def &c, - const coord_def &pos ); -bool see_grid(const coord_def &p); -bool see_grid_no_trans( const coord_def &p ); +bool see_cell(const env_show_grid &show, + const coord_def &c, + const coord_def &pos ); +bool see_cell(const coord_def &p); +bool see_cell_no_trans( const coord_def &p ); bool trans_wall_blocking( const coord_def &p ); -inline bool see_grid( int grx, int gry ) +inline bool see_cell(int grx, int gry) { - return see_grid(coord_def(grx, gry)); + return see_cell(coord_def(grx, gry)); } -inline bool see_grid_no_trans(int x, int y) +inline bool see_cell_no_trans(int x, int y) { - return see_grid_no_trans(coord_def(x, y)); + return see_cell_no_trans(coord_def(x, y)); } inline bool trans_wall_blocking(int x, int y) diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index c7d8d90167..aca73554a1 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -3329,14 +3329,14 @@ LUARET1(you_x_pos, number, you.pos().x) LUARET1(you_y_pos, number, you.pos().y) LUARET2(you_pos, number, you.pos().x, you.pos().y) -// see_grid should not be exposed to user scripts. The game should +// see_cell should not be exposed to user scripts. The game should // never disclose grid coordinates to the player. Therefore we load it // only into the core Lua interpreter (dlua), never into the user // script interpreter (clua). -LUARET1(you_see_grid, boolean, - see_grid(luaL_checkint(ls, 1), luaL_checkint(ls, 2))) -LUARET1(you_see_grid_no_trans, boolean, - see_grid_no_trans(luaL_checkint(ls, 1), luaL_checkint(ls, 2))) +LUARET1(you_see_cell, boolean, + see_cell(luaL_checkint(ls, 1), luaL_checkint(ls, 2))) +LUARET1(you_see_cell_no_trans, boolean, + see_cell_no_trans(luaL_checkint(ls, 1), luaL_checkint(ls, 2))) LUAFN(you_moveto) { @@ -3365,8 +3365,8 @@ static const struct luaL_reg you_lib[] = { "y_pos", you_y_pos }, { "pos", you_pos }, { "moveto", you_moveto }, - { "see_grid", you_see_grid }, - { "see_grid_no_trans", you_see_grid_no_trans }, + { "see_cell", you_see_cell }, + { "see_cell_no_trans", you_see_cell_no_trans }, { "random_teleport", you_random_teleport }, { "losight", you_losight }, { NULL, NULL } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index ec3806caa1..849c875820 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1219,7 +1219,7 @@ void search_around(bool only_adjacent) for (radius_iterator ri(you.pos(), max_dist); ri; ++ri ) { // Must have LOS, with no translucent walls in the way. - if (see_grid_no_trans(*ri)) + if (see_cell_no_trans(*ri)) { // Maybe we want distance() instead of grid_distance()? int dist = grid_distance(*ri, you.pos()); @@ -2710,12 +2710,12 @@ bool mons_is_safe(const monsters *mon, bool want_move, // Only seen through glass walls or within water? // Assuming that there are no water-only/lava-only // monsters capable of throwing or zapping wands. - || (!see_grid_no_trans(mon->pos()) + || (!see_cell_no_trans(mon->pos()) || mons_class_habitat(mon->type) == HT_WATER || mons_class_habitat(mon->type) == HT_LAVA) && !_mons_has_path_to_player(mon) && !mons_has_los_attack(mon) - && (!see_grid_no_trans(mon->pos()) + && (!see_cell_no_trans(mon->pos()) || !mons_has_ranged_ability(mon))); #ifdef CLUA_BINDINGS diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 925c4fa46f..2ae2614e30 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -902,7 +902,7 @@ bool mons_see_invis(const monsters *mon) bool mon_can_see_monster(const monsters *mon, const monsters *targ) { - if (!mon->mon_see_grid(targ->pos())) + if (!mon->mon_see_cell(targ->pos())) return (false); return (mons_monster_visible(mon, targ)); @@ -7696,7 +7696,7 @@ void monsters::apply_enchantment(const mon_enchant &me) // If you are no longer dying, you must be dead. if (decay_enchantment(me)) { - if (see_grid(this->position)) + if (see_cell(this->position)) { mprf("A nearby %s withers and dies.", this->name(DESC_PLAIN, false).c_str()); @@ -7736,7 +7736,7 @@ void monsters::apply_enchantment(const mon_enchant &me) { env.mons[rc].behaviour = BEH_WANDER; - if (see_grid(adjacent) && see_grid(pos())) + if (see_cell(adjacent) && see_cell(pos())) mpr("A nearby fungus spawns a giant spore."); } break; @@ -8006,7 +8006,7 @@ bool monsters::visible_to(const actor *looker) const } } -bool monsters::mon_see_grid(const coord_def& p, bool reach) const +bool monsters::mon_see_cell(const coord_def& p, bool reach) const { if (distance(pos(), p) > LOS_RADIUS * LOS_RADIUS + 1) return (false); @@ -8031,7 +8031,7 @@ bool monsters::can_see(const actor *targ) const if (targ->atype() == ACT_PLAYER) return (mons_near(this)); - return (mon_see_grid(targ->pos())); + return (mon_see_cell(targ->pos())); } bool monsters::can_mutate() const @@ -8104,8 +8104,8 @@ bool monsters::has_action_energy() const void monsters::check_redraw(const coord_def &old) const { - const bool see_new = see_grid(pos()); - const bool see_old = see_grid(old); + const bool see_new = see_cell(pos()); + const bool see_old = see_cell(old); if ((see_new || see_old) && !view_update()) { if (see_new) @@ -8159,7 +8159,7 @@ void monsters::apply_location_effects(const coord_def &oldpos) if (genus == MONS_JELLY || genus == MONS_GIANT_SLUG) { prop &= ~FPROP_BLOODY; - if (see_grid(pos()) && !visible_to(&you)) + if (see_cell(pos()) && !visible_to(&you)) { std::string desc = feature_description(pos(), false, DESC_NOCAP_THE, false); @@ -8916,7 +8916,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@The_monster@", "Your @the_monster@"); } - if (see_grid(monster->pos())) + if (see_cell(monster->pos())) { dungeon_feature_type feat = grd(monster->pos()); if (feat < DNGN_MINMOVE || feat >= NUM_REAL_FEATURES) diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 0d7177be5d..82984ef0bc 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -850,7 +850,7 @@ int place_monster(mgen_data mg, bool force_pos) case PROX_CLOSE_TO_PLAYER: case PROX_AWAY_FROM_PLAYER: // If this is supposed to measure los vs not los, - // then see_grid(mg.pos) should be used instead. (jpeg) + // then see_cell(mg.pos) should be used instead. (jpeg) close_to_player = (distance(you.pos(), mg.pos) < 64); if (mg.proximity == PROX_CLOSE_TO_PLAYER && !close_to_player @@ -927,7 +927,7 @@ int place_monster(mgen_data mg, bool force_pos) } // Message to player from stairwell/gate appearance. - if (see_grid(mg.pos) && mg.proximity == PROX_NEAR_STAIRS) + if (see_cell(mg.pos) && mg.proximity == PROX_NEAR_STAIRS) { std::string msg; @@ -2667,7 +2667,7 @@ int create_monster(mgen_data mg, bool fail_msg) // Determine whether creating a monster is successful (summd != -1) {dlb}: // then handle the outcome. {dlb}: - if (fail_msg && summd == -1 && see_grid(mg.pos)) + if (fail_msg && summd == -1 && see_cell(mg.pos)) mpr("You see a puff of smoke."); // The return value is either -1 (failure of some sort) @@ -2692,7 +2692,7 @@ bool empty_surrounds(const coord_def& where, dungeon_feature_type spc_wanted, continue; // Players won't summon out of LOS, or past transparent walls. - if (!see_grid_no_trans(*ri) && playerSummon) + if (!see_cell_no_trans(*ri) && playerSummon) continue; success = diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index eca5e7c0ad..80d4e11a78 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -425,7 +425,7 @@ int place_monster_corpse(const monsters *monster, bool silent, // Don't care if 'o' is changed, and it shouldn't be (corpses don't // stack). move_item_to_grid(&o, monster->pos()); - if (see_grid(monster->pos())) + if (see_cell(monster->pos())) { if (force && !silent) { @@ -774,7 +774,7 @@ static bool _slime_vault_in_los() { if ((grd[x][y] == DNGN_STONE_WALL || grd[x][y] == DNGN_CLEAR_STONE_WALL) - && see_grid(x, y)) + && see_cell(x, y)) { in_los = true; break; @@ -1873,7 +1873,7 @@ int monster_die(monsters *monster, killer_type killer, monster->foe = killer_index; } - if (!silent && !wizard && see_grid(monster->pos())) + if (!silent && !wizard && see_cell(monster->pos())) { // Make sure that the monster looks dead. if (monster->alive() && !in_transit && (!summoned || duration > 0)) @@ -1976,7 +1976,7 @@ int monster_die(monsters *monster, killer_type killer, monster_cleanup(monster); // Force redraw for monsters that die. - if (see_grid(mwhere)) + if (see_cell(mwhere)) { view_update_at(mwhere); update_screen(); @@ -2489,7 +2489,7 @@ static coord_def _random_monster_nearby_habitable_space(const monsters& mon, continue; } - if (respect_los && !mon.mon_see_grid(target)) + if (respect_los && !mon.mon_see_cell(target)) continue; // Survived everything, break out (with a good value of target.) @@ -2666,7 +2666,7 @@ bool random_near_space(const coord_def& origin, coord_def& target, tried(delta) = true; if (!in_bounds(target) - || restrict_LOS && !see_grid(target) + || restrict_LOS && !see_cell(target) || grd(target) < DNGN_SHALLOW_WATER || actor_at(target) || !allow_adjacent && distance(origin, target) <= 2 @@ -2700,13 +2700,13 @@ bool random_near_space(const coord_def& origin, coord_def& target, // away from the player, since in the absence of translucent // walls monsters can blink to places which are not in either // the monster's nor the player's LOS. - if (!origin_is_player && !see_grid(target)) + if (!origin_is_player && !see_cell(target)) return (true); // Player can't randomly pass through translucent walls. if (origin_is_player) { - if (see_grid_no_trans(target)) + if (see_cell_no_trans(target)) return (true); continue; @@ -3091,7 +3091,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src, // XXX: Should this be done in _handle_behaviour()? if (src == MHITYOU && src_pos == you.pos() - && !see_grid(mon->pos())) + && !see_cell(mon->pos())) { const dungeon_feature_type can_move = (mons_amphibious(mon)) ? DNGN_DEEP_WATER @@ -3142,7 +3142,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src, else if (mons_friendly(mon)) mon->foe = MHITYOU; - if (see_grid(mon->pos())) + if (see_cell(mon->pos())) learned_something_new(TUT_FLEEING_MONSTER); break; @@ -3240,7 +3240,7 @@ static bool _choose_random_patrol_target_grid(monsters *mon) return (false); // Can the monster see the patrol point from its current position? - const bool patrol_seen = mon->mon_see_grid(mon->patrol_point, + const bool patrol_seen = mon->mon_see_cell(mon->patrol_point, habitat2grid(mons_primary_habitat(mon))); if (intel == I_PLANT && !patrol_seen) @@ -3397,7 +3397,7 @@ static void _mark_neighbours_target_unreachable(monsters *mon) // Don't alert monsters out of sight (e.g. on the other side of // a wall). - if (!mon->mon_see_grid(*ri)) + if (!mon->mon_see_cell(*ri)) continue; monsters* const m = monster_at(*ri); @@ -4392,7 +4392,7 @@ static void _handle_behaviour(monsters *mon) if (!mons_player_visible( mon )) proxPlayer = false; // Must be able to see each other. - else if (!see_grid(mon->pos())) + else if (!see_cell(mon->pos())) proxPlayer = false; const int intel = mons_intel(mon); @@ -5170,7 +5170,7 @@ static void _handle_movement(monsters *monster) // always pathfind to their targets. if (delta.abs() > 2 && (!ranged - || !monster->mon_see_grid(monster->target, !glass_ok))) + || !monster->mon_see_cell(monster->target, !glass_ok))) { monster_pathfind mp; if (mp.init_pathfind(monster, monster->target)) @@ -5439,7 +5439,7 @@ static void _handle_movement(monsters *monster) } // We're already staying in the player's LOS. - if (see_grid(old_pos + mmov)) + if (see_cell(old_pos + mmov)) return; // Try to find a move that brings us closer to the player while @@ -5457,7 +5457,7 @@ static void _handle_movement(monsters *monster) delta.set(i - 1, j - 1); coord_def tmp = old_pos + delta; - if (grid_distance(you.pos(), tmp) < old_dist && see_grid(tmp)) + if (grid_distance(you.pos(), tmp) < old_dist && see_cell(tmp)) { if (one_chance_in(++matches)) mmov = delta; @@ -6461,7 +6461,7 @@ static bool _handle_reaching(monsters *monster) // This check isn't redundant -- player may be invisible. if (monster->target == you.pos() && grid_distance(monster->pos(), you.pos()) == 2 - && (see_grid_no_trans(monster->pos()) + && (see_cell_no_trans(monster->pos()) || grd(middle) > DNGN_MAX_NONREACH)) { ret = true; @@ -6474,7 +6474,7 @@ static bool _handle_reaching(monsters *monster) coord_def foepos = mfoe.pos(); // Same comments as to invisibility as above. if (monster->target == foepos - && monster->mon_see_grid(foepos, true) + && monster->mon_see_cell(foepos, true) && grid_distance(monster->pos(), foepos) == 2) { ret = true; @@ -8521,10 +8521,10 @@ static bool _do_move_monster(monsters *monster, const coord_def& delta) // The monster gave a "comes into view" message and then immediately // moved back out of view, leaing the player nothing to see, so give // this message to avoid confusion. - if (monster->seen_context == _just_seen && !see_grid(f)) + if (monster->seen_context == _just_seen && !see_cell(f)) simple_monster_message(monster, " moves out of view."); else if (Options.tutorial_left && (monster->flags & MF_WAS_IN_VIEW) - && !see_grid(f)) + && !see_cell(f)) { learned_something_new(TUT_MONSTER_LEFT_LOS, monster->pos()); } @@ -8749,13 +8749,13 @@ static void _mons_open_door(monsters* monster, const coord_def &pos) i != all_door.end(); ++i) { const coord_def& dc = *i; - if (grd(dc) == DNGN_SECRET_DOOR && see_grid(dc)) + if (grd(dc) == DNGN_SECRET_DOOR && see_cell(dc)) { grid = grid_secret_door_appearance(dc); was_secret = true; } - if (see_grid(dc)) + if (see_cell(dc)) was_seen = true; else set_terrain_changed(dc); @@ -8886,7 +8886,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, } // Wandering mushrooms don't move while you are looking. - if (monster->type == MONS_WANDERING_MUSHROOM && see_grid(targ)) + if (monster->type == MONS_WANDERING_MUSHROOM && see_cell(targ)) return (false); // Water elementals avoid fire and heat. @@ -9219,7 +9219,7 @@ static bool _monster_move(monsters *monster) _jelly_grows(monster); - if (see_grid(newpos)) + if (see_cell(newpos)) { viewwindow(true, false); diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index ef95a45c67..bb23dfd7fb 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -695,7 +695,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, if (spell_is_direct_explosion(spell_cast)) { const actor *foe = monster->get_foe(); - const bool need_more = foe && (foe == &you || see_grid(foe->pos())); + const bool need_more = foe && (foe == &you || see_cell(foe->pos())); pbolt.in_explosion_phase = false; pbolt.explode(need_more); } @@ -927,7 +927,7 @@ void mons_cast_noise(monsters *monster, bolt &pbolt, spell_type spell_cast) { target = "DEAD FOE"; } - else if (in_bounds(pbolt.target) && see_grid(pbolt.target)) + else if (in_bounds(pbolt.target) && see_cell(pbolt.target)) { if (const monsters* mtarg = monster_at(pbolt.target)) { diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index e52ed53ea6..2c4ec2a69f 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -547,7 +547,7 @@ bool expose_items_to_element(beam_type flavour, const coord_def& where, if (flavour == BEAM_STEAL_FOOD) return (true); - if (see_grid(where)) + if (see_cell(where)) { switch (target_class) { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 111147c503..4cccea0a48 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2998,7 +2998,7 @@ void forget_map(unsigned char chance_forgotten, bool force) : 25*25; for (rectangle_iterator ri(0); ri; ++ri) { - if (!see_grid(*ri) + if (!see_cell(*ri) && (force || x_chance_in_y(chance_forgotten, 100) || use_lab_check && (you.pos()-*ri).abs() > radius)) { diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 5fc5a51949..81bc558f2c 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -8193,7 +8193,7 @@ int get_tension(god_type god, bool count_travelling) if (!mons->alive()) continue; - if (see_grid(mons->pos())) + if (see_cell(mons->pos())) { // Monster is nearby. if (!nearby_monster && !mons_wont_attack(mons)) @@ -8215,7 +8215,7 @@ int get_tension(god_type god, bool count_travelling) target = mons->target; // Monster is neither nearby nor trying to get near us. - if (!in_bounds(target) || !see_grid(target)) + if (!in_bounds(target) || !see_cell(target)) continue; } diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 57b01695a7..e400801e37 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -141,7 +141,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) mesclr(); mpr("You can't blink into the sea!"); } - else if (see_grid_no_trans(beam.target)) + else if (see_cell_no_trans(beam.target)) { // Grid in los, no problem. break; @@ -393,8 +393,8 @@ void cast_chain_lightning(int pow) } } - const bool see_source = see_grid( source ); - const bool see_targ = see_grid( target ); + const bool see_source = see_cell( source ); + const bool see_targ = see_cell( target ); if (target.x == -1) { @@ -414,7 +414,7 @@ void cast_chain_lightning(int pow) else if (!see_source && see_targ) mpr("The lightning arc suddenly appears!"); - if (!see_grid_no_trans( target )) + if (!see_cell_no_trans( target )) { // It's no longer in the caster's LOS and influence. pow = pow / 2 + 1; diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 9bc1681695..4e611af001 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -147,7 +147,7 @@ static bool _mark_detected_creature(coord_def where, const monsters *mon, // If the player would be able to see a monster at this location // don't place it there. - if (see_grid(place)) + if (see_cell(place)) continue; // Try not to overwrite another detected monster. @@ -220,7 +220,7 @@ void corpse_rot() { for (radius_iterator ri(you.pos(), 6); ri; ++ri) { - if (see_grid_no_trans(*ri) && !is_sanctuary(*ri) + if (see_cell_no_trans(*ri) && !is_sanctuary(*ri) && env.cgrid(*ri) == EMPTY_CLOUD) { for (stack_iterator si(*ri); si; ++si) @@ -1838,7 +1838,7 @@ int fungal_bloom() destroy_item(j->index()); } - if (corpse_on_pos && see_grid(*i)) + if (corpse_on_pos && see_cell(*i)) seen_corpses++; } } @@ -1872,7 +1872,7 @@ int create_plant(coord_def & target) if (plant != -1) { env.mons[plant].flags |= MF_ATT_CHANGE_ATTEMPT; - if (see_grid(target)) + if (see_cell(target)) mpr("A plant grows up from the ground."); } @@ -1941,7 +1941,7 @@ bool sunlight() if (grd(target) != ftype) { grd(target) = ftype; - if (see_grid(target)) + if (see_cell(target)) evap_count++; } @@ -1976,7 +1976,7 @@ bool sunlight() MG_FORCE_PLACE, GOD_FEAWN)); - if (plant != -1 && see_grid(target)) + if (plant != -1 && see_cell(target)) plant_count++; } } @@ -2037,7 +2037,7 @@ void path_distance(coord_def & origin, for (adjacent_iterator adj_it(current.first); adj_it; ++adj_it) { idx = adj_it->x + adj_it->y * X_WIDTH; - if (see_grid(*adj_it) + if (see_cell(*adj_it) && !grid_is_solid(env.grid(*adj_it)) && exclusion.insert(idx).second) { diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index b6b07dcf85..5ec06009a8 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -943,7 +943,7 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha, // Headless hydras cannot be raised, sorry. if (zombie_type == MONS_HYDRA && number == 0) { - if (see_grid(pos)) + if (see_cell(pos)) { mpr("The zero-headed hydra corpse sways and immediately " "collapses!"); @@ -1028,7 +1028,7 @@ int animate_remains(const coord_def &a, corpse_type class_allowed, : "attack"); } - if (!quiet && see_grid(a)) + if (!quiet && see_cell(a)) mpr("The dead are walking!"); if (was_butchering) @@ -1074,7 +1074,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, actual, true) > 0) { number_raised++; - if (see_grid(*ri)) + if (see_cell(*ri)) number_seen++; } } @@ -1508,7 +1508,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) if (is_controlled) { - if (!see_grid(pos)) + if (!see_cell(pos)) large_change = true; // Merfolk should be able to control-tele into deep water. @@ -1580,7 +1580,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) if ( newpos == you.pos() ) mpr("Your surroundings flicker for a moment."); - else if ( see_grid(newpos) ) + else if ( see_cell(newpos) ) mpr("Your surroundings seem slightly different."); else { @@ -1765,7 +1765,7 @@ bool remove_sanctuary(bool did_attack) if (is_sanctuary(*ri)) { _remove_sanctuary_property(*ri); - if (see_grid(*ri)) + if (see_cell(*ri)) seen_change = true; } } @@ -1826,7 +1826,7 @@ void decrease_sanctuary_radius() if (!size) { _remove_sanctuary_property(env.sanctuary_pos); - if (see_grid(env.sanctuary_pos)) + if (see_cell(env.sanctuary_pos)) mpr("The sanctuary disappears.", MSGCH_DURATION); } } @@ -1877,7 +1877,7 @@ bool cast_sanctuary(const int power) continue; const coord_def pos = *ri; - if (testbits(env.map(pos).property, FPROP_BLOODY) && see_grid(pos)) + if (testbits(env.map(pos).property, FPROP_BLOODY) && see_cell(pos)) blood_count++; if (trap_def* ptrap = find_trap(pos)) @@ -1958,7 +1958,7 @@ bool cast_sanctuary(const int power) if (!is_harmless_cloud(cloud_type_at(pos))) { delete_cloud(env.cgrid(pos)); - if (see_grid(pos)) + if (see_cell(pos)) cloud_count++; } } // radius loop @@ -2074,7 +2074,7 @@ bool project_noise(void) if (success) { mprf(MSGCH_SOUND, "You hear a %svoice call your name.", - (!see_grid( pos ) ? "distant " : "") ); + (!see_cell( pos ) ? "distant " : "") ); } else mprf(MSGCH_SOUND, "You hear a dull thud."); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 0339e79934..3c10f9385a 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -221,7 +221,7 @@ static int _shatter_walls(coord_def where, int pow, int, actor *) switch (grid) { case DNGN_SECRET_DOOR: - if (see_grid(where)) + if (see_cell(where)) mpr("A secret door shatters!"); chance = 100; break; @@ -229,7 +229,7 @@ static int _shatter_walls(coord_def where, int pow, int, actor *) case DNGN_CLOSED_DOOR: case DNGN_DETECTED_SECRET_DOOR: case DNGN_OPEN_DOOR: - if (see_grid(where)) + if (see_cell(where)) mpr("A door shatters!"); chance = 100; break; @@ -1969,7 +1969,7 @@ static int _quadrant_blink(coord_def where, int pow, int, actor *) if (distance(base, target) > 10 || distance(you.pos(), target) < 8) continue; - if (!see_grid_no_trans(target)) + if (!see_cell_no_trans(target)) continue; found = true; diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 48e1d3ccd3..521e84acdd 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -635,7 +635,7 @@ static int _get_dist_to_nearest_monster() continue; // Can we see (and reach) the grid? - if (!see_grid_no_trans(*ri)) + if (!see_cell_no_trans(*ri)) continue; const monsters *mon = monster_at(*ri); diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index c3097b0e53..083cc13d14 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -484,7 +484,7 @@ int apply_area_visible(cell_func cf, int power, int rv = 0; for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri) - if (pass_through_trans || see_grid_no_trans(*ri)) + if (pass_through_trans || see_cell_no_trans(*ri)) rv += cf(*ri, power, 0, agent); return (rv); diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index d35a5a9751..6eb97aba92 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -1546,7 +1546,7 @@ void StashTracker::update_visible_stashes( for (int cy = crawl_view.glos1.y; cy <= crawl_view.glos2.y; ++cy) for (int cx = crawl_view.glos1.x; cx <= crawl_view.glos2.x; ++cx) { - if (!in_bounds(cx, cy) || !see_grid(cx, cy)) + if (!in_bounds(cx, cy) || !see_cell(cx, cy)) continue; const dungeon_feature_type grid = grd[cx][cy]; diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 21b500954c..330f436610 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -207,9 +207,9 @@ bool interrupt_cmd_repeat( activity_interrupt_type ai, formatted_string fs( channel_to_colour(MSGCH_WARN) ); fs.cprintf("%s (", mon->name(DESC_PLAIN, true).c_str()); fs.add_glyph( mon ); - fs.cprintf(") in view: (%d,%d), see_grid: %s", + fs.cprintf(") in view: (%d,%d), see_cell: %s", mon->pos().x, mon->pos().y, - see_grid(mon->pos())? "yes" : "no"); + see_cell(mon->pos())? "yes" : "no"); formatted_mpr(fs, MSGCH_WARN); #endif diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 89212293ce..667a5fff53 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -264,9 +264,9 @@ bool radius_iterator::on_valid_square() const return (false); if (require_los) { - if (!losgrid && !see_grid(location)) + if (!losgrid && !see_cell(location)) return (false); - if (losgrid && !see_grid(*losgrid, center, location)) + if (losgrid && !see_cell(*losgrid, center, location)) return (false); } if (exclude_center && location == center) diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 69f9ec4240..ad0b33ee11 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -604,7 +604,7 @@ void dungeon_terrain_changed(const coord_def &pos, unnotice_feature(level_pos(level_id::current(), pos)); grd(pos) = nfeat; env.grid_colours(pos) = BLACK; - if (is_notable_terrain(nfeat) && see_grid(pos)) + if (is_notable_terrain(nfeat) && see_cell(pos)) seen_notable_thing(nfeat, pos); // Don't destroy a trap which was just placed. @@ -627,7 +627,7 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos) const std::string orig_name = feature_description(dest_pos, false, - see_grid(orig_pos) ? DESC_CAP_THE : DESC_CAP_A, + see_cell(orig_pos) ? DESC_CAP_THE : DESC_CAP_A, false); std::string prep = grid_preposition(orig_feat, false); @@ -651,13 +651,13 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos) std::ostringstream str; str << orig_name << " "; - if (see_grid(orig_pos) && !see_grid(dest_pos)) + if (see_cell(orig_pos) && !see_cell(dest_pos)) { str << "suddenly disappears"; if (!orig_actor.empty()) str << " from " << prep << " " << orig_actor; } - else if (!see_grid(orig_pos) && see_grid(dest_pos)) + else if (!see_cell(orig_pos) && see_cell(dest_pos)) { str << "suddenly appears"; if (!dest_actor.empty()) @@ -677,7 +677,7 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos) static void _announce_swap(coord_def pos1, coord_def pos2) { - if (!see_grid(pos1) && !see_grid(pos2)) + if (!see_cell(pos1) && !see_cell(pos2)) return; const dungeon_feature_type feat1 = grd(pos1); @@ -686,8 +686,8 @@ static void _announce_swap(coord_def pos1, coord_def pos2) if (feat1 == feat2) return; - const bool notable_seen1 = is_notable_terrain(feat1) && see_grid(pos1); - const bool notable_seen2 = is_notable_terrain(feat2) && see_grid(pos2); + const bool notable_seen1 = is_notable_terrain(feat1) && see_cell(pos1); + const bool notable_seen2 = is_notable_terrain(feat2) && see_cell(pos2); coord_def orig_pos, dest_pos; if (notable_seen1 && notable_seen2) @@ -699,7 +699,7 @@ static void _announce_swap(coord_def pos1, coord_def pos2) _announce_swap_real(pos2, pos1); else if (notable_seen2) _announce_swap_real(pos1, pos2); - else if (see_grid(pos2)) + else if (see_cell(pos2)) _announce_swap_real(pos1, pos2); else _announce_swap_real(pos2, pos1); @@ -717,13 +717,13 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, const dungeon_feature_type feat1 = grd(pos1); const dungeon_feature_type feat2 = grd(pos2); - if (is_notable_terrain(feat1) && !see_grid(pos1) + if (is_notable_terrain(feat1) && !see_cell(pos1) && is_terrain_known(pos1)) { return (false); } - if (is_notable_terrain(feat2) && !see_grid(pos2) + if (is_notable_terrain(feat2) && !see_cell(pos2) && is_terrain_known(pos2)) { return (false); diff --git a/crawl-ref/source/test/findray.lua b/crawl-ref/source/test/findray.lua index 72f9526f15..1b0248494b 100644 --- a/crawl-ref/source/test/findray.lua +++ b/crawl-ref/source/test/findray.lua @@ -20,7 +20,7 @@ local function test_findray() for x = -8, 8 do if x ~= 0 or y ~= 0 then local px, py = x + you_x, y + you_y - if you.see_grid_no_trans(px, py) then + if you.see_cell_no_trans(px, py) then table.insert(visible_spots, { px, py }) end end diff --git a/crawl-ref/source/test/los_maps.lua b/crawl-ref/source/test/los_maps.lua index 769cd251ec..f6ac2a2591 100644 --- a/crawl-ref/source/test/los_maps.lua +++ b/crawl-ref/source/test/los_maps.lua @@ -30,7 +30,7 @@ local function test_los_map(map) local should_see = ((x == 0 and y == 0) or dgn.grid(xa, ya) == rock_wall or dgn.grid(xa, ya) == floor) - local can_see = you.see_grid(xa, ya) + local can_see = you.see_cell(xa, ya) if can_see and (not should_see) then assert(false, "los error in " .. name .."(iter #" .. checks .. "): can see " .. p .. " but shouldn't.") diff --git a/crawl-ref/source/test/los_symm.lua b/crawl-ref/source/test/los_symm.lua index 43bce66928..eac1db7577 100644 --- a/crawl-ref/source/test/los_symm.lua +++ b/crawl-ref/source/test/los_symm.lua @@ -20,7 +20,7 @@ local function test_losight_symmetry() for x = -8, 8 do if x ~= 0 or y ~= 0 then local px, py = x + you_x, y + you_y - if you.see_grid(px, py) then + if you.see_cell(px, py) then table.insert(visible_spots, { px, py }) end end @@ -33,7 +33,7 @@ local function test_losight_symmetry() local x, y = unpack(spot) you.moveto(x, y) you.losight() - if not you.see_grid(you_x, you_y) then + if not you.see_cell(you_x, you_y) then -- Draw the view to show the problem. crawl.redraw_view() local this_p = dgn.point(x, y) diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 80915be39e..6a150a4b05 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2995,7 +2995,7 @@ static inline void _finalise_tile(unsigned int *tile, else if (orig < TILE_DNGN_MAX) { // Some tiles may change from turn to turn, but only if in view. - if (orig >= TILE_DNGN_LAVA && orig < TILE_BLOOD && see_grid(gc)) + if (orig >= TILE_DNGN_LAVA && orig < TILE_BLOOD && see_cell(gc)) env.tile_flv(gc).special = random2(256); (*tile) = orig + (special_flv % tile_dngn_count(orig)); @@ -4771,7 +4771,7 @@ void tile_finish_dngn(unsigned int *tileb, int cx, int cy) bool print_blood = true; if (inside_halo(gc)) { - if (see_grid(gc) && mgrd(gc) != NON_MONSTER) + if (see_cell(gc) && mgrd(gc) != NON_MONSTER) { monsters* m = &menv[mgrd(gc)]; if (!mons_class_flag(m->type, M_NO_EXP_GAIN) diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 819b96ae5b..35598704b6 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -964,7 +964,7 @@ void DungeonRegion::pack_buffers() } pack_cursor(CURSOR_TUTORIAL, TILE_TUTORIAL_CURSOR); - pack_cursor(CURSOR_MOUSE, see_grid(m_cursor[CURSOR_MOUSE]) ? TILE_CURSOR + pack_cursor(CURSOR_MOUSE, see_cell(m_cursor[CURSOR_MOUSE]) ? TILE_CURSOR : TILE_CURSOR2); if (m_cursor[CURSOR_TUTORIAL] != NO_CURSOR @@ -1492,7 +1492,7 @@ bool DungeonRegion::update_alt_text(std::string &alt) return (false); describe_info inf; - if (see_grid(gc)) + if (see_cell(gc)) get_square_desc(gc, inf, true); else if (grd(gc) != DNGN_FLOOR) get_feature_desc(gc, inf); diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index d1dc8fb92a..f6dc4ae676 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -307,7 +307,7 @@ void check_net_will_hold_monster(monsters *mons) if (net != NON_ITEM) destroy_item(net); - if (see_grid(mons->pos())) + if (see_cell(mons->pos())) { if (player_monster_visible(mons)) { @@ -347,7 +347,7 @@ void trap_def::trigger(actor& triggerer, bool flat_footed) const bool trig_knows = !flat_footed && this->is_known(&triggerer); const bool you_trigger = (triggerer.atype() == ACT_PLAYER); - const bool in_sight = see_grid(this->pos); + const bool in_sight = see_cell(this->pos); // If set, the trap will be removed at the end of the // triggering process. @@ -1121,7 +1121,7 @@ void trap_def::shoot_ammo(actor& act, bool was_known) { if (was_known && act.atype() == ACT_PLAYER) mpr("The trap is out of ammunition!"); - else if (player_can_hear(this->pos) && see_grid(this->pos)) + else if (player_can_hear(this->pos) && see_cell(this->pos)) mpr("You hear a soft click."); this->disarm(); @@ -1210,7 +1210,7 @@ void trap_def::shoot_ammo(actor& act, bool was_known) // Determine whether projectile hits. bool hit = (trap_hit >= act.melee_evasion(NULL)); - if (see_grid(act.pos())) + if (see_cell(act.pos())) { mprf("%s %s %s%s!", shot.name(DESC_CAP_A).c_str(), diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 10c080aa62..346c04bd25 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -319,7 +319,7 @@ bool travel_exclude::affects(const coord_def& p) const if (!uptodate) mprf(MSGCH_ERROR, "exclusion not up-to-date: e (%d,%d) p (%d,%d)", pos.x, pos.y, p.x, p.y); - return (see_grid(show, pos, p)); + return (see_cell(show, pos, p)); } void init_exclusion_los() @@ -1991,7 +1991,7 @@ void find_travel_pos(const coord_def& youpos, { coord_def unseen = coord_def(); for (adjacent_iterator ai(dest); ai; ++ai) - if (!see_grid(*ai) + if (!see_cell(*ai) && (!is_terrain_seen(*ai) || !grid_is_wall(grd(*ai)))) { unseen = *ai; diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index 14fc9ca3d4..3420909acb 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -4454,7 +4454,7 @@ static bool _water_is_disturbed(int x, int y) const coord_def c(x,y); const monsters *mon = monster_at(c); - if (mon == NULL || grd(c) != DNGN_SHALLOW_WATER || !see_grid(c)) + if (mon == NULL || grd(c) != DNGN_SHALLOW_WATER || !see_cell(c)) return (false); return (!player_monster_visible(mon) && !mons_flies(mon)); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index b3ddaad12c..9c3e465c1c 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -707,7 +707,7 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, #endif dungeon_feature_type grid_value = grd(p); - if (!see_grid(p)) + if (!see_cell(p)) { const int remembered = get_envmap_obj(p); if (remembered < NUM_REAL_FEATURES) @@ -763,7 +763,7 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, const int olddist = grid_distance(you.pos(), mon.pos()); const int newdist = grid_distance(p, mon.pos()); - if (olddist < newdist || !see_grid(env.show, p, mon.pos())) + if (olddist < newdist || !see_cell(env.show, p, mon.pos())) { blocked_movement = true; break; @@ -1738,7 +1738,7 @@ void cloud_grid(void) if (env.cloud[s].type != CLOUD_NONE) { mnc++; - if (see_grid(env.cloud[s].pos)) + if (see_cell(env.cloud[s].pos)) _update_cloud_grid(s); } } @@ -1857,7 +1857,7 @@ void blood_smell( int strength, const coord_def& where ) #endif you.check_awaken(range - player_distance); // Don't message if you can see the square. - if (!see_grid(where)) + if (!see_cell(where)) { mprf("You smell fresh blood%s.", _player_vampire_smells_blood(player_distance)); @@ -1950,7 +1950,7 @@ void blood_smell( int strength, const coord_def& where ) // 5. Anything else will look for the exact same character in the level map. bool is_feature(int feature, const coord_def& where) { - if (!env.map(where).object && !see_grid(where)) + if (!env.map(where).object && !see_cell(where)) return (false); dungeon_feature_type grid = grd(where); @@ -2950,7 +2950,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, } // Realise that this is simply a repackaged version of -// stuff::see_grid() -- make certain they correlate {dlb}: +// stuff::see_cell() -- make certain they correlate {dlb}: bool mons_near(const monsters *monster, unsigned short foe) { // Early out -- no foe! @@ -2974,7 +2974,7 @@ bool mons_near(const monsters *monster, unsigned short foe) // Must be a monster. const monsters *myFoe = &menv[foe]; if (myFoe->alive()) - return (monster->mon_see_grid(myFoe->pos())); + return (monster->mon_see_cell(myFoe->pos())); return (false); } @@ -4147,7 +4147,7 @@ void viewwindow(bool draw_it, bool do_updates) const coord_def sep = ep - coord_def(1,1); #endif - if (in_bounds(gc) && see_grid(gc)) + if (in_bounds(gc) && see_cell(gc)) maybe_remove_autoexclusion(gc); // Print tutorial messages for features in LOS. @@ -4346,16 +4346,16 @@ void viewwindow(bool draw_it, bool do_updates) if (flash_colour && buffy[bufcount]) { buffy[bufcount + 1] = - see_grid(gc) ? real_colour(flash_colour) + see_cell(gc) ? real_colour(flash_colour) : DARKGREY; } else if (Options.target_range > 0 && buffy[bufcount] && (grid_distance(you.pos(), gc) > Options.target_range - || !see_grid(gc))) + || !see_cell(gc))) { buffy[bufcount + 1] = DARKGREY; #ifdef USE_TILE - if (see_grid(gc)) + if (see_cell(gc)) tileb[bufcount + 1] |= TILE_FLAG_OOR; #endif } diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 8c30858bcb..eccfed5285 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1540,7 +1540,7 @@ static int _xom_swap_weapons(bool debug = false) if (!m->alive()) continue; - if (!see_grid(m->pos())) + if (!see_cell(m->pos())) continue; if (!wpn || mons_wont_attack(m) || mons_is_summoned(m) @@ -1676,7 +1676,7 @@ static int _xom_rearrange_pieces(int sever, bool debug = false) if (!m->alive()) continue; - if (!see_grid(m->pos())) + if (!see_cell(m->pos())) continue; mons.push_back(m); @@ -1740,7 +1740,7 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false) if (!m->alive()) continue; - if (!see_grid(m->pos())) + if (!see_cell(m->pos())) continue; if (mons_wont_attack(m) || mons_is_summoned(m) @@ -1985,7 +1985,7 @@ static int _xom_change_scenery(bool debug = false) std::vector candidates; for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true); ri; ++ri) { - if (!in_bounds(*ri) || !see_grid(*ri)) + if (!in_bounds(*ri) || !see_cell(*ri)) continue; dungeon_feature_type feat = grd(*ri); @@ -2012,7 +2012,7 @@ static int _xom_change_scenery(bool debug = false) { if ((random_near_space(you.pos(), place) || random_near_space(you.pos(), place, true)) - && grd(place) == DNGN_FLOOR && see_grid(place)) + && grd(place) == DNGN_FLOOR && see_cell(place)) { if (debug) return (XOM_GOOD_SCENERY); @@ -2950,7 +2950,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) bool found_stairs = false; int past_stairs = 0; - while (in_bounds(ray.pos()) && see_grid(ray.pos()) + while (in_bounds(ray.pos()) && see_cell(ray.pos()) && !grid_is_solid(ray.pos()) && ray.pos() != you.pos()) { if (ray.pos() == stair_pos) @@ -2987,7 +2987,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (!in_bounds(ray.pos()) || ray.pos() == you.pos()) ray.regress(); - while (!see_grid(ray.pos()) || grd(ray.pos()) != DNGN_FLOOR) + while (!see_cell(ray.pos()) || grd(ray.pos()) != DNGN_FLOOR) { ray.regress(); if (!in_bounds(ray.pos()) || ray.pos() == you.pos() -- cgit v1.2.3-54-g00ecf