[PATCH] Life time profit on vehicle windows

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

[PATCH] Life time profit on vehicle windows

Post by burty »

I've been thinking about this one for a while.

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

V1
[*] Stores lifetime profit (gets updated at end of year)
[*] Displays on the vehicle info window where the other profits are shown.

This currently isn't saved into the save games.
Attachments
Lifetime profit V1.patch
Lifetime profit patch v1
(3.39 KiB) Downloaded 257 times
openttd.zip
Binaries and language
(7.44 MiB) Downloaded 173 times
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: [PATCH] Life time profit on vehicle windows

Post by burty »

V2 attached.

This now saves the lifetime profit in to the save game and loads it.
Attachments
openttd.zip
(7.99 MiB) Downloaded 103 times
Lifetime profit V2.patch
(5.42 KiB) Downloaded 278 times
McZapkie
Tycoon
Tycoon
Posts: 1266
Joined: 18 Jan 2014 18:10

Re: [PATCH] Life time profit on vehicle windows

Post by McZapkie »

Good idea, I always wondered why there is lack of such information.
I'm using first patch (for game/multiplayer compatibility), hope that it will be in trunk, combined with group info :)

BTW, how profit_lifetime variable is initialized?
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

[PATCH] Life time profit on vehicle windows

Post by burty »

Ahh... Yeah I just realised that on new game it doesn't get initialised :S
I don't know How I missed that!

I'm glad you like it, I hope it gets in trunk as well. Ive written another small patch that meddles with the share system and dividends :)


Sent from my iPhone using Tapatalk
xarick
Transport Coordinator
Transport Coordinator
Posts: 292
Joined: 26 Feb 2015 00:52

Re: [PATCH] Life time profit on vehicle windows

Post by xarick »

Hi. Can it also be added to the Sort by when listing vehicles? That would be awesome.
Formerly known as Samu
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: [PATCH] Life time profit on vehicle windows

Post by burty »

I don't see why not. I shall look in to it in the week


Sent from my iPhone using Tapatalk
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: [PATCH] Life time profit on vehicle windows

Post by burty »

V4
[*] NEW: Option to use Lifetime instead of last years profit for news alert.

V3
[*] New: Sort by lifetime profit in vehicle lists.
Attachments
Lifetime profit V3.patch
(6.85 KiB) Downloaded 181 times
Lifetime profit V4.patch
(11.66 KiB) Downloaded 195 times
Lifetime Patch R27447 - V4.zip
Win 32 binaries
(5.2 MiB) Downloaded 95 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2256
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: [PATCH] Life time profit on vehicle windows

Post by JGR »

I've made a few slight tweaks to version 3 of this patch.
  • Display the current lifetime profit, instead of the lifetime profit at the start of the current year
  • Change the lifetime profit string format to avoid breaking translations
The update in version 4 is not multiplayer safe, as the AI event for unprofitable vehicles depends on the current client display setting for which profit to use.
I'm not sure that it makes sense in general for profit warnings to use the lifetime profit, as that effectively means that older vehicles which later become unprofitable will not show a warning.

Edit: updated.
Attachments
lifetime_profit_v3.1.1.patch
(7.76 KiB) Downloaded 192 times
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests