From 3ffe2a238be5d62381f88fe243551464f5581924 Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 8 Nov 2007 17:39:42 +0000 Subject: Merge r2817 (better secret door handling) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2818 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/direct.cc | 19 ++++--------------- crawl-ref/source/terrain.cc | 4 ++-- crawl-ref/source/terrain.h | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 96f8fc2d6b..017d0086db 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1563,7 +1563,10 @@ static bool interesting_feature(dungeon_feature_type feat) std::string feature_description(int mx, int my, description_level_type dtype, bool add_stop) { - const dungeon_feature_type grid = grd[mx][my]; + dungeon_feature_type grid = grd[mx][my]; + if ( grid == DNGN_SECRET_DOOR ) + grid = grid_secret_door_appearance(mx, my); + switch (grid) { case DNGN_TRAP_MECHANICAL: @@ -1578,20 +1581,6 @@ std::string feature_description(int mx, int my, description_level_type dtype, return (feature_do_grammar( dtype, add_stop, false, marker_feature_description(coord_def(mx, my)))); - case DNGN_SECRET_DOOR: - { - // If we have neighbouring walls, try to look like them. - // Arguably we should go by our own colour, but well... - for ( int dx = -1; dx <= 1; ++dx ) - for ( int dy = -1; dy <= 1; ++dy ) - { - const dungeon_feature_type neighbour = grd[mx+dx][my+dy]; - if ( grid_is_wall(neighbour) ) - return feature_description(neighbour, NUM_TRAPS, - dtype, add_stop); - } - return (feature_description(grid, NUM_TRAPS, dtype, add_stop)); - } default: return (feature_description(grid, NUM_TRAPS, dtype, add_stop)); } diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index a8c6fc2981..87a453285a 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -226,9 +226,9 @@ bool grid_is_branch_stairs( dungeon_feature_type grid ) || (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS)); } -int grid_secret_door_appearance( int gx, int gy ) +dungeon_feature_type grid_secret_door_appearance( int gx, int gy ) { - int ret = DNGN_FLOOR; + dungeon_feature_type ret = DNGN_FLOOR; for (int dx = -1; dx <= 1; dx++) { diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h index db7eee5f82..5839d4d02e 100644 --- a/crawl-ref/source/terrain.h +++ b/crawl-ref/source/terrain.h @@ -42,7 +42,7 @@ bool grid_is_watery(dungeon_feature_type grid); god_type grid_altar_god( dungeon_feature_type grid ); dungeon_feature_type altar_for_god( god_type god ); bool grid_is_branch_stairs( dungeon_feature_type grid ); -int grid_secret_door_appearance( int gx, int gy ); +dungeon_feature_type grid_secret_door_appearance( int gx, int gy ); bool grid_destroys_items( dungeon_feature_type grid ); const char *grid_item_destruction_message( dungeon_feature_type grid ); -- cgit v1.2.3-54-g00ecf