OpenLoco
OpenLoco copied to clipboard
Certain cargo types not rendering on narrow gauge stations
Version information:
- Platform: Windows 10
- Version: 21.10
- Build/commit: 3bec790
Describe the bug Certain cargo types do not render when they are present on a narrow gauge station platform (grapes in the screenshot, but it may apply to other types)
Screenshots
Is this OpenLoco specific or in vanilla?
This bug does occur in the vanilla game, at least in the steam version. It may occur in the disc version, but I can't test that myself as I don't have a disc drive
confirmed. for examples goods
does render:
but grapes
do not:
- [x] goods
- [x] mail
- [x] passengers
- [ ] grapes
- [x] oil
- [x] chemicals
- [x] iron ore
- [x] coal
- [x] grain
- [x] paper
- [x] lumber
- [x] food
- [x] livestock
- [x] steel
I tested every cargo type, all render except grapes, and I even tried a custom industry that produces diamonds, and that also renders correctly on narrow-gauge stations.
Something special about the grapes...
Unfortunately paintStation()
isn't reverse-engineered yet so I don't think I can fix this yet:
https://github.com/OpenLoco/OpenLoco/blob/d9371e39a306e0da3f38325c748b71921659a6cb/src/OpenLoco/Paint/PaintTile.cpp#L133-L141
Since the code treats all objects equally, ie no specific code for grapes, or steel, etc, it could be an issue with the grapes DAT file having some bad/missing graphics.
This bug also occurs on normal stations and isn't just limited to narrow-gauge station
Does this happen in vanilla?
I wonder if it's something silly like an off-by-one error checking the cargo type bitmask.
Yep, they also don't render in vanilla for both stations.
Grapes are an interesting item. Even when a certain industry isn't available (ie it isn't in the list that was selected when creating the scenario), any vehicle that can carry it will display it as cargo it can carry.
For example, boxcars always show that they can carry food, even when there are no food producing industries (meaning they weren't selected in the editor).
Except grapes. Grapes don't appear in the list of what a vehicle can carry, UNLESS there are vineyards in the scenario's selected industries. I have a strange feeling this may have something to do with it.
Okay so i investigated it and grapes cargo object has one of its properties set incorrectly. var_13 which im pretty sure is the number of station platform variations is set to 0
. Changing this to 1
and the grapes get shown.
Nice!
What should be our fix for this situation? Since it's in a data object and not in the code, we can't really change the data object until we redo them all in yaml which is very far away. Perhaps we could add a hardcoded fix in the code in object loading, that checks the checksum of the object loaded and if it matches the original grapes object, set it's var_13
to 1?
Also, perhaps var_13
is renderCargoOnStation
? haha
var_13 is the number of variations of station cargo. For example people cargo have a number of different variations. We could hardcode it in the loader of the cargo but it would be a bit messy as you must also unload it otherwise you will break the checksum https://github.com/OpenLoco/OpenLoco/blob/master/src/OpenLoco/Objects/CargoObject.cpp#L23 would be a case of looking up the header in the ObjectManager in both the load and unload. Unload we don't pass the objects index so that might be quite hard.
Speaking of data objects, how far off do you think it is until the item limit is increased? OpenRCT2 already did this, allowing more sprites, more selected objects (in editor) etc, so how close is this game to such a thing?
A long long time away (multiple years).