45° rotated rectangle clearing / leveling patch

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

Diadem
Engineer
Engineer
Posts: 70
Joined: 13 Jun 2005 14:19

45° rotated rectangle clearing / leveling patch

Post by Diadem »

I made a patch that allows you to clear or level rectangle areas rotated 45°. This allows you to clear or level diagonal stretches of land. That, imho, makes constructing diagonal rails or roads a lot less bothersome.

I've tested the patch myself, and I can't find any problems with it anymore. If you find any, please tell me. Since my windows compiler won't compile with .png support I can't add screenshots. Feel free to add your own :)

A final note for the coders: As a bonus I added some extra comments here and there in the code in this patch.

[edit]
Oh, before I forget. Use ctrl to use this feature.
Attachments
diagonal_clearing.diff
Diff against r2478
(18.61 KiB) Downloaded 708 times
Last edited by Diadem on 24 Jun 2005 09:47, edited 3 times in total.

Diadem
Engineer
Engineer
Posts: 70
Joined: 13 Jun 2005 14:19

Post by Diadem »

Some screenies of this feature (many thanks to HackyKid):
Attachments
Selecting an area for clearing
Selecting an area for clearing
diagsel1.png (82.25 KiB) Viewed 21768 times
... and clearing it
... and clearing it
diagsel2.png (80.75 KiB) Viewed 21763 times

Diadem
Engineer
Engineer
Posts: 70
Joined: 13 Jun 2005 14:19

Post by Diadem »

More Screenies:
Attachments
... and leveling it
... and leveling it
diagsel4.png (82.29 KiB) Viewed 21735 times
Selecting an area for leveling
Selecting an area for leveling
diagsel3.png (83.2 KiB) Viewed 21741 times

User avatar
mkxx
Engineer
Engineer
Posts: 65
Joined: 06 Jun 2005 22:15
Location: Czech Republic, Prague

Post by mkxx »

Good work! Looking for use this in latest nightly ;o)

Nanaki13
Traffic Manager
Traffic Manager
Posts: 151
Joined: 08 Jan 2005 16:08

Post by Nanaki13 »

WOW :)
That's all I'll say about this patch.

User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

how do you control between diagonal and square flatterning?
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]

User avatar
Jump
Traffic Manager
Traffic Manager
Posts: 147
Joined: 22 Sep 2004 21:10
Location: Belgium

Post by Jump »

bobingabout wrote:how do you control between diagonal and square flatterning?
ctrl :)

User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

sounds simple. i supose "Activate these options" means "Use this feature".
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]

Diadem
Engineer
Engineer
Posts: 70
Joined: 13 Jun 2005 14:19

Post by Diadem »

bobingabout wrote:sounds simple. i supose "Activate these options" means "Use this feature".
Eh, yes, it does. I changed it now in the first post :)

User avatar
Heinz Humpelstrumpf
Engineer
Engineer
Posts: 12
Joined: 19 Mar 2005 12:42
Location: Holland!

Post by Heinz Humpelstrumpf »

Very nice patch, but I had already made it :o

http://www.tt-forums.net/viewtopic.php?t=14264

That version of mine is not fixed for the newer releases as there was little interest in it an I have not so much time now.

Diadem
Engineer
Engineer
Posts: 70
Joined: 13 Jun 2005 14:19

Post by Diadem »

Hmm, two different patches that do the same thing.

Well, my patch is newer (so less conflicts), and seems to work flawlessly. Also, my patch works for the dynamite tool as well. So to be honest, I don't see any reason to choose your patch over mine.

But of course you're welcome to look into my patch and improve it, if you spot anything that you did better than me, coding-wise.

User avatar
magnato
Traffic Manager
Traffic Manager
Posts: 241
Joined: 08 Sep 2004 20:35
Location: Oslo
Contact:

this is a must have

Post by magnato »

wonderful!
Everything that makes construction easier is a must have!
How can we novices download it and put it into action?
Magnato, Oslo

Conditional Zenith
Chief Executive
Chief Executive
Posts: 697
Joined: 10 Jun 2003 00:19
Location: Australia

Post by Conditional Zenith »

You can wait until it makes it into the integrated/nightly builds, or you can check the code out of SVN, apply the patch, and compile it yourself. If you want to try the latter, check out http://wiki.openttd.org/index.php/SVN#Source_code

Note that the diff is against revision 2478. You can try to apply it to a later version and it might work (it depends on whether the code this patch is for has been worked on since).

Good luck.

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

In a different thread, SirkoZ wrote:Could someone update the 45° to the latest source,
Because I was getting tired of bughunting NFORenum:
Attachments
source.rar
(1.89 MiB) Downloaded 337 times
OTTD-r3011-Diagonal.zip
(1.09 MiB) Downloaded 359 times
diagonal_clearing_3011.patch
(18.6 KiB) Downloaded 447 times
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
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

great :D

I'll apply the patch asap 8)
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)

peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Hmm, any chance of a patch without a huge #define?

micomico
Engineer
Engineer
Posts: 18
Joined: 25 Apr 2007 01:19
Location: Portugal

Post by micomico »

Rediffed against trunk r9715.

I'm posting the patch this in this old topic, because another recent topic about this patch is now locked.
Attachments
diagonal-clearing-r9715.patch
(17.67 KiB) Downloaded 393 times

User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Post by NukeBuster »

micomico wrote:Rediffed against trunk r9715.

I'm posting the patch this in this old topic, because another recent topic about this patch is now locked.
I was hoping someone would rediff this one. Thanks A LOT!
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Reviving this patch is nice.
But will it EVER be fixed?
This huge macro is a big no-no...
Tip for the next patch (or the next patcher) : remove the macro and have a function instead.
Ho... and check comment/code style too...
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

micomico
Engineer
Engineer
Posts: 18
Joined: 25 Apr 2007 01:19
Location: Portugal

Post by micomico »

How does it look like now?

I think a function would complicate the code more in this case, but i've unfolded the macro and changed the code/comment style.
Attachments
diagonal-clearing-r9795.patch
(19.7 KiB) Downloaded 398 times

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: nihues and 5 guests