* Generate cargo for a house using the original algorithm. * @param t The current town. * @param tpe The town production effect. * @param rate The town's product rate for this production. * @param stations Available stations for this house. */
| 557 | * @param stations Available stations for this house. |
| 558 | */ |
| 559 | static void TownGenerateCargoOriginal(Town *t, TownProductionEffect tpe, uint8_t rate, StationFinder &stations) |
| 560 | { |
| 561 | for (const CargoSpec *cs : CargoSpec::town_production_cargoes[tpe]) { |
| 562 | uint32_t r = Random(); |
| 563 | if (GB(r, 0, 8) < rate) { |
| 564 | CargoType cargo_type = cs->Index(); |
| 565 | uint amt = (GB(r, 0, 8) * cs->town_production_multiplier / TOWN_PRODUCTION_DIVISOR) / 8 + 1; |
| 566 | |
| 567 | TownGenerateCargo(t, cargo_type, amt, stations, true); |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | /** |
| 573 | * Generate cargo for a house using the binomial algorithm. |
no test coverage detected