diff options
author | alberth <alberth@openttd.org> | 2010-11-13 10:11:47 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-11-13 10:11:47 +0000 |
commit | 6c088543c1407e4ef0531babe6b870c676528946 (patch) | |
tree | 0a6e53cf292c3f848645db1db3b0e1fc58969b90 /src | |
parent | 30637a8340844abce2aab469295b4160d1f2d532 (diff) | |
download | openttd-6c088543c1407e4ef0531babe6b870c676528946.tar.xz |
(svn r21158) -Codechange: Assert boundary inside the loop rather than afterwards.
Diffstat (limited to 'src')
-rw-r--r-- | src/industry_cmd.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index a56ed02b5..aff016ae6 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1994,11 +1994,12 @@ void GenerateIndustries() for (uint i = 0; i < total_amount; i++) { uint32 r = RandomRange(total_prob); IndustryType it = 0; - while (it < NUM_INDUSTRYTYPES && r >= industry_probs[it]) { + while (r >= industry_probs[it]) { r -= industry_probs[it]; it++; + assert(it < NUM_INDUSTRYTYPES); } - assert(it < NUM_INDUSTRYTYPES && industry_probs[it] > 0); + assert(industry_probs[it] > 0); PlaceInitialIndustry(it, false); } } |