Disable closures of all TTD industries

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

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

Disable closures of all TTD industries

Post 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.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Disable closures of all TTD industries

Post by DaleStan »

For what did you look?
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: Disable closures of all TTD industries

Post by SirkoZ »

There is no such switch in Actions 0 and 2 that would allow what the title says.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Disable closures of all TTD industries

Post 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)
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Disable closures of all TTD industries

Post 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. ;-)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Disable closures of all TTD industries

Post 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".
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
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Disable closures of all TTD industries

Post 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.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Disable closures of all TTD industries

Post by DaleStan »

Fair enough.
As I said, George may have different ideas, and it sounds like he -- and/or other newindustry authors -- did.
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: Disable closures of all TTD industries

Post 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?
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Disable closures of all TTD industries

Post 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.
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
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Amazon [Bot] and 11 guests