Page 5 of 14

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

Posted: 25 Jul 2010 07:36
by Anon
Updated against 1.0.2

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

Posted: 15 Nov 2010 17:06
by belugas
Currently? The sun.

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

Posted: 15 Nov 2010 17:15
by Kogut
belugas wrote:Currently? The sun.
It is probably spambot.

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

Posted: 15 Nov 2010 17:47
by Lord Aro
Made me lol.

Basically, people got all huffy that the developers wouldn't include it, even though it obviously wasn't finished. Then development and support sort of dried up

The thread with the latest version has v3 in its name, i think
Or you could try chillcore's patchpack

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

Posted: 20 Feb 2011 07:12
by adf88
Hi all! I'm getting back to work on the patch. I don't promise anything but there should be beta in next few months if I find enough time.

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

Posted: 20 Feb 2011 19:46
by Starbud
I for one apreciate it :)
I love the function of copy and paste :)

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

Posted: 02 Mar 2011 09:49
by kyosuke1989
Thank you, adf88, for developing this feature. I'm happy to see it is developing in good hands. I have always found it useful in it's earlier forms. When i was creating larger networks, there was building of several hours without this feature, and that was annoying, because time for OTTD is limited (at least on my side). It is much more creative to spend time to handle traffic and plan for extensions etc, etc. on OTTD than spend time to repeat everything (for example, the station areas) when building new branch lines. This feature cuts network building times to maybe 1/10th of which it is without it, and still does not make the game too dumb copy-pasting, because you always have other things than manual building to do. That's why it is one of my favorite requested features. :)

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

Posted: 11 May 2011 20:12
by adf88
New approach:
adf88 wrote:I took a new approach. Many problems you noticed will be resolved. Old approach builds a new logic on top of the OTTD. Now I'm trying to integrate as much as possible. I also resigned with compatibility with unpatched servers. Server maintainers should decide whether to allow to copy-pasting.

Firstly I generalized map accessors to work not only with the main map, but with other maps too - with contents of the the clipboard in this case. Basically I templatized the TileIndex to differentiate which map to operate on...

...Secondly I'm writing new command handlers. Similarly to TerraformTile_XXX functions I created a set of CopyPasteTile_XXX functions to operate on tiles. These handlers integrate with other handlers API. I'm also "upgrading" some existing handlers. Copy-pasting is a single command. In a network game it is possible to copy-paste instantly one piece of map into other location. In single play we can also copy to clipboard or paste from it.
read more --> http://www.tt-forums.net/viewtopic.php?p=945067#p945067 <--

And that's the code:
TheClipboard_0.1alpha-r22441.diff
(416.04 KiB) Downloaded 320 times
// EDIT
press Ctrl+C or Ctrl+V to show the clipboard toolbar

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

Posted: 12 May 2011 17:37
by ndh

Code: Select all

-typedef uint32 TileIndex;    ///< The ID of a tile (just named differently).
+typedef uint32 RawTileIndex; ///< The ID of a tile (just named differently).
Why? It makes the patch kinda unreadable. Refactorings and features don't go well together in diffs. I suggest you undo that.

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

Posted: 12 May 2011 19:33
by adf88
That's not just a new name. RawTileIndex is a new type with new meaning. Basically tile index handling changed. TileIndex is a class now. The code you quoted comes from the AI API. It have to be RawTileIndex there instead of TileIndex because Squirrel doesn't handle custom types, just those built-in.

The goal was to generalize map accessors to work not only with the main tile map, but also with other maps. Originally map accessors take just a tile index - a 32 bit integer pointing to a certain tile. In the patch I had also to point which map to operate on. I had two choices - pass map pointer on run time (as an additional argument) or bind to a certain map on compile time using templates. I decided to use templates. This solution requires less modifications and is more flexible. I don't have to change bodies of functions but just define tile index differently in their declarations. A lot of functions stayed unchanged or almost unchanged. It's also safer - it's hard to point a wrong map.

So now we have...

Tile index not bounded to any map:

Code: Select all

typedef uint32 RawTileIndex; 
Tile index bounded to a map.

Code: Select all

template <typename Tmap>
struct TileIndexT {
public:
    static TileIndexT<Tmap> INVALID;

    RawTileIndex index;

public:
    FORCEINLINE TileIndexT() { }
    FORCEINLINE TileIndexT(const TileIndexT<Tmap> &tile) : index(tile.index) { }
    FORCEINLINE TileIndexT(RawTileIndex index) : index(index) { }

private:
    template <typename Tother_map>
    TileIndexT(const TileIndexT<Tother_map> &tile) { NOT_REACHED(); }

public:
    FORCEINLINE operator const RawTileIndex& () const { return this->index; }
    FORCEINLINE operator RawTileIndex& () { return this->index; }
}; 
Tile index bounded to the main map, it's named "TileIndex" like the original:

Code: Select all

typedef TileIndexT<Map> TileIndex; 
Exemplar map accessor:

Code: Select all

template <typename Tmap>
static inline bool IsPlainRailTile(TileIndexT<Tmap> t)
{
    return IsTileType(t, MP_RAILWAY) && IsPlainRail(t);
} 

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

Posted: 15 Aug 2011 13:33
by adf88
The Clipboard 0.1 Beta 1 is ready!

What does not work (and won't work until v0.2 or later):
  • - Condition: non-allow-partial-paste mode (when you depress the button with a broken wall image), terraforming is on (either full or minimal)
    - Expected result: Whole template is successfully pasted.
    - Possible result: Nothing is pasted, you get an error message that says the paste operation is impossible because of improperly terraformed land. These errors are "site unsuitable", "land slope in wrong direction", "flat land required" etc.
  • - Condition: non-allow-partial-paste mode
    - Expected result: Nothing is pasted (because the land cannot be terraformed or because of local authorities or you don't have enough money etc.)
    - Possible result: The template is pasted partially.
  • copy/pasting stations (and waypoints)
  • precise cost estimation
Some features you've never met:
  • Minimal terraforming
  • Instant copy/pasting in multiplayer (requires patched server)
  • Cannals support

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

Posted: 15 Aug 2011 22:02
by JacobD88
adf88 wrote:The Clipboard 0.1 Beta 1 is ready!
Fantastic work adf88, downloading now :bow:

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

Posted: 19 Aug 2011 08:38
by adf88
Beta 2.
- fixed compilation errors in "release" configuration
- fixed pasting on water (DC_NO_WATER flag was omitted)
- fixed road depot pasting (we had a piece of road instead of a depot)

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

Posted: 08 Oct 2011 00:18
by Starbud
A friend of mine made a playable version for windows (i tried myself but it seems i have things to learn because i was unsuccessful).
He mentioned that the function "EmptyClipboard" was duplicated on windows version since there already are such a function in some windows related thingie, he also said the programmer most likely didnt use windows.

Then we couldnt find the proper grf that was asked for during compilation i think so we used some old copypaste.grf from frostregens version we found somewhere.
I'll update this post when i have talked with my friend again.

It works really nice when it works but we have noticed during play that it crash under some circumstances.
Like sometimes when pasting with minimal terraforming or a part of the layout ending up under the waterlevel, or pasting directly on water even tho the original is taken from waterlevel, like an island with something on it.

Here is the compiled game om my webserver, tho the ip might change making this link unuseful, i hope it wont happen anytime soon tho.
http://85.229.12.253/intermundi/ottdcp.zip

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

Posted: 30 Oct 2011 12:09
by lordwurst
could someone just tell me what to do to use this patch?? read some stuff in the net but I don't really get it... so pleas try to explain it for a total noob

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

Posted: 30 Oct 2011 16:36
by Starbud
The general idea is that one take the pach and apply it to the sourcecode of the official version of openttd, this patch was supposed to be used with one particular nigtly build i think, not a release like 1.1.3 for example.

Then when you get it to work youre supposed have new tools so you can copy and paste tracks instead of building them by hand.
When i use it i save A LOT of time building big and efficient networks, i find this particular patch very useful and i apreciate the work that has been put down to code it :)

At the moment that link is down so noone can download it due to a crashed 30GB harddrive named Hitatchi deskstar.

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

Posted: 01 Nov 2011 16:40
by dbncoold
Great job, adf88!

This needs to get into trunk ASAP. This feature has been a "patch" for a very long time, and I would argue that it should be the #1 priority for a new feature. It makes OpenTTD so much more fun, and lets you build complicated stuff within minutes that will normally take hours.

Anyways, here it is diff-ed and compiled for Windows. Enjoy!

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

Posted: 01 Nov 2011 16:44
by planetmaker
Please include the necessary license and copyright information or we'll have to remove the build. Best build a complete bundle as that includes all required files, including the version-specific language files and base set complements as well.

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

Posted: 01 Nov 2011 17:14
by dbncoold
Hi planetmaker,

I have added COPYING to the zip file.

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

Posted: 01 Nov 2011 21:14
by ChillCore
dbncoold wrote: I have added COPYING to the zip file.
Unfortunately your zip is still missing a LOT of needed files; the executable alone is not a complete binary even if you include COPYING.

Instead of listing everything that is missing ... just use the "make bundle" command after compilation, a bundle folder will be created next to the bin folder with all files that need to be included in your zip.

Also, please do not name the zip OpenTTD to not confuse people and take it for an official (read: not modified) release but instead rename it to something more usefull; using the same name as the diff might be a good idea? ;)


ps:
@The four other downloaders:
Why do you not speak up if you downloaded a binary that is:
a. Not complete :? and
b. Not functional :roll: