From 167ae03b160a0ccadd7934b2bfe557d491f1cb1f Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 7 Jul 2008 11:58:54 +0000 Subject: Another clean up, and add some new weapon speech. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6439 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mapdef.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/mapdef.cc') diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 851c9819fe..362bd33c11 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1835,7 +1835,7 @@ mons_spec mons_list::pick_monster(mons_spec_slot &slot) i != slot.mlist.end(); ++i) { const int weight = i->genweight; - if (random2(totweight += weight) < weight) + if (x_chance_in_y(weight, totweight += weight)) { pick = *i; @@ -2266,7 +2266,7 @@ item_spec item_list::pick_item(item_spec_slot &slot) i != slot.ilist.end(); ++i) { const int weight = i->genweight; - if (random2(cumulative += weight) < weight) + if (x_chance_in_y(weight, cumulative += weight)) spec = *i; } @@ -2673,10 +2673,8 @@ int subst_spec::value() int cumulative = 0; int chosen = 0; for (int i = 0, size = repl.size(); i < size; ++i) - { - if (random2(cumulative += repl[i].second) < repl[i].second) + if (x_chance_in_y(repl[i].second, cumulative += repl[i].second)) chosen = repl[i].first; - } if (fix) frozen_value = chosen; @@ -2767,7 +2765,7 @@ int colour_spec::get_colour() int chosen = BLACK; int cweight = 0; for (int i = 0, size = colours.size(); i < size; ++i) - if (random2(cweight += colours[i].second) < colours[i].second) + if (x_chance_in_y(colours[i].second, cweight += colours[i].second)) chosen = colours[i].first; if (fix) fixed_colour = chosen; @@ -3079,7 +3077,7 @@ feature_spec feature_slot::get_feat(int def_glyph) for (int i = 0, size = feats.size(); i < size; ++i) { const feature_spec &feat = feats[i]; - if (random2(tweight += feat.genweight) < feat.genweight) + if (x_chance_in_y(feat.genweight, tweight += feat.genweight)) chosen_feat = feat; } -- cgit v1.2.3-54-g00ecf