[Patch] Copy/paste templates (storable on disk) r3 for 27153

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
MJP
Engineer
Engineer
Posts: 116
Joined: 12 Mar 2011 19:01

[Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by MJP »

Hi!

Here is another clipboard patch. It is greatly inspired of adf88's Clipboard
(and I took some graphics from its grf). I tried it but I didn't like a few
things so I made my own. Simple as that. Main goals were the diagonal
selection and a low diff footprint.

3 files in the package : the first diff is the clipboard. The second diff is
an extension to the game/scenario/heightmap save/load dialog to support
templates (use the main toolbar, right of the landscape button). Templates are
stored in separate files, the savegame is not affected. The third file is a
.grf containing mouse cursors and the toolbar icon (put it in the "baseset"
folder).

So, how does it work?

1/ The selection is:
- initiated by CTRL+C
- a classic "orthogonal" area
- or an "diagonal" one (use CTRL while selecting)

2/ Once the area is set:
- you can edit the selection with CTRL+E
- then click left to enable/disable any tile (white is selected, blue is
available and red is owned by another player)
- to validate the edition : CTRL+E again or a left click outside of the area

3/ Paste is:
- initiated with CTRL+V
- while the preview, the mousewheel rotates the buffer
- transmitted through a new game command (a multiplayer game is possible if
everyone has the patch)

4/ Buffer history:
A successful paste puts the buffer in the history queue. To access these old
buffers, you just have press BACKSPACE to cycle through them (a new paste put
the buffer on top of the queue). For the moment, the queue is arbitrarily
limited to 16.

I see copypasting as some sort of subcontract so I'm thinking of adding a fee
to each paste operation. To compensate the time gain by money... Speaking of
money, the cost estimation of a paste operation is currently wrong.

This patch requires a network extension provided by enhanced viewport.
clipboard_r3_for_r27153.zip
(24.89 KiB) Downloaded 240 times
[r3]
- fix backspace hotkey
- fix data transfer in multiplayer

[r2]
- Fix compilation with gcc.

[r1]
- Initial version.
vredko
Engineer
Engineer
Posts: 5
Joined: 23 Aug 2010 10:05

Re: [Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by vredko »

please fix thi patche :bow: :bow: :bow:
EG0611
Engineer
Engineer
Posts: 49
Joined: 19 Feb 2012 08:39

Re: [Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by EG0611 »

vredko wrote: 23 Aug 2022 11:22 please fix thi patche :bow: :bow: :bow:
I don't believe a patch from 9 years ago would be fixed.
_dp_
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 18 Dec 2013 12:32

Re: [Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by _dp_ »

vredko wrote: 23 Aug 2022 11:22 please fix thi patche :bow: :bow: :bow:
There is a somewhat similar patch in the CityMania patchpack as LaChupacabra nicely explained here: viewtopic.php?p=1254840#p1254840
MJP
Engineer
Engineer
Posts: 116
Joined: 12 Mar 2011 19:01

Re: [Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by MJP »

EG0611 wrote: 23 Aug 2022 15:10I don't believe a patch from 9 years ago would be fixed.
I confirm that it's incredibly unlikely to happen.

Thinking about this patch again, I made it for a friend who never used it even once :roll:
Good thing I recorded a video memory of it when I still had an ancient compiled version.
It was a nice feature, but iirc with 1 known issue: templates were not shareable between big and little endian processors.
Good times... And I'm glad to see the OTTD community is still kicking :)
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: [Patch] Copy/paste templates (storable on disk) r3 for 27153

Post by Eddi »

MJP wrote: 24 Aug 2022 18:23templates were not shareable between big and little endian processors.
in any sane environment (which i can't judge this is, because i haven't looked at it) this should be a 2 line fix: a BSWAP in the save routine and a BSWAP in the load routine.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 12 guests