summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/dungeon.cc15
-rw-r--r--crawl-ref/source/spl-cast.cc3
-rw-r--r--crawl-ref/source/traps.cc7
3 files changed, 11 insertions, 14 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 14d7f60374..cfe2a84f0d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2819,10 +2819,10 @@ static bool _shaft_is_in_corridor(const coord_def& c)
const coord_def adjs[] = { coord_def(-1,0), coord_def(1,0),
coord_def(0,-1), coord_def(0,1) };
- for ( unsigned int i = 0; i < ARRAYSZ(adjs); ++i )
+ for (unsigned int i = 0; i < ARRAYSZ(adjs); ++i)
{
const coord_def spot = c + adjs[i];
- if ( !inside_level_bounds(spot) || grd(spot) < DNGN_SHALLOW_WATER )
+ if (!inside_level_bounds(spot) || grd(spot) < DNGN_SHALLOW_WATER)
return (true);
}
return (false);
@@ -2857,7 +2857,7 @@ static void _place_traps(int level_number)
if (ts.type == TRAP_SHAFT && level_number <= 7)
{
// Disallow shaft construction in corridors!
- if ( _shaft_is_in_corridor(ts.pos) )
+ if (_shaft_is_in_corridor(ts.pos))
{
// Choose again!
ts.type = random_trap_for_place(level_number);
@@ -4842,8 +4842,8 @@ static void _vault_grid( vault_placement &place,
{
const trap_type trap =
(f.trap == TRAP_INDEPTH)
- ? random_trap_for_place(place.level_number)
- : static_cast<trap_type>(f.trap);
+ ? random_trap_for_place(place.level_number)
+ : static_cast<trap_type>(f.trap);
place_specific_trap(where, trap);
}
@@ -7507,7 +7507,8 @@ static void _roguey_level(int level_number, spec_room &sr, bool make_stairs)
bool place_specific_trap(const coord_def& where, trap_type spec_type)
{
- if (spec_type == TRAP_RANDOM || spec_type == TRAP_NONTELEPORT)
+ if (spec_type == TRAP_RANDOM || spec_type == TRAP_NONTELEPORT
+ || spec_type == TRAP_SHAFT && !is_valid_shaft_level())
{
trap_type forbidden1 = NUM_TRAPS;
trap_type forbidden2 = NUM_TRAPS;
@@ -7521,9 +7522,7 @@ bool place_specific_trap(const coord_def& where, trap_type spec_type)
forbidden1 = TRAP_SHAFT;
do
- {
spec_type = static_cast<trap_type>( random2(NUM_TRAPS) );
- }
while (spec_type == forbidden1 || spec_type == forbidden2);
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 8dfbd94993..d20fc01ee7 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -2272,12 +2272,13 @@ static unsigned int _breakpoint_rank(int val, const int breakpoints[],
unsigned int result = 0;
while (result < num_breakpoints && val >= breakpoints[result])
++result;
+
return result;
}
const char* spell_hunger_string( spell_type spell )
{
- if ( you.is_undead == US_UNDEAD )
+ if (you.is_undead == US_UNDEAD)
return "N/A";
const int hunger = spell_hunger(spell);
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index a46995b4d6..5aff02caec 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -1273,11 +1273,8 @@ bool is_valid_shaft_level(const level_id &place)
return (false);
// Disallow shafts on the first two levels.
- if (place == BRANCH_MAIN_DUNGEON
- && you.your_level < 2)
- {
+ if (place == BRANCH_MAIN_DUNGEON && you.your_level < 2)
return (false);
- }
// Don't generate shafts in branches where teleport control
// is prevented. Prevents player from going down levels without
@@ -1330,7 +1327,7 @@ level_id generic_shaft_dest(level_pos lpos)
// be created during level generation time.
// Include level 27 of the main dungeon here, but don't restrict
// shaft creation (so don't set branch.dangerous_bottom_level).
- if ((branch.dangerous_bottom_level)
+ if (branch.dangerous_bottom_level
&& lid.depth == branch.depth
&& (branch.depth - curr_depth) > 1)
{