diff options
author | frosch <frosch@openttd.org> | 2011-11-08 17:26:13 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-11-08 17:26:13 +0000 |
commit | b98c7763de42eda4b3d19604bc3f33452b9b05e4 (patch) | |
tree | 3a0092e76fa25fd7d025cefe8e105875b99c5c8f /src/industry_cmd.cpp | |
parent | b374b92bfb06745d21701d398bb0c78a395498b4 (diff) | |
download | openttd-b98c7763de42eda4b3d19604bc3f33452b9b05e4.tar.xz |
(svn r23146) -Change: [NewGRF v8] Make callback 22 return a probability to use instead of property 18.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 5309135f1..c7ed3f7a6 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1777,7 +1777,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin return CMD_ERROR; } - if (_game_mode != GM_EDITOR && !CheckIfCallBackAllowsAvailability(it, IACT_USERCREATION)) { + if (_game_mode != GM_EDITOR && GetIndustryProbabilityCallback(it, IACT_USERCREATION, 1) == 0) { return CMD_ERROR; } @@ -1876,9 +1876,9 @@ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *forc { const IndustrySpec *ind_spc = GetIndustrySpec(it); uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision - if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 || - !CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || - (_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY)) { + if (!ind_spc->enabled || ind_spc->num_table == 0 || + (_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY) || + (chance = GetIndustryProbabilityCallback(it, IACT_MAPGENERATION, chance)) == 0) { *force_at_least_one = false; return 0; } else { @@ -1906,10 +1906,10 @@ static uint16 GetIndustryGamePlayProbability(IndustryType it, byte *min_number) const IndustrySpec *ind_spc = GetIndustrySpec(it); byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape]; - if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 || + if (!ind_spc->enabled || ind_spc->num_table == 0 || ((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && _cur_year > 1950) || ((ind_spc->behaviour & INDUSTRYBEH_AFTER_1960) && _cur_year < 1960) || - !CheckIfCallBackAllowsAvailability(it, IACT_RANDOMCREATION)) { + (chance = GetIndustryProbabilityCallback(it, IACT_RANDOMCREATION, chance)) == 0) { *min_number = 0; return 0; } |