[patch] Clipboard (a/k/a "Copy and Paste")

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

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

[patch] Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 13 Oct 2009 21:44

I'm rewriting the "Copy & Paste patch, reworked" patch introduced by davidc, which is rework of the "Build Templates (Copy&Paste)" patch introduced by Frostregen. Original threads:
[list]Build Templates (Copy&Paste)
Copy & Paste patch, reworked[/list]

DESCRIPTION:
Allows to copy part of map into in-game clipboard and paste it later at a given location. Latest version is 1.1.0

INSTALLATION (Clipboard 1.1.0 binaries for OpenTTD r26400):
  • Download and unpack OpenTTD nightly.
  • Download the ZIP package:
    the_clipboard_1.1.0-ottd_r26400-win32.7z
    Win32 binaries (XP SP3 or higher) for OpenTTD r26400.
    (5.89 MiB) Downloaded 1976 times
  • Extract contents of the package to the root folder of your OpenTTD (replacing some existing files).
  • Run openttd.exe.
USAGE:
  • Everything is available from a toolbar. You can open it by clicking "Clipboard" button on the landscaping toolbar.
  • There are also shortcuts - hit [Ctrl]+[C] / [Ctrl]+[V] to copy/paste.
  • Read tooltips to learn buttons
  • There is also a shortcut to adjust heights while pasting - rotate your mouse wheel while holding [Ctrl] key.
  • Construction->Clipboard capacity setting may be used to restrict clipboard capacity (e.g. in MP games).
COMPATIBILITY:
  • savegame compatibility: full¹
  • network compatibility: no²

¹ Clipboard content is not stored in a savegame.
² You can safely play MP on a patched server. While there should be no desyncs with a non-patched server, I do not guarantee anything. Command system has been slightly modified, especially command errors may slightly differ ("already built" is returned more often instead of "something in the way").


EXTRAS: SOURCE CODE (Clipboard 1.1.0 for OpenTTD r26400 / hg 96539891bc1b):
the_clipboard_1.1.0-ottd_r26400-svn.zip
Single unidiff. Apply with 'patch -p0' or some SVN utitlity. Put GRF file into './bin/baseset' or other suitable folder.
(126.81 KiB) Downloaded 439 times
the_clipboard_1.1.0-ottd_r26400-mq.zip
Mercurial patch queue. Extract into hg-cloned working copy and apply with 'hg push -a'.
(161.91 KiB) Downloaded 194 times
Older versions: https://www.dropbox.com/sh/cwlrdqux4vqbv9x/yvVcQ2345o

ILLUSTRATED EXAMPLE:
Image
Image
Image
Last edited by adf88 on 16 Mar 2014 09:10, edited 64 times in total.
:] don't worry, be happy and checkout my patches

petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Clipboard (a/k/a "Copy and Paste")

Post by petert » 13 Oct 2009 23:38

Can I compile windows builds for the site?

User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by CommanderZ » 14 Oct 2009 07:32

high quality, complete, bug-free code (basic condition of trunk inclusion)
Too bad devs repeatedly said they don't like the idea of clipboard in OTTD (I'm a big fan of it though).

Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Clipboard (a/k/a "Copy and Paste")

Post by Rubidium » 14 Oct 2009 08:24

CommanderZ wrote:Too bad devs repeatedly said ...
Too bad users do overgeneralise and remove/ignore all nuances the developers have added to their reasoning. I've explained these nuances plenty of times, so if you're really interested... see here.

petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Clipboard (a/k/a "Copy and Paste")

Post by petert » 14 Oct 2009 10:37

adf88 wrote: - high quality, complete, bug-free code (basic condition of trunk inclusion)
He never said he wanted it IN trunk. Just to keep it up to trunk and such.

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Clipboard (a/k/a "Copy and Paste")

Post by Bilbo » 14 Oct 2009 11:35

Rubidium wrote:Too bad users do overgeneralise and remove/ignore all nuances the developers have added to their reasoning.
Well, the point is, some of the developers thinks this feature (copy & paste) will give players "unfair advantage" (though if all players will have this feature, this certainly won't be unfair) or make the game dull and boring (if you just copy stuff, you won't be creative, but for small repetitive things, like service station, that are to be placed along the tracks every X tiles, this feature removes need for tediously construction every service station manually) and so they don't want it in trunk no matter the code quality.

But maybe the part of copy&paste for scenario editor perhaps could get to trunk (if well written..) though it will be devs who will have last word on this.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)

Neddy
Engineer
Engineer
Posts: 1
Joined: 15 Oct 2009 09:40

Re: Clipboard (a/k/a "Copy and Paste")

Post by Neddy » 15 Oct 2009 09:47

Do you think you would be able to make a separate utility that converts losslessly compressed image files (for example, http://transporttycoon.net/images/4way_spaghetti.gif) into copy-and-paste template files? I understand it would be hard to make but it would be a quite useful addition.

I was thinking of trying to make it myself but really it is way out of my league.

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

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 16 Oct 2009 09:16

Neddy wrote:Do you think you would be able to make a separate utility that converts losslessly compressed image files (for example, http://transporttycoon.net/images/4way_spaghetti.gif) into copy-and-paste template files? I understand it would be hard to make but it would be a quite useful addition.
It's too expansive to be worth of case.

BTW
I'm not saying that copy&paste will be include into trunk for sure. I just want to make the patch closer to eventual inclusion.

//EDIT
I decided to make most NewGRF support in the first stage.
:] don't worry, be happy and checkout my patches

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 674
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by JacobD88 » 16 Oct 2009 16:47

adf88 wrote: ...
BTW
I'm not saying that copy&paste will be include into trunk for sure. I just want to make the patch closer to eventual inclusion.
....
From all the reasons for it not being included (unfair, etc) i have read on the forums would it be considered for trunk if it were possible to make it only applicable to Single Player?

That way it shouldn't interfere with MP advantages, on the other hand would it be worth creating an MP option to differentiate between patch enabled games and non-patch enabled games (basically the host sets whether the patch is used or not)

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Clipboard (a/k/a "Copy and Paste")

Post by Zuu » 16 Oct 2009 16:56

If the paste action becomes a DoCommand then it shouldn't be to trival to hack a client around the protection mechanism if the server is configured to disallow paste. But nothing will be totally safe since as far as I understand todays c/p patches can be applied just on the client and then you can join a MP-server and use the c/p function there, with the risk of getting desyncs though.

Though, making the paste-action a single DoCommand might make it hard to make the paste action take some time.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1502
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Clipboard (a/k/a "Copy and Paste")

Post by SirkoZ » 16 Oct 2009 19:26

Again - so what if it's possible in multi-player (MP) - it's a really great tool for building big. And if we start moaning about the situation being either unfair or dull playing with it in MP or otherwise (SP) - well then let's just go all the way - OpenTTD can be both unfair and dull. OK nay-sayers?

(Of course I really like OpenTTD - why I consider it to be the best game of all times because it can easily replace a large room full of expensive railway models - in fact all Tycoons with loose or otherwise connection to Chris Sawyer.)
nod.gif
:nod:
nod.gif (1.46 KiB) Viewed 30809 times

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

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 17 Oct 2009 10:29

JacobD88 wrote:...on the other hand would it be worth creating an MP option to differentiate between patch enabled games and non-patch enabled...
If the C&P would be included, of course there would be an option to enable it or disable, so admins of OTTD servers could decide. Also there can be limit to pasting intensity. These options will exists even without trunk inclusion.
Zuu wrote:If the paste action becomes a DoCommand then it shouldn't be to trival to hack a client around the protection mechanism if the server is configured to disallow paste...
As Zuu said, someone can write the patch to hack this option as long as C&P is based on DoCommand chain. But this is already possible, you can use C&P in servers where this patch is unwelcome (there is not many of them, I always ask on the server forum about C&P before using it). So trunk inclusion has no negative impact on this issue. Even otherwise - it eliminates this problem!!! If the C&P would be included, there would be server side support and C&P would no longer use DoCommand chain. Old mechanism would be discontinued, thus not available as a patch.
I don't think that any programmer with enough skill to continue patch in old form (DoCommand chain) has interest in cheating in MP games. Besides, how many patches do you know that are made for cheating? They surely won't appear in this forum or flyspray.

Maybe I'll implement server side support when the patch is completed, but these are far away plans.
:] don't worry, be happy and checkout my patches

User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Clipboard (a/k/a "Copy and Paste")

Post by DJ Nekkid » 17 Oct 2009 16:19

adf88 wrote: Current code: will be soon (I'll create project page at Google Code)
Why not use the openttdcoop.devzone ? :) There are a few ok coders there as well :)
Member of the
ImageImage

User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Clipboard (a/k/a "Copy and Paste")

Post by Bilbo » 17 Oct 2009 19:28

adf88 wrote:chain. Old mechanism would be discontinued, thus not available as a patch.
If it won't be possible to use C&P in multiplayer, I think someone will dig out the old C&P - which is buggy and messy, but it works in MP - and poke in the patch till he gets something that works.
adf88 wrote:I don't think that any programmer with enough skill to continue patch in old form (DoCommand chain) has interest in cheating in MP games. Besides, how many patches do you know that are made for cheating? They surely won't appear in this forum or flyspray.
Technically, you can't cheat in OpenTTD. The way the game works (you send command to server, the server reject any commands you can't do) forbid any form of cheating (you can't make the server do thing you are not allowed to do and since in game you have all information about the game available to examine (every information about everything is public), you can't have advantage of type "seeing thing that others can't see", like wallhacks in FPS games, where allowing you to see through wall will probably give you quite an advantage).

Few times in past I think someone have found some exploits in the server that can give some advantage, but these get usually fixed pretty soon.

Though by patches you can modify the game to give you advantage in two ways:
  • Allowing you to see things in more legible/nicer way - those would be patches that enhance the GUI, like zoomable minimap, GUI to watch opponents, my console commands patch, colored town ratings, tracking viewport, ...
  • Allowing you to do same things more quickly - these would be copy & paste patch, my console commands patch, query land shortcut patch, ...
None of these patches will enable you to do something you won't be able to do without them. You just can make these things faster.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)

audigex
Tycoon
Tycoon
Posts: 1919
Joined: 09 Dec 2007 21:28
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by audigex » 18 Oct 2009 04:24

This patch is superb from a health+safety style aspect.

Less clicks = better, as far as I'm concerned.

Maybe have the option to disable it in multiplayer - but it takes some of the hassle out of building.
Jon

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

Re: Clipboard (a/k/a "Copy and Paste")

Post by adf88 » 18 Oct 2009 11:56

Bilbo wrote:
adf88 wrote:chain. Old mechanism would be discontinued, thus not available as a patch.
If it won't be possible to use C&P in multiplayer, I think someone will dig out the old C&P - which is buggy and messy, but it works in MP - and poke in the patch till he gets something that works.
Risk is small. And it'll become smaller and smaller with every OTTD version. Even if someone do this, his/her work won't be widely available. Trunk inclusion almost fully eliminates the problem (which is using C&P in MP servers where is not allowed).
Also have on mind that if you don't like the rules on one server you just go to another. This hypothetical person must want to play with C&P in MP and do this on a certain server where C&P is forbidden, other servers are not enough for him/her. Also he/she must have enough programming skills. Programmers usually are not interested in cheating (yes, that would be a cheating - braking server rules).

Now the risk is almost 100% (you can use C&P without any restrictions). After trunk inclusion it'll become almost 0%.
:] don't worry, be happy and checkout my patches

User avatar
nulio
Traffic Manager
Traffic Manager
Posts: 157
Joined: 23 Aug 2007 21:20
Location: Portugal

Re: Clipboard (a/k/a "Copy and Paste")

Post by nulio » 19 Oct 2009 12:47

Hi! I just wanted to give you a great thanks for picking this "project" ;)

I really love this game but due to a lack of time to play it in the way I enjoy the most, copy and paste is one of the two patches I expect more (along with cargodist).


Later on (after I finish to do some thinks in my computer) I can compile stuff for mac if you want.

Dante123
Chief Executive
Chief Executive
Posts: 670
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by Dante123 » 26 Oct 2009 16:07

oooh man, cant w8 till its in trunk, than my dream can become true: huge map with huge train network with daylength and copy-paste patch :)

thanx for trying to rewrite it :bow:

petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Clipboard (a/k/a "Copy and Paste")

Post by petert » 26 Oct 2009 19:40

It won't ever be in trunk, but if it's updated to trunk, then you could merge trunk and daylength easily. Don't worry, it will come soon.

KingNimby
Engineer
Engineer
Posts: 18
Joined: 01 Apr 2004 13:53
Contact:

Re: Clipboard (a/k/a "Copy and Paste")

Post by KingNimby » 27 Oct 2009 16:21

I'm very happy that this patch has been resurrected and appreciate the time and effort that you are spending on this adf88. I also wanted to say that the patch's eligibility for trunk inclusion is a complex affair and is not simply black and white. The final few pages of the last thread contained a lot of discussion on that topic, which can be roughly summarised as follows:
  • As a whole, the devs are against including the "complete" copy+paste in trunk on gameplay grounds.
  • The poor coding style of the old patch was a much bigger hinderance to trunk inclusion than any gameplay objection.
  • Until the code was brought up to a good standard any discussion about inclusion was informal since the coding style was already too big a hurdle and that no formal discussion would take place until the patch was ready in every other way.
  • The part of the patch that the devs found hardest to justify was the template saving/loading system since it allowed users to directly copy the work of others. Without it, you would only be able to copy+paste your own creations. The patch would definitely have a higher chance of trunk inclusion were it possible to separate out or otherwise exclude the template saving/loading facility and present only the "bare bones" copy+paste for inclusion, with those desiring the complete version needing to patch it in themselves.
  • Making it into a cheat function, like build-while-paused, is something that could potentially increase the chance of trunk inclusion.
As you can see, it was not a flat-out no. Anybody interested in the opinions of the devs on this patch should definitely read page 7/8 of the last thread. There was a lot of confusion about it, including my own.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests