News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Bug: Incorrect operating profit at the end of the month.

Started by Tortain, April 13, 2018, 05:25:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


ACarlotti

Vehicle maintenance is charged at the end of the month, but does not appear on the list of financial data (except as an unspecified part of operating profit). This is the real bug.

(P.S. I was only able to work this out by reading the relevant code and then inspecting the program with a debugger. The functionality is far from obvious.)

Tortain

After some testing i saw that only horses, post boy and post bicycle (biological vehicles) have both maintenance per km and per month.

jamespetts

I think that this behaves the same way in Standard - can anyone who knows the Standard codebase better than I confirm?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Tortain

Is posible to change biological vehicles cost per month to 0 like in others vehicles?

jamespetts

Quote from: Tortain on April 13, 2018, 11:48:34 PM
Is posible to change biological vehicles cost per month to 0 like in others vehicles?

It is possible to create vehicles with any cost, although removing the fixed cost will affect the balance.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

ACarlotti

Quote from: Tortain on April 13, 2018, 11:48:34 PM
Is posible to change biological vehicles cost per month to 0 like in others vehicles?

Better to add monthy vehicle maintenance to the finance window, either separately, or merged into a renamed infrastructure maintenance or vehicle running costs.

From Standard:
ATV_VEHICLE_MAINTENANCE,        ///< Monthly vehicle maintenance. Unused.
Assuming the comment isn't a lie, then this isn't currently an issue in Standard. However, if our fix doesn't add any new rows to the table then it's probably worth adding to Standard as well, in case they start using monthly vehicle maintenance.

jamespetts

I have now added a graph in the finances window showing the monthly vehicle maintenance cost as separate to the per km cost, which should make this clearer.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Tortain

Is possible to have vehicles maintanence at begining of the month, and added to fixed month costs?

jamespetts

Quote from: Tortain on April 15, 2018, 04:08:11 PM
Is possible to have vehicles maintanence at begining of the month, and added to fixed month costs?

With enough work, most things are possible - but may I ask why you think that this would be worthwhile?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Tortain

Some vehicle maintenance per month is shown at begining of the month, rest is added at the end.
When someone in the middle of a month want to check operating profit, graph do not show real operating profit. Is needed to manually calculate the likely profit looking at the maintenance from the previous month.



jamespetts

Quote from: Tortain on April 15, 2018, 05:35:04 PM
Some vehicle maintenance per month is shown at begining of the month, rest is added at the end.


Are you sure that this is right? This does not seem correct. Can you upload a saved game in which this issue can reliably be reproduced?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Tortain

After some years I sold some horses and now maintenece per km is only added at the end of the month.

But on my picture you can find another bug.
Look at account balance. :P

ACarlotti

James: If I'm understanding finance.cc correctly, then all the changes you made there are modifying the definition of the old save format, used for compatibility for loading/saving old versions. Since you can't just redefine the legacy format, those changes should be reverted (as I have pushed).

I looked at the code for the finance gui, and I think I managed to fix the problems in the below image. I also think the way it is currently written is messy and difficult to maintain, although I will not attempt to refactor any of it now.

Fixes pushed to Github.

jamespetts

Excellent - thank you for the fixes: now incorporated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.