Skip to content

Deliver a certain amount of cargo stepper has odd behaviour #3028

@LeeSpork

Description

@LeeSpork

Version information:

  • Platform: Windows 10
  • Version: 25.02

Describe the bug
When setting a "Deliver a certain amount of cargo" objective in the scenario editor, the number selector thing has odd behaviour. Original Locomotion (Steam) does not have these issues. It feels like it may be integer overflow/underflow errors that only happens depending on the step size (which changes based on how long you hold the button).

Specifics:

  1. If you click and hold the subtract button for long enough, instead of having a minimum value of 100 tons, it can underflow to 35 million and something tons.
  2. Clicking the + or - when it is above a certain value causes it to suddenly reduce by a lot (overflow?): 77,777,700 tons is treated as 5,688,100 tons. 35,123,000 tons is treated as 2,355,000 tons.

To Reproduce

  1. Go to scenario editor
  2. Click bottom-right button twice
  3. Change the drop-down to the bottom option
  4. Play with the + and - buttons (and/or scrollwheel)

OR: You could also attempt to modify a scenario created in the original game by loading it in the scenario editor and attempting to edit its objective, if it had a high cargo deliver objective. For example, this one that I created by holding the increase button for several minutes in the Steam version of the game: 77 Million tons of Chemicals please.zip

Speculation
Does changing this to a 32 bit int fix this issue?

uint16_t cargoFactor = (Scenario::getObjective().deliveredCargoAmount - stepSize) / stepSize;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions