Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Transfer credits calculated wrong with negative cargo values #9719

Open
2TallTyler opened this issue Nov 27, 2021 · 0 comments
Open

[Bug]: Transfer credits calculated wrong with negative cargo values #9719

2TallTyler opened this issue Nov 27, 2021 · 0 comments

Comments

@2TallTyler
Copy link
Member

@2TallTyler 2TallTyler commented Nov 27, 2021

Version of OpenTTD

12.1

Expected result

When using a NewGRF which has cargos with a negative value, for example Industries of the Caribbean or Minimalist Industries, transfer credits show the proper negative value for the vehicle's portion of the delivery.

Actual result

Transfer credits are positive, showing the vehicle made a profit. It doesn't matter whether the cargo value is defined by property or callback — the attached savegame defines it as a property, but Industries of the Caribbean uses the callback and has the same problem.

Of course, transfer credits are virtual and the company doesn't actually make money when it should not. This is purely an accounting error.

Note that GRF specs explicitly allows negative cargo values, per the NML specs for the profit callback. A previous bug with inflation and negative cargo values was fixed in #9455.

Steps to reproduce

  1. Load the attached savegame with included Minimalist Industries NewGRF: transfer_credits.zip.
  2. Note the cargo value for Building Materials in Cargo Payment Rates graph, showing that no positive profit is ever possible.
  3. Notice how the train shows a positive profit this year, and the transfer credit pop-up text is positive, but the truck shows the correct negative profit and delivery pop-up text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant