The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on June 26, 2009, 10:23:46 pm

Title: Click and drag for tunnels
Post by: jamespetts on June 26, 2009, 10:23:46 pm
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.
Title: Re: Click and drag for tunnels
Post by: gerw on June 27, 2009, 12:21:31 pm
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.
Title: Re: Click and drag for tunnels
Post by: jamespetts on June 29, 2009, 07:28:21 am
Excellent, thank you :-)
Title: Re: Click and drag for tunnels
Post by: gerw on June 29, 2009, 07:11:41 pm
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 (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"?  ;)
Title: Re: Click and drag for tunnels
Post by: jamespetts on June 29, 2009, 07:15:24 pm
Excellent! This will make building underground networks much easier.
Title: Re: Click and drag for tunnels
Post by: gerw on June 30, 2009, 05:26:11 pm
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 (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 (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.
Title: Re: Click and drag for tunnels
Post by: z9999 on July 04, 2009, 09:07:07 am
One thing.
Estimated price on tooltips is not tunnel cost but normal way cost.
Title: Re: Click and drag for tunnels
Post by: gerw on July 04, 2009, 12:16:26 pm
Thank you. This was buggy, because wegbauer_t::calc_cost didn't considered tunnel / monorail correctly.

tu-chemnitz.de/~gerw/patches/tunnel_preview_v3.patch (http://tu-chemnitz.de/~gerw/patches/tunnel_preview_v3.patch)
Title: Re: Click and drag for tunnels
Post by: Dwachs on July 21, 2009, 07:10:17 pm
I cant reproduce the monorail bug you mentioned ???
Title: Re: Click and drag for tunnels
Post by: z9999 on July 21, 2009, 07:37:06 pm
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.
Title: Re: Click and drag for tunnels
Post by: Isaac Eiland-Hall on July 22, 2009, 08:04:10 am
This also happens with elevated roads, in case then patch doesn't address them. :)
Title: Re: Click and drag for tunnels
Post by: Dwachs on July 22, 2009, 09:04:08 am
@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.


Title: Re: Click and drag for tunnels
Post by: gerw on July 22, 2009, 09:09:41 am
@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.
Title: Re: Click and drag for tunnels
Post by: jamespetts on July 22, 2009, 07:19:46 pm
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... ;-)
Title: Re: Click and drag for tunnels
Post by: gerw on July 22, 2009, 08:12:52 pm
I've updated the patch tu-chemnitz.de/~gerw/patches/tunnel_preview_v4.patch (http://tu-chemnitz.de/~gerw/patches/tunnel_preview_v4.patch).
[advertisement]It was really easy with git.[/advertisement]  :)

Has anybody a (good) idea, how to avoid saving of these dummy-grounds?

Remark: Maybe you will get a failed ****ertion, but this is caused by this bug: http://forum.simutrans.com/index.php?topic=2804 (http://forum.simutrans.com/index.php?topic=2804)
Title: Re: Click and drag for tunnels
Post by: jamespetts on July 22, 2009, 08:47:40 pm
Yes, Git! Git makes things easy. Do you have a Github repository that I could watch?
Title: Re: Click and drag for tunnels
Post by: Dwachs on July 23, 2009, 05:36:34 am
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.
Title: Re: Click and drag for tunnels
Post by: gerw on July 23, 2009, 06:56:30 am
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...

Title: Re: Click and drag for tunnels
Post by: Dwachs on July 23, 2009, 07:09:03 am
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.
Title: Re: Click and drag for tunnels
Post by: gerw on July 23, 2009, 07:16:43 am
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?
Title: Re: Click and drag for tunnels
Post by: prissi on July 23, 2009, 07:34:47 am
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).
Title: Re: Click and drag for tunnels
Post by: jamespetts on July 23, 2009, 08:04:36 am
Prissi,

the idea with Git is to use branches instead of patches.
Title: Re: Click and drag for tunnels
Post by: Dwachs on July 23, 2009, 08:23:59 am
But then the difficulties arise if you take the git patch and want to apply it to the svn working copy.
Title: Re: Click and drag for tunnels
Post by: jamespetts on July 23, 2009, 10:18:50 am
Then the difficulties arise because of the use of SVN, not Git ;-)
Title: Re: Click and drag for tunnels
Post by: prissi on July 23, 2009, 12:52:50 pm
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.
Title: Re: Click and drag for tunnels
Post by: gerw on July 23, 2009, 01:00:14 pm
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.
Title: Re: Click and drag for tunnels
Post by: Dwachs on July 23, 2009, 01:25:50 pm
I edited the diff's to match the svn-diffs by hand :/
Title: Re: Click and drag for tunnels
Post by: gerw on July 23, 2009, 01:31:46 pm
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?
Title: Re: Click and drag for tunnels
Post by: prissi on July 23, 2009, 01:33:12 pm
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.
Title: Re: Click and drag for tunnels
Post by: gerw on July 23, 2009, 01:36:20 pm
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?
Title: Re: Click and drag for tunnels
Post by: gerw on August 09, 2009, 07:57:24 pm
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 (http://www.tu-chemnitz.de/~gerw/patches/tunnel_preview_v5.patch)
Title: Re: Click and drag for tunnels
Post by: Maragil on August 09, 2009, 08:01:51 pm
Sorry- I'm stupid.

How do you apply this patch?
Title: Re: Click and drag for tunnels
Post by: gerw on August 09, 2009, 08:04:48 pm
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.
Title: Re: Click and drag for tunnels
Post by: Dwachs on August 27, 2009, 07:37:20 pm
Can you apply the patch with tortoise?
yes it worked.

Incorporated in rev 2620. Thank you!
Title: Re: Click and drag for tunnels
Post by: gerw on August 28, 2009, 06:20:41 am
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