(svn r19643) -Fix (r19120): Industry generation failed for large maps and lots of industry types.

This commit is contained in:
frosch
2010-04-16 21:21:54 +00:00
parent d1c3234918
commit 2141ca2368
3 changed files with 5 additions and 2 deletions

View File

@@ -1923,7 +1923,8 @@ void GenerateIndustries()
/* Add the remaining industries according to their probabilities */
for (uint i = 0; i < total_amount; i++) {
uint32 r = RandomRange(total_prob);
/* RandomRange() can only deal with 16 bit, which is not enough here. */
uint32 r = ((uint64)Random() * (uint64)total_prob) >> 32;
IndustryType it = 0;
while (it < NUM_INDUSTRYTYPES && r >= industry_probs[it]) {
r -= industry_probs[it];