Disable Open and Closure of Industries
Moderator: OpenTTD Developers
Disable Open and Closure of Industries
http://www.tt-forums.net/viewtopic.php? ... 8&p=737264
See that post for the specification of this patch.
Version History
0.0.1 - Initial Release 17/10/08
o Added the choice to advanced settings to chose none or all are able to close
o Built against R14469
0.0.2 Added Open option as well 17/10/08
o Added the ability to stop industries opening.
0.0.3 18/10/08
o Update so that you do not have 'empty' primary industries any more.
Please can you post if you notice any weirdness with the opening and/or closing sections.
Also please post if the empty primaries do appear when this is enabled, thank you.
NOTE: code breaks the NewGRF specification and therefore, it may break NewIndustry GRF
See that post for the specification of this patch.
Version History
0.0.1 - Initial Release 17/10/08
o Added the choice to advanced settings to chose none or all are able to close
o Built against R14469
0.0.2 Added Open option as well 17/10/08
o Added the ability to stop industries opening.
0.0.3 18/10/08
o Update so that you do not have 'empty' primary industries any more.
Please can you post if you notice any weirdness with the opening and/or closing sections.
Also please post if the empty primaries do appear when this is enabled, thank you.
NOTE: code breaks the NewGRF specification and therefore, it may break NewIndustry GRF
- Attachments
-
- industry_open_close.patch
- Patch
- (6.34 KiB) Downloaded 155 times
-
- OTTD.zip
- Binary v0.0.3
- (2.81 MiB) Downloaded 130 times
Last edited by burty on 19 Oct 2008 16:23, edited 3 times in total.
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Re: Disable Open and Closure of Industries
This is quite a nice option, although I doubt whether the devs will ever accept this because NewGRF is the preferred format. Even so it really has its benefits and personally I'd like to see this in-game.
Please allow me to give some comments about this patch:
Don't add the strings for openable industries if the option is not implemented (yet?)
SDT_VAR() breaks savegame compatibility because openttd now expects the variable in every savegame it opens, which is obviously not the case in older saves. Use SDT_CONDVAR() instead.
Please allow me to give some comments about this patch:
Not Every Word Of A String Has To Be Capitalized.patch wrote:{LTBLUE}Industries Allowed To Close During Gameplay {ORANGE}{STRING1}
Don't add the strings for openable industries if the option is not implemented (yet?)
Merge this into a single if(..)patch wrote:if (_settings_game.construction.closeable_industries == 0) {
if (closeit && !CheckIndustryCloseDownProtection(i->type)) {
SDT_VAR() breaks savegame compatibility because openttd now expects the variable in every savegame it opens, which is obviously not the case in older saves. Use SDT_CONDVAR() instead.
Create your own NewGRF? Check out this tutorial!
Re: Disable Open and Closure of Industries
Sorry mate i forgot to thank you REALLY sorry man,
Thank you loads and loads for that .
Updated first post with new versions
Edit: Sorry mate forgot to thank you
Thank you loads and loads for that .
Updated first post with new versions
Edit: Sorry mate forgot to thank you
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Disable Open and Closure of Industries
Sounds good.
Btw I think it should be stored in savegames - it would allow for scenarios to have it as default "build-in" (but still disablable) option. I think most well-done scenarios like the Cindini really don't make sense with enabled closures and openings.
Btw I think it should be stored in savegames - it would allow for scenarios to have it as default "build-in" (but still disablable) option. I think most well-done scenarios like the Cindini really don't make sense with enabled closures and openings.
Re: Disable Open and Closure of Industries
CommanderZ wrote:Sounds good.
Btw I think it should be stored in savegames - it would allow for scenarios to have it as default "build-in" (but still disablable) option. I think most well-done scenarios like the Cindini really don't make sense with enabled closures and openings.
Thank you , i have (i think put it in save games).
The older save games do not work with this but then that does not surprise me... that may be something i look into for future refernce .
Thank you CommanderZ .
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Re: Disable Open and Closure of Industries
You can preserve backward compatibility if you do it correctly..
To do it, you need to increase the version number (in saveload.cpp) by one, compared to the trunk version you based it on, and make all saved patch settings conditional (like Swallow said). That means they will only be expected in a certain range of revisions. And for this range you specify [number you increased to in saveload.cpp] to SL_MAX_VERSION.
PS: after looking at your code, you already use CONDVAR for one of them, but VAR for the other also you use the amount of parameters for the VAR line that would be expected by a CONDVAR.. I think you should change it to CONDVAR too. This in combination with bumping the savegame version and using that version where now stands "77" should solve the backward compatibility problem.
To do it, you need to increase the version number (in saveload.cpp) by one, compared to the trunk version you based it on, and make all saved patch settings conditional (like Swallow said). That means they will only be expected in a certain range of revisions. And for this range you specify [number you increased to in saveload.cpp] to SL_MAX_VERSION.
PS: after looking at your code, you already use CONDVAR for one of them, but VAR for the other also you use the amount of parameters for the VAR line that would be expected by a CONDVAR.. I think you should change it to CONDVAR too. This in combination with bumping the savegame version and using that version where now stands "77" should solve the backward compatibility problem.
Re: Disable Open and Closure of Industries
I don't think you are there yet.
You have disabled actually closing of industry, but afaik all primary industries get exhausted when used, so your game will end up with a lot of 'empty' primary industries.
You have disabled actually closing of industry, but afaik all primary industries get exhausted when used, so your game will end up with a lot of 'empty' primary industries.
Re: Disable Open and Closure of Industries
Updated First Post with new Versions
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Disable Open and Closure of Industries
Did you test this with ECS/Pikka's industries?
Re: Disable Open and Closure of Industries
No this is a CLEAN OTTD eg No GRFs played with.
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Disable Open and Closure of Industries
burty wrote:No this is a CLEAN OTTD eg No GRFs played with.
I mean...what does it do, when a GRF requests an industry closure? It just ignores the request?
Re: Disable Open and Closure of Industries
To be honest i do not know since i rarely play with anything more than plain OTTD , i will try now but if the GRF requests the closure in the same way as normal industries do then yes the GRF request would be ignored however i am guessing it is not as simple as that therefore meaning that GRFs can still close industries.CommanderZ wrote:burty wrote:No this is a CLEAN OTTD eg No GRFs played with.
I mean...what does it do, when a GRF requests an industry closure? It just ignores the request?
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Re: Disable Open and Closure of Industries
I tested this with Chemical vectors GRF and it seems that the chem plants did NOT close.
I played for ~roughly~ ONE game year give or take a month .
I played for ~roughly~ ONE game year give or take a month .
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
-
- Chairman
- Posts: 776
- Joined: 20 Jan 2007 12:08
- Location: Germany
Re: Disable Open and Closure of Industries
Well, I guess the real question is not if they don't close (they won't if you don't let them ), but if they are well-behaving after they requested closure. I doubt that NewGRF authors coded state transitions from closed state to a usable state, as that just can't happen normally. And even if by luck (or should I say by accident) it seems to work cleanly it can break at any time, so you should state clearly that your code breaks the NewGRF specification and therefore, it may break NewIndustry GRFs (you might have known that if you had read and understood the current topics on that in TTDPatch Graphics and OpenTTD Graphics forums ).burty wrote:I tested this with Chemical vectors GRF and it seems that the chem plants did NOT close.
I played for ~roughly~ ONE game year give or take a month .
BTW, one game year is not enough to test that given that ECS industries are protected of closure in the first five years.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Re: Disable Open and Closure of Industries
This patch is great, I always play with it
I've run into the same problem Alberth has, though. Industries end having such a low production that you can't pick any cargo on them. Sometimes I have to enable closure just to get them out of the map.
I've run into the same problem Alberth has, though. Industries end having such a low production that you can't pick any cargo on them. Sometimes I have to enable closure just to get them out of the map.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Re: Disable Open and Closure of Industries
Hehehe... how UNEXPECTED!
NOT!
It's nice people start to realize finally the price of simply preventing industry closure
/me feels rejoyced!
NOT!
It's nice people start to realize finally the price of simply preventing industry closure
/me feels rejoyced!
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
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Re: Disable Open and Closure of Industries
Well, Terkhen - and to rain on belugas' parade some - you can get those industries up, though gradually. The whole point of this patch is for such beautifully crafted scenarios as aforementioned, not for just any random game. If of course I make a newGRF for such behaviour (though limited to default industry set), it can be then used for such scenarios...Terkhen wrote:This patch is great, I always play with it
I've run into the same problem Alberth has, though. Industries end having such a low production that you can't pick any cargo on them. Sometimes I have to enable closure just to get them out of the map.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: Disable Open and Closure of Industries
I wished this patch work with Pika's Basic Industries.
I'm getting so disappointed when I'm done building a station/network and seeing the industry next to it vanish the second after.
This is in my opinion a must have feature for advanced settings.
I'm getting so disappointed when I'm done building a station/network and seeing the industry next to it vanish the second after.
This is in my opinion a must have feature for advanced settings.
Re: Disable Open and Closure of Industries
I would be willing to get it working with NewGRF industries but would need someone who has knowledge of the workings (c++ code side) of the NewGRFs as whenever I have looked in there I end up go around in forever increasing circles and closeing the program for the next 2months.
Since the source is open as is this patch I am sure someone may be able to patch the patch to work with Pikka's sets
Since the source is open as is this patch I am sure someone may be able to patch the patch to work with Pikka's sets
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Re: Disable Open and Closure of Industries
As requested updated to trunk
- Attachments
-
- industry_open_close 15879.patch
- (5.08 KiB) Downloaded 79 times
My Patches: Lifetime profit patch | Improved Shares [ON HIATUS]
Who is online
Users browsing this forum: No registered users and 35 guests