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 » 23 Jun 2005 17:48

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 675 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 » 23 Jun 2005 17:53

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

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

Post by Diadem » 23 Jun 2005 18:01

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

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

Post by mkxx » 23 Jun 2005 18:19

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 » 23 Jun 2005 19:12

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 » 23 Jun 2005 21:21

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 » 23 Jun 2005 21:48

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 » 23 Jun 2005 21:57

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 » 24 Jun 2005 09:47

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 » 06 Jul 2005 15:50

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 » 06 Jul 2005 17:01

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 » 19 Jul 2005 22:18

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 » 21 Jul 2005 02:17

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 » 04 Oct 2005 03:58

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 320 times
OTTD-r3011-Diagonal.zip
(1.09 MiB) Downloaded 342 times
diagonal_clearing_3011.patch
(18.6 KiB) Downloaded 424 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 » 04 Oct 2005 08:48

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 » 04 Oct 2005 08:57

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 » 25 Apr 2007 01:41

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 363 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 » 25 Apr 2007 11:52

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 » 05 May 2007 19:18

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 » 06 May 2007 15:48

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 364 times

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests