From f76829ed22a7b9d20b0a217e7c988abd110de634 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Wed, 19 Aug 2009 21:59:45 +0000 Subject: A KFEAT specified trap can start out known to the player by adding "known" to the trap name. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10581 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dungeon.cc | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'crawl-ref/source/dungeon.cc') diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 2c4a04ba1f..b5ef022f55 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4768,14 +4768,20 @@ dungeon_feature_type map_feature(map_def *map, const coord_def &c, int rawfeat) if (mapsp) { const feature_spec f = mapsp->get_feat(); - if (f.feat >= 0) + if (f.trap >= 0) + { + // f.feat == 1 means trap is generated known. + if (f.feat == 1) + return trap_category(static_cast(f.trap)); + else + return (DNGN_UNDISCOVERED_TRAP); + } + else if (f.feat >= 0) return static_cast(f.feat); else if (f.glyph >= 0) return map_feature(NULL, c, rawfeat); else if (f.shop >= 0) return (DNGN_ENTER_SHOP); - else if (f.trap >= 0) - return (DNGN_UNDISCOVERED_TRAP); return (DNGN_FLOOR); } @@ -4829,7 +4835,20 @@ static void _vault_grid( vault_placement &place, if (mapsp) { const feature_spec f = mapsp->get_feat(); - if (f.feat >= 0) + if (f.trap >= 0) + { + const trap_type trap = + (f.trap == TRAP_INDEPTH) + ? random_trap_for_place(place.level_number) + : static_cast(f.trap); + + place_specific_trap(where, trap); + + // f.feat == 1 means trap is generated known. + if (f.feat == 1) + grd(where) = trap_category(trap); + } + else if (f.feat >= 0) { grd(where) = static_cast( f.feat ); vgrid = -1; @@ -4840,15 +4859,6 @@ static void _vault_grid( vault_placement &place, } else if (f.shop >= 0) place_spec_shop(place.level_number, where, f.shop); - else if (f.trap >= 0) - { - const trap_type trap = - (f.trap == TRAP_INDEPTH) - ? random_trap_for_place(place.level_number) - : static_cast(f.trap); - - place_specific_trap(where, trap); - } else grd(where) = DNGN_FLOOR; -- cgit v1.2.3-54-g00ecf