[patch] Clipboard (a/k/a "Copy and Paste")
Moderator: OpenTTD Developers
Re: Clipboard (a/k/a "Copy and Paste")
Updated against 1.0.2
- Attachments
-
- clipboard_1.0.2.diff
- (252.55 KiB) Downloaded 396 times
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Re: Clipboard (a/k/a "Copy and Paste")
Currently? The sun.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Re: Clipboard (a/k/a "Copy and Paste")
It is probably spambot.belugas wrote:Currently? The sun.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
Re: Clipboard (a/k/a "Copy and Paste")
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
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
AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: Clipboard (a/k/a "Copy and Paste")
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.
don't worry, be happy and checkout my patches
Re: Clipboard (a/k/a "Copy and Paste")
I for one apreciate it
I love the function of copy and paste
I love the function of copy and paste
- kyosuke1989
- Transport Coordinator
- Posts: 273
- Joined: 24 Mar 2008 13:04
- Location: Finland
Re: Clipboard (a/k/a "Copy and Paste")
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.
Projects in progress: Finnish Trainset (DevZone)| Finnish Rail Infrastructure and Stations Set (DevZone)
Re: Clipboard (a/k/a "Copy and Paste")
New approach:
And that's the code: // EDIT
press Ctrl+C or Ctrl+V to show the clipboard toolbar
read more --> http://www.tt-forums.net/viewtopic.php?p=945067#p945067 <--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.
And that's the code: // EDIT
press Ctrl+C or Ctrl+V to show the clipboard toolbar
- Attachments
-
- copypaste.grf
- (4.63 KiB) Downloaded 250 times
don't worry, be happy and checkout my patches
Re: Clipboard (a/k/a "Copy and Paste")
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).
Re: Clipboard (a/k/a "Copy and Paste")
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:
Tile index bounded to a map.
Tile index bounded to the main map, it's named "TileIndex" like the original:
Exemplar map accessor:
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;
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; }
};
Code: Select all
typedef TileIndexT<Map> TileIndex;
Code: Select all
template <typename Tmap>
static inline bool IsPlainRailTile(TileIndexT<Tmap> t)
{
return IsTileType(t, MP_RAILWAY) && IsPlainRail(t);
}
don't worry, be happy and checkout my patches
Re: Clipboard (a/k/a "Copy and Paste")
The Clipboard 0.1 Beta 1 is ready!
What does not work (and won't work until v0.2 or later):
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
- Minimal terraforming
- Instant copy/pasting in multiplayer (requires patched server)
- Cannals support
- Attachments
-
- the_clipboard_0.1beta1_r22752.diff
- (261.46 KiB) Downloaded 178 times
don't worry, be happy and checkout my patches
- JacobD88
- Chief Executive
- Posts: 708
- Joined: 16 Aug 2008 17:51
- Location: Long Eaton, Nottinghamshire. UK
- Contact:
Re: Clipboard (a/k/a "Copy and Paste")
Fantastic work adf88, downloading nowadf88 wrote:The Clipboard 0.1 Beta 1 is ready!
High-Functioning Autistic & Proud... National Autistic Society * Asperger Foundation
My (O)TTD Work...BIGGER DEPOTS (REL.) & SERVICING-STATIONS (WIP) * Advanced DEPOT DESIGNS * SCREENSHOTS
My personal website is occasionally here - sometimes it's just the family site - it's basically a lucky dip
My (O)TTD Work...BIGGER DEPOTS (REL.) & SERVICING-STATIONS (WIP) * Advanced DEPOT DESIGNS * SCREENSHOTS
My personal website is occasionally here - sometimes it's just the family site - it's basically a lucky dip
Re: Clipboard (a/k/a "Copy and Paste")
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)
- 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)
- Attachments
-
- the_clipboard_0.1beta2_r22758.diff
- on MSVC build "generate" project first
- (321.86 KiB) Downloaded 243 times
don't worry, be happy and checkout my patches
Re: Clipboard (a/k/a "Copy and Paste")
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
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")
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")
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.
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")
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!
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!
- Attachments
-
- the_clipboard_0.1beta2_r22758_Windows.diff
- (323.12 KiB) Downloaded 155 times
-
- OpenTTD.zip
- r22758MClipboard
- (2.76 MiB) Downloaded 173 times
Last edited by dbncoold on 01 Nov 2011 17:16, edited 3 times in total.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Clipboard (a/k/a "Copy and Paste")
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.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Clipboard (a/k/a "Copy and Paste")
Hi planetmaker,
I have added COPYING to the zip file.
I have added COPYING to the zip file.
Re: Clipboard (a/k/a "Copy and Paste")
Unfortunately your zip is still missing a LOT of needed files; the executable alone is not a complete binary even if you include COPYING.dbncoold wrote: I have added COPYING to the zip file.
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
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Who is online
Users browsing this forum: No registered users and 38 guests