[patch] Polyline track building tool

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

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

[patch] Polyline track building tool

Post by adf88 »

***UPDATED***

The patch adds new rail building tool called "polyline". It allows to build rail lines more quickly and more precisely.
polyline_track_tool_v11b_ottd_r27726.zip
All-in-one patch against OpenTTD r27726.
(24.19 KiB) Downloaded 451 times
polyline_track_tool_v11b_ottd_r27726-mq.zip
[ALTERNATIVE] Patch queue.
(42.2 KiB) Downloaded 302 times
Usage:
  • To open polyline tool click or CTRL-click on the new button in the rail toolbar or use hotkeys (CTRL+A, CTRL+SHIFT+A)
  • Click on a tile to start placing a line.
  • Click once to build a line, click another time to build another line connected to previous one.
  • Double-click to build an ending line.
  • To lock direction of the line, press and hold left mouse button (drag-drop).
poly2.png
poly2.png (156.58 KiB) Viewed 28894 times
Detailed description on how the tool works:
  • Every time you build a track/tunnel/bridge/station (no matted which tool you use) it's end is remembered. While the "polyline" tool is opened a line is highlighted from the point that was remembered (the end of the previous track) toward cursor.
  • Pushing left mouse button down locks direction so you can change only length of the line. Releasing button builds highlighted line. After a line is built the tool keeps opened and you can build next line connected to the previous one by clicking another time.
  • White highlight is a track that will be placed if you click. Blue highlight is a guideline.
  • Moving backward is possible by using remove mode (hold CTRL), when you remove a piece of track next highlight will start from the end of the removed line.
  • Clicking on the polyline button opens the tool in non-snapping mode (new line) or closes the tool if it was already opened.
  • Ctrl-clicking on the polyline button opens the tool in snapping mode or switch between snapping and non-snapping modes if the tool was already opened.
  • Ctrl+A hotkey activates polyline tool in snapping mode or closes the tool if snapping mode was already active.
  • Ctrl+Shift+A hotkey activates polyline tool in non-snapping mode or closes the tool if non-snapping mode was already active.
Compatibility:
  • The patch can be used to play on unpatched servers.
  • Savegames made with patched OpenTTD can be opened with unpatched OpenTTD.
Extras:
Last edited by adf88 on 27 Apr 2017 06:12, edited 62 times in total.
:] don't worry, be happy and checkout my patches
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden »

Do you have image which can demonstrate what you mean by Polyline building?
Image
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 »

I would have to make a video...
In short: one click is one line (one straight rail track), fallowing line starts where the previous line ended. You don't have to drag-drop to build a track. Just click,click,click and you built 3 track connected each other.
Last edited by adf88 on 19 Oct 2011 13:57, edited 1 time in total.
:] don't worry, be happy and checkout my patches
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden »

Ah, so basically, you click once to indicate the start point, then the track drags with the mouse until you reach the end point and click again. Much like how Autorail dragging works now but without having to hold down the mouse button? (I assume meaning you could use the right mouse button to scroll across the screen?)
Image
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 »

:] don't worry, be happy and checkout my patches
xmirakulix
Engineer
Engineer
Posts: 36
Joined: 06 Jan 2010 18:06

Re: [patch] Polyline track building tool

Post by xmirakulix »

Just gave it a try, and I really like it.
It comes in handy, when you're building log tracks that don't consist of only straight tracks (e.g. when building across hills without terraforming)

One feature I'm missing though is, if one could "end" the sequence and start building a new polyline, maybe by right- or double-clicking the last piece of the "ending" line.
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3426
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: [patch] Polyline track building tool

Post by Emperor Jake »

This is very similar to a suggestion I made some time ago... Thank you, I must try it out :D
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 »

Patch updated.
Refined rules about direction and length choice. Better hotkey handling. No blinking tooltip bug.
xmirakulix wrote:One feature I'm missing though is, if one could "end" the sequence and start building a new polyline, maybe by right- or double-clicking the last piece of the "ending" line.
Right click is for map scrolling. Double-click is problematic to handle. Just hit 'A' button to enter regular mode, place the first line and hit CTRL+A to switch back to "polyline" mode and place fallowing lines (it is possible after recent update).
:] don't worry, be happy and checkout my patches
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [patch] Polyline track building tool

Post by FooBar »

adf88 wrote:Double-click is problematic to handle.
Maybe you can borrow something from other doubleclick functions elsewhere in the game.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: [patch] Polyline track building tool

Post by Eddi »

i don't remember any double click functionality elsewhere in the game.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: [patch] Polyline track building tool

Post by Yexo »

A few lists react to double-click, but not so much.
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [patch] Polyline track building tool

Post by FooBar »

Eddi wrote:i don't remember any double click functionality elsewhere in the game.
Here's a non-exhaustive overview:

- load game (doubleclick on savegame name)
- add newgrf to active list
- remove newgrf from active list
- purchase vehicle
- refit to

These are indeed all doubleclicks in list thingies and not somewhere on the map. I don't know if that complicates the matter further, but doubleclicks are certainly possible.
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Re: [patch] Polyline track building tool

Post by Korenn »

FooBar wrote: - purchase vehicle
- refit to

These are indeed all doubleclicks in list thingies and not somewhere on the map. I don't know if that complicates the matter further, but doubleclicks are certainly possible.
wait, those exist? stupid non-documented features... That saves a lot of time.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch] Polyline track building tool

Post by adf88 »

I didn't say that it is impossible or even hard to put a hook on double-clicks. Actually it's extremely easy. The game nicely detects double-clicks, all I have to do is to pass an extra value to HandleVieportClicked saying whether the click was single or double.

The problem is to define how the tool should behave. The idea of finishing a polyline discords with the idea of starting a polyline. We are not defining directly where a polyline starts, it's always connected with previously built track/bridge/tunnel. That's a feature, it allows to build a railway continuously e.g. we place a piece of track, then do some terraforming, then build a tunnel and place next piece of track and so on. So basically we are not defining the start point of a polyline at all, it's (almost) always defined. This is consistent with not defining the end of a polyline because an end point, if defined, means no start point for next polyline. In other words - there was no start points or end points, there were only middle points.

Anyway, I updated the patch so a double-click finishes current polyline and clears any start points. Maybe it's a better way...
I also refined the rule about track length.
:] don't worry, be happy and checkout my patches
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: [patch] Polyline track building tool

Post by HackaLittleBit »

Nice feature adf88.

I tried it and I like it very much.
The double click works smooth.
Maybe this feature should be standard behavior for
cr.png
cr.png (13.54 KiB) Viewed 33653 times
'auto rail mode'?
That would make the patch more simple (no extra graphics) and
nm.png
nm.png (34.45 KiB) Viewed 33653 times
'original rail construction' behaves like before.
My only doubt is that rail building becomes really easy (and fun :) ) now. Is that not cheating?
Maybe 10% extra cost?

Thanks
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden »

Why is it cheating or worthy of being more expensive. All you are doing is hastening the building of the railway by making fewer clicks, You are still performing all the actions yourself, you just dont have to do the silly click and drag of before.

If the rail was being designed for you with a pathfinder or something that would be different.
Image
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: [patch] Polyline track building tool

Post by HackaLittleBit »

Leanden wrote:Why is it cheating
Time == Money. :wink:
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden »

Pause the game and build while paused generates the same effect timewise. Also not a cheat.
Image
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: [patch] Polyline track building tool

Post by Eddi »

Leanden wrote:Also not a cheat.
it used to be.
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch] Polyline track building tool

Post by Leanden »

Eddi wrote:
Leanden wrote:Also not a cheat.
it used to be.
But the fact that it used to be and now isnt is surely an argument that being able to build quicker outside the active calender of the game isnt an issue if you dont want it to be.
Image
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests