MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / RecomputeProductionMultipliers

Method RecomputeProductionMultipliers

src/industry_cmd.cpp:2592–2601  ·  view source on GitHub ↗

* Recompute #production_rate for current #prod_level. * This function is only valid when not using smooth economy. */

Source from the content-addressed store, hash-verified

2590 * This function is only valid when not using smooth economy.
2591 */
2592void Industry::RecomputeProductionMultipliers()
2593{
2594 const IndustrySpec *indspec = GetIndustrySpec(this->type);
2595 assert(indspec->UsesOriginalEconomy());
2596
2597 /* Rates are rounded up, so e.g. oilrig always produces some passengers */
2598 for (auto &p : this->produced) {
2599 p.rate = ClampTo<uint8_t>(CeilDiv(indspec->production_rate[&p - this->produced.data()] * this->prod_level, PRODLEVEL_DEFAULT));
2600 }
2601}
2602
2603void Industry::FillCachedName() const
2604{

Callers 4

DoCreateNewIndustryFunction · 0.80
CmdIndustrySetProductionFunction · 0.80
ChangeIndustryProductionFunction · 0.80
UpdateIndustryProductionFunction · 0.80

Calls 4

GetIndustrySpecFunction · 0.85
CeilDivFunction · 0.85
UsesOriginalEconomyMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected