From dcc94e4df24a1111124d87532aaa263f55edf58d Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 17 Oct 2009 07:51:25 +0200 Subject: Naming consistency. Mostly rename functions from terrain.h that accept features of typ dgn_feature_type from grid_is_* to feat_is_*. --- crawl-ref/source/abyss.cc | 10 +-- crawl-ref/source/acr.cc | 14 ++-- crawl-ref/source/beam.cc | 38 ++++----- crawl-ref/source/cloud.cc | 4 +- crawl-ref/source/debug.cc | 10 +-- crawl-ref/source/decks.cc | 4 +- crawl-ref/source/directn.cc | 12 +-- crawl-ref/source/dungeon.cc | 56 ++++++------- crawl-ref/source/dungeon.h | 12 +-- crawl-ref/source/effects.cc | 44 +++++----- crawl-ref/source/fight.cc | 4 +- crawl-ref/source/files.cc | 6 +- crawl-ref/source/it_use2.cc | 2 +- crawl-ref/source/item_use.cc | 4 +- crawl-ref/source/items.cc | 8 +- crawl-ref/source/losparam.cc | 6 +- crawl-ref/source/luadgn.cc | 8 +- crawl-ref/source/maps.cc | 6 +- crawl-ref/source/misc.cc | 40 ++++----- crawl-ref/source/mon-util.cc | 30 +++---- crawl-ref/source/monplace.cc | 98 +++++++++++----------- crawl-ref/source/monplace.h | 2 +- crawl-ref/source/monstuff.cc | 50 ++++++------ crawl-ref/source/mstuff2.cc | 4 +- crawl-ref/source/overmap.cc | 6 +- crawl-ref/source/player.cc | 22 ++--- crawl-ref/source/player.h | 2 +- crawl-ref/source/ray.cc | 6 +- crawl-ref/source/religion.cc | 14 ++-- crawl-ref/source/spells1.cc | 10 +-- crawl-ref/source/spells2.cc | 6 +- crawl-ref/source/spells3.cc | 6 +- crawl-ref/source/spells4.cc | 6 +- crawl-ref/source/spl-mis.cc | 6 +- crawl-ref/source/spl-util.cc | 2 +- crawl-ref/source/stash.cc | 4 +- crawl-ref/source/stuff.cc | 2 +- crawl-ref/source/terrain.cc | 188 +++++++++++++++++++++---------------------- crawl-ref/source/terrain.h | 50 ++++++------ crawl-ref/source/tilepick.cc | 8 +- crawl-ref/source/tilereg.cc | 22 ++--- crawl-ref/source/travel.cc | 36 ++++----- crawl-ref/source/travel.h | 16 ++-- crawl-ref/source/tutorial.cc | 10 +-- crawl-ref/source/view.cc | 36 ++++----- crawl-ref/source/xom.cc | 38 ++++----- 46 files changed, 484 insertions(+), 484 deletions(-) diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index f8c331ad00..13bc428e2c 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -688,7 +688,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos) const coord_def p( pos.x + random2avg(4, 3) + random2(3), pos.y + random2avg(4, 3) + random2(3) ); if (!in_bounds(p) || actor_at(p) - || !grid_compatible(DNGN_FLOOR, grd(p))) + || !feat_compatible(DNGN_FLOOR, grd(p))) { continue; } @@ -754,7 +754,7 @@ static bool _is_grid_corruptible(const coord_def &c) const dungeon_feature_type feat = grd(c); // Stairs and portals cannot be corrupted. - if (grid_stair_direction(feat) != CMD_NO_CMD) + if (feat_stair_direction(feat) != CMD_NO_CMD) return (false); switch (feat) @@ -802,7 +802,7 @@ static bool _is_crowded_square(const coord_def &c) static bool _is_sealed_square(const coord_def &c) { for (adjacent_iterator ai(c); ai; ++ai) - if ( !grid_is_opaque(grd(*ai)) ) + if ( !feat_is_opaque(grd(*ai)) ) return (false); return (true); @@ -813,7 +813,7 @@ static void _corrupt_square(const crawl_environment &oenv, const coord_def &c) // To prevent the destruction of, say, branch entries. bool preserve_feat = true; dungeon_feature_type feat = DNGN_UNSEEN; - if (grid_altar_god(grd(c)) != GOD_NO_GOD) + if (feat_altar_god(grd(c)) != GOD_NO_GOD) { // altars may be safely overwritten, ha! preserve_feat = false; @@ -823,7 +823,7 @@ static void _corrupt_square(const crawl_environment &oenv, const coord_def &c) else feat = oenv.grid(c); - if (grid_is_trap(feat, true) + if (feat_is_trap(feat, true) || feat == DNGN_SECRET_DOOR || feat == DNGN_UNSEEN) { return; diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index abe9ec0ec8..e4ba83d5cd 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1204,7 +1204,7 @@ static void _go_upstairs() shop(); return; } - else if (grid_stair_direction(ygrd) != CMD_GO_UPSTAIRS) + else if (feat_stair_direction(ygrd) != CMD_GO_UPSTAIRS) { if (ygrd == DNGN_STONE_ARCH) mpr("There is nothing on the other side of the stone arch."); @@ -1243,7 +1243,7 @@ static void _go_downstairs() return; } - if (grid_stair_direction(grd(you.pos())) != CMD_GO_DOWNSTAIRS + if (feat_stair_direction(grd(you.pos())) != CMD_GO_DOWNSTAIRS && !shaft) { if (grd(you.pos()) == DNGN_STONE_ARCH) @@ -3041,7 +3041,7 @@ static bool _untrap_target(const coord_def move, bool check_confused) } const dungeon_feature_type feat = grd(target); - if (!grid_is_closed_door(feat) || you.confused()) + if (!feat_is_closed_door(feat) || you.confused()) { switch (feat) { @@ -3053,7 +3053,7 @@ static bool _untrap_target(const coord_def move, bool check_confused) bool do_msg = true; // Press trigger/switch/button in wall. - if (grid_is_solid(feat)) + if (feat_is_solid(feat)) { dgn_event event(DET_WALL_HIT, target); event.arg1 = NON_MONSTER; @@ -3160,7 +3160,7 @@ static void _open_door(coord_def move, bool check_confused) const dungeon_feature_type feat = (in_bounds(doorpos) ? grd(doorpos) : DNGN_UNSEEN); - if (!grid_is_closed_door(feat)) + if (!feat_is_closed_door(feat)) { if (you.confused()) { @@ -3740,7 +3740,7 @@ static void _move_player(coord_def move) dungeon_feature_type dangerous = DNGN_FLOOR; for (adjacent_iterator ai(you.pos(), false); ai; ++ai) { - if (is_grid_dangerous(grd(*ai)) + if (is_feat_dangerous(grd(*ai)) && (dangerous == DNGN_FLOOR || grd(*ai) == DNGN_LAVA)) { dangerous = grd(*ai); @@ -3871,7 +3871,7 @@ static void _move_player(coord_def move) } // BCR - Easy doors single move - if (Options.easy_open && !attacking && grid_is_closed_door(targ_grid)) + if (Options.easy_open && !attacking && feat_is_closed_door(targ_grid)) { _open_door(move.x, move.y, false); you.prev_move = move; diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 224ac15eb0..83736773da 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -1433,7 +1433,7 @@ static void _munge_bounced_bolt(bolt &old_bolt, bolt &new_bolt, // is shot into an inside corner. ray_def test_ray = temp_ray; test_ray.advance(true); - if (in_bounds(test_ray.pos()) && !grid_is_solid(test_ray.pos())) + if (in_bounds(test_ray.pos()) && !cell_is_solid(test_ray.pos())) break; shift = 0.0; @@ -1651,15 +1651,15 @@ void bolt::bounce() { do ray.regress(); - while (grid_is_solid(grd(ray.pos()))); + while (feat_is_solid(grd(ray.pos()))); bounce_pos = ray.pos(); ray.advance_and_bounce(); range_used += 2; } - while (range_used < range && grid_is_solid(grd(ray.pos()))); + while (range_used < range && feat_is_solid(grd(ray.pos()))); - if (!grid_is_solid(grd(ray.pos()))) + if (!feat_is_solid(grd(ray.pos()))) _munge_bounced_bolt(old_bolt, *this, old_ray, ray); } @@ -1698,7 +1698,7 @@ void bolt::digging_wall_effect() msg_generated = true; } } - else if (grid_is_wall(feat)) + else if (feat_is_wall(feat)) finish_beam(); } @@ -1832,7 +1832,7 @@ void bolt::affect_wall() else if (flavour == BEAM_DISINTEGRATION || flavour == BEAM_NUKE) nuke_wall_effect(); - if (grid_is_solid(pos())) + if (cell_is_solid(pos())) finish_beam(); } @@ -1847,13 +1847,13 @@ coord_def bolt::pos() const void bolt::hit_wall() { const dungeon_feature_type feat = grd(pos()); - ASSERT( grid_is_solid(feat) ); + ASSERT( feat_is_solid(feat) ); 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_cell(target) - && !grid_is_solid(grd(target))) + && !feat_is_solid(grd(target))) { // Okay, with all those tests passed, this is probably an instance // of the player manually targetting something whose line of fire @@ -1909,7 +1909,7 @@ void bolt::hit_wall() { do ray.regress(); - while (ray.pos() != source && grid_is_solid(ray.pos())); + while (ray.pos() != source && cell_is_solid(ray.pos())); // target is where the explosion is centered, so update it. if (is_explosion && !is_tracer) @@ -1928,7 +1928,7 @@ void bolt::affect_cell(bool avoid_self) fake_flavour(); const coord_def old_pos = pos(); - const bool was_solid = grid_is_solid(grd(pos())); + const bool was_solid = feat_is_solid(grd(pos())); bool avoid_monster = (avoid_self && this->thrower == KILL_MON_MISSILE); bool avoid_player = (avoid_self && this->thrower != KILL_MON_MISSILE); @@ -1974,7 +1974,7 @@ void bolt::affect_cell(bool avoid_self) affect_monster(m); } - if (!grid_is_solid(grd(pos()))) + if (!feat_is_solid(grd(pos()))) affect_ground(); } @@ -2112,7 +2112,7 @@ void bolt::do_fire() break; } - ASSERT((!grid_is_solid(grd(pos())) || avoid_self) + ASSERT((!feat_is_solid(grd(pos())) || avoid_self) || is_tracer && affects_wall(grd(pos()))); const bool was_seen = seen; @@ -2886,7 +2886,7 @@ void mimic_alert(monsters *mimic) bool bolt::is_bouncy(dungeon_feature_type feat) const { - if (real_flavour == BEAM_CHAOS && grid_is_solid(feat)) + if (real_flavour == BEAM_CHAOS && feat_is_solid(feat)) return (true); if (is_enchantment()) @@ -3172,12 +3172,12 @@ void bolt::affect_place_clouds() // Fire/cold over water/lava if (feat == DNGN_LAVA && flavour == BEAM_COLD - || grid_is_watery(feat) && is_fiery()) + || feat_is_watery(feat) && is_fiery()) { place_cloud(CLOUD_STEAM, p, 2 + random2(5), whose_kill(), killer()); } - if (grid_is_watery(feat) && flavour == BEAM_COLD + if (feat_is_watery(feat) && flavour == BEAM_COLD && damage.num * damage.size > 35) { place_cloud(CLOUD_COLD, p, damage.num * damage.size / 30 + 1, @@ -3204,7 +3204,7 @@ void bolt::affect_place_explosion_clouds() // First check: fire/cold over water/lava. if (grd(p) == DNGN_LAVA && flavour == BEAM_COLD - || grid_is_watery(grd(p)) && is_fiery()) + || feat_is_watery(grd(p)) && is_fiery()) { place_cloud(CLOUD_STEAM, p, 2 + random2(5), whose_kill(), killer()); return; @@ -5684,9 +5684,9 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta, const dungeon_feature_type dngn_feat = grd(loc); // Check to see if we're blocked by a wall. - if (grid_is_wall(dngn_feat) + if (feat_is_wall(dngn_feat) || dngn_feat == DNGN_SECRET_DOOR - || grid_is_closed_door(dngn_feat)) + || feat_is_closed_door(dngn_feat)) { // Special case: explosion originates from rock/statue // (e.g. Lee's Rapid Deconstruction) - in this case, ignore @@ -5695,7 +5695,7 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta, return; } - if (grid_is_solid(dngn_feat) && !grid_is_wall(dngn_feat) && stop_at_statues) + if (feat_is_solid(dngn_feat) && !feat_is_wall(dngn_feat) && stop_at_statues) return; // Hmm, I think we're OK. diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index ce99e8de5c..f0d3146cf9 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -114,7 +114,7 @@ static int _spread_cloud(const cloud_struct &cloud) if (!in_bounds(*ai) || env.cgrid(*ai) != EMPTY_CLOUD - || grid_is_solid(grd(*ai)) + || feat_is_solid(grd(*ai)) || is_sanctuary(*ai) && !is_harmless_cloud(cloud.type)) { continue; @@ -145,7 +145,7 @@ static void _spread_fire(const cloud_struct &cloud) continue; // burning trees produce flames all around - if (!grid_is_solid(*ai) && make_flames) + if (!cell_is_solid(*ai) && make_flames) _place_new_cloud( CLOUD_FIRE, *ai, cloud.decay/2+1, cloud.whose, cloud.killer, cloud.spread_rate ); diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 6cef944a8c..440a38e90c 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -738,7 +738,7 @@ bool _take_portal_vault_stairs( const bool down ) for (rectangle_iterator ri(1); ri; ++ri) { - if (grid_stair_direction(grd(*ri)) == cmd) + if (feat_stair_direction(grd(*ri)) == cmd) { stair_pos = *ri; break; @@ -774,7 +774,7 @@ void wizard_level_travel( bool down ) // This lets us, for example, use &U to exit from Pandemonium and // &D to go to the next level. - command_type real_dir = grid_stair_direction(stairs); + command_type real_dir = feat_stair_direction(stairs); if (down && real_dir == CMD_GO_UPSTAIRS || !down && real_dir == CMD_GO_DOWNSTAIRS) { @@ -3247,7 +3247,7 @@ void debug_mons_scan() #ifdef WIZARD static void _debug_acquirement_stats(FILE *ostat) { - if (grid_destroys_items(grd(you.pos()))) + if (feat_destroys_items(grd(you.pos()))) { mpr("You must stand on a square which doesn't destroy items " "in order to do this."); @@ -5204,7 +5204,7 @@ void wizard_dismiss_all_monsters(bool force_all) static void _debug_kill_traps() { for (rectangle_iterator ri(1); ri; ++ri) - if (grid_is_trap(grd(*ri), true)) + if (feat_is_trap(grd(*ri), true)) destroy_trap(*ri); } @@ -5244,7 +5244,7 @@ static void _debug_destroy_doors() for (int x = 0; x < GXM; ++x) { const dungeon_feature_type feat = grd[x][y]; - if (feat == DNGN_SECRET_DOOR || grid_is_closed_door(feat)) + if (feat == DNGN_SECRET_DOOR || feat_is_closed_door(feat)) grd[x][y] = DNGN_FLOOR; } } diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 8c6aaad9e3..ad3e2c8a2c 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1569,7 +1569,7 @@ static void _stairs_card(int power, deck_rarity_type rarity) you.duration[DUR_REPEL_STAIRS_MOVE] = 0; you.duration[DUR_REPEL_STAIRS_CLIMB] = 0; - if (grid_stair_direction(grd(you.pos())) == CMD_NO_CMD) + if (feat_stair_direction(grd(you.pos())) == CMD_NO_CMD) you.duration[DUR_REPEL_STAIRS_MOVE] = 1000; else you.duration[DUR_REPEL_STAIRS_CLIMB] = 500; // more annoying @@ -1579,7 +1579,7 @@ static void _stairs_card(int power, deck_rarity_type rarity) for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true, true); ri; ++ri) { dungeon_feature_type feat = grd(*ri); - if (grid_stair_direction(feat) != CMD_NO_CMD + if (feat_stair_direction(feat) != CMD_NO_CMD && feat != DNGN_ENTER_SHOP) { stairs_avail.push_back(*ri); diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 44459c2131..ed8b044461 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -472,7 +472,7 @@ void full_describe_view() // Grab all items known (or thought) to be in the stashes in view. for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri) { - if (grid_stair_direction(grd(*ri)) != CMD_NO_CMD + if (feat_stair_direction(grd(*ri)) != CMD_NO_CMD || is_altar(grd(*ri))) { list_features.push_back(*ri); @@ -2492,7 +2492,7 @@ void describe_floor() msg_channel_type channel = MSGCH_EXAMINE; // Water is not terribly important if you don't mind it. - if (grid_is_water(grid) && player_likes_water()) + if (feat_is_water(grid) && player_likes_water()) channel = MSGCH_EXAMINE_FILTER; mpr((prefix + feat + suffix).c_str(), channel); @@ -2549,13 +2549,13 @@ std::string feature_description(dungeon_feature_type grid, if (bloody) desc += ", spattered with blood"; - return thing_do_grammar(dtype, add_stop, grid_is_trap(grid), desc); + return thing_do_grammar(dtype, add_stop, feat_is_trap(grid), desc); } static std::string _base_feature_desc(dungeon_feature_type grid, trap_type trap) { - if (grid_is_trap(grid) && trap != NUM_TRAPS) + if (feat_is_trap(grid) && trap != NUM_TRAPS) { switch (trap) { @@ -2901,7 +2901,7 @@ std::string feature_description(const coord_def& where, bool bloody, if (grid == DNGN_SECRET_DOOR) grid = grid_secret_door_appearance(where); - if (grid == DNGN_OPEN_DOOR || grid_is_closed_door(grid)) + if (grid == DNGN_OPEN_DOOR || feat_is_closed_door(grid)) { std::set all_door; find_connected_identical(where, grd(where), all_door); @@ -3522,7 +3522,7 @@ static void _describe_cell(const coord_def& where, bool in_range) msg_channel_type channel = MSGCH_EXAMINE; if (feat == DNGN_FLOOR || feat == DNGN_FLOOR_SPECIAL - || grid_is_water(feat)) + || feat_is_water(feat)) { channel = MSGCH_EXAMINE_FILTER; } diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 1fd256c3fa..3cd7471f5c 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -1467,7 +1467,7 @@ static bool _branch_entrances_are_connected() for (int x = 0; x < GXM; ++x) { coord_def gc(x,y); - if (!grid_is_branch_stairs(grd(gc))) + if (!feat_is_branch_stairs(grd(gc))) continue; if (!_has_connected_stone_stairs_from(gc)) return (false); @@ -1732,21 +1732,21 @@ static void _check_doors() for (int x = 1; x < GXM-1; x++) for (int y = 1; y < GYM-1; y++) { - if (!grid_is_closed_door(grd[x][y])) + if (!feat_is_closed_door(grd[x][y])) continue; int solid_count = 0; - if (grid_is_solid( grd[x - 1][y] )) + if (feat_is_solid( grd[x - 1][y] )) solid_count++; - if (grid_is_solid( grd[x + 1][y] )) + if (feat_is_solid( grd[x + 1][y] )) solid_count++; - if (grid_is_solid( grd[x][y - 1] )) + if (feat_is_solid( grd[x][y - 1] )) solid_count++; - if (grid_is_solid( grd[x][y + 1] )) + if (feat_is_solid( grd[x][y + 1] )) solid_count++; grd[x][y] = (solid_count < 2 ? DNGN_FLOOR @@ -1859,7 +1859,7 @@ static int _count_connected(int margin) for (int i = margin; i < GXM - margin; ++i) for (int j = margin; j < GYM - margin; ++j) - taken[i][j] = grid_is_water(grd[i][j]); + taken[i][j] = feat_is_water(grd[i][j]); int count = 0; @@ -3181,8 +3181,8 @@ static void _make_trail(int xs, int xr, int ys, int yr, int corrlength, static int _good_door_spot(int x, int y) { - if (!grid_is_solid(grd[x][y]) && grd[x][y] < DNGN_ENTER_PANDEMONIUM - || grid_is_closed_door(grd[x][y])) + if (!feat_is_solid(grd[x][y]) && grd[x][y] < DNGN_ENTER_PANDEMONIUM + || feat_is_closed_door(grd[x][y])) { return 1; } @@ -3240,8 +3240,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) { // left side if (grd[sx-1][ry] == DNGN_FLOOR - && grid_is_solid(grd[sx-1][ry-1]) - && grid_is_solid(grd[sx-1][ry+1])) + && feat_is_solid(grd[sx-1][ry-1]) + && feat_is_solid(grd[sx-1][ry+1])) { if (x_chance_in_y(doorlevel, 10)) grd[sx-1][ry] = DNGN_CLOSED_DOOR; @@ -3249,8 +3249,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) // right side if (grd[ex+1][ry] == DNGN_FLOOR - && grid_is_solid(grd[ex+1][ry-1]) - && grid_is_solid(grd[ex+1][ry+1])) + && feat_is_solid(grd[ex+1][ry-1]) + && feat_is_solid(grd[ex+1][ry+1])) { if (x_chance_in_y(doorlevel, 10)) grd[ex+1][ry] = DNGN_CLOSED_DOOR; @@ -3262,8 +3262,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) { // top if (grd[rx][sy-1] == DNGN_FLOOR - && grid_is_solid(grd[rx-1][sy-1]) - && grid_is_solid(grd[rx+1][sy-1])) + && feat_is_solid(grd[rx-1][sy-1]) + && feat_is_solid(grd[rx+1][sy-1])) { if (x_chance_in_y(doorlevel, 10)) grd[rx][sy-1] = DNGN_CLOSED_DOOR; @@ -3271,8 +3271,8 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) // bottom if (grd[rx][ey+1] == DNGN_FLOOR - && grid_is_solid(grd[rx-1][ey+1]) - && grid_is_solid(grd[rx+1][ey+1])) + && feat_is_solid(grd[rx-1][ey+1]) + && feat_is_solid(grd[rx+1][ey+1])) { if (x_chance_in_y(doorlevel, 10)) grd[rx][ey+1] = DNGN_CLOSED_DOOR; @@ -3493,7 +3493,7 @@ static void _place_aquatic_monsters(int level_number, char level_type) if (grd[x][y] == DNGN_LAVA) lava_spaces++; - if (grid_is_water(grd[x][y])) + if (feat_is_water(grd[x][y])) water_spaces++; } @@ -3983,7 +3983,7 @@ static void _dig_away_from(vault_placement &place, const coord_def &pos) { if (!xi && !yi) continue; - if (!grid_is_solid(dig_at + coord_def(xi, yi)) + if (!cell_is_solid(dig_at + coord_def(xi, yi)) && ++adjacent_count >= 2) { return; @@ -4002,12 +4002,12 @@ static void _dig_vault_loose( vault_placement &place, static bool _grid_needs_exit(int x, int y) { - return (!grid_is_solid(x, y) - || grid_is_closed_door(grd[x][y]) + return (!cell_is_solid(x, y) + || feat_is_closed_door(grd[x][y]) || grd[x][y] == DNGN_SECRET_DOOR); } -static bool _map_grid_is_on_edge(const vault_placement &place, +static bool _map_feat_is_on_edge(const vault_placement &place, const coord_def &c) { for (int xi = c.x - 1; xi <= c.x + 1; ++xi) @@ -4026,7 +4026,7 @@ static void _pick_internal_float_exits(const vault_placement &place, for (int y = place.pos.y + 1; y < place.pos.y + place.size.y - 1; ++y) for (int x = place.pos.x + 1; x < place.pos.x + place.size.x - 1; ++x) if (_grid_needs_exit(x, y) - && _map_grid_is_on_edge(place, coord_def(x, y))) + && _map_feat_is_on_edge(place, coord_def(x, y))) { exits.push_back( coord_def(x, y) ); } @@ -6328,7 +6328,7 @@ bool octa_room(spec_room &sr, int oblique_max, if (grd[x][y] == DNGN_FLOOR && type_floor == DNGN_SHALLOW_WATER) grd[x][y] = DNGN_SHALLOW_WATER; - if (grd[x][y] == DNGN_CLOSED_DOOR && !grid_is_solid(type_floor)) + if (grd[x][y] == DNGN_CLOSED_DOOR && !feat_is_solid(type_floor)) grd[x][y] = DNGN_FLOOR; // ick } @@ -6475,7 +6475,7 @@ static void _change_labyrinth_border(const dgn_region ®ion, if (!in_bounds(c)) // paranoia continue; - if (grd(c) == wall || !grid_is_wall(grd(c))) + if (grd(c) == wall || !feat_is_wall(grd(c))) continue; // All border grids have neighbours without any access to floor. @@ -6886,7 +6886,7 @@ static void _labyrinth_level(int level_number) static bool _is_wall(int x, int y) { - return grid_is_wall(grd[x][y]); + return feat_is_wall(grd[x][y]); } static int _box_room_door_spot(int x, int y) @@ -7698,7 +7698,7 @@ struct nearest_point inline static bool _dgn_square_travel_ok(const coord_def &c) { const dungeon_feature_type feat = grd(c); - return (is_traversable(feat) || grid_is_trap(feat) + return (is_traversable(feat) || feat_is_trap(feat) || feat == DNGN_SECRET_DOOR); } @@ -7711,7 +7711,7 @@ static coord_def _dgn_find_closest_to_stone_stairs(coord_def base_pos) for (int y = 0; y < GYM; ++y) for (int x = 0; x < GXM; ++x) { - if (!travel_point_distance[x][y] && grid_is_stone_stair(grd[x][y])) + if (!travel_point_distance[x][y] && feat_is_stone_stair(grd[x][y])) _dgn_fill_zone(coord_def(x, y), 1, np, _dgn_square_travel_ok); } diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index 125041258d..c730d26ec5 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -288,9 +288,9 @@ bool flood_find::path_flood( } } - const dungeon_feature_type grid = fgrid(dc); + const dungeon_feature_type feat = fgrid(dc); - if (grid == NUM_FEATURES) + if (feat == NUM_FEATURES) { if (want_exit) { @@ -301,16 +301,16 @@ bool flood_find::path_flood( return (false); } - if (needed_features[ grid ]) + if (needed_features[ feat ]) { unexplored_place = dc; unexplored_dist = traveled_distance; return (true); } - if (!is_traversable(grid) - && grid != DNGN_SECRET_DOOR - && !grid_is_trap(grid)) + if (!is_traversable(feat) + && feat != DNGN_SECRET_DOOR + && !feat_is_trap(feat)) { return (false); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 2647a39a63..0c96386338 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2219,11 +2219,11 @@ bool acquirement(object_class_type class_wanted, int agent, } } - if (grid_destroys_items(grd(you.pos()))) + if (feat_destroys_items(grd(you.pos()))) { // How sad (and stupid). if (!silenced(you.pos()) && !quiet) - mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos()))); + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(you.pos()))); if (agent > GOD_NO_GOD && agent < NUM_GODS) { @@ -2818,7 +2818,7 @@ static void _hell_effects() static bool _is_floor(const dungeon_feature_type feat) { - return (!grid_is_solid(feat) && !grid_destroys_items(feat)); + return (!feat_is_solid(feat) && !feat_destroys_items(feat)); } // This function checks whether we can turn a wall into a floor space and @@ -2829,7 +2829,7 @@ static bool _is_floor(const dungeon_feature_type feat) // . # 2 // #x# or .x. -> 0x1 // . # 3 -static bool _grid_is_flanked_by_walls(const coord_def &p) +static bool _feat_is_flanked_by_walls(const coord_def &p) { const coord_def adjs[] = { coord_def(p.x-1,p.y), coord_def(p.x+1,p.y), @@ -2841,10 +2841,10 @@ static bool _grid_is_flanked_by_walls(const coord_def &p) if (!in_bounds(adjs[i])) return (false); - return (grid_is_wall(grd(adjs[0])) && grid_is_wall(grd(adjs[1])) + return (feat_is_wall(grd(adjs[0])) && feat_is_wall(grd(adjs[1])) && _is_floor(grd(adjs[2])) && _is_floor(grd(adjs[3])) || _is_floor(grd(adjs[0])) && _is_floor(grd(adjs[1])) - && grid_is_wall(grd(adjs[2])) && grid_is_wall(grd(adjs[3]))); + && feat_is_wall(grd(adjs[2])) && feat_is_wall(grd(adjs[3]))); } // Sometimes if a floor is turned into a wall, a dead-end will be created. @@ -2875,7 +2875,7 @@ static bool _deadend_check_wall(const coord_def &p) // The grids to the left and right of p are walls. (We already know that // they are symmetric, so only need to check one side. We also know that // the other direction, here up/down must then be non-walls.) - if (grid_is_wall(grd[p.x-1][p.y])) + if (feat_is_wall(grd[p.x-1][p.y])) { // Run the check twice, once in either direction. for (int i = -1; i <= 1; i++) @@ -2889,9 +2889,9 @@ static bool _deadend_check_wall(const coord_def &p) const coord_def d(p.x+1, p.y+2*i); if (in_bounds(a) && in_bounds(b) - && grid_is_wall(grd(a)) && grid_is_wall(grd(b)) + && feat_is_wall(grd(a)) && feat_is_wall(grd(b)) && (!in_bounds(c) || !in_bounds(d) - || !grid_is_wall(grd(c)) || !grid_is_wall(grd(d)))) + || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d)))) { return (false); } @@ -2910,9 +2910,9 @@ static bool _deadend_check_wall(const coord_def &p) const coord_def d(p.x+2*i, p.y+1); if (in_bounds(a) && in_bounds(b) - && grid_is_wall(grd(a)) && grid_is_wall(grd(b)) + && feat_is_wall(grd(a)) && feat_is_wall(grd(b)) && (!in_bounds(c) || !in_bounds(d) - || !grid_is_wall(grd(c)) || !grid_is_wall(grd(d)))) + || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d)))) { return (false); } @@ -2940,7 +2940,7 @@ static bool _deadend_check_wall(const coord_def &p) // as well. static bool _deadend_check_floor(const coord_def &p) { - if (grid_is_wall(grd[p.x-1][p.y])) + if (feat_is_wall(grd[p.x-1][p.y])) { for (int i = -1; i <= 1; i++) { @@ -3028,7 +3028,7 @@ void change_labyrinth(bool msg) // directions, and by floor on the two remaining sides. for (rectangle_iterator ri(c1, c2); ri; ++ri) { - if (is_terrain_seen(*ri) || !grid_is_wall(grd(*ri))) + if (is_terrain_seen(*ri) || !feat_is_wall(grd(*ri))) continue; // Skip on grids inside vaults so as not to disrupt them. @@ -3036,7 +3036,7 @@ void change_labyrinth(bool msg) continue; // Make sure we don't accidentally create "ugly" dead-ends. - if (_grid_is_flanked_by_walls(*ri) && _deadend_check_floor(*ri)) + if (_feat_is_flanked_by_walls(*ri) && _deadend_check_floor(*ri)) targets.push_back(*ri); } @@ -3090,7 +3090,7 @@ void change_labyrinth(bool msg) { const coord_def c(targets[count]); // Maybe not valid anymore... - if (!grid_is_wall(grd(c)) || !_grid_is_flanked_by_walls(c)) + if (!feat_is_wall(grd(c)) || !_feat_is_flanked_by_walls(c)) continue; // Use the adjacent floor grids as source and destination. @@ -3152,7 +3152,7 @@ void change_labyrinth(bool msg) if (std::abs(p.x-c.x) + std::abs(p.y-c.y) <= 1) continue; - if (_grid_is_flanked_by_walls(p) && _deadend_check_wall(p)) + if (_feat_is_flanked_by_walls(p) && _deadend_check_wall(p)) points.push_back(p); } @@ -3186,7 +3186,7 @@ void change_labyrinth(bool msg) int wall_count = 0; coord_def old_adj(c); for (adjacent_iterator ai(c); ai; ++ai) - if (grid_is_wall(grd(*ai)) && one_chance_in(++wall_count)) + if (feat_is_wall(grd(*ai)) && one_chance_in(++wall_count)) old_adj = *ai; if (old_adj != c && !is_bloodcovered(old_adj)) @@ -3205,10 +3205,10 @@ void change_labyrinth(bool msg) // Rather than use old_grid directly, replace with an adjacent // wall type, preferably stone, rock, or metal. old_grid = grd[p.x-1][p.y]; - if (!grid_is_wall(old_grid)) + if (!feat_is_wall(old_grid)) { old_grid = grd[p.x][p.y-1]; - if (!grid_is_wall(old_grid)) + if (!feat_is_wall(old_grid)) { if (msg) { @@ -3272,7 +3272,7 @@ void change_labyrinth(bool msg) // and move them to a random adjacent non-wall grid. for (rectangle_iterator ri(c1, c2); ri; ++ri) { - if (!grid_is_wall(grd(*ri)) || igrd(*ri) == NON_ITEM) + if (!feat_is_wall(grd(*ri)) || igrd(*ri) == NON_ITEM) continue; if (msg) @@ -4041,7 +4041,7 @@ static void _catchup_monster_moves(monsters *mon, int turns) const coord_def next(pos + inc); const dungeon_feature_type feat = grd(next); - if (grid_is_solid(feat) + if (feat_is_solid(feat) || monster_at(next) || !monster_habitable_grid(mon, feat)) { @@ -4335,7 +4335,7 @@ void collect_radius_points(std::vector > &radius_points, if (visited_indices.find(idx) == visited_indices.end() && in_bounds(temp.first) - && !grid_is_solid(temp.first)) + && !cell_is_solid(temp.first)) { fringe.push(temp); } diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 8f8f67f64a..a136971334 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -621,7 +621,7 @@ bool melee_attack::attack() // Defending monster protects itself from attacks using the wall // it's in. - if (defender->atype() == ACT_MONSTER && grid_is_solid(defender->pos()) + if (defender->atype() == ACT_MONSTER && cell_is_solid(defender->pos()) && mons_wall_shielded(defender_as_monster())) { std::string feat_name = raw_feature_description(grd(defender->pos())); @@ -2549,7 +2549,7 @@ static bool _move_stairs(const actor* attacker, const actor* defender) const coord_def orig_pos = attacker->pos(); const dungeon_feature_type stair_feat = grd(orig_pos); - if (grid_stair_direction(stair_feat) == CMD_NO_CMD) + if (feat_stair_direction(stair_feat) == CMD_NO_CMD) return (false); // The player can't use shops to escape, so don't bother. diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 8d4dceaf98..86c87298b2 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -999,7 +999,7 @@ static void _close_level_gates() if (you.char_direction == GDT_ASCENDING && you.level_type != LEVEL_PANDEMONIUM) { - if (grid_sealable_portal(grd(*ri))) + if (feat_sealable_portal(grd(*ri))) { grd(*ri) = DNGN_STONE_ARCH; env.markers.remove_markers_at(*ri, MAT_ANY); @@ -1464,8 +1464,8 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, { dungeon_feature_type feat = grd(you.pos()); if (feat != DNGN_ENTER_SHOP - && grid_stair_direction(feat) != CMD_NO_CMD - && grid_stair_direction(stair_taken) != CMD_NO_CMD) + && feat_stair_direction(feat) != CMD_NO_CMD + && feat_stair_direction(stair_taken) != CMD_NO_CMD) { std::string stair_str = feature_description(feat, NUM_TRAPS, false, diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index b3d296d6a5..dd6aa27168 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -247,7 +247,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) // Merfolk boots unmeld if levitation takes us out of water. if (!player_is_airborne() && you.species == SP_MERFOLK - && grid_is_water(grd(you.pos()))) + && feat_is_water(grd(you.pos()))) { unmeld_one_equip(EQ_BOOTS); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 4d3a0c5974..ab63b492ae 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3047,7 +3047,7 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where, // destruction: plus / (1 + plus) chance of survival. bool destroyed = (chance == 0) ? false : (one_chance_in(chance) && one_chance_in(item->plus + 1)); - bool hostile_grid = grid_destroys_items(grd(where)); + bool hostile_grid = feat_destroys_items(grd(where)); // Non-returning items thrown into item-destroying grids are always // destroyed. Returning items are only destroyed if they would have @@ -3058,7 +3058,7 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where, if (hostile_grid) { if (player_can_hear(where)) - mprf(MSGCH_SOUND, grid_item_destruction_message(grd(where))); + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(where))); item_was_destroyed(*item, NON_MONSTER); destroyed = true; diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 7433d434ee..c784cf2503 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1960,7 +1960,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) const dungeon_feature_type my_grid = grd(you.pos()); - if (!grid_destroys_items(my_grid) + if (!feat_destroys_items(my_grid) && !copy_item_to_grid( you.inv[item_dropped], you.pos(), quant_drop, true )) { @@ -1971,10 +1971,10 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) mprf("You drop %s.", quant_name(you.inv[item_dropped], quant_drop, DESC_NOCAP_A).c_str()); - if (grid_destroys_items(my_grid)) + if (feat_destroys_items(my_grid)) { if (!silenced(you.pos())) - mprf(MSGCH_SOUND, grid_item_destruction_message(my_grid)); + mprf(MSGCH_SOUND, feat_item_destruction_message(my_grid)); item_was_destroyed(you.inv[item_dropped], NON_MONSTER); } @@ -1994,7 +1994,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) if (try_offer && you.religion != GOD_NO_GOD && you.duration[DUR_PRAYER] - && grid_altar_god(grd(you.pos())) == you.religion) + && feat_altar_god(grd(you.pos())) == you.religion) { offer_items(); } diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 132c2005f2..52a2856c80 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -18,7 +18,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const { int m; dungeon_feature_type f = env.grid(p); - if (grid_is_opaque(f)) + if (feat_is_opaque(f)) return OPC_OPAQUE; else if (is_opaque_cloud(env.cgrid(p))) return OPC_HALF; @@ -32,7 +32,7 @@ opacity_type opacity_default::operator()(const coord_def& p) const opacity_type opacity_fullyopaque::operator()(const coord_def& p) const { - if (grid_is_opaque(env.grid(p))) + if (feat_is_opaque(env.grid(p))) return OPC_OPAQUE; else return OPC_CLEAR; @@ -44,7 +44,7 @@ opacity_type opacity_solid::operator()(const coord_def& p) const { int m; dungeon_feature_type f = env.grid(p); - if (grid_is_solid(f)) + if (feat_is_solid(f)) return OPC_OPAQUE; else if (is_opaque_cloud(env.cgrid(p))) return OPC_HALF; diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index aca73554a1..c01bc869e8 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -1149,7 +1149,7 @@ static int dgn_grid(lua_State *ls) } LUARET1(_dgn_is_wall, boolean, - grid_is_wall(static_cast(luaL_checkint(ls, 1)))) + feat_is_wall(static_cast(luaL_checkint(ls, 1)))) static int dgn_max_bounds(lua_State *ls) { @@ -1747,11 +1747,11 @@ static int dgn_fixup_stairs(lua_State *ls) for (int x = 0; x < GXM; ++x) { const dungeon_feature_type feat = grd[x][y]; - if (grid_is_stone_stair(feat) || grid_is_escape_hatch(feat)) + if (feat_is_stone_stair(feat) || feat_is_escape_hatch(feat)) { dungeon_feature_type new_feat = DNGN_UNSEEN; - if (grid_stair_direction(feat) == CMD_GO_DOWNSTAIRS) + if (feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS) new_feat = down_feat; else new_feat = up_feat; @@ -2377,7 +2377,7 @@ static int dgn_fill_disconnected_zones(lua_State *ls) LUAFN(_dgn_is_opaque) { COORDS(c, 1, 2); - lua_pushboolean(ls, grid_is_opaque(grd(c))); + lua_pushboolean(ls, feat_is_opaque(grd(c))); return (1); } diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index eb28cb485c..38960f8bb9 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -184,17 +184,17 @@ static bool _may_overwrite_feature(const dungeon_feature_type grid, return (water_ok); // Handle all other non-LOS blocking grids here. - if (!grid_is_opaque(grid) + if (!feat_is_opaque(grid) && grid != DNGN_FLOOR && grid != DNGN_SHALLOW_WATER && grid != DNGN_OPEN_DOOR && grid != DNGN_SECRET_DOOR - && !grid_is_closed_door(grid)) + && !feat_is_closed_door(grid)) { return (false); } - if (grid_is_wall(grid)) + if (feat_is_wall(grid)) return (wall_ok); // Otherwise, feel free to clobber this feature. diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 849c875820..fc9cefbf0b 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1041,7 +1041,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg ) // Only bother creating a distinct stack of potions // if it won't get destroyed right away. - if (!grid_destroys_items(grd(you.pos()))) + if (!feat_destroys_items(grd(you.pos()))) { item_def potion2; potion2.base_type = OBJ_POTIONS; @@ -1080,7 +1080,7 @@ static bool allow_bleeding_on_square(const coord_def& where) } // The good gods like to keep their altars pristine. - if (is_good_god(grid_altar_god(grd(where)))) + if (is_good_god(feat_altar_god(grd(where)))) return (false); return (true); @@ -1221,7 +1221,7 @@ void search_around(bool only_adjacent) // Must have LOS, with no translucent walls in the way. if (see_cell_no_trans(*ri)) { - // Maybe we want distance() instead of grid_distance()? + // Maybe we want distance() instead of feat_distance()? int dist = grid_distance(*ri, you.pos()); // Don't exclude own square; may be levitating. @@ -1267,7 +1267,7 @@ void search_around(bool only_adjacent) bool merfolk_change_is_safe(bool quiet) { // If already transformed, no subsequent transformation necessary. - if (!player_is_airborne() && grid_is_water(grd(you.pos()))) + if (!player_is_airborne() && feat_is_water(grd(you.pos()))) return (true); std::set r; @@ -1290,7 +1290,7 @@ void merfolk_start_swimming() static void exit_stair_message(dungeon_feature_type stair, bool /* going_up */) { - if (grid_is_escape_hatch(stair)) + if (feat_is_escape_hatch(stair)) mpr("The hatch slams shut behind you."); } @@ -1300,9 +1300,9 @@ static void climb_message(dungeon_feature_type stair, bool going_up, if (old_level_type != LEVEL_DUNGEON) return; - if (grid_is_portal(stair)) + if (feat_is_portal(stair)) mpr("The world spins around you as you enter the gateway."); - else if (grid_is_escape_hatch(stair)) + else if (feat_is_escape_hatch(stair)) { if (going_up) mpr("A mysterious force pulls you upwards."); @@ -1668,7 +1668,7 @@ static bool _stair_moves_pre(dungeon_feature_type stair) if (stair != grd(you.pos())) return (false); - if (grid_stair_direction(stair) == CMD_NO_CMD) + if (feat_stair_direction(stair) == CMD_NO_CMD) return (false); if (!you.duration[DUR_REPEL_STAIRS_CLIMB]) @@ -1739,7 +1739,7 @@ void up_stairs(dungeon_feature_type force_stair, } // Probably still need this check here (teleportation) -- bwr - if (grid_stair_direction(stair_find) != CMD_GO_UPSTAIRS) + if (feat_stair_direction(stair_find) != CMD_GO_UPSTAIRS) { if (stair_find == DNGN_STONE_ARCH) mpr("There is nothing on the other side of the stone arch."); @@ -1759,15 +1759,15 @@ void up_stairs(dungeon_feature_type force_stair, if (!player_is_airborne() && you.confused() && old_level_type == LEVEL_DUNGEON - && !grid_is_escape_hatch(stair_find) + && !feat_is_escape_hatch(stair_find) && coinflip()) { const char* fall_where = "down the stairs"; - if (!grid_is_staircase(stair_find)) + if (!feat_is_staircase(stair_find)) fall_where = "through the gate"; mprf("In your confused state, you trip and fall back %s.", fall_where); - if (!grid_is_staircase(stair_find)) + if (!feat_is_staircase(stair_find)) ouch(1, NON_MONSTER, KILLED_BY_FALLING_THROUGH_GATE); else ouch(1, NON_MONSTER, KILLED_BY_FALLING_DOWN_STAIRS); @@ -1775,7 +1775,7 @@ void up_stairs(dungeon_feature_type force_stair, return; } - if (you.burden_state == BS_OVERLOADED && !grid_is_escape_hatch(stair_find) + if (you.burden_state == BS_OVERLOADED && !feat_is_escape_hatch(stair_find) && !is_gate(stair_find)) { mpr("You are carrying too much to climb upwards."); @@ -2004,7 +2004,7 @@ static void _player_change_level_downstairs(dungeon_feature_type stair_find, && (you.level_type != LEVEL_PANDEMONIUM || stair_find != DNGN_TRANSIT_PANDEMONIUM) && (you.level_type != LEVEL_PORTAL_VAULT - || !grid_is_stone_stair(stair_find))) + || !feat_is_stone_stair(stair_find))) { you.level_type = LEVEL_DUNGEON; } @@ -2065,7 +2065,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, int shaft_level = -1; // Probably still need this check here (teleportation) -- bwr - if (grid_stair_direction(stair_find) != CMD_GO_DOWNSTAIRS && !shaft) + if (feat_stair_direction(stair_find) != CMD_GO_DOWNSTAIRS && !shaft) { if (stair_find == DNGN_STONE_ARCH) mpr("There is nothing on the other side of the stone arch."); @@ -2284,18 +2284,18 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, if (!player_is_airborne() && you.confused() - && !grid_is_escape_hatch(stair_find) + && !feat_is_escape_hatch(stair_find) && force_stair != DNGN_ENTER_ABYSS && coinflip()) { const char* fall_where = "down the stairs"; - if (!grid_is_staircase(stair_find)) + if (!feat_is_staircase(stair_find)) fall_where = "through the gate"; mprf("In your confused state, you trip and fall %s.", fall_where); // Note that this only does damage; it doesn't cancel the level // transition. - if (!grid_is_staircase(stair_find)) + if (!feat_is_staircase(stair_find)) ouch(1, NON_MONSTER, KILLED_BY_FALLING_THROUGH_GATE); else ouch(1, NON_MONSTER, KILLED_BY_FALLING_DOWN_STAIRS); @@ -2388,7 +2388,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, case LEVEL_DUNGEON: // Xom thinks it's funny if you enter a new level via shaft // or escape hatch, for shafts it's funnier the deeper you fell. - if (shaft || grid_is_escape_hatch(stair_find)) + if (shaft || feat_is_escape_hatch(stair_find)) xom_is_stimulated(shaft_depth * 50); else xom_is_stimulated(14); @@ -3097,7 +3097,7 @@ void reveal_secret_door(const coord_def& p) dungeon_feature_type door = grid_secret_door_appearance(p); // Former secret doors become known but are still hidden to monsters // until opened. - grd(p) = grid_is_opaque(door) ? DNGN_DETECTED_SECRET_DOOR + grd(p) = feat_is_opaque(door) ? DNGN_DETECTED_SECRET_DOOR : DNGN_OPEN_DOOR; viewwindow(true, false); learned_something_new(TUT_SEEN_SECRET_DOOR, p); diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 2ae2614e30..a282e0c942 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -89,10 +89,10 @@ static int _mons_real_base_speed(int mc); habitat_type grid2habitat(dungeon_feature_type grid) { - if (grid_is_watery(grid)) + if (feat_is_watery(grid)) return (HT_WATER); - if (grid_is_rock(grid) && !grid_is_permarock(grid)) + if (feat_is_rock(grid) && !feat_is_permarock(grid)) return (HT_ROCK); switch (grid) @@ -3699,7 +3699,7 @@ void monsters::init_with(const monsters &mon) bool monsters::swimming() const { const dungeon_feature_type grid = grd(pos()); - return (grid_is_watery(grid) && mons_primary_habitat(this) == HT_WATER); + return (feat_is_watery(grid) && mons_primary_habitat(this) == HT_WATER); } bool monsters::wants_submerge() const @@ -3752,7 +3752,7 @@ bool monsters::extra_balanced() const bool monsters::floundering() const { const dungeon_feature_type grid = grd(pos()); - return (grid_is_water(grid) + return (feat_is_water(grid) && !cannot_fight() // Can't use monster_habitable_grid() because that'll return // true for non-water monsters in shallow water. @@ -3767,11 +3767,11 @@ bool mons_class_can_pass(int mc, const dungeon_feature_type grid) if (mons_class_wall_shielded(mc)) { // Permanent walls can't be passed through. - return (!grid_is_solid(grid) - || grid_is_rock(grid) && !grid_is_permarock(grid)); + return (!feat_is_solid(grid) + || feat_is_rock(grid) && !feat_is_permarock(grid)); } - return !grid_is_solid(grid); + return !feat_is_solid(grid); } bool mons_can_pass(const monsters *mon, dungeon_feature_type grid) @@ -4667,10 +4667,10 @@ bool monsters::drop_item(int eslot, int near) } dungeon_feature_type feat = grd(pos()); - if (grid_destroys_items(feat)) + if (feat_destroys_items(feat)) { if ( player_can_hear(pos()) ) - mprf(MSGCH_SOUND, grid_item_destruction_message(feat)); + mprf(MSGCH_SOUND, feat_item_destruction_message(feat)); item_was_destroyed(*pitem, mindex()); unlink_item(item_index); @@ -7145,7 +7145,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) } } else if (mons_near(this) - && grid_compatible(grd(pos()), DNGN_DEEP_WATER)) + && feat_compatible(grd(pos()), DNGN_DEEP_WATER)) { mpr("Something invisible bursts forth from the water."); interrupt_activity(AI_FORCE_INTERRUPT); @@ -7402,7 +7402,7 @@ void monsters::apply_enchantment(const mon_enchant &me) case ENCH_AQUATIC_LAND: // Aquatic monsters lose hit points every turn they spend on dry land. ASSERT(mons_habitat(this) == HT_WATER - && !grid_is_watery( grd(pos()) )); + && !feat_is_watery( grd(pos()) )); // Zombies don't take damage from flopping about on land. if (mons_is_zombified(this)) @@ -7652,7 +7652,7 @@ void monsters::apply_enchantment(const mon_enchant &me) // Assumption: mons_res_fire has already been checked. case ENCH_STICKY_FLAME: { - if (grid_is_watery(grd(pos()))) + if (feat_is_watery(grd(pos()))) { if (mons_near(this) && player_monster_visible(this)) mprf("The flames covering %s go out.", @@ -8123,9 +8123,9 @@ void monsters::apply_location_effects(const coord_def &oldpos) if (alive() && has_ench(ENCH_AQUATIC_LAND)) { - if (!grid_is_watery( grd(pos()) )) + if (!feat_is_watery( grd(pos()) )) simple_monster_message(this, " flops around on dry land!"); - else if (!grid_is_watery( grd(oldpos) )) + else if (!feat_is_watery( grd(oldpos) )) { simple_monster_message(this, " dives back into the water!"); del_ench(ENCH_AQUATIC_LAND); @@ -8923,7 +8923,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@surface@", "buggy surface"); else if (feat == DNGN_LAVA) msg = replace_all(msg, "@surface@", "lava"); - else if (grid_is_water(feat)) + else if (feat_is_water(feat)) msg = replace_all(msg, "@surface@", "water"); else if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD) msg = replace_all(msg, "@surface@", "altar"); diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 82984ef0bc..173739b9a9 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -70,38 +70,38 @@ static band_type _choose_band(int mon_type, int power, int &band_size); static int _place_monster_aux(const mgen_data &mg, bool first_band_member, bool force_pos = false); -// Returns whether actual_grid is compatible with grid_wanted for monster +// Returns whether actual_feat is compatible with feat_wanted for monster // movement and generation. -bool grid_compatible(dungeon_feature_type grid_wanted, - dungeon_feature_type actual_grid) +bool feat_compatible(dungeon_feature_type feat_wanted, + dungeon_feature_type actual_feat) { - if (grid_wanted == DNGN_FLOOR) + if (feat_wanted == DNGN_FLOOR) { - return (actual_grid >= DNGN_FLOOR - && actual_grid != DNGN_BUILDER_SPECIAL_WALL - || actual_grid == DNGN_SHALLOW_WATER); + return (actual_feat >= DNGN_FLOOR + && actual_feat != DNGN_BUILDER_SPECIAL_WALL + || actual_feat == DNGN_SHALLOW_WATER); } - if (grid_wanted >= DNGN_ROCK_WALL - && grid_wanted <= DNGN_CLEAR_PERMAROCK_WALL) + if (feat_wanted >= DNGN_ROCK_WALL + && feat_wanted <= DNGN_CLEAR_PERMAROCK_WALL) { // A monster can only move through or inhabit permanent rock if that's // exactly what it's asking for. - if (actual_grid == DNGN_PERMAROCK_WALL - || actual_grid == DNGN_CLEAR_PERMAROCK_WALL) + if (actual_feat == DNGN_PERMAROCK_WALL + || actual_feat == DNGN_CLEAR_PERMAROCK_WALL) { - return (grid_wanted == DNGN_PERMAROCK_WALL - || grid_wanted == DNGN_CLEAR_PERMAROCK_WALL); + return (feat_wanted == DNGN_PERMAROCK_WALL + || feat_wanted == DNGN_CLEAR_PERMAROCK_WALL); } - return (actual_grid >= DNGN_ROCK_WALL - && actual_grid <= DNGN_CLEAR_PERMAROCK_WALL); + return (actual_feat >= DNGN_ROCK_WALL + && actual_feat <= DNGN_CLEAR_PERMAROCK_WALL); } - return (grid_wanted == actual_grid - || (grid_wanted == DNGN_DEEP_WATER - && (actual_grid == DNGN_SHALLOW_WATER - || actual_grid == DNGN_FOUNTAIN_BLUE))); + return (feat_wanted == actual_feat + || (feat_wanted == DNGN_DEEP_WATER + && (actual_feat == DNGN_SHALLOW_WATER + || actual_feat == DNGN_FOUNTAIN_BLUE))); } // Can this monster survive on actual_grid? @@ -142,23 +142,23 @@ bool monster_habitable_grid(int monster_class, if (actual_grid == DNGN_OPEN_SEA) return (false); - const dungeon_feature_type grid_preferred = + const dungeon_feature_type feat_preferred = habitat2grid(mons_class_primary_habitat(monster_class)); - const dungeon_feature_type grid_nonpreferred = + const dungeon_feature_type feat_nonpreferred = habitat2grid(mons_class_secondary_habitat(monster_class)); // Special check for fire elementals since their habitat is floor which // is generally considered compatible with shallow water. - if (monster_class == MONS_FIRE_ELEMENTAL && grid_is_watery(actual_grid)) + if (monster_class == MONS_FIRE_ELEMENTAL && feat_is_watery(actual_grid)) return (false); // Krakens are too large for shallow water. if (monster_class == MONS_KRAKEN && actual_grid == DNGN_SHALLOW_WATER) return (false); - if (grid_compatible(grid_preferred, actual_grid) - || (grid_nonpreferred != grid_preferred - && grid_compatible(grid_nonpreferred, actual_grid))) + if (feat_compatible(feat_preferred, actual_grid) + || (feat_nonpreferred != feat_preferred + && feat_compatible(feat_nonpreferred, actual_grid))) { return (true); } @@ -185,7 +185,7 @@ bool monster_can_submerge(const monsters *mons, dungeon_feature_type grid) { case HT_WATER: // Monsters can submerge in shallow water - this is intentional. - return (grid_is_watery(grid)); + return (feat_is_watery(grid)); case HT_LAVA: return (grid == DNGN_LAVA); @@ -672,7 +672,7 @@ static int _is_near_stairs(coord_def &p) if (is_stair(feat)) { // Shouldn't matter for escape hatches. - if (grid_is_escape_hatch(feat)) + if (feat_is_escape_hatch(feat)) continue; // Should there be several stairs, don't overwrite the @@ -694,9 +694,9 @@ static bool _valid_monster_location(const mgen_data &mg, { const int montype = (mons_class_is_zombified(mg.cls) ? mg.base_type : mg.cls); - const dungeon_feature_type grid_preferred = + const dungeon_feature_type feat_preferred = habitat2grid(mons_class_primary_habitat(montype)); - const dungeon_feature_type grid_nonpreferred = + const dungeon_feature_type feat_nonpreferred = habitat2grid(mons_class_secondary_habitat(montype)); if (!in_bounds(mg_pos)) @@ -707,9 +707,9 @@ static bool _valid_monster_location(const mgen_data &mg, return (false); // Is the monster happy where we want to put it? - if (!grid_compatible(grid_preferred, grd(mg_pos)) - && (grid_nonpreferred == grid_preferred - || !grid_compatible(grid_nonpreferred, grd(mg_pos)))) + if (!feat_compatible(feat_preferred, grd(mg_pos)) + && (feat_nonpreferred == feat_preferred + || !feat_compatible(feat_nonpreferred, grd(mg_pos)))) { return (false); } @@ -2425,7 +2425,7 @@ static dungeon_feature_type _monster_secondary_habitat_feature(int mc) class newmons_square_find : public travel_pathfind { private: - dungeon_feature_type grid_wanted; + dungeon_feature_type feat_wanted; coord_def start; int maxdistance; @@ -2438,7 +2438,7 @@ public: newmons_square_find(dungeon_feature_type grdw, const coord_def &pos, int maxdist = 0) - : grid_wanted(grdw), start(pos), maxdistance(maxdist), + : feat_wanted(grdw), start(pos), maxdistance(maxdist), best_distance(0), nfound(0) { } @@ -2459,7 +2459,7 @@ public: { return (false); } - if (!grid_compatible(grid_wanted, grd(dc))) + if (!feat_compatible(feat_wanted, grd(dc))) { if (passable.find(grd(dc)) != passable.end()) good_square(dc); @@ -2487,18 +2487,18 @@ coord_def find_newmons_square_contiguous(monster_type mons_class, { coord_def p; - const dungeon_feature_type grid_preferred = + const dungeon_feature_type feat_preferred = _monster_primary_habitat_feature(mons_class); - const dungeon_feature_type grid_nonpreferred = + const dungeon_feature_type feat_nonpreferred = _monster_secondary_habitat_feature(mons_class); - newmons_square_find nmpfind(grid_preferred, start, distance); + newmons_square_find nmpfind(feat_preferred, start, distance); const coord_def pp = nmpfind.pathfind(); p = pp; - if (grid_nonpreferred != grid_preferred && !in_bounds(pp)) + if (feat_nonpreferred != feat_preferred && !in_bounds(pp)) { - newmons_square_find nmsfind(grid_nonpreferred, start, distance); + newmons_square_find nmsfind(feat_nonpreferred, start, distance); const coord_def ps = nmsfind.pathfind(); p = ps; } @@ -2514,19 +2514,19 @@ coord_def find_newmons_square(int mons_class, const coord_def &p) if (mons_class == WANDERING_MONSTER) mons_class = RANDOM_MONSTER; - const dungeon_feature_type grid_preferred = + const dungeon_feature_type feat_preferred = _monster_primary_habitat_feature(mons_class); - const dungeon_feature_type grid_nonpreferred = + const dungeon_feature_type feat_nonpreferred = _monster_secondary_habitat_feature(mons_class); // Might be better if we chose a space and tried to match the monster // to it in the case of RANDOM_MONSTER, that way if the target square // is surrounded by water or lava this function would work. -- bwr - if (empty_surrounds(p, grid_preferred, 2, true, empty)) + if (empty_surrounds(p, feat_preferred, 2, true, empty)) pos = empty; - if (grid_nonpreferred != grid_preferred && !in_bounds(pos) - && empty_surrounds(p, grid_nonpreferred, 2, true, empty)) + if (feat_nonpreferred != feat_preferred && !in_bounds(pos) + && empty_surrounds(p, feat_nonpreferred, 2, true, empty)) { pos = empty; } @@ -2696,7 +2696,7 @@ bool empty_surrounds(const coord_def& where, dungeon_feature_type spc_wanted, continue; success = - (grd(*ri) == spc_wanted) || grid_compatible(spc_wanted, grd(*ri)); + (grd(*ri) == spc_wanted) || feat_compatible(spc_wanted, grd(*ri)); if (success && one_chance_in(++good_count)) empty = *ri; @@ -3213,7 +3213,7 @@ bool monster_pathfind::traversable(const coord_def p) if (mons) return mons_traversable(p); - return (!grid_is_solid(grd(p)) && !grid_destroys_items(grd(p))); + return (!feat_is_solid(grd(p)) && !feat_destroys_items(grd(p))); } // Checks whether a given monster can pass over a certain position, respecting @@ -3227,7 +3227,7 @@ bool monster_pathfind::mons_traversable(const coord_def p) return (false); // Monsters that can't open doors won't be able to pass them. - if (grid_is_closed_door(grd(p)) || grd(p) == DNGN_SECRET_DOOR) + if (feat_is_closed_door(grd(p)) || grd(p) == DNGN_SECRET_DOOR) { if (mons_is_zombified(mons)) { @@ -3282,7 +3282,7 @@ int monster_pathfind::mons_travel_cost(coord_def npos) ASSERT(grid_distance(pos, npos) <= 1); // Doors need to be opened. - if (grid_is_closed_door(grd(npos)) || grd(npos) == DNGN_SECRET_DOOR) + if (feat_is_closed_door(grd(npos)) || grd(npos) == DNGN_SECRET_DOOR) return 2; const int montype = mons_is_zombified(mons) ? mons_zombie_base(mons) diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index b7c348bd00..4d24ef1815 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -310,7 +310,7 @@ bool drac_colour_incompatible(int drac, int colour); void mark_interesting_monst(monsters* monster, beh_type behaviour = BEH_SLEEP); -bool grid_compatible(dungeon_feature_type grid_wanted, +bool feat_compatible(dungeon_feature_type grid_wanted, dungeon_feature_type actual_grid); bool monster_habitable_grid(const monsters *m, dungeon_feature_type actual_grid); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 80d4e11a78..9e011a1e9b 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -277,7 +277,7 @@ bool curse_an_item( bool decay_potions, bool quiet ) void monster_drop_ething(monsters *monster, bool mark_item_origins, int owner_id) { - const bool hostile_grid = grid_destroys_items(grd(monster->pos())); + const bool hostile_grid = feat_destroys_items(grd(monster->pos())); bool destroyed = false; @@ -313,7 +313,7 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins, } if (destroyed) - mprf(MSGCH_SOUND, grid_item_destruction_message(grd(monster->pos()))); + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(monster->pos()))); } int fill_out_corpse(const monsters* monster, item_def& corpse, @@ -395,7 +395,7 @@ int place_monster_corpse(const monsters *monster, bool silent, // Don't attempt to place corpses within walls, either. // Currently, this only applies to (shapeshifter) rock worms. - if (grid_is_wall(grd(monster->pos()))) + if (feat_is_wall(grd(monster->pos()))) return (-1); item_def corpse; @@ -409,7 +409,7 @@ int place_monster_corpse(const monsters *monster, bool silent, if (corpse_class == -1 || (!force && coinflip())) return (-1); - if (grid_destroys_items(grd(monster->pos()))) + if (feat_destroys_items(grd(monster->pos()))) { item_was_destroyed(corpse); return (-1); @@ -2797,7 +2797,7 @@ bool swap_check(monsters *monster, coord_def &loc, bool quiet) loc = you.pos(); // Don't move onto dangerous terrain. - if (is_grid_dangerous(grd(monster->pos()))) + if (is_feat_dangerous(grd(monster->pos()))) { canned_msg(MSG_UNTHINKING_ACT); return (false); @@ -3500,7 +3500,7 @@ static void _mons_indicate_level_exit(const monsters *mon) simple_monster_message(mon, " passes through the gate."); else if (is_travelable_stair(gridc)) { - command_type dir = grid_stair_direction(gridc); + command_type dir = feat_stair_direction(gridc); simple_monster_message(mon, make_stringf(" %s the %s.", dir == CMD_GO_UPSTAIRS ? "goes up" : @@ -3804,7 +3804,7 @@ static bool _find_siren_water_target(monsters *mon) for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false); ri; ++ri) { - if (!grid_is_water(grd(*ri))) + if (!feat_is_water(grd(*ri))) continue; // In the first iteration only count water grids that are @@ -3895,7 +3895,7 @@ static bool _find_wall_target(monsters *mon) // Target grid might have changed since we started, like if the // player destroys the wall the monster wants to hide in. - if (grid_is_solid(targ_pos) + if (cell_is_solid(targ_pos) && monster_habitable_grid(mon, grd(targ_pos))) { // Wall is still good. @@ -3923,7 +3923,7 @@ static bool _find_wall_target(monsters *mon) for (radius_iterator ri(mon->pos(), LOS_RADIUS, true, false); ri; ++ri) { - if (!grid_is_solid(*ri) + if (!cell_is_solid(*ri) || !monster_habitable_grid(mon, grd(*ri))) { continue; @@ -4362,7 +4362,7 @@ static void _handle_behaviour(monsters *mon) mon->foe = MHITNOT; } - if (mons_wall_shielded(mon) && grid_is_solid(mon->pos())) + if (mons_wall_shielded(mon) && cell_is_solid(mon->pos())) { // Monster is safe, so its behaviour can be simplified to fleeing. if (mon->behaviour == BEH_CORNERED || mon->behaviour == BEH_PANIC @@ -4815,7 +4815,7 @@ static void _handle_behaviour(monsters *mon) mon->foe = new_foe; } - if (mon->travel_target == MTRAV_WALL && grid_is_solid(mon->pos())) + if (mon->travel_target == MTRAV_WALL && cell_is_solid(mon->pos())) { if (mon->behaviour == BEH_FLEE) { @@ -5263,11 +5263,11 @@ static void _handle_movement(monsters *monster) bool leftright = false; coord_def t = monster->pos() + coord_def(mmov.x, 0); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) updown = true; t = monster->pos() + coord_def(0, mmov.y); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) leftright = true; if (updown && (!leftright || coinflip())) @@ -5280,11 +5280,11 @@ static void _handle_movement(monsters *monster) bool left = false; bool right = false; coord_def t = monster->pos() + coord_def(-1, mmov.y); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) left = true; t = monster->pos() + coord_def(1, mmov.y); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) right = true; if (left && (!right || coinflip())) @@ -5297,11 +5297,11 @@ static void _handle_movement(monsters *monster) bool up = false; bool down = false; coord_def t = monster->pos() + coord_def(mmov.x, -1); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) up = true; t = monster->pos() + coord_def(mmov.x, 1); - if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + if (in_bounds(t) && feat_is_rock(grd(t)) && !feat_is_permarock(grd(t))) down = true; if (up && (!down || coinflip())) @@ -5798,7 +5798,7 @@ static bool _siren_movement_effect(const monsters *monster) const coord_def newpos = you.pos() + dir; - if (!in_bounds(newpos) || is_grid_dangerous(grd(newpos)) + if (!in_bounds(newpos) || is_feat_dangerous(grd(newpos)) || !you.can_pass_through_feat(grd(newpos))) { do_resist = true; @@ -5949,7 +5949,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem) if (!inside_level_bounds(t)) continue; - if (!grid_is_solid(grd(t))) + if (!feat_is_solid(grd(t))) { monster->hit_points = -1; used = true; @@ -7423,7 +7423,7 @@ static void _monster_regenerate(monsters *monster) || cloud_type_at(monster->pos()) == CLOUD_FIRE)) || (monster->type == MONS_WATER_ELEMENTAL - && grid_is_watery(grd(monster->pos()))) + && feat_is_watery(grd(monster->pos()))) || (monster->type == MONS_AIR_ELEMENTAL && env.cgrid(monster->pos()) == EMPTY_CLOUD @@ -8868,7 +8868,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, return (false); } else if (!monster->can_pass_through_feat(target_grid) - || no_water && grid_is_water(target_grid)) + || no_water && feat_is_water(target_grid)) { return (false); } @@ -8901,7 +8901,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, // Fire elementals avoid water and cold. if (monster->type == MONS_FIRE_ELEMENTAL - && (grid_is_watery(target_grid) + && (feat_is_watery(target_grid) || targ_cloud_type == CLOUD_COLD)) { return (false); @@ -9124,10 +9124,10 @@ static bool _monster_move(monsters *monster) std::vector adj_move; for (adjacent_iterator ai(monster->pos()); ai; ++ai) { - if (!grid_is_solid(*ai)) + if (!cell_is_solid(*ai)) { adj_move.push_back(*ai); - if (grid_is_watery(grd(*ai))) + if (feat_is_watery(grd(*ai))) adj_water.push_back(*ai); } } @@ -9190,7 +9190,7 @@ static bool _monster_move(monsters *monster) // Normal/smart monsters know about secret doors, since they live in // the dungeon. if (grd(newpos) == DNGN_CLOSED_DOOR - || grid_is_secret_door(grd(newpos)) && mons_intel(monster) >= I_NORMAL) + || feat_is_secret_door(grd(newpos)) && mons_intel(monster) >= I_NORMAL) { if (mons_is_zombified(monster)) { diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index bb23dfd7fb..ce3fba41e2 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -651,7 +651,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, && monster_at(*ai)->attitude != monster->attitude) sumcount++; if (grd(*ai) != DNGN_FLOOR && grd(*ai) > DNGN_MAX_NONREACH - && !grid_is_trap(grd(*ai))) + && !feat_is_trap(grd(*ai))) sumcount++; } if (abs(you.pos().x-monster->pos().x)<=1 && @@ -676,7 +676,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, continue; } } - if (grd(*ai) == DNGN_FLOOR || grid_is_trap(grd(*ai))) + if (grd(*ai) == DNGN_FLOOR || feat_is_trap(grd(*ai))) { grd(*ai) = DNGN_ROCK_WALL; sumcount++; diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc index bb59e46571..0a7cad42b9 100644 --- a/crawl-ref/source/overmap.cc +++ b/crawl-ref/source/overmap.cc @@ -72,10 +72,10 @@ void seen_notable_thing( dungeon_feature_type which_thing, if (you.level_type != LEVEL_DUNGEON) return; - const god_type god = grid_altar_god(which_thing); + const god_type god = feat_altar_god(which_thing); if (god != GOD_NO_GOD) _seen_altar( god, pos ); - else if (grid_is_branch_stairs( which_thing )) + else if (feat_is_branch_stairs( which_thing )) _seen_staircase( which_thing, pos ); else _seen_other_thing( which_thing, pos ); @@ -567,7 +567,7 @@ static bool _unnotice_shop(const level_pos &pos) static bool _unnotice_stair(const level_pos &pos) { const dungeon_feature_type feat = grd(pos.pos); - if (grid_is_branch_stairs(feat)) + if (feat_is_branch_stairs(feat)) { for (int i = 0; i < NUM_BRANCHES; ++i) { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 4cccea0a48..8f3343270a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -233,11 +233,11 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, bool merfolk_check = false; if (you.species == SP_MERFOLK) { - if (grid_is_water(new_grid)) + if (feat_is_water(new_grid)) merfolk_check = true; // Safer water effects. - if (grid_is_water(new_grid) && !grid_is_water(old_grid)) + if (feat_is_water(new_grid) && !feat_is_water(old_grid)) { // Check for fatal stat loss due to transforming. // Also handles the warning message. @@ -258,8 +258,8 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, need_doll_update = true; #endif } - else if (!grid_is_water(new_grid) && grid_is_water(old_grid) - && !is_grid_dangerous(new_grid)) + else if (!feat_is_water(new_grid) && feat_is_water(old_grid) + && !is_feat_dangerous(new_grid)) { unmeld_one_equip(EQ_BOOTS); you.redraw_evasion = true; @@ -273,7 +273,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, { // XXX: at some point we're going to need to fix the swimming // code to handle burden states. - if (is_grid_dangerous(new_grid)) + if (is_feat_dangerous(new_grid)) { // Lava and dangerous deep water (ie not merfolk). const coord_def entry = (stepped) ? you.pos() : p; @@ -337,7 +337,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, if (trap_def* ptrap = find_trap(you.pos())) ptrap->trigger(you, !stepped); // blinking makes it hard to evade - command_type stair_dir = grid_stair_direction(new_grid); + command_type stair_dir = feat_stair_direction(new_grid); if (stepped && stair_dir != CMD_NO_CMD && new_grid != DNGN_ENTER_SHOP @@ -361,7 +361,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, std::string stair_str = feature_description(new_grid, NUM_TRAPS, false, DESC_CAP_THE, false); - std::string prep = grid_preposition(new_grid, true, &you); + std::string prep = feat_preposition(new_grid, true, &you); mprf("%s slides away as you move %s it!", stair_str.c_str(), prep.c_str()); @@ -380,7 +380,7 @@ bool player_can_swim() return (you.can_swim()); } -bool is_grid_dangerous(int grid) +bool is_feat_dangerous(dungeon_feature_type grid) { return (!player_is_airborne() && (grid == DNGN_LAVA @@ -5581,7 +5581,7 @@ void dec_napalm_player() { if (you.duration[DUR_LIQUID_FLAMES] > 1) { - if (grid_is_watery(grd(you.pos()))) + if (feat_is_watery(grd(you.pos()))) { mpr("The flames go out!", MSGCH_WARN); you.duration[DUR_LIQUID_FLAMES] = 0; @@ -6260,7 +6260,7 @@ bool player::is_levitating() const bool player::in_water() const { return (!airborne() && !beogh_water_walk() - && grid_is_water(grd(you.pos()))); + && feat_is_water(grd(you.pos()))); } bool player::can_swim() const @@ -6303,7 +6303,7 @@ bool player::floundering() const bool player::can_pass_through_feat(dungeon_feature_type grid) const { - return !grid_is_solid(grid); + return !feat_is_solid(grid); } size_type player::body_size(int psize, bool base) const diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 8792fc0c49..ae164cbef1 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -450,7 +450,7 @@ item_def *player_weapon(); item_def *player_shield(); // Determines if the given grid is dangerous for the player to enter. -bool is_grid_dangerous(int grid); +bool is_feat_dangerous(dungeon_feature_type feat); void run_macro(const char *macroname = NULL); diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index 4beb6bed92..6d3db368d6 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -87,10 +87,10 @@ void ray_def::advance_and_bounce() const double oldaccx = accx, oldaccy = accy; adv_type rc = advance(false); int newx = x(), newy = y(); - ASSERT(grid_is_solid(grd[newx][newy])); + ASSERT(feat_is_solid(grd[newx][newy])); - const bool blocked_x = grid_is_solid(grd[oldx][newy]); - const bool blocked_y = grid_is_solid(grd[newx][oldy]); + const bool blocked_x = feat_is_solid(grd[oldx][newy]); + const bool blocked_y = feat_is_solid(grd[newx][oldy]); if (double_is_zero(slope) || slope > 100.0) { diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 81bc558f2c..954dd3cf03 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -1241,7 +1241,7 @@ static bool _need_missile_gift() const item_def *launcher = _find_missile_launcher(best_missile_skill); return (you.piety > 80 && random2( you.piety ) > 70 - && !grid_destroys_items( grd(you.pos()) ) + && !feat_destroys_items( grd(you.pos()) ) && one_chance_in(8) && you.skills[ best_missile_skill ] >= 8 && (launcher || best_missile_skill == SK_DARTS) @@ -1330,7 +1330,7 @@ static void _show_pure_deck_chances() static void _give_nemelex_gift() { - if (grid_destroys_items(grd(you.pos()))) + if (feat_destroys_items(grd(you.pos()))) return; // Nemelex will give at least one gift early. @@ -2127,7 +2127,7 @@ static void _do_god_gift(bool prayed_for) case GOD_TROG: if (you.piety > 130 && random2(you.piety) > 120 - && !grid_destroys_items(grd(you.pos())) + && !feat_destroys_items(grd(you.pos())) && one_chance_in(4)) { if (you.religion == GOD_TROG @@ -2274,7 +2274,7 @@ static void _do_god_gift(bool prayed_for) } if (gift != NUM_BOOKS - && !grid_destroys_items(grd(you.pos()))) + && !feat_destroys_items(grd(you.pos()))) { if (gift == OBJ_RANDOM) { @@ -2433,7 +2433,7 @@ void pray() const bool was_praying = !!you.duration[DUR_PRAYER]; bool something_happened = false; - const god_type altar_god = grid_altar_god(grd(you.pos())); + const god_type altar_god = feat_altar_god(grd(you.pos())); if (altar_god != GOD_NO_GOD) { if (you.flight_mode() == FL_LEVITATE) @@ -2456,7 +2456,7 @@ void pray() return; } - god_pitch(grid_altar_god(grd(you.pos()))); + god_pitch(feat_altar_god(grd(you.pos()))); return; } } @@ -4433,7 +4433,7 @@ bool trog_burn_spellbooks() // If a grid is blocked, books lying there will be ignored. // Allow bombing of monsters. const unsigned short cloud = env.cgrid(*ri); - if (grid_is_solid(grd(*ri)) + if (feat_is_solid(grd(*ri)) || cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_FIRE) { continue; diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 4d0389e9eb..0e71583ffb 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -164,10 +164,10 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) // Allow wizard blink to send player into walls, in case the // user wants to alter that grid to something else. - if (wizard_blink && grid_is_solid(grd(beam.target))) + if (wizard_blink && feat_is_solid(grd(beam.target))) grd(beam.target) = DNGN_FLOOR; - if (grid_is_solid(grd(beam.target)) || monster_at(beam.target)) + if (feat_is_solid(grd(beam.target)) || monster_at(beam.target)) { mpr("Oops! Maybe something was there already."); random_blink(false); @@ -522,7 +522,7 @@ bool conjure_flame(int pow, const coord_def& where) return (false); } - if (grid_is_solid(where)) + if (cell_is_solid(where)) { if (grd(where) == DNGN_WAX_WALL) mpr("The flames aren't hot enough to melt wax walls!"); @@ -1446,7 +1446,7 @@ void cast_fly(int power) mpr("You fly up into the air."); // Merfolk boots unmeld if flight takes us out of water. - if (you.species == SP_MERFOLK && grid_is_water(grd(you.pos()))) + if (you.species == SP_MERFOLK && feat_is_water(grd(you.pos()))) unmeld_one_equip(EQ_BOOTS); } else @@ -1536,6 +1536,6 @@ void manage_fire_shield() // Place fire clouds all around you for ( adjacent_iterator ai; ai; ++ai ) - if (!grid_is_solid(grd(*ai)) && env.cgrid(*ai) == EMPTY_CLOUD) + if (!feat_is_solid(grd(*ai)) && env.cgrid(*ai) == EMPTY_CLOUD) place_cloud( CLOUD_FIRE, *ai, 1 + random2(6), KC_YOU ); } diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 4e611af001..8d8ac9ba7a 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1307,7 +1307,7 @@ bool cast_summon_elemental(int pow, god_type god, { mon = MONS_FIRE_ELEMENTAL; } - else if (grid_is_watery(grd(targ)) + else if (feat_is_watery(grd(targ)) && (any_elemental || restricted_type == MONS_WATER_ELEMENTAL)) { mon = MONS_WATER_ELEMENTAL; @@ -1914,7 +1914,7 @@ bool sunlight() target.x += x_offset[i]; target.y += y_offset[i]; - if (!in_bounds(target) || grid_is_solid(grd(target))) + if (!in_bounds(target) || feat_is_solid(grd(target))) continue; temp_bolt.explosion_draw_cell(target); @@ -2038,7 +2038,7 @@ void path_distance(coord_def & origin, { idx = adj_it->x + adj_it->y * X_WIDTH; if (see_cell(*adj_it) - && !grid_is_solid(env.grid(*adj_it)) + && !feat_is_solid(env.grid(*adj_it)) && exclusion.insert(idx).second) { monsters * temp = monster_at(*adj_it); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 0f431e3aff..11b71d67e6 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1605,8 +1605,8 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) if (you.species == SP_MERFOLK) { const dungeon_feature_type new_grid = grd(you.pos()); - if (grid_is_water(old_grid) && !grid_is_water(new_grid) - || !grid_is_water(old_grid) && grid_is_water(new_grid)) + if (feat_is_water(old_grid) && !feat_is_water(new_grid) + || !feat_is_water(old_grid) && feat_is_water(new_grid)) { init_player_doll(); } @@ -2063,7 +2063,7 @@ bool project_noise(void) if (!silenced( pos )) { - if (in_bounds(pos) && !grid_is_solid(grd(pos))) + if (in_bounds(pos) && !feat_is_solid(grd(pos))) { noisy(30, pos); success = true; diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 3f6f187090..075b0acf1b 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -934,7 +934,7 @@ static int _passwall(coord_def where, int pow, int, actor *) switch (grd(n)) { default: - if (grid_is_solid(grd(n))) + if (feat_is_solid(grd(n))) non_rock_barriers = true; done = true; break; @@ -1733,7 +1733,7 @@ bool cast_portal_projectile(int pow) if (item == -1) return (false); - if (grid_is_solid(target.target)) + if (cell_is_solid(target.target)) { mpr("You can't shoot at gazebos."); return (false); @@ -1758,7 +1758,7 @@ bool cast_portal_projectile(int pow) bool cast_apportation(int pow, const coord_def& where) { // Protect the player from destroying the item. - if (grid_destroys_items(grd(you.pos()))) + if (feat_destroys_items(grd(you.pos()))) { mpr( "That would be silly while over this terrain!" ); return (false); diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc index 00a1f290f6..e2cee8e971 100644 --- a/crawl-ref/source/spl-mis.cc +++ b/crawl-ref/source/spl-mis.cc @@ -2118,8 +2118,8 @@ void MiscastEffect::_ice(int severity) const dungeon_feature_type feat = grd(target->pos()); const bool frostable_feat = - (feat == DNGN_FLOOR || grid_altar_god(feat) != GOD_NO_GOD - || grid_is_staircase(feat) || grid_is_water(feat)); + (feat == DNGN_FLOOR || feat_altar_god(feat) != GOD_NO_GOD + || feat_is_staircase(feat) || feat_is_water(feat)); const std::string feat_name = (feat == DNGN_FLOOR ? "the " : "") + feature_description(target->pos(), false, DESC_NOCAP_THE); @@ -2180,7 +2180,7 @@ void MiscastEffect::_ice(int severity) you_msg = "A snowflake lands on your nose."; break; case 10: - if (grid_is_water(feat)) + if (feat_is_water(feat)) all_msg = "A thin layer of ice forms on " + feat_name; else all_msg = "Frost spreads across " + feat_name; diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 083cc13d14..56cb1eedb7 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -965,7 +965,7 @@ static bool _cloud_helper(cloud_func func, const coord_def& where, cloud_type ctype, kill_category whose, killer_type killer) { - if (!grid_is_solid(grd(where)) && env.cgrid(where) == EMPTY_CLOUD) + if (!feat_is_solid(grd(where)) && env.cgrid(where) == EMPTY_CLOUD) { func(where, pow, spread_rate, ctype, whose, killer); return (true); diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 6eb97aba92..c74e144a98 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -312,7 +312,7 @@ bool Stash::is_boring_feature(dungeon_feature_type feat) case DNGN_UNDISCOVERED_TRAP: return (true); default: - return (grid_is_solid(feat)); + return (feat_is_solid(feat)); } } @@ -349,7 +349,7 @@ void Stash::update() if (is_boring_feature(feat)) feat = DNGN_FLOOR; - if (grid_is_trap(feat)) + if (feat_is_trap(feat)) trap = get_trap_type(p); // If this is your position, you know what's on this square diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 667a5fff53..4cafaa9b08 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -1659,7 +1659,7 @@ int near_stairs(const coord_def &p, int max_dist, if (is_stair(feat)) { // Shouldn't happen for escape hatches. - if (grid_is_escape_hatch(feat)) + if (feat_is_escape_hatch(feat)) continue; stair_type = get_feature_dchar(feat); diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index ad0b33ee11..2c8518c9a6 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -43,14 +43,14 @@ actor* actor_at(const coord_def& c) return (monster_at(c)); } -bool grid_is_wall(dungeon_feature_type grid) +bool feat_is_wall(dungeon_feature_type feat) { - return (grid >= DNGN_MINWALL && grid <= DNGN_MAXWALL); + return (feat >= DNGN_MINWALL && feat <= DNGN_MAXWALL); } -bool grid_is_stone_stair(dungeon_feature_type grid) +bool feat_is_stone_stair(dungeon_feature_type feat) { - switch (grid) + switch (feat) { case DNGN_STONE_STAIRS_UP_I: case DNGN_STONE_STAIRS_UP_II: @@ -64,14 +64,14 @@ bool grid_is_stone_stair(dungeon_feature_type grid) } } -bool grid_is_staircase(dungeon_feature_type grid) +bool feat_is_staircase(dungeon_feature_type feat) { - if (grid_is_stone_stair(grid)) + if (feat_is_stone_stair(feat)) { // Make up staircases in hell appear as gates. if (player_in_hell()) { - switch (grid) + switch (feat) { case DNGN_STONE_STAIRS_UP_I: case DNGN_STONE_STAIRS_UP_II: @@ -85,22 +85,22 @@ bool grid_is_staircase(dungeon_feature_type grid) } // All branch entries/exits are staircases, except for Zot. - if (grid == DNGN_ENTER_ZOT || grid == DNGN_RETURN_FROM_ZOT) + if (feat == DNGN_ENTER_ZOT || feat == DNGN_RETURN_FROM_ZOT) return (false); - return (grid >= DNGN_ENTER_FIRST_BRANCH && grid <= DNGN_ENTER_LAST_BRANCH - || grid >= DNGN_RETURN_FROM_FIRST_BRANCH - && grid <= DNGN_RETURN_FROM_LAST_BRANCH); + return (feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH + || feat >= DNGN_RETURN_FROM_FIRST_BRANCH + && feat <= DNGN_RETURN_FROM_LAST_BRANCH); } -bool grid_is_escape_hatch(dungeon_feature_type grid) +bool feat_is_escape_hatch(dungeon_feature_type feat) { - return (grid == DNGN_ESCAPE_HATCH_UP || grid == DNGN_ESCAPE_HATCH_DOWN); + return (feat == DNGN_ESCAPE_HATCH_UP || feat == DNGN_ESCAPE_HATCH_DOWN); } -bool grid_sealable_portal(dungeon_feature_type grid) +bool feat_sealable_portal(dungeon_feature_type feat) { - switch (grid) + switch (feat) { case DNGN_ENTER_COCYTUS: case DNGN_ENTER_DIS: @@ -116,14 +116,14 @@ bool grid_sealable_portal(dungeon_feature_type grid) } } -bool grid_is_portal(dungeon_feature_type grid) +bool feat_is_portal(dungeon_feature_type feat) { - return (grid == DNGN_ENTER_PORTAL_VAULT || grid == DNGN_EXIT_PORTAL_VAULT); + return (feat == DNGN_ENTER_PORTAL_VAULT || feat == DNGN_EXIT_PORTAL_VAULT); } -command_type grid_stair_direction(dungeon_feature_type grid) +command_type feat_stair_direction(dungeon_feature_type feat) { - switch (grid) + switch (feat) { case DNGN_STONE_STAIRS_UP_I: case DNGN_STONE_STAIRS_UP_II: @@ -185,81 +185,81 @@ command_type grid_stair_direction(dungeon_feature_type grid) } } -bool grid_is_opaque(dungeon_feature_type grid) +bool feat_is_opaque(dungeon_feature_type feat) { - return (grid <= DNGN_MAXOPAQUE); + return (feat <= DNGN_MAXOPAQUE); } -bool grid_is_solid(dungeon_feature_type grid) +bool feat_is_solid(dungeon_feature_type feat) { - return (grid <= DNGN_MAXSOLID); + return (feat <= DNGN_MAXSOLID); } -bool grid_is_solid(int x, int y) +bool cell_is_solid(int x, int y) { - return (grid_is_solid(grd[x][y])); + return (feat_is_solid(grd[x][y])); } -bool grid_is_solid(const coord_def &c) +bool cell_is_solid(const coord_def &c) { - return (grid_is_solid(grd(c))); + return (feat_is_solid(grd(c))); } -bool grid_is_closed_door(dungeon_feature_type grid) +bool feat_is_closed_door(dungeon_feature_type feat) { - return (grid == DNGN_CLOSED_DOOR || grid == DNGN_DETECTED_SECRET_DOOR); + return (feat == DNGN_CLOSED_DOOR || feat == DNGN_DETECTED_SECRET_DOOR); } -bool grid_is_secret_door(dungeon_feature_type grid) +bool feat_is_secret_door(dungeon_feature_type feat) { - return (grid == DNGN_SECRET_DOOR || grid == DNGN_DETECTED_SECRET_DOOR); + return (feat == DNGN_SECRET_DOOR || feat == DNGN_DETECTED_SECRET_DOOR); } -bool grid_is_rock(dungeon_feature_type grid) +bool feat_is_rock(dungeon_feature_type feat) { - return (grid == DNGN_ORCISH_IDOL - || grid == DNGN_GRANITE_STATUE - || grid == DNGN_SECRET_DOOR - || grid >= DNGN_ROCK_WALL - && grid <= DNGN_CLEAR_PERMAROCK_WALL); + return (feat == DNGN_ORCISH_IDOL + || feat == DNGN_GRANITE_STATUE + || feat == DNGN_SECRET_DOOR + || feat >= DNGN_ROCK_WALL + && feat <= DNGN_CLEAR_PERMAROCK_WALL); } -bool grid_is_permarock(dungeon_feature_type grid) +bool feat_is_permarock(dungeon_feature_type feat) { - return (grid == DNGN_PERMAROCK_WALL || grid == DNGN_CLEAR_PERMAROCK_WALL); + return (feat == DNGN_PERMAROCK_WALL || feat == DNGN_CLEAR_PERMAROCK_WALL); } -bool grid_is_trap(dungeon_feature_type grid, bool undiscovered_too) +bool feat_is_trap(dungeon_feature_type feat, bool undiscovered_too) { - return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL - || grid == DNGN_TRAP_NATURAL - || undiscovered_too && grid == DNGN_UNDISCOVERED_TRAP); + return (feat == DNGN_TRAP_MECHANICAL || feat == DNGN_TRAP_MAGICAL + || feat == DNGN_TRAP_NATURAL + || undiscovered_too && feat == DNGN_UNDISCOVERED_TRAP); } -bool grid_is_water(dungeon_feature_type grid) +bool feat_is_water(dungeon_feature_type feat) { - return (grid == DNGN_SHALLOW_WATER - || grid == DNGN_DEEP_WATER - || grid == DNGN_OPEN_SEA - || grid == DNGN_WATER_RESERVED); + return (feat == DNGN_SHALLOW_WATER + || feat == DNGN_DEEP_WATER + || feat == DNGN_OPEN_SEA + || feat == DNGN_WATER_RESERVED); } -bool grid_is_watery(dungeon_feature_type grid) +bool feat_is_watery(dungeon_feature_type feat) { - return (grid_is_water(grid) || grid == DNGN_FOUNTAIN_BLUE); + return (feat_is_water(feat) || feat == DNGN_FOUNTAIN_BLUE); } -bool grid_destroys_items(dungeon_feature_type grid) +bool feat_destroys_items(dungeon_feature_type feat) { - return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER); + return (feat == DNGN_LAVA || feat == DNGN_DEEP_WATER); } -// Returns GOD_NO_GOD if grid is not an altar, otherwise returns the +// Returns GOD_NO_GOD if feat is not an altar, otherwise returns the // GOD_* type. -god_type grid_altar_god(dungeon_feature_type grid) +god_type feat_altar_god(dungeon_feature_type feat) { - if (grid >= DNGN_ALTAR_FIRST_GOD && grid <= DNGN_ALTAR_LAST_GOD) - return (static_cast(grid - DNGN_ALTAR_FIRST_GOD + 1)); + if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD) + return (static_cast(feat - DNGN_ALTAR_FIRST_GOD + 1)); return (GOD_NO_GOD); } @@ -274,10 +274,10 @@ dungeon_feature_type altar_for_god(god_type god) return static_cast(DNGN_ALTAR_FIRST_GOD + god - 1); } -bool grid_is_branch_stairs(dungeon_feature_type grid) +bool feat_is_branch_stairs(dungeon_feature_type feat) { - return ((grid >= DNGN_ENTER_FIRST_BRANCH && grid <= DNGN_ENTER_LAST_BRANCH) - || (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS)); + return ((feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH) + || (feat >= DNGN_ENTER_DIS && feat <= DNGN_ENTER_TARTARUS)); } // Find all connected cells containing ft, starting at d. @@ -379,13 +379,13 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where) for (int dx = -1; dx <= 1; dx++) for (int dy = -1; dy <= 1; dy++) { - // only considering orthogonal grids + // only considering orthogonal cells if ((abs(dx) + abs(dy)) % 2 == 0) continue; const dungeon_feature_type targ = grd[where.x + dx][where.y + dy]; - if (!grid_is_wall( targ )) + if (!feat_is_wall(targ)) continue; if (ret == DNGN_FLOOR) @@ -398,10 +398,10 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where) : ret); } -const char *grid_item_destruction_message(dungeon_feature_type grid) +const char *feat_item_destruction_message(dungeon_feature_type feat) { - return (grid == DNGN_DEEP_WATER ? "You hear a splash." : - grid == DNGN_LAVA ? "You hear a sizzling splash." + return (feat == DNGN_DEEP_WATER ? "You hear a splash." : + feat == DNGN_LAVA ? "You hear a sizzling splash." : "You hear a crunching noise."); } @@ -455,7 +455,7 @@ static coord_def _dgn_find_nearest_square( static bool _item_safe_square(const coord_def &pos) { const dungeon_feature_type feat = grd(pos); - return (is_traversable(feat) && !grid_destroys_items(feat)); + return (is_traversable(feat) && !feat_destroys_items(feat)); } // Moves an item on the floor to the nearest adjacent floor-space. @@ -473,8 +473,8 @@ static bool _dgn_shift_item(const coord_def &pos, item_def &item) bool is_critical_feature(dungeon_feature_type feat) { - return (grid_stair_direction(feat) != CMD_NO_CMD - || grid_altar_god(feat) != GOD_NO_GOD); + return (feat_stair_direction(feat) != CMD_NO_CMD + || feat_altar_god(feat) != GOD_NO_GOD); } static bool _is_feature_shift_target(const coord_def &pos) @@ -507,8 +507,8 @@ static bool _dgn_shift_feature(const coord_def &pos) static void _dgn_check_terrain_items(const coord_def &pos, bool preserve_items) { - const dungeon_feature_type grid = grd(pos); - if (grid_is_solid(grid) || grid_destroys_items(grid)) + const dungeon_feature_type feat = grd(pos); + if (feat_is_solid(feat) || feat_destroys_items(feat)) { int item = igrd(pos); bool did_destroy = false; @@ -528,7 +528,7 @@ static void _dgn_check_terrain_items(const coord_def &pos, bool preserve_items) } } if (did_destroy && player_can_hear(pos)) - mprf(MSGCH_SOUND, grid_item_destruction_message(grid)); + mprf(MSGCH_SOUND, feat_item_destruction_message(feat)); } } @@ -552,13 +552,13 @@ static void _dgn_check_terrain_blood(const coord_def &pos, { // Caller has already changed the grid, and old_feat is actually // the new feat. - if (old_feat != DNGN_FLOOR && !grid_is_solid(old_feat)) + if (old_feat != DNGN_FLOOR && !feat_is_solid(old_feat)) env.map(pos).property &= ~(FPROP_BLOODY); } else { - if (grid_is_solid(old_feat) != grid_is_solid(new_feat) - || grid_is_water(new_feat) || grid_destroys_items(new_feat) + if (feat_is_solid(old_feat) != feat_is_solid(new_feat) + || feat_is_water(new_feat) || feat_destroys_items(new_feat) || is_critical_feature(new_feat)) { env.map(pos).property &= ~(FPROP_BLOODY); @@ -630,7 +630,7 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos) see_cell(orig_pos) ? DESC_CAP_THE : DESC_CAP_A, false); - std::string prep = grid_preposition(orig_feat, false); + std::string prep = feat_preposition(orig_feat, false); std::string orig_actor, dest_actor; if (orig_pos == you.pos()) @@ -870,7 +870,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, return (true); } -static bool _ok_dest_grid(const actor* orig_actor, +static bool _ok_dest_cell(const actor* orig_actor, const dungeon_feature_type orig_feat, const coord_def dest_pos) { @@ -901,7 +901,7 @@ bool slide_feature_over(const coord_def &src, coord_def prefered_dest, const actor* orig_actor = actor_at(src); if (in_bounds(prefered_dest) - && _ok_dest_grid(orig_actor, orig_feat, prefered_dest)) + && _ok_dest_cell(orig_actor, orig_feat, prefered_dest)) { ASSERT(prefered_dest != src); } @@ -910,7 +910,7 @@ bool slide_feature_over(const coord_def &src, coord_def prefered_dest, int squares = 0; for (adjacent_iterator ai(src); ai; ++ai) { - if (_ok_dest_grid(orig_actor, orig_feat, *ai) + if (_ok_dest_cell(orig_actor, orig_feat, *ai) && one_chance_in(++squares)) { prefered_dest = *ai; @@ -1003,7 +1003,7 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift, if (escape) { - if (in_bounds(empty) && !is_grid_dangerous(grd(empty))) + if (in_bounds(empty) && !is_feat_dangerous(grd(empty))) { mpr("You manage to scramble free!"); move_player_to_grid( empty, false, false, true ); @@ -1032,12 +1032,12 @@ void init_feat_desc_cache() { for (int i = 0; i < NUM_FEATURES; i++) { - dungeon_feature_type grid = static_cast(i); - std::string desc = feature_description(grid); + dungeon_feature_type feat = static_cast(i); + std::string desc = feature_description(feat); lowercase(desc); if (feat_desc_cache.find(desc) == feat_desc_cache.end()) - feat_desc_cache[desc] = grid; + feat_desc_cache[desc] = feat; } } @@ -1056,21 +1056,21 @@ dungeon_feature_type feat_by_desc(std::string desc) return (DNGN_UNSEEN); } -// If active is true, the player is just stepping onto the grid, with the +// If active is true, the player is just stepping onto the feature, with the // message: " slides away as you move it!" -// Else, the actor is already on the grid: +// Else, the actor is already on the feature: // " moves from to !" -std::string grid_preposition(dungeon_feature_type grid, bool active, +std::string feat_preposition(dungeon_feature_type feat, bool active, const actor* who) { const bool airborne = !who || who->airborne(); - const command_type dir = grid_stair_direction(grid); + const command_type dir = feat_stair_direction(feat); if (dir == CMD_NO_CMD) { - if (grid == DNGN_STONE_ARCH) + if (feat == DNGN_STONE_ARCH) return "beside"; - else if (grid_is_solid(grid)) // Passwall? + else if (feat_is_solid(feat)) // Passwall? { if (active) return "inside"; @@ -1079,7 +1079,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, } else if (!airborne) { - if (grid == DNGN_LAVA || grid_is_water(grid)) + if (feat == DNGN_LAVA || feat_is_water(feat)) { if (active) return "into"; @@ -1096,7 +1096,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, } } - if (dir == CMD_GO_UPSTAIRS && grid_is_escape_hatch(grid)) + if (dir == CMD_GO_UPSTAIRS && feat_is_escape_hatch(feat)) { if (active) return "under"; @@ -1113,7 +1113,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, } if (dir == CMD_GO_DOWNSTAIRS - && (grid_is_staircase(grid) || grid_is_escape_hatch(grid))) + && (feat_is_staircase(feat) || feat_is_escape_hatch(feat))) { if (active) return "onto"; @@ -1124,13 +1124,13 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, return "beside"; } -std::string stair_climb_verb(dungeon_feature_type grid) +std::string stair_climb_verb(dungeon_feature_type feat) { - ASSERT(grid_stair_direction(grid) != CMD_NO_CMD); + ASSERT(feat_stair_direction(feat) != CMD_NO_CMD); - if (grid_is_staircase(grid)) + if (feat_is_staircase(feat)) return "climb"; - else if (grid_is_escape_hatch(grid)) + else if (feat_is_escape_hatch(feat)) return "use"; else return "pass through"; diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h index 05dd845f42..35ff6603c9 100644 --- a/crawl-ref/source/terrain.h +++ b/crawl-ref/source/terrain.h @@ -19,32 +19,32 @@ bool fall_into_a_pool( const coord_def& entry, bool allow_shift, unsigned char terrain ); -bool grid_is_wall(dungeon_feature_type grid); -bool grid_is_opaque(dungeon_feature_type grid); -bool grid_is_solid(dungeon_feature_type grid); -bool grid_is_solid(int x, int y); -bool grid_is_solid(const coord_def &c); -bool grid_is_closed_door(dungeon_feature_type grid); -bool grid_is_secret_door(dungeon_feature_type grid); -bool grid_is_rock(dungeon_feature_type grid); -bool grid_is_permarock(dungeon_feature_type grid); -bool grid_is_stone_stair(dungeon_feature_type grid); -bool grid_is_staircase(dungeon_feature_type grid); -bool grid_is_escape_hatch(dungeon_feature_type grid); -bool grid_is_trap(dungeon_feature_type grid, bool undiscovered_too = false); -command_type grid_stair_direction(dungeon_feature_type grid); -bool grid_sealable_portal(dungeon_feature_type grid); -bool grid_is_portal(dungeon_feature_type grid); - -std::string grid_preposition(dungeon_feature_type grid, bool active = false, +bool feat_is_wall(dungeon_feature_type feat); +bool feat_is_opaque(dungeon_feature_type feat); +bool feat_is_solid(dungeon_feature_type feat); +bool cell_is_solid(int x, int y); +bool cell_is_solid(const coord_def &c); +bool feat_is_closed_door(dungeon_feature_type feat); +bool feat_is_secret_door(dungeon_feature_type feat); +bool feat_is_rock(dungeon_feature_type feat); +bool feat_is_permarock(dungeon_feature_type feat); +bool feat_is_stone_stair(dungeon_feature_type feat); +bool feat_is_staircase(dungeon_feature_type feat); +bool feat_is_escape_hatch(dungeon_feature_type feat); +bool feat_is_trap(dungeon_feature_type feat, bool undiscovered_too = false); +command_type feat_stair_direction(dungeon_feature_type feat); +bool feat_sealable_portal(dungeon_feature_type feat); +bool feat_is_portal(dungeon_feature_type feat); + +std::string feat_preposition(dungeon_feature_type feat, bool active = false, const actor* who = NULL); -std::string stair_climb_verb(dungeon_feature_type grid); +std::string stair_climb_verb(dungeon_feature_type feat); -bool grid_is_water(dungeon_feature_type grid); -bool grid_is_watery(dungeon_feature_type grid); -god_type grid_altar_god(dungeon_feature_type grid); +bool feat_is_water(dungeon_feature_type feat); +bool feat_is_watery(dungeon_feature_type feat); +god_type feat_altar_god(dungeon_feature_type feat); dungeon_feature_type altar_for_god(god_type god); -bool grid_is_branch_stairs(dungeon_feature_type grid); +bool feat_is_branch_stairs(dungeon_feature_type feat); void find_connected_identical(coord_def d, dungeon_feature_type ft, std::set& out); void find_connected_range(coord_def d, dungeon_feature_type ft_min, @@ -54,9 +54,9 @@ void get_door_description(int door_size, const char** adjective, const char** no dungeon_feature_type grid_secret_door_appearance(const coord_def &where); dungeon_feature_type grid_appearance(const coord_def &gc); unsigned int show_appearance(const coord_def &ep); -bool grid_destroys_items(dungeon_feature_type grid); +bool feat_destroys_items(dungeon_feature_type feat); -const char *grid_item_destruction_message( dungeon_feature_type grid ); +const char *feat_item_destruction_message( dungeon_feature_type feat ); // Terrain changed under 'pos', perform necessary effects. void dungeon_terrain_changed(const coord_def &pos, diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 6a150a4b05..23fbe166f4 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -118,7 +118,7 @@ static int _bow_offset(const monsters *mon) int tileidx_monster_base(const monsters *mon, bool detected) { - bool in_water = grid_is_water(grd(mon->pos())); + bool in_water = feat_is_water(grd(mon->pos())); int type = mon->type; @@ -2364,7 +2364,7 @@ int tileidx_feature(int object, int gx, int gy) { const dungeon_feature_type appear = grid_secret_door_appearance(coord_def(gx, gy)); - ASSERT(!grid_is_secret_door(appear)); + ASSERT(!feat_is_secret_door(appear)); return tileidx_feature((int) appear, gx, gy); } case DNGN_CLEAR_ROCK_WALL: @@ -4243,7 +4243,7 @@ void tile_init_flavour(const coord_def &gc) env.tile_flv(gc).wall = env.tile_default.wall + wall_rnd; } - if (grd(gc) == DNGN_OPEN_DOOR || grid_is_closed_door(grd(gc))) + if (grd(gc) == DNGN_OPEN_DOOR || feat_is_closed_door(grd(gc))) { // Check for horizontal gates. @@ -4271,7 +4271,7 @@ void tile_init_flavour(const coord_def &gc) else env.tile_flv(gc).special = 0; } - else if (grid_is_secret_door(grd(gc))) + else if (feat_is_secret_door(grd(gc))) env.tile_flv(gc).special = 0; else if (!env.tile_flv(gc).special) env.tile_flv(gc).special = random2(256); diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 35598704b6..4c7da0c727 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -1214,16 +1214,16 @@ int DungeonRegion::handle_mouse(MouseEvent &event) if (!(event.mod & MOD_SHIFT)) return 'g'; - const dungeon_feature_type grid = grd(gc); - switch (grid_stair_direction(grid)) + const dungeon_feature_type feat = grd(gc); + switch (feat_stair_direction(feat)) { case CMD_GO_DOWNSTAIRS: return ('>'); case CMD_GO_UPSTAIRS: return ('<'); default: - if (is_altar(grid) - && player_can_join_god(grid_altar_god(grid))) + if (is_altar(feat) + && player_can_join_god(feat_altar_god(feat))) { return ('p'); } @@ -1343,14 +1343,14 @@ bool DungeonRegion::update_tip_text(std::string& tip) if (igrd(m_cursor[CURSOR_MOUSE]) != NON_ITEM) tip += "\n[L-Click] Pick up items (g)"; - const dungeon_feature_type grid = grd(m_cursor[CURSOR_MOUSE]); - const command_type dir = grid_stair_direction(grid); + const dungeon_feature_type feat = grd(m_cursor[CURSOR_MOUSE]); + const command_type dir = feat_stair_direction(feat); if (dir != CMD_NO_CMD) { tip += "\n[Shift-L-Click] "; - if (grid == DNGN_ENTER_SHOP) + if (feat == DNGN_ENTER_SHOP) tip += "enter shop"; - else if (is_gate(grid)) + else if (is_gate(feat)) tip += "enter gate"; else tip += "use stairs"; @@ -1360,7 +1360,7 @@ bool DungeonRegion::update_tip_text(std::string& tip) else tip += " (<)"; } - else if (is_altar(grid) && player_can_join_god(grid_altar_god(grid))) + else if (is_altar(feat) && player_can_join_god(feat_altar_god(feat))) tip += "\n[Shift-L-Click] pray on altar (p)"; // Character overview. @@ -1375,7 +1375,7 @@ bool DungeonRegion::update_tip_text(std::string& tip) { tip = ""; - if (!grid_is_solid(m_cursor[CURSOR_MOUSE])) + if (!cell_is_solid(m_cursor[CURSOR_MOUSE])) { int mon_num = mgrd(m_cursor[CURSOR_MOUSE]); if (mon_num == NON_MONSTER || mons_friendly(&menv[mon_num])) @@ -1393,7 +1393,7 @@ bool DungeonRegion::update_tip_text(std::string& tip) } else { - if (i_feel_safe() && !grid_is_solid(m_cursor[CURSOR_MOUSE])) + if (i_feel_safe() && !cell_is_solid(m_cursor[CURSOR_MOUSE])) tip = "[L-Click] Travel\n"; tip += "[R-Click] Describe"; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 346c04bd25..672f387dd9 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -191,9 +191,9 @@ static void _populate_stair_distances(const level_pos &target); static bool _is_greed_inducing_square(const LevelStashes *ls, const coord_def &c); -bool is_player_seen(int grid_x, int grid_y) +bool is_player_seen(int feat_x, int feat_y) { - return (is_terrain_seen(grid_x, grid_y)); + return (is_terrain_seen(feat_x, feat_y)); } // Returns true if there is a known trap at (x,y). Returns false for non-trap @@ -201,16 +201,16 @@ bool is_player_seen(int grid_x, int grid_y) // inline bool is_trap(const coord_def& c) { - return grid_is_trap(grd(c)); + return feat_is_trap(grd(c)); } // Returns an estimate for the time needed to cross this feature. // This is done, so traps etc. will usually be circumvented where possible. inline int feature_traverse_cost(dungeon_feature_type feature) { - if (feature == DNGN_SHALLOW_WATER || grid_is_closed_door(feature)) + if (feature == DNGN_SHALLOW_WATER || feat_is_closed_door(feature)) return 2; - else if (grid_is_trap(feature)) + else if (feat_is_trap(feature)) return 3; return 1; @@ -219,7 +219,7 @@ inline int feature_traverse_cost(dungeon_feature_type feature) // Returns true if the dungeon feature supplied is an altar. bool is_altar(dungeon_feature_type grid) { - return grid_altar_god(grid) != GOD_NO_GOD; + return feat_altar_god(grid) != GOD_NO_GOD; } bool is_altar(const coord_def &c) @@ -231,7 +231,7 @@ inline bool is_player_altar(dungeon_feature_type grid) { // An ugly hack, but that's what religion.cc does. return (you.religion != GOD_NO_GOD - && grid_altar_god(grid) == you.religion); + && feat_altar_god(grid) == you.religion); } inline bool is_player_altar(const coord_def &c) @@ -278,7 +278,7 @@ bool is_traversable(dungeon_feature_type grid) opacity_type _feat_opacity(dungeon_feature_type feat) { - return (grid_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR); + return (feat_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR); } // A cell is considered clear unless the player knows it's @@ -594,7 +594,7 @@ static bool _is_reseedable(const coord_def& c) return (true); const dungeon_feature_type grid = grd(c); - return (grid_is_water(grid) + return (feat_is_water(grid) || grid == DNGN_LAVA || is_trap(c) || _is_monster_blocked(c)); @@ -1896,7 +1896,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) if (dc != start && (feature != DNGN_FLOOR - && !grid_is_water(feature) + && !feat_is_water(feature) && feature != DNGN_LAVA || is_waypoint(dc) || is_stash(ls, dc.x, dc.y))) @@ -1992,7 +1992,7 @@ void find_travel_pos(const coord_def& youpos, coord_def unseen = coord_def(); for (adjacent_iterator ai(dest); ai; ++ai) if (!see_cell(*ai) - && (!is_terrain_seen(*ai) || !grid_is_wall(grd(*ai)))) + && (!is_terrain_seen(*ai) || !feat_is_wall(grd(*ai)))) { unseen = *ai; break; @@ -2733,7 +2733,7 @@ void start_translevel_travel(bool prompt_for_destination) command_type _trans_negotiate_stairs() { - return grid_stair_direction(grd(you.pos())); + return feat_stair_direction(grd(you.pos())); } static int _target_distance_from(const coord_def &pos) @@ -2884,7 +2884,7 @@ static int _find_transtravel_stair( const level_id &cur, // that will leave the player unable to retrace their path. // This does not apply if we have a destination with a specific // position on the target level travel wants to get to. - if (grid_is_escape_hatch(si.grid) + if (feat_is_escape_hatch(si.grid) && target.pos.x == -1 && dest.id == target.id) { @@ -4131,7 +4131,7 @@ const runrest &runrest::operator = (int newrunmode) return (*this); } -static dungeon_feature_type _base_grid_type( dungeon_feature_type grid ) +static dungeon_feature_type _base_feat_type( dungeon_feature_type grid ) { // Don't stop for undiscovered traps: if ((grid >= DNGN_FLOOR_MIN && grid <= DNGN_FLOOR_MAX) @@ -4141,7 +4141,7 @@ static dungeon_feature_type _base_grid_type( dungeon_feature_type grid ) } // Merge walls and secret doors. - if (grid_is_wall(grid) || grid == DNGN_SECRET_DOOR) + if (feat_is_wall(grid) || grid == DNGN_SECRET_DOOR) return (DNGN_ROCK_WALL); return (grid); @@ -4153,7 +4153,7 @@ void runrest::set_run_check(int index, int dir) const coord_def targ = you.pos() + Compass[dir]; - run_check[index].grid = _base_grid_type( grd(targ) ); + run_check[index].grid = _base_feat_type( grd(targ) ); } bool runrest::check_stop_running() @@ -4179,7 +4179,7 @@ bool runrest::run_grids_changed() const for (int i = 0; i < 3; i++) { const coord_def targ = you.pos() + run_check[i].delta; - const dungeon_feature_type targ_grid = _base_grid_type(grd(targ)); + const dungeon_feature_type targ_grid = _base_feat_type(grd(targ)); if (run_check[i].grid != targ_grid) return (true); @@ -4295,7 +4295,7 @@ void explore_discoveries::found_feature(const coord_def &pos, add_stair(stair); es_flags |= ES_STAIR; } - else if (grid_is_portal(grid) && ES_portal) + else if (feat_is_portal(grid) && ES_portal) { const named_thing portal(cleaned_feature_description(pos), 1); add_stair(portal); diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 7370d49d44..8ce242e5e1 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -66,17 +66,17 @@ void clear_excludes(); unsigned char is_waypoint(const coord_def &p); bool is_exclude_root(const coord_def &p); -bool is_stair(dungeon_feature_type gridc); -bool is_travelable_stair(dungeon_feature_type gridc); -bool is_escape_hatch(dungeon_feature_type gridc); -bool is_gate(dungeon_feature_type gridc); -command_type direction_to_command( char x, char y ); -bool is_altar(dungeon_feature_type gridc); -bool is_resting( void ); +bool is_stair(dungeon_feature_type feat); +bool is_travelable_stair(dungeon_feature_type feat); +bool is_escape_hatch(dungeon_feature_type feat); +bool is_gate(dungeon_feature_type feat); +command_type direction_to_command(char x, char y); +bool is_altar(dungeon_feature_type feat); +bool is_resting(void); #ifdef CLUA_BINDINGS const char *trap_name(const coord_def &p); #endif -bool is_traversable(dungeon_feature_type grid); +bool is_traversable(dungeon_feature_type feat); void explore_pickup_event(int did_pickup, int tried_pickup); bool is_excluded(const coord_def &p); diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index 3420909acb..354e81c92c 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -2211,7 +2211,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) { tiles.place_cursor(CURSOR_TUTORIAL, gc); std::string altar = "An altar to "; - altar += god_name(grid_altar_god(grd(gc))); + altar += god_name(feat_altar_god(grd(gc))); tiles.add_text_tag(TAG_TUTORIAL, altar, gc); } #endif @@ -4294,7 +4294,7 @@ static void _tutorial_describe_feature(int x, int y) default: if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD) { - god_type altar_god = grid_altar_god(feat); + god_type altar_god = feat_altar_god(feat); if (you.religion == GOD_NO_GOD) { @@ -4595,9 +4595,9 @@ void tutorial_describe_monster(const monsters *mons) void tutorial_observe_cell(const coord_def& gc) { - if (grid_is_escape_hatch(grd(gc))) + if (feat_is_escape_hatch(grd(gc))) learned_something_new(TUT_SEEN_ESCAPE_HATCH, gc); - else if (grid_is_branch_stairs(grd(gc))) + else if (feat_is_branch_stairs(grd(gc))) learned_something_new(TUT_SEEN_BRANCH, gc); else if (is_feature('>', gc)) learned_something_new(TUT_SEEN_STAIRS, gc); @@ -4605,7 +4605,7 @@ void tutorial_observe_cell(const coord_def& gc) learned_something_new(TUT_SEEN_ALTAR, gc); else if (is_feature('^', gc)) learned_something_new(TUT_SEEN_TRAP, gc); - else if (grid_is_closed_door(grd(gc))) + else if (feat_is_closed_door(grd(gc))) learned_something_new(TUT_SEEN_DOOR, gc); else if (grd(gc) == DNGN_ENTER_SHOP) learned_something_new(TUT_SEEN_SHOP, gc); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 9c3e465c1c..bc34ea8ce1 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -400,7 +400,7 @@ static int _view_emphasised_colour(const coord_def& where, { if (is_travelable_stair(feat) && !travel_cache.know_stair(where)) { - if ((you.your_level || grid_stair_direction(feat) == CMD_GO_DOWNSTAIRS) + if ((you.your_level || feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS) && you.where_are_you != BRANCH_VESTIBULE_OF_HELL) { return (newcolour); @@ -417,7 +417,7 @@ static bool _show_bloodcovered(const coord_def& where) dungeon_feature_type grid = grd(where); // Altars, stairs (of any kind) and traps should not be coloured red. - return (!is_critical_feature(grid) && !grid_is_trap(grid)); + return (!is_critical_feature(grid) && !feat_is_trap(grid)); } static unsigned short _tree_colour(const coord_def& where) @@ -706,12 +706,12 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, } #endif - dungeon_feature_type grid_value = grd(p); + dungeon_feature_type feat_value = grd(p); if (!see_cell(p)) { const int remembered = get_envmap_obj(p); if (remembered < NUM_REAL_FEATURES) - grid_value = static_cast(remembered); + feat_value = static_cast(remembered); } unsigned tc = travel_colour ? _get_travel_colour(p) : DARKGREY; @@ -735,14 +735,14 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, int feature_colour = DARKGREY; const bool terrain_seen = is_terrain_seen(p); - const feature_def &fdef = Feature[grid_value]; + const feature_def &fdef = Feature[feat_value]; feature_colour = terrain_seen? fdef.seen_colour : fdef.map_colour; if (terrain_seen && feature_colour != fdef.seen_em_colour && fdef.seen_em_colour) { feature_colour = - _view_emphasised_colour(p, grid_value, feature_colour, + _view_emphasised_colour(p, feat_value, feature_colour, fdef.seen_em_colour); } @@ -775,13 +775,13 @@ screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, } if (Options.feature_item_brand - && is_critical_feature(grid_value) + && is_critical_feature(feat_value) && igrd(p) != NON_ITEM) { tc |= COLFLAG_FEATURE_ITEM; } else if (Options.trap_item_brand - && grid_is_trap(grid_value) && igrd(p) != NON_ITEM) + && feat_is_trap(feat_value) && igrd(p) != NON_ITEM) { // FIXME: this uses the real igrd, which the player shouldn't // be aware of. @@ -850,13 +850,13 @@ void clear_map(bool clear_detected_items, bool clear_detected_monsters) { unsigned int feature = grd(p); - unsigned int grid_symbol; - unsigned short grid_colour; - get_item_symbol(feature, &grid_symbol, &grid_colour); + unsigned int feat_symbol; + unsigned short feat_colour; + get_item_symbol(feature, &feat_symbol, &feat_colour); unsigned int fg; unsigned int bg; - tileidx_unseen(fg, bg, grid_symbol, p); + tileidx_unseen(fg, bg, feat_symbol, p); env.tile_bk_bg(p) = bg; env.tile_bk_fg(p) = fg; } @@ -900,7 +900,7 @@ int get_mons_colour(const monsters *mons) { if (Options.feature_item_brand != CHATTR_NORMAL && is_critical_feature(grd(mons->pos())) - && grid_stair_direction(grd(mons->pos())) != CMD_NO_CMD) + && feat_stair_direction(grd(mons->pos())) != CMD_NO_CMD) { col |= COLFLAG_FEATURE_ITEM; } @@ -1590,7 +1590,7 @@ inline static void _update_item_grid(const coord_def &gp, const coord_def &ep) const dungeon_feature_type grid = grd(gp); if (Options.feature_item_brand && is_critical_feature(grid)) ecol |= COLFLAG_FEATURE_ITEM; - else if (Options.trap_item_brand && grid_is_trap(grid)) + else if (Options.trap_item_brand && feat_is_trap(grid)) ecol |= COLFLAG_TRAP_ITEM; else { @@ -1940,7 +1940,7 @@ void blood_smell( int strength, const coord_def& where ) } -// Determines if the given feature is present at (x, y) in _grid_ coordinates. +// Determines if the given feature is present at (x, y) in _feat_ coordinates. // If you have map coords, add (1, 1) to get grid coords. // Use one of // 1. '<' and '>' to look for stairs @@ -2904,13 +2904,13 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, bool open = true; - if (grid_is_solid(grd(*ri)) && !grid_is_closed_door(grd(*ri))) + if (feat_is_solid(grd(*ri)) && !feat_is_closed_door(grd(*ri))) { open = false; for (adjacent_iterator ai(*ri); ai; ++ai) { - if (map_bounds(*ai) && (!grid_is_opaque(grd(*ai)) - || grid_is_closed_door(grd(*ai)))) + if (map_bounds(*ai) && (!feat_is_opaque(grd(*ai)) + || feat_is_closed_door(grd(*ai)))) { open = true; break; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index eccfed5285..28bc00d85b 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -377,13 +377,13 @@ static int _exploration_estimate(bool seen_only = false) } bool open = true; - if (grid_is_solid(grd(pos)) && !grid_is_closed_door(grd(pos))) + if (feat_is_solid(grd(pos)) && !feat_is_closed_door(grd(pos))) { open = false; for (adjacent_iterator ai(pos); ai; ++ai) { - if (map_bounds(*ai) && (!grid_is_opaque(grd(*ai)) - || grid_is_closed_door(grd(*ai)))) + if (map_bounds(*ai) && (!feat_is_opaque(grd(*ai)) + || feat_is_closed_door(grd(*ai)))) { open = true; break; @@ -639,10 +639,10 @@ static void _xom_make_item(object_class_type base, int subtype, int power) items(true, base, subtype, true, power, MAKE_ITEM_RANDOM_RACE, 0, 0, GOD_XOM); - if (grid_destroys_items(grd(you.pos()))) + if (feat_destroys_items(grd(you.pos()))) { if (!silenced(you.pos())) - mprf(MSGCH_SOUND, grid_item_destruction_message(grd(you.pos()))); + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(you.pos()))); simple_god_message(" snickers.", GOD_XOM); destroy_item(thing_created, true); @@ -2383,8 +2383,8 @@ static void _xom_zero_miscast() const dungeon_feature_type feat = grd(you.pos()); - if (!grid_is_solid(feat) && grid_stair_direction(feat) == CMD_NO_CMD - && !grid_is_trap(feat) && feat != DNGN_STONE_ARCH + if (!feat_is_solid(feat) && feat_stair_direction(feat) == CMD_NO_CMD + && !feat_is_trap(feat) && feat != DNGN_STONE_ARCH && feat != DNGN_OPEN_DOOR && feat != DNGN_ABANDONED_SHOP) { const std::string feat_name = @@ -2405,13 +2405,13 @@ static void _xom_zero_miscast() vec->push_back(feat_name + " seems to rush up at you!"); - if (grid_is_water(feat)) + if (feat_is_water(feat)) { priority.push_back("Something invisible splashes into the " "water beneath you!"); } } - else if (grid_is_water(feat)) + else if (feat_is_water(feat)) { priority.push_back("The water briefly recedes away from you."); priority.push_back("Something invisible splashes into the water " @@ -2419,7 +2419,7 @@ static void _xom_zero_miscast() } } - if (!grid_destroys_items(feat) && !grid_is_solid(feat) + if (!feat_destroys_items(feat) && !feat_is_solid(feat) && inv_items.size() > 0) { int idx = inv_items[random2(inv_items.size())]; @@ -2816,7 +2816,7 @@ static int _xom_player_confusion_effect(int sever, bool debug = false) { // Don't confuse the player if standing next to lava or deep water. for (adjacent_iterator ai; ai; ++ai) - if (in_bounds(*ai) && is_grid_dangerous(grd(*ai))) + if (in_bounds(*ai) && is_feat_dangerous(grd(*ai))) return (XOM_DID_NOTHING); } @@ -2883,7 +2883,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) ASSERT(stair_pos != you.pos()); dungeon_feature_type feat = grd(stair_pos); - ASSERT(grid_stair_direction(feat) != CMD_NO_CMD); + ASSERT(feat_stair_direction(feat) != CMD_NO_CMD); coord_def begin, towards; @@ -2951,7 +2951,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_cell(ray.pos()) - && !grid_is_solid(ray.pos()) && ray.pos() != you.pos()) + && !cell_is_solid(ray.pos()) && ray.pos() != you.pos()) { if (ray.pos() == stair_pos) found_stairs = true; @@ -2961,7 +2961,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) } past_stairs--; - if (!away && grid_is_solid(ray.pos())) + if (!away && cell_is_solid(ray.pos())) { // Transparent wall between stair and player. return (stairs_moved); @@ -2969,7 +2969,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (away && !found_stairs) { - if (grid_is_solid(ray.pos())) + if (cell_is_solid(ray.pos())) { // Transparent wall between stair and player. return (stairs_moved); @@ -3050,11 +3050,11 @@ static int _xom_repel_stairs(bool debug = false) for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true); ri; ++ri) { dungeon_feature_type feat = grd(*ri); - if (grid_stair_direction(feat) != CMD_NO_CMD + if (feat_stair_direction(feat) != CMD_NO_CMD && feat != DNGN_ENTER_SHOP) { stairs_avail.push_back(*ri); - if (grid_is_staircase(feat)) + if (feat_is_staircase(feat)) real_stairs = true; } } @@ -3073,7 +3073,7 @@ static int _xom_repel_stairs(bool debug = false) std::string feat_name; if (!real_stairs) { - if (grid_is_escape_hatch(grd(stairs_avail[0]))) + if (feat_is_escape_hatch(grd(stairs_avail[0]))) feat_name = "escape hatch"; else feat_name = "gate"; @@ -3088,7 +3088,7 @@ static int _xom_repel_stairs(bool debug = false) you.duration[DUR_REPEL_STAIRS_MOVE] = 1000; if (one_chance_in(5) - || grid_stair_direction(grd(you.pos())) != CMD_NO_CMD + || feat_stair_direction(grd(you.pos())) != CMD_NO_CMD && grd(you.pos()) != DNGN_ENTER_SHOP) { you.duration[DUR_REPEL_STAIRS_CLIMB] = 500; -- cgit v1.2.3-54-g00ecf