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

Lifetime profit #7919

Open
wants to merge 3 commits into
base: master
from
Open

Lifetime profit #7919

wants to merge 3 commits into from

Conversation

@SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Jan 7, 2020

There is now a lifetime profit value against vehicles which can be viewed alongside the profit this year and profit last year.

burty - Stores lifetime profit (gets updated at end of year)
burty - Displays on the vehicle info window where the other profits are shown.
burty - Saves the lifetime profit in to the save game and loads it.
burty - Sort by lifetime profit in vehicle lists.
JGR - Display the current lifetime profit, instead of the lifetime profit at the start of the current year
JGR - Reset overall lifetime profit to 0 when renewing vehicle.
JGR - Sort by length was incorrectly available, and crashed for non ground vehicles.
Samu - Displays on the vehicle group info panel where the other profits are shown.
Samu - Displays on the vehicle list window where the other profits are shown.
Samu - Add AI/GS functions to get lifetime profits of groups and vehicles.

Copy link
Contributor

@nielsmh nielsmh left a comment

Most of these comments are just thoughts and opinions.

Before reading this code I kind of expected the lifetime profit to include the purchase cost of the vehicle/train. On the other hand, that might be difficult to keep track of with trains composed of multiple vehicles, i.e. what happens if you add or remove cars from a train, how does that update the lifetime profit? (I think that can be solved, but I'm not sure if it's worth solving.)

src/lang/english.txt Outdated Show resolved Hide resolved
src/saveload/saveload.h Outdated Show resolved Hide resolved
src/saveload/vehicle_sl.cpp Outdated Show resolved Hide resolved
src/script/api/script_group.hpp Outdated Show resolved Hide resolved
@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch 2 times, most recently from 1c85e0c to 9ee5102 Jan 8, 2020
@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Jan 13, 2020

I have a dilema - what should be the conversion approach for old savegames?

Renewed vehicles reset lifetime profit to 0, but not last year profit. It remains whatever it is.
This makes it so that vehicles before 1 year old of age from old savegames to have uncertain last year profit.

It could be a real new vehicle, or a renewed vehicle. If it's a real new vehicle, then getting its last year profit as best guess for lifetime profit is correct, no matter its age. But if the vehicle was renewed, then its last year profit was inherited from its past vehicle, and using its last year profit to determine lifetime profit, falls into the wrong side, unless the vehicle is already 1 year old at the time of conversion.

How should I do the lifetime conversion?

  • As burty had in his patch, profit_lifetime equals to 0 for every vehicle.
  • As it currently stands, best guess by using last years profit, no matter the age.
  • Using last years profit for vehicles that are already 1 year old, but 0 for the others.
@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Jan 16, 2020

Another problem: Too large profits don't fit.
screenshot113 (8)

@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch 2 times, most recently from 3e797d9 to df1a225 Jan 16, 2020
@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Jan 16, 2020

Better now.
Unnamed, 2036-10-18

@stormcone
Copy link
Contributor

@stormcone stormcone commented Jan 22, 2020

Wouldn't it be better to make the window resizable horizontally too or to put a horizontal scrollbar at the bottom of the vehicle list? Instead of making wider the whole window by default.

@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch from df1a225 to 3ffc56b Feb 9, 2020
@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch from 3ffc56b to fb09f55 Mar 30, 2020
@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch from fb09f55 to cc6e49c May 12, 2020
SamuXarick added 3 commits Jan 6, 2020
There is now a lifetime profit value against vehicles which can be viewed alongside the profit this year and profit last year.

burty - Stores lifetime profit (gets updated at end of year)
burty - Displays on the vehicle info window where the other profits are shown.
burty - Saves the lifetime profit in to the save game and loads it.
burty - Sort by lifetime profit in vehicle lists.
JGR   - Display the current lifetime profit, instead of the lifetime profit at the start of the current year
JGR   - Reset overall lifetime profit to 0 when renewing vehicle.
JGR   - Sort by length was incorrectly available, and crashed for non ground vehicles.
Samu  - Displays on the vehicle group info panel where the other profits are shown.
Samu  - Displays on the vehicle list window where the other profits are shown.
Samu  - Add AI/GS functions to get lifetime profits of groups and vehicles.
@SamuXarick SamuXarick force-pushed the SamuXarick:lifetime-profit branch from cc6e49c to 9f08c55 Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.