Improved smooth_economy patch

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

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

As I thought, it work fine.

Just replace in "ExtChangeIndustryProduction(Industry *i)" located in industry_cmd.cpp :

Code: Select all

				if (mag >= 10) {
					SetDParam(2, mag);
					SetDParam(0, _cargoc.names_s[i->produced_cargo[j]]);
					SetDParam(1, i->index);
					AddNewsItem(
						percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
						NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
						i->xy + TileDiffXY(1, 1), 0
					);
				}
by

Code: Select all

				mag = abs(percent);
				if (mag >= 10 && (HASBIT(i->town->have_ratings, _local_player) || i->town->exclusivity == _local_player)) {
					SetDParam(2, mag);
					SetDParam(0, _cargoc.names_s[i->produced_cargo[j]]);
					SetDParam(1, i->index);
					AddNewsItem(
						percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
						NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
						i->xy + TileDiffXY(1, 1), 0
					);
				}
Here is a patch file :

http://magicsite.manga-torii.com/files/ ... cities.zip
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

I'm glad you like the patch. :D

Yes, the numerous messages tend to be very annoying, to me too...
Usually I just turn the economy messages OFF (under the "Message Settings").

I thought about making the messages of only player-used industries to be visible to a certain player but I'm not really sure how I'd go about it. :)
I'll look some more at the source, but please be patient, as my programming knowledge is quite basic. :)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Wow - thank you - looks like you have posted a new message while I was still typing the above one. :)

I'll try that and include it.

Thank you very much!

EDIT: I just may post it tomorrow (sunday) - it's evening here and I am sleepy - I'll rather get at it tomorrow and also update the other patches.

Thanks again. :D
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

SirkoZ wrote:Wow - thank you

Thank you very much!

Thanks again. :D
No problem, I did it for me ;)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Well I'm sure other players will appreciate it. ;)

:arrow: Anyways here's version 2.8 of the patch - that message filtering deserves a revision upgrade.
Attachments
smooth_economy_sz_v2-8_r8435_mini-IN.patch
diff
(1.95 KiB) Downloaded 427 times
smooth_economy_sz_v2-8_r8435_NS.patch
diff
(6.28 KiB) Downloaded 507 times
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Improved smooth_economy patch v3.0 (nightly r10715 and up)

Post by SirkoZ »

Mainly different approach.....here's the v3.0 (2.9 was a non-release although fully functional):

EDIT: the 0% transported behaviour was too radical in 3.0 - so it's fixed now - 3.0c
(also chances are a bit higher now):
Attachments
smooth_economy_sz_v3-0c_r10774_simple.patch
diff
(2.04 KiB) Downloaded 295 times
smooth_economy_sz_v3-0c_0-5-3-RC2_simple.patch
diff
(1.77 KiB) Downloaded 283 times
sz_ind_patch_comments_v3-0c.txt
txt
(4.94 KiB) Downloaded 302 times
clark17
Engineer
Engineer
Posts: 4
Joined: 18 Oct 2007 11:46

Re: Improved smooth_economy patch

Post by clark17 »

It there has a chance to see it in the trunk?
Sorry for my little english....
User avatar
George
Tycoon
Tycoon
Posts: 4362
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Improved smooth_economy patch

Post by George »

Sorry for a question, but
Can industry prop 13 (var 93) have values other than 00, 04, 08, 10, 20, 40, 80?
Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Improved smooth_economy patch

Post by DaleStan »

George wrote:Can industry prop 13 (var 93)
Industry prop 13 is cargo-specific.
Industry variable 93 is not cargo-specific.

Of which do you speak?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Improved smooth_economy patch

Post by SirkoZ »

clark17 wrote:It there has a chance to see it in the trunk?
I honestly don't know.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Improved smooth_economy patch

Post by SirkoZ »

George wrote:Sorry for a question, but
Can industry prop 13 (var 93) have values other than 00, 04, 08, 10, 20, 40, 80?
No clue - DaleStan is the one to tell you the grf specifics. I only deal with the behaviour, not grf compatibility.
User avatar
George
Tycoon
Tycoon
Posts: 4362
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Improved smooth_economy patch

Post by George »

DaleStan wrote:
George wrote:Can industry prop 13 (var 93)
Industry prop 13 is cargo-specific.
Industry variable 93 is not cargo-specific.
Of which do you speak?
Sorry for not clean question
51766 [36][5A] Industry array (+90 entries), locations within each entry follow:
Offset Size Meaning
13 B Production multiplier, always either 00 (which means the industry has announced imminent closure) or an integer power of 2. 10 is the default, 04 is the minimum, 80 is the maximum.
Image Image Image Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Improved smooth_economy patch

Post by belugas »

I think it is only a powerof 2, indeed.
I'll check when i can
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
George
Tycoon
Tycoon
Posts: 4362
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Improved smooth_economy patch

Post by George »

belugas wrote:I think it is only a powerof 2, indeed.
I'll check when i can
It may be useful to use other values to indicate for the GRF that the value is smooth.
Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Improved smooth_economy patch

Post by DaleStan »

George wrote: 51766 [36][5A] Industry array (+90 entries), locations within each entry follow:
Offset Size Meaning
13 B Production multiplier, always either 00 (which means the industry has announced imminent closure) or an integer power of 2. 10 is the default, 04 is the minimum, 80 is the maximum.
Absolutely everything GRF-accessible that listed in that document is a variable. *EVERYTHING!* Stop calling them properties. They aren't.

Properties are the things you put in an action 0.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
George
Tycoon
Tycoon
Posts: 4362
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Improved smooth_economy patch

Post by George »

DaleStan wrote:
George wrote: 51766 [36][5A] Industry array (+90 entries), locations within each entry follow:
Offset Size Meaning
13 B Production multiplier, always either 00 (which means the industry has announced imminent closure) or an integer power of 2. 10 is the default, 04 is the minimum, 80 is the maximum.
Absolutely everything GRF-accessible that listed in that document is a variable. *EVERYTHING!* Stop calling them properties. They aren't.
Properties are the things you put in an action 0.
Sorry
Back on topic. Values in var 93 could take a more wide range of values in OTTD. GRFs could use it. What do you think?
Image Image Image Image
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Improved smooth_economy patch

Post by SirkoZ »

Newsflash - since r11500 - my smooth_economy patch has been included in the trunk, although not 3.0c but 3.0w - its behavior is still the same old good one that was known for my patches but it's really simple and "clean".

Of course as always, there can be improvements, de-coupl-ings and such, but it's in and it's behaving, that's the most important.

Thank you to all that have helped me through the years with your suggestions/advices for this small but useful patch. And of course - thank you, Belugas, who reviewed and approved it.
Attachments
smooth_economy_sz_v3-0w_r11399_simple.patch
diff
(1.41 KiB) Downloaded 383 times
User avatar
Octopussy
Engineer
Engineer
Posts: 122
Joined: 01 May 2006 21:57

Re: Improved smooth_economy patch

Post by Octopussy »

SirkoZ wrote:Newsflash - since r11500 - my smooth_economy patch has been included in the trunk, although not 3.0c but 3.0w - its behavior is still the same old good one that was known for my patches but it's really simple and "clean".

Of course as always, there can be improvements, de-coupl-ings and such, but it's in and it's behaving, that's the most important.

Thank you to all that have helped me through the years with your suggestions/advices for this small but useful patch. And of course - thank you, Belugas, who reviewed and approved it.
Well Done !!

it might be thought to add [in trunk] in the main post of this topic and update this page of the OpenTTD Manual : http://wiki.openttd.org/index.php/Economy :)

And what's the difference with this another project branch : http://wiki.openttd.org/index.php/New_E ... _Balancing ?

8)
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Improved smooth_economy patch

Post by SirkoZ »

Yes, I will update that wiki page tomorrow and also the title here.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Semrush [Bot] and 6 guests