summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/traps.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2014-04-09 17:08:30 +0100
committerChris Campbell <chriscampbell89@gmail.com>2014-04-09 17:55:17 +0100
commit62b11cb347c864cbab3e8c65a5250c8c8f2cf771 (patch)
tree912ed39c4bb705c29c15b7813b42eee9dd1741ca /crawl-ref/source/traps.cc
parentd1b32bca3e9eab8e1d984c8d11a3bcb47e3968c4 (diff)
downloadcrawl-ref-62b11cb347c864cbab3e8c65a5250c8c8f2cf771.tar.gz
crawl-ref-62b11cb347c864cbab3e8c65a5250c8c8f2cf771.zip
Remove some now-unused handling for web placement
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r--crawl-ref/source/traps.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 79bde55dfa..6bd6cc9a18 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -1908,7 +1908,7 @@ int count_traps(trap_type ttyp)
return num;
}
-void place_webs(int num, bool is_second_phase)
+void place_webs(int num)
{
int slot = 0;
for (int j = 0; j < num; j++)
@@ -1931,35 +1931,26 @@ void place_webs(int num, bool is_second_phase)
ts.pos.y = random2(GYM);
if (in_bounds(ts.pos)
&& grd(ts.pos) == DNGN_FLOOR
- && !map_masked(ts.pos, MMT_NO_TRAP)
- // During play, only generate out of LOS
- && (!is_second_phase || !you.see_cell(ts.pos)))
+ && !map_masked(ts.pos, MMT_NO_TRAP))
{
- // Calculate weight
- float weight = 0;
+ // Calculate weight.
+ int weight = 0;
for (adjacent_iterator ai(ts.pos); ai; ++ai)
{
// Solid wall?
- float solid_weight = 0;
+ int solid_weight = 0;
+ // Orthogonals weight three, diagonals 1.
if (cell_is_solid(*ai))
- solid_weight = 1;
- // During play, adjacent webs also count slightly
- else if (is_second_phase
- && feat_is_trap(grd(*ai))
- && (get_trap_type(*ai) == TRAP_WEB))
{
- // Adjacent webs
- solid_weight = 0.5;
+ solid_weight = (ai->x == ts.pos.x || ai->y == ts.pos.y)
+ ? 3 : 1;
}
- // Orthogonals weight three, diagonals 1
- int orth_weight = (ai->x == ts.pos.x || ai->y == ts.pos.y)
- ? 3 : 1;
- weight = weight + solid_weight * orth_weight;
+ weight += solid_weight;
}
// Maximum weight is 4*3+4*1 = 16
// *But* that would imply completely surrounded by rock (no point there)
- if (weight <= 16 && x_chance_in_y(floor(weight) + 2, 34))
+ if (weight <= 16 && x_chance_in_y(weight + 2, 34))
break;
}
}