Build Templates (Copy&Paste) (r13911 + 0.6.3 + 0.6.2)

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

User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i think it should be instant... depending on the delay, you can lay the same thing quicker.... also, you can instantly place REALLY long sections of tracks, if you use an AI type delay, it would definitly take longer to duplicate long stretches of tracks, why duplicate long stretched of tracks? maybe the long stretch of tracks holds cross over sections, and junctions that you might want copying at regular intervals.

am i correct in assuming that the copy paste acts like a clipboard, so once you copy the junction you can place it multiple times, untill you select another section to copy?
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Rotation won't be easy with (non-square) airports, and with newstations - some of which aren't properly rotatable (such as the Toronto Grand Central one).

I'm intreted to know how the copy feature deals, or will deal, with objects which extend beyond the selected area. Examples include the selection just covering part of a larger station, covering part of an airport, or one end of a long tunnel.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Brianetta wrote: I'm intreted to know how the copy feature deals, or will deal, with objects which extend beyond the selected area. Examples include the selection just covering part of a larger station, covering part of an airport, or one end of a long tunnel.
Trainstations can be cutted into smaller ones. Not clever but it works.
Copy only half of an airports will crash the game i think. On the other side is it clever to copy only half of an airport? So i think the copy function only should copy the airport if the whole airport is copied. The same to tunnels.
Rotating an airport wont work too. So then it should not be copied too.
Something left what can't be rotated?
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@bobingabout:
Yes you may copy it more than once.

@delay questions:
Maybe there will be different types of copy&paste.
I will come back to those ideas later.

@Brianetta & gigajum:
Objects which are not completely inside the copied area, are not copied.
(Currently applies to Bridges+Tunnels)
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

If anyone wants to play around,
here is the patch + compiled windows exe.

Stations, especially non-uniform stations will require some thinking,
so this will take a while.


Current todo list:

-check tunnel-end out of selection
-check terrain before tunnel build
-implement Stations
-implement Depots
-implement Waypoints

One problem will always be that this patch depends on nearly all game structures. So if anything changes or gets added, this patch must be updated too.

EDIT:
Maybe someone should move this thread to developement.
Attachments
copypaste.png
copypaste.png (7.33 KiB) Viewed 8257 times
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Some questions:

Why are you taking 7 arrays to store the information? Why not copy tile for tile into a small copy array of struct Tile. And only check tile for beeing copied or left out. And the past function builds exact the copy array onto the map.

Why are 100x100 tiles copyable? Aren't 16x16 or 32x32 (maximal) enough?
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

gigajum wrote:Why are 100x100 tiles copyable? Aren't 16x16 or 32x32 (maximal) enough?
Depends what you want to copy. If you're trying to spare the effort of duplicating a huge junction, you might need a huge copy buffer.

No comment on your first point, though, as I dont have the background.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Brianetta wrote: Depends what you want to copy. If you're trying to spare the effort of duplicating a huge junction, you might need a huge copy buffer.
huge junction? how big? 32 tiles are about 2 screens in 800x600. with 100x100 you can copy a whole 64x64 map and almost the whole 128x128 map. if would copy something i copy that within the screen since i need to fit that copy into the destination tiles. But with 10000 tiles where is the meaning? it's waste of RAM, imo. 16x16 should be enough. if something is missing, copy the missing part, too. :)
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

The tile struct uses 8Byte,
At the moment the 6 arrays I use also take 8Byte per tile.

10000 * 8Byte is around 80kb, which is not that great memory waste.
Some of my junctions are larger than 32x32, so I decided to raise the
maximum from 1000 to 10000.
But maybe 50*50 is enough, which would be 20kb of RAM.

The tileheight(difference) needs to be stored for every tile.

I did not directly copy the tile-struct, to be somewhat independent from the map array. Which I noticed later, is futile anyway.
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Frostregen wrote:The tile struct uses 8Byte,
At the moment the 6 arrays I use also take 8Byte per tile.

10000 * 8Byte is around 80kb, which is not that great memory waste.
Some of my junctions are larger than 32x32, so I decided to raise the
maximum from 1000 to 10000.
But maybe 50*50 is enough, which would be 20kb of RAM.

The tileheight(difference) needs to be stored for every tile.

I did not directly copy the tile-struct, to be somewhat independent from the map array. Which I noticed later, is futile anyway.
10000* 8Bytes * 6 array!!!!
so it is not 80KB it is ~470KB
ok the computers today have enough of that, that's not the problem. i only wanted to know why :)
If you have 50x50 junctions you could copy more single parts. 32x32 are big enough (imo)
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

The 8Bytes are for all 6 Arrays.

Code: Select all

int8 _copy_heightmap[COPY_MAX];      
uint8 _copy_rail[COPY_MAX];   
uint8 _copy_tunnel[COPY_MAX];      
uint8 _copy_road[COPY_MAX];        
uint16 _copy_signals[COPY_MAX]; 
uint16 _copy_bridge[COPY_MAX];
1 + 1 + 1 + 1 + 2 +2 = 8

NOTE:
In the sourcecode, the calculation is wrong.
It should read:

Code: Select all

//Total Space used = 8 * COPY_MAX = 80kb
Somehow i counted the bits, instead of bytes ;)
ebi
Engineer
Engineer
Posts: 26
Joined: 26 Mar 2006 22:57

Post by ebi »

What means:

"ERROR: Invalid version of language packs" ?

I loaded the last Nightly and replaced the openttd.exe with this one of this topic.

Greetings EBI
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

uhm yeah ... your right, i'm busy with something other and only read over and remembered the 640KB usage. But as said that's not the big problem with the ram usage.

@ Ebi

The IN uses other lang files then the normal nightly. So get the lang files from the nightly around r4914
ebi
Engineer
Engineer
Posts: 26
Joined: 26 Mar 2006 22:57

Post by ebi »

Hello,

so, i tried to use the Mini Integrated Nightly with this openttd.exe but Error too. And the file size are totaly different. I'm desperate.


Greetings EBI
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

Here are the lang files...
ebi
Engineer
Engineer
Posts: 26
Joined: 26 Mar 2006 22:57

Post by ebi »

Thank You, Its running and the feature is great!!!! :)
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i want to be able to copy something like this :P
Attachments
Nonnwell City Transport, 19th May 1941.png
(132.43 KiB) Downloaded 661 times
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@bobingabout:
This is already possible :)

At the moment I am coding a gui.
If you have 50x50 junctions you could copy more single parts. 32x32 are big enough (imo)
This will be a problem with tunnels/bridges which are only partially contained.
They would be left out. Anyway this is finetuning, which will be something to think about later.
Haukinger
Engineer
Engineer
Posts: 110
Joined: 15 Mar 2006 16:38

Post by Haukinger »

Can you select diagonally ? Or are mountains in the corners of bobingabout's junction copied with the junction ?
Perhaps it is possible to add an option that it copies only 'modified' tiles, that is, thoppse with tracks, tunnels bridges etc. on them...
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@Haukinger:
Good point, I'll try to make this an option
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 21 guests