changeset 7823:a15c8666b08f draft

(svn r11373) -Fix [FS#1398]: do not even think about building disabled industries.
author rubidium <rubidium@openttd.org>
date Sat, 03 Nov 2007 23:34:12 +0000
parents 379a15470ab2
children 7ae5bda4e8dd
files src/industry_cmd.cpp
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1784,11 +1784,14 @@
 
 	/* Generate a list of all possible industries that can be built. */
 	for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
-		byte chance = GetIndustrySpec(j)->appear_ingame[_opt.landscape];
+		ind_spc = GetIndustrySpec(j);
+		byte chance = ind_spc->appear_ingame[_opt.landscape];
+
+		if (!ind_spc->enabled || chance == 0) continue;
 
 		/* If there is no Callback CBID_INDUSTRY_AVAILABLE or if this one did anot failed,
 		 * and if appearing chance for this landscape is above 0, this industry can be chosen */
-		if (CheckIfCallBackAllowsAvailability(j, IACT_RANDOMCREATION) && chance != 0) {
+		if (CheckIfCallBackAllowsAvailability(j, IACT_RANDOMCREATION)) {
 			probability_max += chance;
 			/* adds the result for this industry */
 			cumulative_probs[num].ind = j;