Page 1 of 12

Copy & Paste patch, reworked

Posted: 02 Jan 2009 22:00
by davidc
Here's a rework of the Copy & Paste (or "Build Templates") patch that Frostregen started a while back. Since making it work with trunk, a few bugs have been fixed. Thanks should go mostly to yorick who has done much of the coding.

I'll keep this post updated for as long as I am looking at it. Please post any bugs or requests in this thread, don't bother developers with them :)

The patch is currently known to work with r16050. You can get Windows builds which will be generated when there are enough changes to test. If you build from source you will still need copypaste.grf from the original thread.

Windows build last updated: 13th April 2009 (r16050)

The patch has currently not been tested with cargodest (perhaps in future, or try it yourself!).

You can track development progress on my site. You can checkout and build using Mercurial from the same address, this is advised if you want the latest build on Linux.

Important note: The format for saved templates is currently changing constantly, so templates saved with one build may not load in future builds until a stable patch is finished.

Re: Copy & Paste patch, reworked

Posted: 02 Jan 2009 22:01
by davidc
Features which need adding:
  • Compression for saved templates
  • Copying train stations (including newgrf tiles)
Features added:
  • Dynamic size for copy/paste area (can reduce memory usage)
  • Rotation of one-way roads
  • Versions for saved templates, to stop old builds loading new templates
  • Copying of bus stations
Known bugs:
  • Tram tracks on roads apparently aren't copied properly (reported by Roest)
  • Doesn't integrate fully with distant-joint stations
Fixed bugs:
  • Improve the command queue after this update
  • All types of signal can now be copied and pasted
  • No longer possible to bulldoze water and build on it before it floods
  • Error handling when loading templates needs improving
  • Bridge rotation fixed

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 12:36
by nulio
200+ views and no comments? :S

I haven't tried it yet because since reinstalling Leopard I haven't being able to compile stuff (I have to work on this).

I only tried copy & paste with 0.6.1 a few months ago.

When using it in a multiplayer game I noticed that if the paste was too big it was pasted with some problems. The terrain was badly "redone" making some bridges/tunnels being built wrongly and many signals would have wrong directions and/or types. The solution was to copy things in different parts having smaller pastes. Offline singleplayer had none of this problems.

Do you thing that "Features added: Dynamic size for copy/paste area (can reduce memory usage)" would resolve this?

Thanks

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 13:59
by davidc
Windows build and the patch itself updated to r14952. This includes distant-joint stations, but the patch doesn't yet make full use of them (e.g. to copy a spread out station). This will hopefully be worked on. Pasting rail stations doesn't work yet either, there are newgrf related things to think about (what happens if you only copy half of a station which has a roof spanning 2 tiles?).

Please report any problems here if you test it.

nulio: The reduced memory usage will not affect multiplayer pasting. Two things have been changed: less arrays are used to hold the data and the size is dynamic. Using less arrays helps with memory usage and makes saved templates smaller. Making the size dynamic may help with machines will less memory (e.g. you set the max copy paste area to be 16x16, not 256x256).

If you can show exactly what you mean by your problem then it may be possible to fix. However, pasting terrain will never work exactly the way everybody wants. Personally I don't like pasting terrain as invariably it makes a mess of things!

And please, only use on multiplayer servers that allow it :)

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 14:07
by Gremnon
I attempted to patch it in on my build.... the only patches I have, don't affect any files it does.
I got an error about CommandStruct in command_type.h being a redefenition, and after a few various attempts to solve that, I can't paste anything copied.

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 14:55
by davidc
Gremnon wrote:I attempted to patch it in on my build.... the only patches I have, don't affect any files it does.
I got an error about CommandStruct in command_type.h being a redefenition, and after a few various attempts to solve that, I can't paste anything copied.
Are you using the older patch? I have just pulled from the Mercurial trunk and patched using copypaste-r14952.diff. It compiles fine.

The older patch will definitely fail with trunk as the distant-joint stations patch introducted the CommandStruct (distant-joint and copypaste were both written by Frostregen). Pasting will fail because CMD_NO_WATER is no longer used (yorick fixed that). So it definitely sounds like you're using the older patch :)

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 15:11
by PhilSophus
davidc wrote:as the distant-joint stations patch introducted the CommandStruct (distant-joint and copypaste were both written by Frostregen)
It is CommandContainer in distant join and current trunk.

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 15:14
by Gremnon
Yeah, I forgot to get the new version... my bad... and yes, it was container, I misremembered it, sorry bout that

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 15:23
by davidc
Gremnon wrote:Yeah, I forgot to get the new version... my bad... and yes, it was container, I misremembered it, sorry bout that
Glad you got it working, any feedback would be great :D

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 15:25
by Gremnon
I'm getting there... I keep forgetting it's there actually, I'm used to not having it...
One question though, before I try it and possibly break something... I use the routemarkers patch too, does it copy the routemarkers?

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 15:58
by davidc
Gremnon wrote:I'm getting there... I keep forgetting it's there actually, I'm used to not having it...
One question though, before I try it and possibly break something... I use the routemarkers patch too, does it copy the routemarkers?
If it's not in trunk, it wont be copied. I haven't seen the routemarkers patch, so I don't know quite how it works. If it provides sensible interfaces (e.g. GetTileType and CMD_BUILD_XX) then it would be very easy to add.

Re: Copy & Paste patch, reworked

Posted: 10 Jan 2009 16:00
by Gremnon
Ah.... useful...
Right, back to playing my game... and possibly breaking it again if I patched it wrong.

Re: Copy & Paste patch, reworked

Posted: 26 Jan 2009 22:58
by nulio
davidc wrote:Features which need adding:
(...)
  • Copying train stations (including newgrf tiles)
(...)

Known bugs:
  • Doesn't integrate fully with distant-joint stations
(...)
I'm looking forward to see it! :D

Re: Copy & Paste patch, reworked

Posted: 04 Feb 2009 18:11
by Roest
update to current rev

Re: Copy & Paste patch, reworked

Posted: 16 Feb 2009 13:40
by deDied
hey there,

is it possible to make this work in the scenario editor? so i can copy industries?

Re: Copy & Paste patch, reworked

Posted: 20 Feb 2009 15:52
by wil86
hey, nice patch :D
i'd love to see this in trunk!!

Re: Copy & Paste patch, reworked

Posted: 20 Feb 2009 20:15
by toast
Hello Folks!

i'm using Mac OS X 10.5.6 - is there someone nice who can compile a running Openttd with copy and paste functionality for me?? I'm not sure how to patch the r14953 :? It would be great if there someone who could help me!!

Thanks!
toast

Re: Copy & Paste patch, reworked

Posted: 20 Feb 2009 21:03
by planetmaker
With MacOS it should be quite easy: Install xcode from your DVD, install svn and you can compile yourself. An extensive walk-through is found in the sticky thread in this forum.

Re: Copy & Paste patch, reworked

Posted: 21 Feb 2009 12:51
by SirkoZ
Would someone pretty please update this patch to 0.7.0 ß1? ;-)

Re: Copy & Paste patch, reworked

Posted: 21 Feb 2009 13:04
by Roest
That one still applies to current trunk (r15541), didn't test it tho.