Changeset - r13118:fcafc0d67578
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-09-25 09:32:20
rubidium@openttd.org
(svn r17633) -Fix [FS#3233]: [NewGRF] Crash when trying to build an industry that has no industry layout defined.
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -1672,6 +1672,7 @@ static void DoCreateNewIndustry(Industry
 
 */
 
static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 seed, Owner founder)
 
{
 
	assert(itspec_index < indspec->num_table);
 
	const IndustryTileTable *it = indspec->table[itspec_index];
 
	bool custom_shape_check = false;
 

	
 
@@ -1724,7 +1725,7 @@ CommandCost CmdBuildIndustry(TileIndex t
 
	const IndustrySpec *indspec = GetIndustrySpec(it);
 

	
 
	/* Check if the to-be built/founded industry is available for this climate. */
 
	if (!indspec->enabled) return CMD_ERROR;
 
	if (!indspec->enabled || indspec->num_table == 0) return CMD_ERROR;
 

	
 
	/* If the setting for raw-material industries is not on, you cannot build raw-material industries.
 
	 * Raw material industries are industries that do not accept cargo (at least for now) */
 
@@ -1862,7 +1863,7 @@ void GenerateIndustries()
 
			}
 

	
 
			chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 
			if (ind_spc->enabled && chance > 0) {
 
			if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0) {
 
				/* once the chance of appearance is determind, it have to be scaled by
 
				 * the difficulty level. The "chance" in question is more an index into
 
				 * the _numof_industry_table,in fact */
 
@@ -1885,7 +1886,7 @@ void GenerateIndustries()
 
			 * @todo :  Do we really have to pass chance as un-scaled value, since we've already
 
			 *          processed that scaling above? No, don't think so.  Will find a way. */
 
			ind_spc = GetIndustrySpec(it);
 
			if (ind_spc->enabled) {
 
			if (ind_spc->enabled && ind_spc->num_table > 0) {
 
				chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 
				if (chance > 0) PlaceInitialIndustry(it, chance);
 
			}
0 comments (0 inline, 0 general)