Page 1 of 1

Disable closures of all TTD industries

Posted: 03 Oct 2008 22:45
by SirkoZ
Any idea which newGRF action one would use to disable all the closures of extractive, organic and processing industries? Looking at newGRF specs I found none.

Re: Disable closures of all TTD industries

Posted: 03 Oct 2008 23:07
by DaleStan
For what did you look?

Re: Disable closures of all TTD industries

Posted: 04 Oct 2008 13:07
by SirkoZ
There is no such switch in Actions 0 and 2 that would allow what the title says.

Re: Disable closures of all TTD industries

Posted: 06 Oct 2008 17:39
by frosch
For processing industries:
Set http://wiki.ttdpatch.net/tiki-index.php ... n_flags_0B_ to 0x00. It will then behave like e.g. the power plant. So to sum up, you have to set property 0x08, 0x09 and 0x0B to change the behaviour of default industries. Maybe 0x18 is also a good idea.
Note: To modify other newgrfs you have to modify the grfs directly. I.e. you cannot modify the industries an other grf defines.

For organic/extractive industries this is more complicated:
You have to use callback http://wiki.ttdpatch.net/tiki-index.php ... _change_29_ and return 0x02 when var 0x93 is 0x04 (the minimum before closing). You can also use the random bits in var 0x18 to return 0x00 in some cases.
Note: Using the production change callbacks will always disable smooth economy. If you want to also play with smooth economy you have to reinvent the wheel using the industry production callback, the monthly callback and persistent storage registers to store the current production level. (lots of work)

Re: Disable closures of all TTD industries

Posted: 06 Oct 2008 19:40
by SirkoZ
Thank you very much, frosch, I really appreciate your very informative reply.


The main reason for me saying I didn't find any Action to do what I wanted with this newGRF was because I considered just turning industries into power plan-equals (=black hole) dirty.
The procedure that you described for keeping smooth_economy is also quite a tricky one.

Wouldn't you think it would be better if every industry had a property do_not_close_down_ever at least in some Action, so it would be at least possible to use that in simple manner if there is no such switch available in "Configure patches/Advanced settings" window?
Please consider that. ;-)

Re: Disable closures of all TTD industries

Posted: 06 Oct 2008 20:58
by DaleStan
frosch wrote:Note: Using the production change callbacks will always disable smooth economy.
I would call that a bug in Open. Return value 04 should cause the industry to behave -- for this production change -- as if the callback was not enabled.
George may have different ideas, though.

And SirkoZ, you would have gotten a much quicker response if you had answered the question asked. "for what" is not the same as "where".

Re: Disable closures of all TTD industries

Posted: 07 Oct 2008 18:20
by frosch
DaleStan wrote:Return value 04 should cause the industry to behave -- for this production change -- as if the callback was not enabled.
IIRC it was like that in the beginning. But that was not expected by the exisiting grfs. So OTTD interprets it as "behave as original TTD".

However since newindustries smooth-economy is kind of deprecated. AFAIK noone had an idea on how to integrate it with newindustries, as it does not fit with the rest. And the existing newindustry grfs do their own stuff anyway.

Details:
Var 0x93 is meaningless with smooth-economy, which causes trouble with callbacks 0x29 and 0x35 as they usually access this variable. Smooth-economy changes vars 0x8E and 0x8F only, which causes trouble with the production callback (EDIT: not true).
So smooth-economy is disabled when callback 0x29, 0x35 or the production callbacks (on cargo arrival or every 256 ticks) is used.

Re: Disable closures of all TTD industries

Posted: 08 Oct 2008 03:25
by DaleStan
Fair enough.
As I said, George may have different ideas, and it sounds like he -- and/or other newindustry authors -- did.

Re: Disable closures of all TTD industries

Posted: 08 Oct 2008 18:51
by SirkoZ
So how about tie-ing an allow/disallow switch/NewGRF Action property to OpenTTD's/TTD's either CheckIndustryCloseDownProtection function or go to close/closeit function?

Re: Disable closures of all TTD industries

Posted: 21 Oct 2008 20:57
by belugas
If I remember well, another reason we decide to not include smooth economy is that it was way too much based on randomness, something that would have actually kill any decent networking.