Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
16 cargo types in and out for industries #6867
Since the number of cargo types was increased to 64, allowing industries to have more input and output types is natural so fewer industry types can service more cargo types.
The internal macros to set accepts/produces remain unchanged only supporting 3 in/2 out, but the generated structures do have full 16 slots, the remaining filled with "invalid". The new features require NewGRFs to be exploited.
Summary of current NewGRF spec changes:
Action0 Industry properties:
Action0 Industry tile properties:
Industry callbacks 14B and 14C:
Industry callback 37:
Industry tile callbacks 2B and 2C:
Industry production callback:
New VA2 variables for industries:
nielsmh left a comment
I think I covered all locations referencing to specific indices of the production/acceptance arrays, but my only testing so far is "compiles" and "does not crash loading an old save".
An open question about GUI: The Industry chain window sizes itself after the max number of cargo types in/out possible, and with 16 types this results in some ridiculously large windows. It can't fit with standard font and 1x GUI on 1024x768 resolution.
I think it would be worth looking at extending tile callbacks 2B and 2C, to allow more accepted cargos per tile.
I suggest allowing return value to be either
I've played grfs with the 'multiple tiles are required for acceptance' and it's not as fun as it might sound imho.
Also, putting gameplay aside, FIRS tends to split tile IDs for different animation cycles, or for building on different land shapes (water, slope, flat etc). It could be quite faffy to combine that with splitting IDs for tile acceptance and then also giving a visual cue to the player. :)
As far as I can see in docs, cargo acceptance for the tile is not stored in the map, so I am hoping it would be relatively simple to extend :)
This would probably make more sense as a separate PR.
I wonder if it would really be so bad to introduce a couple new Action0 properties to set acceptance. If you're developing a NewIndustries set that depends on 64 cargo type and 16-in-16-out, chance is you won't be compatible with OpenTTD 1.8 and earlier anyway, so shouldn't the NewGRF failing to load on older versions be a non-problem?
Suggestion for new Action0 properties:
I managed to make a slightly more complex NewGRF exercising some of the new properties: oilstuff.zip (It introduces new cargo types so you'll want a vehicle set/extension that supports more than the standard ones.)
It also appears that something prevents town houses from accepting more than 3 cargoes despite them being supposed to. The above NewGRF should make three house types accept a new "diesel oil" cargo, but they don't. I haven't debugged that yet.
About the spec:
Anyway, now that house stuff got added I think this PR has kind of derailed. There are tons of new stuff, but with no use case on the horizon.
For now I suggest:
There are nml patches here https://github.com/nielsmh/nml/commits/indcargonum
There's no clean reference nml file, but I have a patched FIRS that builds ok and appears to do the right thing (GPL 2).
I am unclear whether prop 28 in the nml patch is correct, it dates from August 5th, but the comment about changing from list to direct matrix is 13th August. I don't understand enough to judge that.
Nov 3, 2018
6 checks passed
referenced this pull request
Feb 23, 2019
there seem to be a few vars missing here.