OpenLoco icon indicating copy to clipboard operation
OpenLoco copied to clipboard

Certain cargo types not rendering on narrow gauge stations

Open Derpercoaster opened this issue 3 years ago • 16 comments

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 Grain and Greenery

Derpercoaster avatar Dec 10 '21 16:12 Derpercoaster

Is this OpenLoco specific or in vanilla?

duncanspumpkin avatar Dec 11 '21 08:12 duncanspumpkin

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

Derpercoaster avatar Dec 12 '21 06:12 Derpercoaster

confirmed. for examples goods does render: image

but grapes do not: image

LeftofZen avatar Apr 01 '22 01:04 LeftofZen

  • [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...

LeftofZen avatar Apr 01 '22 01:04 LeftofZen

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

LeftofZen avatar Apr 01 '22 01:04 LeftofZen

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.

LeftofZen avatar Apr 01 '22 02:04 LeftofZen

This bug also occurs on normal stations and isn't just limited to narrow-gauge station image

LeftofZen avatar Apr 02 '22 08:04 LeftofZen

Does this happen in vanilla?

I wonder if it's something silly like an off-by-one error checking the cargo type bitmask.

AaronVanGeffen avatar Apr 02 '22 08:04 AaronVanGeffen

Yep, they also don't render in vanilla for both stations.

LeftofZen avatar Apr 02 '22 08:04 LeftofZen

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.

Derpercoaster avatar Apr 02 '22 18:04 Derpercoaster

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. image

duncanspumpkin avatar Apr 05 '22 06:04 duncanspumpkin

Nice!

LeftofZen avatar Apr 05 '22 06:04 LeftofZen

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

LeftofZen avatar Apr 19 '22 02:04 LeftofZen

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.

duncanspumpkin avatar Apr 19 '22 07:04 duncanspumpkin

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?

Derpercoaster avatar Apr 20 '22 02:04 Derpercoaster

A long long time away (multiple years).

LeftofZen avatar Apr 20 '22 03:04 LeftofZen