diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-05 06:10:49 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-05 06:10:49 +0000 |
commit | 1db9c68406e0892e1ac7331dfd3b412b31741cb7 (patch) | |
tree | dabc507f32d87ba59c660f45fffa6b5b9042e6c5 /crawl-ref/source/dungeon.cc | |
parent | 70d59beabaddfbb2edefee1f610e16881c8ff771 (diff) | |
download | crawl-ref-1db9c68406e0892e1ac7331dfd3b412b31741cb7.tar.gz crawl-ref-1db9c68406e0892e1ac7331dfd3b412b31741cb7.zip |
Shaft traps (trap doors) [1792195] and level annotation [1769009]
added, with the shaft traps changed as per comments on SF; shafts
aren't randomly generated yet, so this doesn't change gameplay.
Changed DNGN_TRAP_III to DNGN_TRAP_NATURAL, of which trap type the
shaft traps are the only current member.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2328 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index d412241c18..118f960e15 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -6673,8 +6673,24 @@ static void jelly_pit(int level_number, spec_room &sr) bool place_specific_trap(int spec_x, int spec_y, trap_type spec_type) { - if (spec_type == TRAP_RANDOM) - spec_type = static_cast<trap_type>( random2(NUM_TRAPS) ); + if (spec_type == TRAP_RANDOM || spec_type == TRAP_NONTELEPORT) + { + trap_type forbidden1 = NUM_TRAPS; + trap_type forbidden2 = NUM_TRAPS; + + if (spec_type == TRAP_NONTELEPORT) + { + forbidden1 = TRAP_SHAFT; + forbidden2 = TRAP_TELEPORT; + } + else if (!is_valid_shaft_level()) + forbidden1 = TRAP_SHAFT; + + do + { + spec_type = static_cast<trap_type>( random2(NUM_TRAPS) ); + } while (spec_type == forbidden1 || spec_type == forbidden2); + } for (int tcount = 0; tcount < MAX_TRAPS; tcount++) { |