News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Click and drag for tunnels

Started by jamespetts, June 26, 2009, 10:23:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

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.

gerw

#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.

jamespetts

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.

gerw

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"?  ;)

jamespetts

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.

gerw

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.

z9999

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

gerw

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

Dwachs

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

z9999

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.

Isaac Eiland-Hall

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

Dwachs

@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.

gerw

Quote from: Dwachs on July 22, 2009, 09:04:08 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 assumed, 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.

jamespetts

Quote from: gerw on July 22, 2009, 09:09:41 AM
I assumed, 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.

gerw

I've updated the patch 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 assertion, but this is caused by this bug: http://forum.simutrans.com/index.php?topic=2804

jamespetts

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.

Dwachs

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.

gerw

Quote from: 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?
I've only a local repository.

Quote from: 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
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...


Dwachs

Quote from: gerw on July 23, 2009, 06:56:30 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.
Parsley, sage, rosemary, and maggikraut.

gerw

Quote from: Dwachs on July 23, 2009, 07:09:03 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?

prissi

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).

jamespetts

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.

Dwachs

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.

jamespetts

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.

prissi

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.

gerw

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.

Dwachs

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

gerw

So I have to change the header
diff --git bauer/wegbauer.cc bauer/wegbauer.cc
index 8b2e4e0..a2ba1e5 100644
--- bauer/wegbauer.cc
+++ bauer/wegbauer.cc

into something like
Index: bauer/wegbauer.cc
===================================================================
--- bauer/wegbauer.cc   (revision 2589)
+++ bauer/wegbauer.cc   (working copy)

Am I right? Or are more/less changes needed?

prissi

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.

gerw

Quote from: 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.
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?

gerw

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

Maragil

Sorry- I'm stupid.

How do you apply this patch?

H./

gerw

Quote from: Maragil on August 09, 2009, 08:01:51 PM
How do you apply this patch?
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.

Dwachs

#33
Quote from: gerw on August 09, 2009, 07:57:24 PM
Can you apply the patch with tortoise?
yes it worked.

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

gerw

Quote from: Dwachs on August 27, 2009, 07:37:20 PM
yes it worked.
Ok, I will post my script to convert git-diffs to diffs, which the simutrans commiters can apply :)

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