diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-17 10:02:54 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-17 10:09:35 +0200 |
commit | 6845f79a5ed4314c86878d013ec3bb11af92483d (patch) | |
tree | 6b3a8d4857bc807c386bbb4b867ff0a605156dd1 /crawl-ref | |
parent | 0c36a4832df8168b4cb45a0300bb165d703cd957 (diff) | |
download | crawl-ref-6845f79a5ed4314c86878d013ec3bb11af92483d.tar.gz crawl-ref-6845f79a5ed4314c86878d013ec3bb11af92483d.zip |
Unify check for unknown staircases in is_unknown_staircase.
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/directn.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/menu.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tilepick.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/travel.h | 5 | ||||
-rw-r--r-- | crawl-ref/source/tutorial.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 15 |
7 files changed, 24 insertions, 26 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index f2a9ca64e9..7adf1fbf4a 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -693,7 +693,7 @@ void full_describe_view() desc += "</" + colour_str +">) "; #endif desc += feature_description(c); - if (feat_is_travelable_stair(grd(c)) && !travel_cache.know_stair(c)) + if (is_unknown_stair(c)) desc += " (not visited)"; FeatureMenuEntry *me = new FeatureMenuEntry(desc, c, hotkey); me->tag = "description"; diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 2c4c505578..c89516add2 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -833,7 +833,7 @@ bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const tileset.push_back(tile_def(tileidx_feature(grd(pos), pos.x, pos.y), TEX_DUNGEON)); - if (feat_is_travelable_stair(grd(pos)) && !travel_cache.know_stair(pos)) + if (is_unknown_stair(pos)) tileset.push_back(tile_def(TILE_NEW_STAIR, TEX_DEFAULT)); return (true); diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index d8e75bd287..2eedc91c6b 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -67,15 +67,8 @@ void TileNewLevel(bool first_time) unsigned int tile = env.tile_bk_bg[x][y]; if (!(tile & TILE_FLAG_NEW_STAIR)) continue; - - const coord_def gc(x,y); - int object = grd(gc); - - if (!feat_is_travelable_stair((dungeon_feature_type)object) - || travel_cache.know_stair(gc)) - { + if (!is_unkown_stair(coord_def(x,y))) env.tile_bk_bg[x][y] &= ~TILE_FLAG_NEW_STAIR; - } } } @@ -4544,11 +4537,8 @@ void tile_draw_floor() { if (object == DNGN_DETECTED_SECRET_DOOR) bg |= TILE_FLAG_WAS_SECRET; - else if (feat_is_travelable_stair((dungeon_feature_type)object) - && !travel_cache.know_stair(gc)) - { + else if (is_unkown_stair(gc)) bg |= TILE_FLAG_NEW_STAIR; - } } } diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 60bd9e5627..76b73924c7 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -226,6 +226,13 @@ inline bool is_player_altar(const coord_def &c) return feat_is_player_altar(grd(c)); } +bool is_unknown_stair(const coord_def &p, dungeon_feature_type remembered_feat) +{ + dungeon_feature_type feat = (remembered_feat == NUM_REAL_FEATURES) + ? env.grid(p) : feat; + return (feat_is_travelable_stair(feat) && !travel_cache.know_stair(p)); +} + #ifdef CLUA_BINDINGS static void _init_traps() { diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 9c72237ab8..a6fb14fc94 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -59,7 +59,8 @@ void stop_running(void); void travel_init_new_level(); void cycle_exclude_radius(const coord_def &p); void del_exclude(const coord_def &p); -void set_exclude(const coord_def &p, int radius = LOS_RADIUS, bool autoexcl = false); +void set_exclude(const coord_def &p, int radius = LOS_RADIUS, + bool autoexcl = false); void maybe_remove_autoexclusion(const coord_def &p); std::string get_exclusion_desc(); void clear_excludes(); @@ -74,6 +75,8 @@ const char *trap_name(const coord_def &p); void explore_pickup_event(int did_pickup, int tried_pickup); bool is_excluded(const coord_def &p); bool feat_is_traversable(dungeon_feature_type feat); +bool is_unknown_stair(const coord_def &p, + dungeon_feature_type remembered_feat = NUM_REAL_FEATURES); void find_travel_pos(const coord_def& youpos, char *move_x, char *move_y, std::vector<coord_def>* coords = NULL); diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index 37ecb261ea..119405fbac 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -4220,7 +4220,7 @@ static void _tutorial_describe_feature(int x, int y) "<w>Shift</w>. "; #endif - if (feat_is_travelable_stair(feat) && !travel_cache.know_stair(where)) + if (is_unknown_stair(where)) { ostr << "\n\nYou have not yet passed through this particular " "set of stairs. "; @@ -4253,8 +4253,7 @@ static void _tutorial_describe_feature(int x, int y) "clicking the <w>left mouse button</w> while pressing " "<w>Shift</w> instead. "; #endif - if (feat_is_travelable_stair(feat) - && !travel_cache.know_stair(where)) + if (is_unknown_stair(where)) { ostr << "\n\nYou have not yet passed through this " "particular set of stairs. "; diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 465f8ee708..ddf2e67c56 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -54,6 +54,7 @@ REVISION("$Rev$"); #include "spells3.h" #include "stash.h" #include "tiles.h" +#include "travel.h" #include "state.h" #include "terrain.h" #include "tilemcache.h" @@ -398,13 +399,11 @@ static int _view_emphasised_colour(const coord_def& where, dungeon_feature_type feat, int oldcolour, int newcolour) { - if (feat_is_travelable_stair(feat) && !travel_cache.know_stair(where)) + if (is_unknown_stair(where, feat) + && (you.your_level || feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS) + && you.where_are_you != BRANCH_VESTIBULE_OF_HELL) { - if ((you.your_level || feat_stair_direction(feat) == CMD_GO_DOWNSTAIRS) - && you.where_are_you != BRANCH_VESTIBULE_OF_HELL) - { return (newcolour); - } } return (oldcolour); } @@ -682,8 +681,8 @@ unsigned short dos_brand( unsigned short colour, // FIXME: Rework this function to use the new terrain known/seen checks // These are still env.map coordinates, NOT grid coordinates! -screen_buffer_t colour_code_map( const coord_def& p, bool item_colour, - bool travel_colour ) +screen_buffer_t colour_code_map(const coord_def& p, bool item_colour, + bool travel_colour) { const unsigned short map_flags = env.map(p).flags; if (!(map_flags & MAP_GRID_KNOWN)) @@ -727,7 +726,7 @@ 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[feat_value]; - feature_colour = terrain_seen? fdef.seen_colour : fdef.map_colour; + feature_colour = terrain_seen ? fdef.seen_colour : fdef.map_colour; if (terrain_seen && feature_colour != fdef.seen_em_colour && fdef.seen_em_colour) |