Open PeterN opened 1 month ago
This goes against the spec when it comes to very old NewGRFs that deal with custom cargoes before labels were a thing.
Not sure how many of those exist, nor how many are still used, as compatibility is already hit & miss.
Motivation / Problem
When loading NewGRFs without cargo translation table, we have to check to see if we need to perform a bitnum lookup or just treat the slot as a climate dependent cargo type.
This requires multiple special cases, and always assumes that cargo slots are in their original positions, which is not always the case.
Description
Instead of falling back to bitnum lookup or climate-dependent cargo types, install a default cargo translation table that performs either of these functions instead.
A NewGRF can still install its own translation table and there will be no change in this case.
This allows better mapping of climate-dependent or bitnum cargo slots, falling back to INVALID_CARGO if they are not defined, and reduces special-casing.
Because everything is now mapped via label, this should allow cargo types to be moved to different slots (as is permitted for default vehicles/houses/industries and anything that installs its own translation table.)
Limitations
Well... I think this breaks everything using pre-cargo-label cargo sets, but it's entirely possible they are already broken in 14.x. (Seem to be broken in at least 1.11.2, so probably nothing to be concerned with...)
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.