A dirty fix to stop industries being deleted ...

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

A dirty fix to stop industries being deleted ...

Post by one billion daleks »

There's a thread in the Development MB about patching the game's ability to randomly close down and create industries. The patch is a good idea, because whilst this function is fine in computer-generated maps, it's darned annoying to see the game trash a carefully thought-out scenario.

For example, in the scenario I'm currently working on, the game closed down 18 industries in the first two game-years, completely undermining the design of the scenario. This can be rather disheartening, and I believe would tend to discourage players from bothering to create elaborate scenarios once they realised what the game will do to them!

I hope the patch gets into trunk, but at the moment for me the game crashes even when the patch is compiled against a (supposedly) compatible nightly.

So here's a very simple workaround that I came up with for the time being, to prevent the game trashing scenarios, that I thought perhaps might be useful for other players ...

Instead of placing industries into a scenario from the outset, just place a sign at the intended location. Then once the scenario is loaded into the game, use the ingame cheat to switch to an unused player slot (say Player 8 ) ... allocate that player $20 million, then use the 'Fund Industry' to establish the industry when you're ready to connect to it. (Note, you'll probably need to Configure Patches to 'Local Authority being permisssive' about demolishing things!)

Of course, signs can be switched on /off from the tools button, so the map doesn't need to be 'contaminated' with lots of signs being displayed during gameplay.

I've found this simple workaround to be useful, especially as I prefer to develop passenger and mail networks before I start on industries, and this way the scenario is protected from the code's enthusiasm for completely trashing things!
Attachments
The usual approach ...
The usual approach ...
A022.jpg (200.85 KiB) Viewed 5548 times
The workaround ...
The workaround ...
A023.jpg (197.83 KiB) Viewed 5537 times
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: A dirty fix to stop industries being deleted ...

Post by Bilbo »

Wouldn't it be better to fix this properly by a patch? This is a bit awkward solution.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

Yes certainly, a patch is a far more preferable solution.

This approach is just offered as a suggestion (a dirty fix really, as indicated in the thread title) for anyone using the Scenario Editor, to use as an intermin solution - until a permanent patch is accepted into trunk. There again, there's no indication of plans to permanently address this difficulty with scenarios ... so this approach might turn out to be the only way for scenario creators to get around the glitch. Well, it's the only solution I could think of anyway!

At the moment, when I'm play-testing scenarios, they're all completely trashed within 3 to 5 game-years ... and this makes it impossible to see how factors like city-growth would influence the positioning of farms, forests etc within the scenario.

I'm also testing the use of motorways as a mechanism for limiting the growth and shape of cities, given that town-growth seems to be (conveniently) halted by the presence of dual carriageways ... but if all the industries I've set up in a city get deleted by the game within a few years, it distorts the outcomes for these playtests.

As I hinted in my first post, it really is a complete waste of time trying to create scenarios of any complexity given the current code. But yep, you're right - this is an awkward solution, it is only suggested as a usable workaround for the time being.
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: A dirty fix to stop industries being deleted ...

Post by andrewas »

A hacky patch to do this involves rewriting CheckIndustryCloseDownProtection in industry_cmd.cpp to always return true. Ill post a diff with a proper patch tonight, if nobody else does it first.
RMJ
Traffic Manager
Traffic Manager
Posts: 160
Joined: 24 Sep 2005 13:52
Location: Denmark
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by RMJ »

would be so nice with an options if the game, to enable or disable closing and spawning of new industries :)
Feel free to join my server on 90.185.50.242. its coop, meaning 1 company to dominate the whole map :) its more random and not as pro as the Openttd Coop guys.
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

andrewas ... well, occasionally problems do have very simple solutions, so it wouldn't necessarily be a hack.

If all that is needed to fix this is to just set a single Boolean flag somewhere, then hopefully your fix could be added to 'Configure Patches' as a simple on/off option, and find its way into trunk fairly quickly.

Fingers crossed anyway! :)
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: A dirty fix to stop industries being deleted ...

Post by andrewas »

Actually, you can fix the problem with the other patch - its actually a bug in OTTD, and its being aggravated by additional checking. Patch against revision 11771 or earlier and you wont get that assert, or remove checking in date.cpp, fairly simple to do, check the SVN repository for the relevant diff.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by belugas »

one billion daleks wrote:... fix this is to just set a single Boolean flag somewhere, then hopefully your fix could be added to 'Configure Patches' as a simple on/off option, and find its way into trunk fairly quickly.
That is out of the question, as far as i am involved.
andrewas wrote:A hacky patch to do this involves rewriting CheckIndustryCloseDownProtection in industry_cmd.cpp to always return true.
That would not be enough, i fear.
The BEST way to do so would be do play in ChangeIndustryProduction, and follow the work been on the Industry member prod_level.
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
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

Oh well, never mind.
Actually, I've found the method of creating labels as 'place-holders' for industries is working perfectly well, and isn't proving awkward at all.
So this workaround has made the problem with industry go away. Now I just get the occasional new industry generated, and those ones can just be left in situ, or demolished by the player.
User avatar
Nemesis
Director
Director
Posts: 529
Joined: 14 Dec 2002 12:18
Location: Zwolle - netherlands
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by Nemesis »

use the ingame cheat to switch to an unused player slot (say Player 8 ) ... allocate that player $20 million
And how do you do this?
Image
Gods don't make mistakes.
Though, sometimes i think it will be nice to be able to carry a tune
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

The ingame cheats are accessed with keypress [Ctrl][Alt][C]

But if this doesn't work, then it will be because you already have [Ctrl][Alt][C] defined to perform some other function on your PC. For example, I used to have it set up as a keyboard shortcut to access the Windows Calculator. So I had to redefine that shortcut to something else before the OTTD cheats could be accessed.

You'll see a message saying "By using cheats, you betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity" ...

... but hey, I wouldn't worry about that! :) ...
... as far as I'm concerned, cheats are essential to make the game run properly! ;)
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: A dirty fix to stop industries being deleted ...

Post by Bilbo »

one billion daleks wrote:But if this doesn't work, then it will be because you already have [Ctrl][Alt][C] defined to perform some other function on your PC. For example, I used to have it set up as a keyboard shortcut to access the Windows Calculator. So I had to redefine that shortcut to something else before the OTTD cheats could be accessed.
I wrote a patch than allowed also to use Ctrl+alt+shift+C in these cases (as ctrl+alt+something is very often used as hotkey for something) but the patch was rejected for trunk.
As I can't redefine the ctrl-alt-c shortcut (it is non-redefinable as it is in openttd) I can't use cheats unless I compile my own version with the patch.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

That's odd that your patch was rejected Bilbo, as it sounds like a perfectly reasonable idea to me!

Another alternative would be to activate cheats from the console, like in other games, but I couldn't find anything on the wiki that says you can use that method.

So how come you can't redefine [Ctrl][Alt][C] on your PC ... what happens when you use that hotkey outside the game ...?
User avatar
Nemesis
Director
Director
Posts: 529
Joined: 14 Dec 2002 12:18
Location: Zwolle - netherlands
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by Nemesis »

Doesn't work with Beta 2.
Image
Gods don't make mistakes.
Though, sometimes i think it will be nice to be able to carry a tune
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

Oh, I didn't know that ... I'm running beta-1.
Do you know if that's a bug in beta-2, or a deliberate change to the code ...?
sforget
Engineer
Engineer
Posts: 69
Joined: 14 Sep 2007 19:01

Re: A dirty fix to stop industries being deleted ...

Post by sforget »

In windows versions the cheat is: [ctrl] + [alt] + [WIN] + [C] (WIN = Windows Key)
TT Player since 1994.
-| Home Page |- -| Save Server Passwords Patch |-
Image - Live ScreenShots
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: A dirty fix to stop industries being deleted ...

Post by Bilbo »

sforget wrote:In windows versions the cheat is: [ctrl] + [alt] + [WIN] + [C] (WIN = Windows Key)
I know, I read than on the wiki too. Unfortunatly, my keyboard lacks the "windows" keys, so I cannot use this either. I find them annoying, so I actually never bought a keyboard equipped with them.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
Nemesis
Director
Director
Posts: 529
Joined: 14 Dec 2002 12:18
Location: Zwolle - netherlands
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by Nemesis »

sforget wrote:In windows versions the cheat is: [ctrl] + [alt] + [WIN] + [C] (WIN = Windows Key)
Yes.. this worked.. whaha.. what a great function. Crossing tunnels.. is really a neat function!!!
Image
Gods don't make mistakes.
Though, sometimes i think it will be nice to be able to carry a tune
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: A dirty fix to stop industries being deleted ...

Post by one billion daleks »

That's good news Nemesis ... now you can switch off those pesky AI players and start managing all eight companies y'self! ;)
User avatar
Nemesis
Director
Director
Posts: 529
Joined: 14 Dec 2002 12:18
Location: Zwolle - netherlands
Contact:

Re: A dirty fix to stop industries being deleted ...

Post by Nemesis »

one billion daleks wrote:That's good news Nemesis ... now you can switch off those pesky AI players and start managing all eight companies y'self! ;)

I never play with the computer. They ruin (?) the world!
Image
Gods don't make mistakes.
Though, sometimes i think it will be nice to be able to carry a tune
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: Google [Bot] and 13 guests