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:
Peter Nelson
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

@@ -3091,6 +3091,24 @@ static ChangeInfoResult CargoChangeInfo(uint cid, int numinfo, int prop, ByteRea
cs->multiplier = std::max<uint16_t>(1u, buf->ReadWord());
break;
case 0x1E: { // Town production substitute type
uint8_t substitute_type = buf->ReadByte();
switch (substitute_type) {
case 0x00: cs->town_production_effect = TPE_PASSENGERS; break;
case 0x02: cs->town_production_effect = TPE_MAIL; break;
default:
GrfMsg(1, "CargoChangeInfo: Unknown town production substitute value {}, setting to none.", substitute_type);
[[fallthrough]];
case 0xFF: cs->town_production_effect = TPE_NONE; break;
}
break;
}
case 0x1F: // Town production multiplier
cs->town_production_multiplier = std::max<uint16_t>(1U, buf->ReadWord());
break;
default:
ret = CIR_UNKNOWN;
break;