Patch: faster cloning

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

Antdovu
Engineer
Engineer
Posts: 19
Joined: 28 May 2008 19:54

Patch: faster cloning

Post by Antdovu »

This patch lets you build N clones (trains, ships, road vehicles, etc.) at once. This behaviour is triggered by double-clicking on the "clone vehicle" button in a depot. Otherwise you shouldn't notice any difference as a single click will still yield the old behaviour.

Any further criticism/suggestions are welcome.

Image
clone_v5.patch
(12.66 KiB) Downloaded 188 times
fast_clone_v4.zip
windows binary
(2.73 MiB) Downloaded 196 times
Attachments
clone_v1.png
clone_v1.png (186.15 KiB) Viewed 2151 times
Last edited by Antdovu on 12 Nov 2008 11:14, edited 5 times in total.
INP
Engineer
Engineer
Posts: 12
Joined: 25 Apr 2008 17:51

Re: Patch: faster cloning

Post by INP »

Nice. Now you need to add the option to start them at once. :)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: faster cloning

Post by Yexo »

INP wrote:Nice. Now you need to add the option to start them at once. :)
That option already exists, try the little green flag in the depot window.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: faster cloning

Post by CommanderZ »

Nice idea. It should not be the primary mean of cloning vehicles though, I would be great if just pressing the clone button made one clone (the current behavior) and pressing the clone button along with shift would open your dialog. It should be compatible with ctrl too to make shared orders.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: faster cloning

Post by Yexo »

Shift is already in use for getting the cost of an action without actually executing that action. I do like this suggestion, but as CommanderZ says not as a replacement for the current way of cloning vehicles, becuase cloing a vehicle 5 times requires just 5 clicks, while with this patch it'll require
1) click on clone button
2) type new number,
3) click ok.
I'm not to sure if this new system is any faster for 10 or less vehicles.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: faster cloning

Post by CommanderZ »

Hmm, I alt is free?
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Patch: faster cloning

Post by PhilSophus »

To be honest, I don't see a real need for this. As Yexo wrote: A vehicle stopped in a depot can already be cloned with a single click on the appropriate button in the vehicle view window. And whether you click once, five times or even ten times is not that much of a difference.

And how many vehicles do you want to send out at once? I've never had the need for more than 10 (and even that only with additional patch support so that the vehicles don't cluster).

CommanderZ wrote:Hmm, I alt is free?
This interferes with bindings from desktop environments (e.g. my KDE uses <ALT>-click for moving windows around).
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Antdovu
Engineer
Engineer
Posts: 19
Joined: 28 May 2008 19:54

Re: Patch: faster cloning

Post by Antdovu »

The behaviour:
Shift+click: just estimate the cost of making N clones
Ctrl+click: makes N clones with shared orders
Click: makes N unrelated clones

Why is this useful?
* Easy to make an exact number of copies
* The single click method requires the vehicle to be in the same depot in which you want to build more of them.
* It isn't hard to imagine a situation when you might want to have more than 10 road vehicles on a single route.
* There people who want 20+ trains serving the same route.
* Somewhat simplifies converting from one incompatible railway type to another.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: faster cloning

Post by CommanderZ »

The problem is, that you usually make one, two or so clones - and for that is your method uncomfortable. It must be only an option.
User avatar
B-b0y
Engineer
Engineer
Posts: 44
Joined: 01 Nov 2008 16:29
Location: Netherlands

Re: Patch: faster cloning

Post by B-b0y »

Rather then having to put in a value, you should just make 5 clones rather than one. That will probably be enough. and 5 clicks would already make 25 clones that way.
It takes an athlete to dance, but an artist to be a dancer. - Anonymous
audigex
Tycoon
Tycoon
Posts: 2056
Joined: 09 Dec 2007 21:28
Contact:

Re: Patch: faster cloning

Post by audigex »

Would it be possible to have it where you can hold a number 1-9 and click clone and it makes that many clones?
Jon
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Patch: faster cloning

Post by PhilSophus »

I think there is a double-click event in OpenTTD (which I would expect to happen additionally to the click event, but I'm not totally sure). So, that's what I propose:
  • Have an advanced setting to set N
  • (Ctrl-)Click copies/clones one vehicle
  • (Ctrl-)Doubleclick copies/clones N vehicles (so probably another N-1 vehicles)
However, I'm not sure how fast double-clicking is and whether this could be falsely triggered when trying to clone 2 or 3 vehicles. So, maybe N should be settable to 1 or 0 to disable the feature completely. That is, if it is aimed to go into trunk, of course. As long as it's just a patch, I just don't need to apply it.

@Antdovu: Don't get me wrong, I don't want to put your effort down. Any help with the code is appreciated. It's just that I for one don't feel the need for this feature and I completely agree with CommanderZ that it shouldn't interfere (i.e. increase the number of necessary actions) with traditional copying/cloning in any way.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Teeg
Engineer
Engineer
Posts: 55
Joined: 31 Jul 2007 23:57

Re: Patch: faster cloning

Post by Teeg »

Forgive my curiosity, but when did "I don't think I'll be using this totally optional feature in my game" start meaning "this feature is useless and you're wasting my time"?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: faster cloning

Post by Yexo »

Teeg wrote:Forgive my curiosity, but when did "I don't think I'll be using this totally optional feature in my game" start meaning "this feature is useless and you're wasting my time"?
Who said so? Personally I don't think I'll be using this feature and the only thing I want is that the current behaviour (cloning in a single click) remains possible. If that is done by creating a patch option that enables the new gui that is fine by me, as I'll just disable that patch and use the current behavior.

Basically I'm ok with it as long as it remains totally optional.
Starbud
Traffic Manager
Traffic Manager
Posts: 211
Joined: 05 Mar 2007 00:48
Location: Sweden
Contact:

Re: Patch: faster cloning

Post by Starbud »

I for one like this idea, i often have the tideous work of cloning 200 trains for something.

To move A LOT of goods i simply make a grid that allow the trains to select what is ahead of them, like a station or a transmissionmanline in the network, that way i can load 10 tracks on a station at once and all trains can access all tracks.
A small thing i built that very few people seem to use as far as i have seen.
But it make use of huge ammounts of trains.

I guess i like making systems :)
http://openttd.org - i love building stuff :)
Someones play with pics http://dimalimsliv.blogg.se
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Patch: faster cloning

Post by PhilSophus »

Teeg wrote:Forgive my curiosity, but when did "I don't think I'll be using this totally optional feature in my game" start meaning "this feature is useless and you're wasting my time"?
Why do you think it started meaning that? At least, I don't see a post that gives that impression and unfortunately, you forgot to mention which post(s) you were referring to.

If that was aimed at my post (which was the last before), I suggest you reread it as it could be subsumed by "I don't think I'll be using this feature and if this should go to trunk it should become totally optional" And I made some suggestions how to make it totally optional (which it isn't in the current implementation).
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: Patch: faster cloning

Post by dihedral »

double click for this feature is silly too, if you want to quickly clone 2 vehicles, what do you do? - click the button twice! and then that dialog appears just to enter a "2"? not very handy
Antdovu
Engineer
Engineer
Posts: 19
Joined: 28 May 2008 19:54

Re: Patch: faster cloning

Post by Antdovu »

dihedral wrote:double click for this feature is silly too, if you want to quickly clone 2 vehicles, what do you do? - click the button twice! and then that dialog appears just to enter a "2"? not very handy
circles.png
circles.png (102.93 KiB) Viewed 5624 times
Some of you seem to be misunderstanding what exactly I changed. There are two clone buttons with different behaviours.
  1. Red circle: available on a vehicle, only as long as it is in a depot. This allows you to clone with one click. I changed nothing here.
  2. Green ellipse: available in depots. You have to click "clone vehicle" and then select the vehicle to clone. It currently takes 2 clicks per vehicle. I changed it to keep working the way it does if you single-click it and give you a prompt if you double-click it. If you attempted to double click it in 0.6.3 (for example) then you would just rapidly activate & deactivate the "clone vehicle" button. Nothing interesting would happen that way.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: faster cloning

Post by Roujin »

Ah, this is something else of course.

However, double clicking a button is not really intuitive. What about a drop down button like it is used in the new order gui?
* @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
PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Patch: faster cloning

Post by PhilSophus »

Antdovu wrote: Some of you seem to be misunderstanding what exactly I changed.
Count me to one of those :wink:
Antdovu wrote:
  1. Red circle: available on a vehicle, only as long as it is in a depot. This allows you to clone with one click. I changed nothing here.
Then everything is fine.
Antdovu wrote:
  • Green ellipse: available in depots. You have to click "clone vehicle" and then select the vehicle to clone. It currently takes 2 clicks per vehicle. I changed it to keep working the way it does if you single-click it and give you a prompt if you double-click it. If you attempted to double click it in 0.6.3 (for example) then you would just rapidly activate & deactivate the "clone vehicle" button. Nothing interesting would happen that way.
[/list]
So, I think you managed to suit everybody now. Good work.
Roujin wrote: However, double clicking a button is not really intuitive. What about a drop down button like it is used in the new order gui?
Normally, I'd say it is quite intuitive, but you're right in that OpenTTD does use double click only rarely (or not at all?). However, I think it will be fine if the tooltip mentions it. I think a drop-down is overkill for only two options.


BTW, given that we had a misunderstanding here: I think <CTRL> is only used when clicking on the vehicle you want to clone not on the clone button in depot, is it? So despite what was stated earlier, <CTRL> could be used.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests