mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r21158) -Codechange: Assert boundary inside the loop rather than afterwards.
This commit is contained in:
parent
5ec2bcc0d9
commit
373c615e9e
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user