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

Function ProduceIndustryGoodsHelper

src/industry_cmd.cpp:1148–1158  ·  view source on GitHub ↗

* Helper for ProduceIndustryGoods that scales and produces cargos. * @param i The industry * @param scale Should we scale production of this cargo directly? */

Source from the content-addressed store, hash-verified

1146 * @param scale Should we scale production of this cargo directly?
1147 */
1148static void ProduceIndustryGoodsHelper(Industry *i, bool scale)
1149{
1150 for (auto &p : i->produced) {
1151 if (!IsValidCargoType(p.cargo)) continue;
1152
1153 uint16_t amount = p.rate;
1154 if (scale) amount = ScaleByCargoScale(amount, false);
1155
1156 p.waiting = ClampTo<uint16_t>(p.waiting + amount);
1157 }
1158}
1159
1160static void ProduceIndustryGoods(Industry *i)
1161{

Callers 1

ProduceIndustryGoodsFunction · 0.85

Calls 2

IsValidCargoTypeFunction · 0.85
ScaleByCargoScaleFunction · 0.85

Tested by

no test coverage detected