Page 1 of 2

Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 14:16
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 14:26
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! :)

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 14:30
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 14:37
by chrissicom
Hehe, great patch :) I was really waiting for this as it annoyed me too!

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 14:56
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 18:52
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?):

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 19:07
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 19:08
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

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 19:16
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 19:40
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.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 20:25
by Acerbus
Also, is it possible to do this:
HalftileFoundationsTeaser2.PNG
HalftileFoundationsTeaser2.PNG (3.7 KiB) Viewed 5566 times
instead of this:
HalftileFoundationsTeaser1.PNG
HalftileFoundationsTeaser1.PNG (3.69 KiB) Viewed 5567 times
?

Highly looking forward to your patch getting included in ChrisIN or trunk.

Re: Patch: Less restrictive railroad construction

Posted: 15 Aug 2007 23:14
by athanasios
Looking forward to play with it. Thank you for your nice patch. :D

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 09:31
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.

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 13:14
by Maedhros
Committed in r10922 (I renamed the struct and changed some whitespace, but otherwise it's the same). Thanks! :D

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 15:51
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.

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 15:59
by Roujin
just one word: awesome 8)

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 18:03
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

Re: Patch: Less restrictive railroad construction

Posted: 16 Aug 2007 23:03
by flake
yes! several nonexistent hairs on my head would love that patch now :P

Re: Patch: Less restrictive railroad construction

Posted: 17 Aug 2007 15:35
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!

Re: Patch: Less restrictive railroad construction

Posted: 27 Aug 2007 14:28
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.)