Skip to main content
Topic: Click and drag for tunnels (Read 9850 times) previous topic - next topic

Click and drag for tunnels

The excellent new tunnel slopes feature is a great addition to Simutrans, but one thing that it does highlight is one of the few remaining way tools without click and drag functionality: the tunnel. When building a tunnel entrance with the CTRL key, and laying tunnels underground manually, it would be much easier if one were able to do so by clicking and dragging, just as one is with ways above ground. I notice that one can add wayobjects to tunnels by clicking and dragging.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #1
This is not possible easily, since underground tiles, on which is nothing, doesn't exist. And the preview for way building just add a dummy object with the right graphic to the tiles. But if there isn't a ground, it's a bit more complicated...

Edit:
With dummy-tiles it works. I will upload a patch soon.

Re: Click and drag for tunnels

Reply #2
Excellent, thank you :-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #3
Here it is. It also solves a bug: The tunnel portal wasn't set dirty in the correct way.

http://www-user.tu-chemnitz.de/~gerw/patches/tunnel_preview.patch

(With the modifications to two_click_werkzeug it should be possible to define the signal tool in the autosignal patch as a two_click_tool).

Can someone move this topic to "patches", "considered" or "denied"?  ;)

Re: Click and drag for tunnels

Reply #4
Excellent! This will make building underground networks much easier.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #5
I remembered, that the preview of monorail was also buggy, I included a better preview for monorail.

http://www-user.tu-chemnitz.de/~gerw/patches/tunnel_preview_v2.patch

I also found a rather curious bug: You can build very high monorail and can't delete the uppermost ground... I'm just wondering that z9999 hasn't found this bug ;D
http://www-user.tu-chemnitz.de/~gerw/patches/pics/cant_remove_monorail.png

For me, it's also a bit strange, that you can build a monorail upon an other. My suggestion is, that if you click on a monorail ground, the monorail will start at this ground. Before the "3d cursor" you couldn't select the monorail ground and therefore only 1 monorail layer was allowed.

Re: Click and drag for tunnels

Reply #6
One thing.
Estimated price on tooltips is not tunnel cost but normal way cost.


Re: Click and drag for tunnels

Reply #8
I cant reproduce the monorail bug you mentioned ???
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #9
One of monorail bug is preview image when dragging.
Preview image is not drawn monorail level but is always drawn on ground level.

This problem will solve by this patch.

Re: Click and drag for tunnels

Reply #10
This also happens with elevated roads, in case then patch doesn't address them. :)

Re: Click and drag for tunnels

Reply #11
@gerw: could you please update the patch? there are some conflicts.

I think the saving routines need some additional logic to not save the dummy grounds.


Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #12
@gerw: could you please update the patch? there are some conflicts.
If I find some time, I will do it.

Quote
I think the saving routines need some additional logic to not save the dummy grounds.
I ****umed, saving isn't possible while dragging, but thats maybe not true.. I've currently haven't an idea, how to solve this in an elegant way.

Re: Click and drag for tunnels

Reply #13
I ****umed, saving isn't possible while dragging, but thats maybe not true.. I've currently haven't an idea, how to solve this in an elegant way.

There's always autosave... ;-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.


Re: Click and drag for tunnels

Reply #15
Yes, Git! Git makes things easy. Do you have a Github repository that I could watch?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #16
The need for a saving routine is due to the behavior that if a dialogue tool is called then the current tool remains active. Which should be not the case.

I.e. in karte_t::set_werkzeug( werkzeug_t *w ) the first 'if' fails for dialogue tools. This should be catched to reset the active tool

@git: TortoiseSvn does not understand the diff-files produced by git. And there is no revision number in the file, which makes it hard to apply the patch for us poor windows using programmers.
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #17
Yes, Git! Git makes things easy. Do you have a Github repository that I could watch?
I've only a local repository.

The need for a saving routine is due to the behavior that if a dialogue tool is called then the current tool remains active. Which should be not the case.

I.e. in karte_t::set_werkzeug( werkzeug_t *w ) the first 'if' fails for dialogue tools. This should be catched to reset the active tool
But this wouldn't solve the problem with auto-saves. One possibility is to reset the active tool in welt->speichern...

Quote
@git: TortoiseSvn does not understand the diff-files produced by git. And there is no revision number in the file, which makes it hard to apply the patch for us poor windows using programmers.
Can't Tortoise apply diff-files to the current directory? That would be odd...


Re: Click and drag for tunnels

Reply #18
Can't Tortoise apply diff-files to the current directory? That would be odd...
At least for me it does nothing with such a file. No patching, no error message, nothing. I think it does not recognize the paths a/* and b/* right.
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #19
At least for me it does nothing with such a file. No patching, no error message, nothing. I think it does not recognize the paths a/* and b/* right.
The above patch file doesn't contain a/* and b/* (you can create this with 'git diff ... --no-prefix'). Does this also not work?

Re: Click and drag for tunnels

Reply #20
git patches are not very friendly to patches on windows. Some work other not. That is why many games enforce to use the patch format of the distribution to submit patches. (But Tortoise is especially picky, without a revision usually it won't patch).

Re: Click and drag for tunnels

Reply #21
Prissi,

the idea with Git is to use branches instead of patches.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #22
But then the difficulties arise if you take the git patch and want to apply it to the svn working copy.
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #23
Then the difficulties arise because of the use of SVN, not Git ;-)
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: Click and drag for tunnels

Reply #24
We use subversion. Patches should be by svn diff style. We can do with other, but one should consider people not skilled with command line tools.

Of course one can discuss changing the rcs again. But I do not see the need at the moment to skip the working svn for another system. Honestly, I have already so much with non-programming issues to do in the last half a year or so, that I am quite reluctant against changing anything that works well enough.

Re: Click and drag for tunnels

Reply #25
Until now, I haven't noticed, that the git-diff-output will create problems. How do you apply (my) git diffs, if tortoise won't work? Maybe I could 'pipe' my patches through svn, if this is more convenient for you.

Re: Click and drag for tunnels

Reply #26
I edited the diff's to match the svn-diffs by hand :/
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #27
So I have to change the header
Code: [Select]
diff --git bauer/wegbauer.cc bauer/wegbauer.cc
index 8b2e4e0..a2ba1e5 100644
--- bauer/wegbauer.cc
+++ bauer/wegbauer.cc
into something like
Code: [Select]
Index: bauer/wegbauer.cc
===================================================================
--- bauer/wegbauer.cc   (revision 2589)
+++ bauer/wegbauer.cc   (working copy)
Am I right? Or are more/less changes needed?

Re: Click and drag for tunnels

Reply #28
patch can do this on the commandline also with git diffs, just use -p1 to ignore the first folder and directly apply it in trunk. However, I am not sure how to do this with TortoiseSVN.

 

Re: Click and drag for tunnels

Reply #29
patch can do this on the commandline also with git diffs, just use -p1 to ignore the first folder and directly apply it in trunk.
You can use 'git diff --no-prefix' and git won't create the 'a/*' and 'b/*' part. But the missing version will still confuse tortoise?

Re: Click and drag for tunnels

Reply #30
New version of the patch. Now, the preview tiles are deleted, when the map is saved, see karte_t::speichern.

Can you apply the patch with tortoise? I wrote a little script, which converts the git-diff format to the svn one.

www.tu-chemnitz.de/~gerw/patches/tunnel_preview_v5.patch

Re: Click and drag for tunnels

Reply #31
Sorry- I'm stupid.

How do you apply this patch?
H./

Re: Click and drag for tunnels

Reply #32
This depends on your system. With tortoise you will find a merge tool in the menu and with linux 'patch -p0 < path_to_patch_file'.

Edit: I had a small mistake in my script (I've forgot no-prefix). Please re-load the patch.

Re: Click and drag for tunnels

Reply #33
Can you apply the patch with tortoise?
yes it worked.

Incorporated in rev 2620. Thank you!
Parsley, sage, rosemary, and maggikraut.

Re: Click and drag for tunnels

Reply #34
Ok, I will post my script to convert git-diffs to diffs, which the simutrans commiters can apply :)

Quote
Incorporated in rev 2620. Thank you!
Was yesterday the 'happy commiting day'?  :D