Build Templates (Copy&Paste) (r13911 + 0.6.3 + 0.6.2)
Moderator: OpenTTD Developers
Re: Build Templates (Copy&Paste) (r11874 + 0.5.3 + 0.6.0-beta3)
I wonder whether the patch could be enhanced to copy buildings, trees, industries, etc ... well, of course these extra things would be copied only in the scenario editor, not in the game. Is this realistic?
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
-
- Transport Coordinator
- Posts: 340
- Joined: 06 Feb 2006 23:58
Re: Build Templates (Copy&Paste) (r11874 + 0.5.3 + 0.6.0-beta3)
Sure, It is possible,
but would require additional GUI features.
When copying buildings you need to specify the town they belong to.
Same with industries.
Trees are simple, and could even make it into normal gameplay
but would require additional GUI features.
When copying buildings you need to specify the town they belong to.
Same with industries.
Trees are simple, and could even make it into normal gameplay

Re: Build Templates (Copy&Paste) (r11946 + 0.5.3 + 0.6.0-beta3)
I dont mind copying all the industries too, would be expensive as hell but it would stop that tideous work of adding industries, but i guess i'm one of the few who need that feature tho.
Anyone for another idea?
Making it really expensive to remove towns so that the magic buldozer wont be needed?
Industries too
Anyone for another idea?
Making it really expensive to remove towns so that the magic buldozer wont be needed?
Industries too

Re: Build Templates (Copy&Paste) (r11946 + 0.5.3 + 0.6.0-beta3)
Won't work well, as som,e industries comes in multiple shapes, randomlyu selected upon placement. So it may be impossible to reproduce industry layout in game. But in scenario editor you can directly manipulate the map array, thus having more possibilities to modify the map.Starbud wrote:I dont mind copying all the industries too, would be expensive as hell but it would stop that tideous work of adding industries, but i guess i'm one of the few who need that feature tho.
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: Build Templates (Copy&Paste) (r11946 + 0.5.3 + 0.6.0-beta3)
When magic buldozer is enabeld you can modify the map "directly" too.Bilbo wrote:..... But in scenario editor you can directly manipulate the map array, thus having more possibilities to modify the map.
From placing industries i have noticed that the industry take up the space it needs or smaller depending on the space avaliable.
I bet that all that would happen is that it might not be built if there is a problem with space or slopes.
Re: Build Templates (Copy&Paste) (r12002+ 0.5.3 + 0.6.0-beta3)
PMFJI - I have a technical question (suggestion?), concerning the memory usage of the c&p-feature.
Frostregen said some time ago:
Hmm. Is it really necessary to create an array (containing tile information I suppose) for copying/pasting?
How about storing just the two defining corners of the selected area (e. g. top left/bottom right coordinates, plus the target tile coordinates), and then handling the copy/paste-actions in a nested loop tile by tile ( foreach x1..x2 {foreach y1..y2 { handle tile x|y }} )?
Shouldn't this get us rid of any memory usage issues?
mfg, Guckemal
Frostregen said some time ago:
To avoid ram fragmentation, the copy-arrays are pre-allocated.
This means:
64 * 64 * 10Bytes = 40kb
...
Hmm. Is it really necessary to create an array (containing tile information I suppose) for copying/pasting?
How about storing just the two defining corners of the selected area (e. g. top left/bottom right coordinates, plus the target tile coordinates), and then handling the copy/paste-actions in a nested loop tile by tile ( foreach x1..x2 {foreach y1..y2 { handle tile x|y }} )?
Shouldn't this get us rid of any memory usage issues?
mfg, Guckemal
-
- Transport Coordinator
- Posts: 340
- Joined: 06 Feb 2006 23:58
Re: Build Templates (Copy&Paste) (r12002+ 0.5.3 + 0.6.0-beta3)
It is necessary to have a map independet storage because:
-After specifying the copy-area, someone could modify your copy
-You could not Load Templates anymore (you would have to build something at least once manually, before you could copy it)
-no copying from one savegame into another
I thought of this idea too, but mainly for multiplayer reasons:
-For multiplayer it would allow copy&paste to be handled easily with only 1 command
(As every client already has a local copy, and could reconstruct the whole area inside the command)
(Currently the proper way would be to send the array data to each client, then reconstruct it at once with one command)
I dropped the idea, because loading is way too important.
-After specifying the copy-area, someone could modify your copy
-You could not Load Templates anymore (you would have to build something at least once manually, before you could copy it)
-no copying from one savegame into another
I thought of this idea too, but mainly for multiplayer reasons:
-For multiplayer it would allow copy&paste to be handled easily with only 1 command
(As every client already has a local copy, and could reconstruct the whole area inside the command)
(Currently the proper way would be to send the array data to each client, then reconstruct it at once with one command)
I dropped the idea, because loading is way too important.
Re: Build Templates (Copy&Paste) (r12002+ 0.5.3 + 0.6.0-beta3)
Hmm. How about using a local temp file instead of RAM? This would surely work slower than plain memory activity, OTOH, storage capacity, i.e. area size, should not be an issue any more.Frostregen wrote: It is necessary to have a map independet storage because:
-After specifying the copy-area, someone could modify your copy
-You could not Load Templates anymore (you would have to build something at least once manually, before you could copy it)
-no copying from one savegame into another
I wouldn't mind if copying my fine tuned crossings takes 2 seconds instead of 50 ms - still saves me lots of clicks (and errors)...
mfg, Guckemal
Last edited by Guckemal on 16 Feb 2008 08:28, edited 1 time in total.
-
- Transport Coordinator
- Posts: 283
- Joined: 08 May 2004 07:48
- Location: Alkmaar, The Netherlands
Re: Build Templates (Copy&Paste) (r12002+ 0.5.3 + 0.6.0-beta3)
Isn't it possible to check the free amount of RAM, and if it isn't enough, use a temp-file? I have 4GB RAM, can't imagine I need a temp file, however others may need it though.Guckemal wrote:Hmm. How about using a local temp file instead of RAM? This would shurely work slower than plain memory activity, OTOH, storage capacity, i.e. area size, should not be an issue any more.Frostregen wrote: It is necessary to have a map independet storage because:
-After specifying the copy-area, someone could modify your copy
-You could not Load Templates anymore (you would have to build something at least once manually, before you could copy it)
-no copying from one savegame into another
I wouldn't mind if copying my fine tuned crossings takes 2 seconds instead of 50 ms - still saves me lots of clicks (and errors)...
mfg, Guckemal
Beer equals power
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
There seems to be some problem with the patch for r12347.
Visual studio 2005 gives me 3 errors when I try to build:
Error 1 error C3083: '{ctor}': the symbol to the left of a '::' must be a type c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 202
Error 2 error C2533: 'CopyPaste::CP_PlaceRail_Depot' : constructors not allowed a return type c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 203
Error 3 error C2264: 'CopyPaste::CP_PlaceRail_Depot' : error in function definition or declaration; function not called c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 400

Visual studio 2005 gives me 3 errors when I try to build:
Error 1 error C3083: '{ctor}': the symbol to the left of a '::' must be a type c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 202
Error 2 error C2533: 'CopyPaste::CP_PlaceRail_Depot' : constructors not allowed a return type c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 203
Error 3 error C2264: 'CopyPaste::CP_PlaceRail_Depot' : error in function definition or declaration; function not called c:\Checkout\OpenTTD-copypaste\src\copy_paste.cpp 400

=== Jez ===
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
OK, I found the problem; there is a problem with the r12347 patch.
On line 1564:
Should be:
How did this mistake get in? Surely it wouldn't compile on your machine like this. 
On line 1564:
Code: Select all
+void CopyPaste::CopyPaste::CP_PlaceRail_Depot(TileIndex tile, uint8 railtype, uint8 direction)
Code: Select all
+void CopyPaste::CP_PlaceRail_Depot(TileIndex tile, uint8 railtype, uint8 direction)

=== Jez ===
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Often when there is more than 1 signal on a tile, the pasted signal type is often wrong.
One thing that would be a great improvement would be to make the dynamite not demolish over tunnels when the land is high enough and it does not need to. Things like bridges over the tunnels, city buildings, roads etc. I often don't want destroyed.
Thanks for this great patch. I use it all the time to build thing that would otherwise be practically impossible.-
- Transport Coordinator
- Posts: 340
- Joined: 06 Feb 2006 23:58
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
@jez: Seems like a copy&paste error 
Strange enough it DID compile. (Not only for me, because this error was there quite long)
@IguannaB:
Signals: This is because when creating the patch it was not possible to have different signal-types on one tile.
Now there are not enough free bits to store the second signal type whithout a change to the template file format.
This will be fixed sometime.
Dynamite: I guess you could just disable dynamite manually, when pasting such layouts.
Thx for using this patch.

Strange enough it DID compile. (Not only for me, because this error was there quite long)
@IguannaB:
Signals: This is because when creating the patch it was not possible to have different signal-types on one tile.
Now there are not enough free bits to store the second signal type whithout a change to the template file format.
This will be fixed sometime.
Dynamite: I guess you could just disable dynamite manually, when pasting such layouts.
Thx for using this patch.
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Hi,
found a small bug.
If I try to save a template as "Con" openttd dies
Workaround: Just choose another name.
found a small bug.
If I try to save a template as "Con" openttd dies

Workaround: Just choose another name.
Have a N.I.C.E. day!
Indiana
Indiana
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Like PRN, LPT1 or COM1 for example.Indiana wrote:
Workaround: Just choose another name.

-
- Transport Coordinator
- Posts: 340
- Joined: 06 Feb 2006 23:58
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
or AUX
Theese are special reserved filenames. (since DOS times)
You can not create files/folders with those names.
Even files named CON.xxx are not allowed.
On the other hand, i should check if file-creation was successful, before trying to write to it
Will be fixed in next release.
EDIT:
OpenTTD crashes/hangs when trying to save a savegame with those names too.
Theese are special reserved filenames. (since DOS times)
You can not create files/folders with those names.
Even files named CON.xxx are not allowed.
On the other hand, i should check if file-creation was successful, before trying to write to it

Will be fixed in next release.
EDIT:
OpenTTD crashes/hangs when trying to save a savegame with those names too.
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
There are more reasons why opening file could fail (like lack of write permission in the directory where you want to write for example) What is a bit worse, if you try to save to some special files, like LPT1 not only that opening that file won't fail but you start copying the savegame to your printer (in case you have one connected to LPT1 - most printer nowadays are ethernet or USBV connected anyways :)Frostregen wrote:On the other hand, i should check if file-creation was successful, before trying to write to it ;)
If you need something, do it yourself or it will be never done.
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility
Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Frostregen: One problem I've noticed with this patch:
I copy my templates late in the game, when I have the best bridges available (tubular steel) and I make the bridges with them, so I have the best possible juntion. Trouble is, when I go to paste them in a game where I don't have those bridges available, I get a 'can't build bridge' message. Is there a way you could, if the bridge to be built isn't available, make it paste the best bridge available at the current time?
I copy my templates late in the game, when I have the best bridges available (tubular steel) and I make the bridges with them, so I have the best possible juntion. Trouble is, when I go to paste them in a game where I don't have those bridges available, I get a 'can't build bridge' message. Is there a way you could, if the bridge to be built isn't available, make it paste the best bridge available at the current time?
=== Jez ===
-
- Transport Coordinator
- Posts: 340
- Joined: 06 Feb 2006 23:58
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Hmm, i never use bridges, so i did not notice this problem.
Hmm, could be some work though,
because bridges have different minimum, and maximum length constraints.
(But i guess those constraints are stored somewhere...)
Hmm, could be some work though,
because bridges have different minimum, and maximum length constraints.
(But i guess those constraints are stored somewhere...)
Re: Build Templates (Copy&Paste) (r12347+ 0.5.3 + 0.6.0-beta5)
Not using bridges?
Can we have a look at your designs to learn from them?
Sonds intresting to use concepts without bridges.
Can we have a look at your designs to learn from them?
Sonds intresting to use concepts without bridges.

Who is online
Users browsing this forum: No registered users and 13 guests