diff options
author | fonsinchen <fonsinchen@openttd.org> | 2013-10-19 11:17:29 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2013-10-19 11:17:29 +0000 |
commit | 8fff781ca06dfdd4e60509d525fcb5c840e0e431 (patch) | |
tree | 6f39d30a2d9f36037e9679aa4d0bbd22efa48325 | |
parent | 79f4cd2b7a2b5750ffe315bd66693792097306f7 (diff) | |
download | openttd-8fff781ca06dfdd4e60509d525fcb5c840e0e431.tar.xz |
(svn r25882) -Change [FS#5766]: Don't offer subsidies for auto-distributed cargo.
-rw-r--r-- | src/subsidy.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/subsidy.cpp b/src/subsidy.cpp index c69b2b23d..0cccd92d5 100644 --- a/src/subsidy.cpp +++ b/src/subsidy.cpp @@ -348,7 +348,10 @@ bool FindSubsidyTownCargoRoute() } /* Avoid using invalid NewGRF cargoes. */ - if (!CargoSpec::Get(cid)->IsValid()) return false; + if (!CargoSpec::Get(cid)->IsValid() || + _settings_game.linkgraph.GetDistributionType(cid) != DT_MANUAL) { + return false; + } /* Quit if the percentage transported is large enough. */ if (src_town->GetPercentTransported(cid) > SUBSIDY_MAX_PCT_TRANSPORTED) return false; @@ -388,8 +391,13 @@ bool FindSubsidyIndustryCargoRoute() } /* Quit if no production in this industry - * or if the pct transported is already large enough */ - if (total == 0 || trans > SUBSIDY_MAX_PCT_TRANSPORTED || cid == CT_INVALID) return false; + * or if the pct transported is already large enough + * or if the cargo is automatically distributed */ + if (total == 0 || trans > SUBSIDY_MAX_PCT_TRANSPORTED || + cid == CT_INVALID || + _settings_game.linkgraph.GetDistributionType(cid) != DT_MANUAL) { + return false; + } SourceID src = src_ind->index; @@ -480,7 +488,16 @@ void SubsidyMonthlyLoop() } } - if (modified) RebuildSubsidisedSourceAndDestinationCache(); + if (modified) { + RebuildSubsidisedSourceAndDestinationCache(); + } else if (_settings_game.linkgraph.distribution_pax != DT_MANUAL && + _settings_game.linkgraph.distribution_mail != DT_MANUAL && + _settings_game.linkgraph.distribution_armoured != DT_MANUAL && + _settings_game.linkgraph.distribution_default != DT_MANUAL) { + /* Return early if there are no manually distributed cargoes and if we + * don't need to invalidate the subsidies window. */ + return; + } bool passenger_subsidy = false; bool town_subsidy = false; @@ -488,7 +505,7 @@ void SubsidyMonthlyLoop() int random_chance = RandomRange(16); - if (random_chance < 2) { + if (random_chance < 2 && _settings_game.linkgraph.distribution_pax == DT_MANUAL) { /* There is a 1/8 chance each month of generating a passenger subsidy. */ int n = 1000; |