|
@@ -1320,13 +1320,13 @@ static CheckNewIndustryProc * const _che
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Find a town for the industry, while checking for multiple industries in the same town.
|
|
|
* @param tile Position of the industry to build.
|
|
|
* @param type Industry type.
|
|
|
* @param [out] town Pointer to return town for the new industry, \c NULL is written if no good town can be found.
|
|
|
* @param[out] t Pointer to return town for the new industry, \c NULL is written if no good town can be found.
|
|
|
* @return Succeeded or failed command.
|
|
|
*
|
|
|
* @pre \c *t != NULL
|
|
|
* @post \c *t points to a town on success, and \c NULL on failure.
|
|
|
*/
|
|
|
static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t)
|
|
@@ -1362,20 +1362,20 @@ bool IsSlopeRefused(Slope current, Slope
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Are the tiles of the industry free?
|
|
|
* @param tile Position to check.
|
|
|
* @param it Industry tiles table.
|
|
|
* @param itspec_index The index of the itsepc to build/fund
|
|
|
* @param type Type of the industry.
|
|
|
* @param initial_random_bits The random bits the industry is going to have after construction.
|
|
|
* @param founder Industry founder
|
|
|
* @param creation_type The circumstances the industry is created under.
|
|
|
* @param [out] custom_shape_check Perform custom check for the site.
|
|
|
* @param tile Position to check.
|
|
|
* @param it Industry tiles table.
|
|
|
* @param itspec_index The index of the itsepc to build/fund
|
|
|
* @param type Type of the industry.
|
|
|
* @param initial_random_bits The random bits the industry is going to have after construction.
|
|
|
* @param founder Industry founder
|
|
|
* @param creation_type The circumstances the industry is created under.
|
|
|
* @param[out] custom_shape_check Perform custom check for the site.
|
|
|
* @return Failed or succeeded command.
|
|
|
*/
|
|
|
static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type, bool *custom_shape_check = NULL)
|
|
|
{
|
|
|
bool refused_slope = false;
|
|
|
bool custom_shape = false;
|
|
@@ -1790,17 +1790,17 @@ static void DoCreateNewIndustry(Industry
|
|
|
* Helper function for Build/Fund an industry
|
|
|
* @param tile tile where industry is built
|
|
|
* @param type of industry to build
|
|
|
* @param flags of operations to conduct
|
|
|
* @param indspec pointer to industry specifications
|
|
|
* @param itspec_index the index of the itsepc to build/fund
|
|
|
* @param seed random seed (possibly) used by industries
|
|
|
* @param initial_random_bits The random bits the industry is going to have after construction.
|
|
|
* @param random_var8f random seed (possibly) used by industries
|
|
|
* @param random_initial_bits The random bits the industry is going to have after construction.
|
|
|
* @param founder Founder of the industry
|
|
|
* @param creation_type The circumstances the industry is created under.
|
|
|
* @param [out] ip Pointer to store newly created industry.
|
|
|
* @param[out] ip Pointer to store newly created industry.
|
|
|
* @return Succeeded or failed command.
|
|
|
*
|
|
|
* @post \c *ip contains the newly created industry if all checks are successful and the \a flags request actual creation, else it contains \c NULL afterwards.
|
|
|
*/
|
|
|
static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, DoCommandFlag flags, const IndustrySpec *indspec, uint itspec_index, uint32 random_var8f, uint16 random_initial_bits, Owner founder, IndustryAvailabilityCallType creation_type, Industry **ip)
|
|
|
{
|
|
@@ -1958,13 +1958,13 @@ static Industry *CreateNewIndustry(TileI
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compute the appearance probability for an industry during map creation.
|
|
|
* @param it Industry type to compute.
|
|
|
* @param [out] force_at_least_one Returns whether at least one instance should be forced on map creation.
|
|
|
* @param[out] force_at_least_one Returns whether at least one instance should be forced on map creation.
|
|
|
* @return Relative probability for the industry to appear.
|
|
|
*/
|
|
|
static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *force_at_least_one)
|
|
|
{
|
|
|
const IndustrySpec *ind_spc = GetIndustrySpec(it);
|
|
|
uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision
|
|
@@ -1983,13 +1983,13 @@ static uint32 GetScaledIndustryGeneratio
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compute the probability for constructing a new industry during game play.
|
|
|
* @param it Industry type to compute.
|
|
|
* @param [out] min_number Minimal number of industries that should exist at the map.
|
|
|
* @param[out] min_number Minimal number of industries that should exist at the map.
|
|
|
* @return Relative probability for the industry to appear.
|
|
|
*/
|
|
|
static uint16 GetIndustryGamePlayProbability(IndustryType it, byte *min_number)
|
|
|
{
|
|
|
if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) {
|
|
|
*min_number = 0;
|