summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r--crawl-ref/source/stuff.cc18
1 files changed, 5 insertions, 13 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 92063e93d3..ce8f822ef6 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -248,19 +248,6 @@ int random_choose_weighted(int weight, int first, ...)
return (chosen);
}
-int weighted_random( const int weights[], unsigned int numweights )
-{
- int totalweight = 0;
- unsigned int result = 0;
- for ( unsigned int i = 0; i < numweights; ++i )
- {
- totalweight += weights[i];
- if ( random2(totalweight) < weights[i] )
- result = i;
- }
- return result;
-}
-
int random2( int max )
{
if (max <= 1)
@@ -1161,3 +1148,8 @@ int coord_def::distance_from(const coord_def &other) const
{
return (grid_distance(x, y, other.x, other.y));
}
+
+int random_rod_subtype()
+{
+ return STAFF_SMITING + random2(NUM_STAVES - STAFF_SMITING);
+}