Feature: NewGRF properties to set town production effect and multiplier. (#11947)

Town production effect is modelled on town acceptance (growth) effect, and so takes an original cargo slot for behaviour instead of a direct value.

NewGRF feature 0x0B, property 0x1E, takes 1 byte.

Valid values are:
- 0x00 to behave like passengers
- 0x02 to behave like mail
- 0xFF to behave like other cargo (i.e. not produced.)

If not set, town production effect is set based on the cargo label ('PASS' or 'MAIL').

Town production multiplier allows adjusting the amount of cargo produces when Town Production Effect is set, without needing to use callbacks.

NewGRF feature 0x0B (cargo), property 0x1F, accepts a 2 byte (word) value, similar to the cargo capacity multiplier property. The default value is 256 which means 100%, i.e. normal rate.
This commit is contained in:
2024-02-03 13:58:31 +00:00
committed by GitHub
parent f6dd5053a3
commit 17d02ed45f
4 changed files with 24 additions and 3 deletions

View File

@@ -558,7 +558,7 @@ static void TownGenerateCargoOriginal(Town *t, TownProductionEffect tpe, uint8_t
uint32_t r = Random();
if (GB(r, 0, 8) < rate) {
CargoID cid = cs->Index();
uint amt = GB(r, 0, 8) / 8 + 1;
uint amt = (GB(r, 0, 8) * cs->town_production_multiplier / TOWN_PRODUCTION_DIVISOR) / 8 + 1;
TownGenerateCargo(t, cid, amt, stations, true);
}
@@ -583,7 +583,7 @@ static void TownGenerateCargoBinominal(Town *t, TownProductionEffect tpe, uint8_
uint32_t genmask = (genmax >= 32) ? 0xFFFFFFFF : ((1 << genmax) - 1);
/* Mask random value by potential pax and count number of actual pax. */
uint amt = CountBits(r & genmask);
uint amt = CountBits(r & genmask) * cs->town_production_multiplier / TOWN_PRODUCTION_DIVISOR;
TownGenerateCargo(t, cid, amt, stations, true);
}