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 »

there was once a patch to do things diagonally if you held CTRL when dragging, but it's been left to rot somewhere...
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 »

Comments about the GUI?

The little arrows are for rotation and will be replaced by "circle arrows".
Attachments
copypaste.png
copypaste.png (24.14 KiB) Viewed 6093 times
Red.xiii
Engineer
Engineer
Posts: 93
Joined: 11 Jan 2005 13:33

Post by Red.xiii »

Very nicely done! A bit big comparing it to the buttons currently in use though....

Any chance of getting this code commited? I know you've worked on several patches and i have no idea if your work is paying off, cos i think it's excellent! :D
Image
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

When I've figured out how to add new images, the text-buttons will be replaced by smaller image buttons.

The Layout would change to this:

Code: Select all

[img: Copy] [img: rotate CCW] [img: rotate CW] [img: Paste]
[      text: include vacant terrain                       ]
EDIT: See image

Hm, I just worked on 1 tiny bugfix before, which was commited (1 line of code moved 3 lines down ;) )
But thx =)

I don't think it will be committed at this state.
Mainly because I don't like the code myself ;)

Also some points are really dissatisfying:
-Rotation won't work on everything (Airports, stations etc.)

-non-conform stations, newstations
This would even require pathfinding, to connect every station piece.
+additional terraforming to create possible path's.
At the moment i think this is to complex(newstations, track length limits), with too little gain, so I will leave it out. Maybe this can be added later.

-For multiplayer it may be to traffic intensive (i still did not test it)
There are 2 ideas how to do it, but none really satisfying.
(1. Make it a single Command - 2. Delay the building process)


News:
-Rail/Road Depots added
-"do not paste vacant terrain" added.
Attachments
copy_paste2.png
copy_paste2.png (21.29 KiB) Viewed 6034 times
cp_3.png
cp_3.png (209.02 KiB) Viewed 6019 times
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

This patch is amazing! Congratulations! :o
User avatar
gkirilov
Chief Executive
Chief Executive
Posts: 696
Joined: 03 May 2005 09:32
Location: Othala

Post by gkirilov »

If there is something that can not be rotated - just disable the rotate buttons.
It will increase the chanse of being added to the trunk :).
Great patch. I am already using it in my build.
OTTDCoop NewGRF Pack|Different sets of GRFs for TTDPatch (some of them work in OTTD) - 1|- 2|GRF sets for OTTD|OTTD nightly
Image
I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
ebi
Engineer
Engineer
Posts: 26
Joined: 26 Mar 2006 22:57

Post by ebi »

It becomes so wunderfull.... ;)

Greetings EBI
User avatar
gkirilov
Chief Executive
Chief Executive
Posts: 696
Joined: 03 May 2005 09:32
Location: Othala

Post by gkirilov »

I just found out that you can "copy" from one game then load another game and paste the layout. That's great :))
So now .. we can have a "template" save game with ALL the layout of stations, junctions and so on and just copy/paste from one savegame to another.

p.s. don't know if this is intentionally build feature, but please keep it that way.
OTTDCoop NewGRF Pack|Different sets of GRFs for TTDPatch (some of them work in OTTD) - 1|- 2|GRF sets for OTTD|OTTD nightly
Image
I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

New Version:

-rotation added
-fixed a bug when copying a 2-track-tile with 2 signals.

Bugs:
-tunnel exit is not checked, neither if terrain is properly restored.
(Just make sure both tunnel ends are within the selection, or it may be very expensive ;) )

Status:
-implementing load & save of selection.

@gkirilov: No, this was not intentionally. I just forgot to clear the copy-buffer after map load ;)

When load & save is implemented, this won't be a point anyway.
Attachments
Senington Transport, 25th Jul 2023.png
Senington Transport, 25th Jul 2023.png (77.9 KiB) Viewed 5811 times
Last edited by Frostregen on 02 Jun 2006 00:11, edited 1 time in total.
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

-Load & Save implemented.
-main code moved to copy_paste_gui.c
-Waypoints added
-disable rotate/Paste/Save buttons, if nothing is copied.

Do not use this to create a large template database, as the file format will definitely change in future, which would ruin your effort.
But try it to report bugs ;)

Things left to do:
-"tunnel ends not in selection" glitch.
-replace some strings (load / save dialogs)
-create + add new sprites for GUI
Last edited by Frostregen on 28 May 2006 11:00, edited 2 times in total.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

great, we will exchange junctions as now we exchange scenarios :D
User avatar
gkirilov
Chief Executive
Chief Executive
Posts: 696
Joined: 03 May 2005 09:32
Location: Othala

Post by gkirilov »

erase.
Last edited by gkirilov on 28 May 2006 16:27, edited 1 time in total.
OTTDCoop NewGRF Pack|Different sets of GRFs for TTDPatch (some of them work in OTTD) - 1|- 2|GRF sets for OTTD|OTTD nightly
Image
I hooked up my accelerator to my brake lights. I hit the gas, people behind me stop, and I'm gone.
Understeer is when you hit the wall with the front of the car. Oversteer is when you hit the wall with the rear of the car. Horsepower is how fast you hit the wall. Torque is how far you take the wall with you. Spoilers and bodykits are how much of the wall you take with you. Rollcages and windownets are how much of a mess you leave on the wall.
Haukinger
Engineer
Engineer
Posts: 110
Joined: 15 Mar 2006 16:38

Post by Haukinger »

I can't compile this on linux - it says 'fd' undeclared in unix.c at line 161... Windows works fine.

EDIT: done. should be

Code: Select all

fios->mtime = sb.st_mtime;
ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
instead of

Code: Select all

fios->mtime = *(uint64*)&fd.ftLastWriteTime;
ttd_strlcpy(fios->name, fd.cFileName, lengthof(fios->name));
and

Code: Select all

ttd_strlcpy(fios->title, dirent->d_name, lengthof(fios->title));
instead of

Code: Select all

ttd_strlcpy(fios->title, FS2OTTD(fd.cFileName), lengthof(fios->title));
BTW: Great work, man ! I'm adding this patch to my server...
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@Haukinger:
thx. Stupid copy&paste error :-/

Btw, this patch is completely clientside at the moment, so there is no need to add it to a server. Would be interesting how well it works on multiplayer though.

Fixed patch attached.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Be interesting to see if , after applying this patch, a client gains this advantage over other players. Feel free to test it on my nightly server. (:
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Haukinger
Engineer
Engineer
Posts: 110
Joined: 15 Mar 2006 16:38

Post by Haukinger »

One more feature-request(-suggestion) from me: let the paste-tool clear the to-be-modified tiles. As it is no, it leaves rails there (even your own) and then fails to terraform or place different rails/signals.
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@Brianetta: I'll try it tonight.

@Haukinger: Good point, will be done. Maybe tonight.
Haukinger
Engineer
Engineer
Posts: 110
Joined: 15 Mar 2006 16:38

Post by Haukinger »

Bug alert :shock:
You can't load templates in multiplayer. The game continues, but you are dropped from the server the moment you click on 'load' - totally quiet. No notification, no error message, no nothing.

In debug-mode, it says 'missing frame for sync test' once the load-template dialog opens. If you are quick enough and cancel now, the you stay connected. If you click on a filename, the connection is closed.
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

Yeah, you can only do 1 thing per frame AFAIK, so you need it to buffer the things to do, and output 1 per frame
We Am De Best

Host of ThroughTheTube site
Frostregen
Transport Coordinator
Transport Coordinator
Posts: 340
Joined: 06 Feb 2006 23:58

Post by Frostregen »

@Haukinger: thx for the bugreport. fixed.
The "demolish before build" is hard to solve, because terraforming may affect tiles far away from the terraformed tile. (if you raise the top of a hill, you would need to clear all tiles around the hill-base)

@Sacro: That was not the problem.
It reset the networking state after a template load. Which caused the game to pause, if you open the load/save dialog again. This caused the drop.
But the Buffer thing is needed too. I could not paste a track with a signal in multiplayer.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 16 guests