Skip to content

Commit

Permalink
Add: NewGRF property to set town production effect.
Browse files Browse the repository at this point in the history
This is modelled on town acceptance (growth) effect, and so takes an original cargo slot instead of a direct value.

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 acceptance effect is set based on the cargo label ('PASS' or 'MAIL'.)
  • Loading branch information
PeterN committed Jan 7, 2024
1 parent a5fc340 commit d1b16b9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/newgrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,20 @@ 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;
}

default:
ret = CIR_UNKNOWN;
break;
Expand Down

0 comments on commit d1b16b9

Please sign in to comment.