Patch: Less restrictive railroad construction

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

frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Patch: Less restrictive railroad construction

Post by frosch »

Hello, I am somewhat surprised I did not find this patch here or in the suggestion forum, though the thing it fixes pretty annoys me. Tell me if I am wrong.

This patch makes railway construction a bit more tolerant about "Train in the way". It enables you to build/remove/modify track/signals on parallel horizontal/vertical track while the other track is busy. (see attached picture)

Enjoy it.
Attachments
What it does
What it does
LessRestrictiveRailConstruction.png (10.9 KiB) Viewed 5877 times
LessRestrictiveRailConstruction_ver2_r10908.patch
The patch: See sticky topics "Howto apply a patch..." and "BuildOTTD"
(2.63 KiB) Downloaded 122 times
Last edited by frosch on 15 Aug 2007 19:02, edited 1 time in total.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
AlienDNA
Engineer
Engineer
Posts: 97
Joined: 12 Apr 2004 08:53
Location: Leiden, Netherlands

Re: Patch: Less restrictive railroad construction

Post by AlienDNA »

Excellent. These kinds of patches make me happy. Indeed odd that no-one ever thought about fixing this, because it can get pretty annoying if you have long diagonal railways, and you want to remove road or place signals.

Keep it up! :)
"I'm gonna rip his leg off and kick him with it!", Sanjuro, Shogo-MAD
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: Patch: Less restrictive railroad construction

Post by Maedhros »

Nice, although I don't like that use of TileInfo. I'd create a struct just for that, personally. Also, you could use TracksOverlap(v->u.rail.track | trackbits) (where trackbits = TrackToTrackBits(track)) instead of that if statement.
No-one's more important than the earthworm.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Less restrictive railroad construction

Post by chrissicom »

Hehe, great patch :) I was really waiting for this as it annoyed me too!
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Patch: Less restrictive railroad construction

Post by frosch »

Wow, fast responses.

By the way I am somewhat anxious about the placing/removing signals. I did not find anything that depends on no vehicle being in the way. However while playing I did not encounter any train crashes till now. But it should be more tested.

@Maedhros:
I will fix those things.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
RainierWatcher
Traffic Manager
Traffic Manager
Posts: 244
Joined: 14 Jan 2007 15:10
Location: West Norfolk, England

Re: Patch: Less restrictive railroad construction

Post by RainierWatcher »

Not exactly the same thing, but would it be possible to extend this patch to allow building of this (or is this a restriction in the map array?):
Attachments
Trintfingfield Transport, 9th Jan 2010.png
Trintfingfield Transport, 9th Jan 2010.png (56.79 KiB) Viewed 1173 times
Ways of Preventing Death:
* Don't breathe air. Seriously. Everyone born before 1870 breathed the substance at some point in their life and every one of them is dead today. A coincidence? I think not.
Taken from uncyclopedia
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Less restrictive railroad construction

Post by DaleStan »

If buildonslopes uses the same type of lookup-tables in Patch as it does in Open, it's really quite easy to allow the building. But getting the right graphics drawn is a completely different matter.
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: Patch: Less restrictive railroad construction

Post by frosch »

Updated patch in first post with Maedhros suggestions.

@RainierWatcher:
Congratulations, that is exactly what I have been working on for four weeks. Parts of it are already committed, but there are still some sprite-sorting issues. Teaser attached. No, it's not a mock-up. :D
Attachments
Halftile Foundations Teaser Screenshot
Halftile Foundations Teaser Screenshot
HalftileFoundationsTeaser.png (89.66 KiB) Viewed 1190 times
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Patch: Less restrictive railroad construction

Post by Acerbus »

frosch wrote:Congratulations, that is exactly what I have been working on for four weeks. Parts of it are already committed, but there are still some sprite-sorting issues. Teaser attached. No, it's not a mock-up. :D
This was the SINGLE most annoying thing in TTD for me. Thanks for finally fixing that!

By the way, did you make it so that OTTD always uses the diagonal foundations under diagonal tracks? Those normal zig-zag foundations looked so ugly.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Less restrictive railroad construction

Post by Roujin »

Acerbus wrote:By the way, did you make it so that OTTD always uses the diagonal foundations under diagonal tracks? Those normal zig-zag foundations looked so ugly.
I forward that. Please do so if its possible.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Patch: Less restrictive railroad construction

Post by Acerbus »

Also, is it possible to do this:
HalftileFoundationsTeaser2.PNG
HalftileFoundationsTeaser2.PNG (3.7 KiB) Viewed 5562 times
instead of this:
HalftileFoundationsTeaser1.PNG
HalftileFoundationsTeaser1.PNG (3.69 KiB) Viewed 5563 times
?

Highly looking forward to your patch getting included in ChrisIN or trunk.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Less restrictive railroad construction

Post by athanasios »

Looking forward to play with it. Thank you for your nice patch. :D
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Patch: Less restrictive railroad construction

Post by frosch »

Acerbus wrote: By the way, did you make it so that OTTD always uses the diagonal foundations under diagonal tracks? Those normal zig-zag foundations looked so ugly.
Yes, you can see that in the teaser screenshot.
By the way: Funny you call it "diagonal foundations". It was my first codename for the project, but later changed it to "halftile foundations" as they are not really diagonal but vertical and horizontal.
Acerbus wrote: Also, is it possible to do this:
###
instead of this:
###
Nice idea. I also did not like the zig-zag at the end, but I did not knew a way to remove it without drawing even more foundation-sprites. Thank you for pointing me on this way. I will definitely implement that.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: Patch: Less restrictive railroad construction

Post by Maedhros »

Committed in r10922 (I renamed the struct and changed some whitespace, but otherwise it's the same). Thanks! :D
No-one's more important than the earthworm.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 991
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Patch: Less restrictive railroad construction

Post by frosch »

Nice, thanks.

Just for the record: Similiar can be done for the convert-rail-tool. It should be allowed to upgrade track if the train on the track/bridge/tunnel/station/road-crossing will stay powered.

Any volunteers?

I will not do it, because it seems to be a lot more work than this patch, and I personally do not play with elrails.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Less restrictive railroad construction

Post by Roujin »

just one word: awesome 8)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Tom0004
Chairman
Chairman
Posts: 822
Joined: 01 Jul 2007 22:33
Location: Manchester, UK

Re: Patch: Less restrictive railroad construction

Post by Tom0004 »

r10922 maedhros 2007-08-16 15:13:07 +0200 (Thu, 16 Aug 2007) 3 lines

-Codechange: Allow building and removing tracks and signals when there is a
train on a parallel diagonal track that doesn't interact with this one. (frosch)
seems someone liked this.. maded it into trunk
User avatar
flake
Engineer
Engineer
Posts: 66
Joined: 28 Apr 2004 10:07
Location: Salzburg
Contact:

Re: Patch: Less restrictive railroad construction

Post by flake »

yes! several nonexistent hairs on my head would love that patch now :P
*<(:-}
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Less restrictive railroad construction

Post by chrissicom »

great :) good my guess was right and I didn't add it to ChrisIN :) but now it's time to update ChrisIN anyway with this cool new trunk feature!
MJS
Director
Director
Posts: 540
Joined: 28 Jul 2005 09:31

Re: Patch: Less restrictive railroad construction

Post by MJS »

It would be nice if diagonal non-electrified tracks would never show overhead wires - now those squares that are shared with an electrified piece of diagonal track do... (They don't in TTDPatch, though.)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 12 guests