summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-09 12:44:48 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-09 12:44:48 +0000
commitb5e9ab44fd03d488791592f447c3b787b49b2d37 (patch)
treee5d622a784dad678d9698a63000bdb890b23cf42 /crawl-ref
parentd59655f1d4249575c1ffa8d1102446eef5d6728f (diff)
downloadcrawl-ref-b5e9ab44fd03d488791592f447c3b787b49b2d37.tar.gz
crawl-ref-b5e9ab44fd03d488791592f447c3b787b49b2d37.zip
Fix level map, and travel, knowing too much about the level. Hopefully
this didn't break anything which travel depends on. Fixes [2051248]. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9012 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/terrain.cc4
-rw-r--r--crawl-ref/source/travel.cc34
-rw-r--r--crawl-ref/source/view.cc13
4 files changed, 25 insertions, 28 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 57f1809db3..753fdc7a0b 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2944,7 +2944,7 @@ void forget_map(unsigned char chance_forgotten, bool force)
{
env.map(*ri).clear();
#ifdef USE_TILE
- set_envmap_obj(*ri, 0);
+ set_envmap_obj(*ri, DNGN_UNSEEN);
tiles.update_minimap(ri->x, ri->y);
env.tile_bk_fg[ri->x][ri->y] = 0;
env.tile_bk_bg[ri->x][ri->y]
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 7ffb7cdafe..aa3df3d151 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -837,8 +837,8 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2,
viewwindow(true, false);
}
- set_terrain_changed(pos1.x, pos1.y);
- set_terrain_changed(pos2.x, pos2.y);
+ set_terrain_changed(pos1);
+ set_terrain_changed(pos2);
if (announce)
_announce_swap(pos1, pos2);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index d49ddac96f..3cacfce33a 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -551,29 +551,31 @@ bool is_travelsafe_square(int x, int y, bool ignore_hostile,
if (!ignore_terrain_knowledge && !is_terrain_known(x, y))
return (false);
- const dungeon_feature_type grid = grd[x][y];
-
- // Special-case secret doors so that we don't run into awkwardness when
- // a monster opens a secret door without the hero seeing it, but the travel
- // code paths through the secret door because it looks at the actual grid,
- // rather than the env overmap.
- if ((grid == DNGN_OPEN_DOOR || grid == DNGN_CLOSED_DOOR)
- && is_terrain_changed(x, y))
- {
- const int c = get_envmap_obj(x, y);
- const int secret_door = grid_secret_door_appearance(coord_def(x, y));
- return (c != secret_door);
- }
+ const bool seen = see_grid(x,y);
+ const int grid = (seen ? grd[x][y] : get_envmap_obj(x,y));
- if (!ignore_hostile && _is_monster_blocked(x, y))
+ // FIXME: this compares to the *real* monster at the square,
+ // even if the one we've seen is different.
+ if (!ignore_hostile
+ && (seen || grid > DNGN_START_OF_MONSTERS)
+ && _is_monster_blocked(x, y))
+ {
return (false);
+ }
// If 'ignore_hostile' is true, we're ignoring hazards that can be
// navigated over if the player is willing to take damage, or levitate.
- if (ignore_hostile && _is_reseedable(x, y))
+ if (ignore_hostile
+ && (seen || grid < NUM_REAL_FEATURES)
+ && _is_reseedable(x, y))
+ {
+ return (true);
+ }
+
+ if (grid >= NUM_REAL_FEATURES)
return (true);
- return (is_traversable(grid)
+ return (is_traversable(static_cast<dungeon_feature_type>(grid))
#ifdef CLUA_BINDINGS
|| (is_trap(x, y)
&& clua.callbooleanfn(false, "ch_cross_trap",
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index c23163b94c..765509a497 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -808,12 +808,12 @@ void clear_map(bool clear_detected_items, bool clear_detected_monsters)
if (!clear_detected_monsters && is_envmap_detected_mons(p))
continue;
- set_envmap_obj(p, is_terrain_known(p)? grd(p) : 0);
+ set_envmap_obj(p, is_terrain_known(p)? grd(p) : DNGN_UNSEEN);
set_envmap_detected_mons(p, false);
set_envmap_detected_item(p, false);
#ifdef USE_TILE
- set_envmap_obj(p, is_terrain_known(p)? grd(p) : 0);
+ set_envmap_obj(p, is_terrain_known(p)? grd(p) : DNGN_UNSEEN);
env.tile_bk_fg(p) = 0;
env.tile_bk_bg(p) = is_terrain_known(p) ?
tile_idx_unseen_terrain(p.x, p.y, grd(p)) :
@@ -3252,13 +3252,8 @@ static void _draw_level_map(int start_x, int start_y, bool travel_mode)
int bufcount2 = 0;
screen_buffer_t buffer2[GYM * GXM * 2];
- int num_lines = _get_number_of_lines_levelmap();
- if (num_lines > GYM)
- num_lines = GYM;
-
- int num_cols = get_number_of_cols();
- if (num_cols > GXM)
- num_cols = GXM;
+ const int num_lines = std::min(_get_number_of_lines_levelmap(), GYM);
+ const int num_cols = std::min(get_number_of_cols(), GXM);
cursor_control cs(false);