Changeset - r14471:03133833f1f3
[Not reviewed]
master
0 1 0
frosch - 14 years ago 2010-02-06 20:41:27
frosch@openttd.org
(svn r19050) -Fix: Don't call callbacks for disabled industrytypes.
1 file changed with 1 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -81,18 +81,12 @@ void ResetIndustries()
 

	
 
	/* Reset any overrides that have been set. */
 
	_industile_mngr.ResetOverride();
 
	_industry_mngr.ResetOverride();
 
}
 

	
 
void ResetIndustryCreationProbility(IndustryType type)
 
{
 
	assert(type < INVALID_INDUSTRYTYPE);
 
	_industry_specs[type].appear_creation[_settings_game.game_creation.landscape] = 0;
 
}
 

	
 
/**
 
 * Retrieve the type for this industry.  Although it is accessed by a tile,
 
 * it will return the general type of industry, and not the sprite index
 
 * as would do GetIndustryGfx.
 
 * @param tile that is queried
 
 * @pre IsTileType(tile, MP_INDUSTRY)
 
@@ -1819,18 +1813,14 @@ void GenerateIndustries()
 
	/* Find the total amount of industries */
 
	if (_settings_game.difficulty.number_industries > 0) {
 
		for (it = 0; it < NUM_INDUSTRYTYPES; it++) {
 

	
 
			ind_spc = GetIndustrySpec(it);
 

	
 
			if (!CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION)) {
 
				ResetIndustryCreationProbility(it);
 
			}
 

	
 
			chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 
			if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0) {
 
			if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0 && CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION)) {
 
				/* 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 */
 
				uint num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings_game.difficulty.number_industries][chance];
 

	
 
				/* These are always placed next to the coastline, so we scale by the perimeter instead. */
0 comments (0 inline, 0 general)