From 200b4c0e08504a7c8df898d77a9d72b3fa573c04 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 6 Jul 2008 16:47:06 +0000 Subject: Add a function x_chance_in_y(x,y) to replace the various random2(y) < x checks, e.g. x_chance_in_y(weight, totalweight). This should make things a bit more readable. Apply it to a number of files. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6428 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mgrow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crawl-ref/source/mgrow.cc') diff --git a/crawl-ref/source/mgrow.cc b/crawl-ref/source/mgrow.cc index bdaf066465..40025ee814 100644 --- a/crawl-ref/source/mgrow.cc +++ b/crawl-ref/source/mgrow.cc @@ -89,7 +89,7 @@ static const monster_level_up *_monster_level_up_target( monster_type type, { const monsterentry *me = get_monster_data(mlup.after); if (static_cast(me->hpdice[0]) == hit_dice - && random2(1000) < mlup.chance) + && x_chance_in_y(mlup.chance, 1000)) { return (&mlup); } -- cgit v1.2.3-54-g00ecf