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 · 1 comment
Open
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs

Comments

@2TallTyler
Copy link
Member

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.
@2TallTyler 2TallTyler added component: NewGRF This issue is related to NewGRFs bug Something isn't working labels Oct 19, 2022
@PeterN
Copy link
Member

PeterN commented Jan 30, 2024

I'd suggest that transfer credits should not apply if cargo value is negative.
All legs have to pay the fee, and if you transport it weirdly, you get to pay higher fees.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs
Projects
None yet
Development

No branches or pull requests

2 participants