News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

[Patch] Auto hide buildings in cursor range

Started by Fabio, October 06, 2011, 02:32:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fabio

When I play, I mostly keep trees and buildings hidden, in order to be able to "work" on the ways.
It's a shame, I miss a very beautiful part of the game.
Hence this idea: the buildings and the trees in a 5*5 square around the cursor (2 in each direction) are hidden, the other shown in their magnificence.

ojii

*LOVE* the idea! Should be customizable in the GUI though how big the 'hide' area should be

Václav

#2
This would be good - but only as extra option for display settings dialogue - because I would like to if current total hiding would stay available.

And I have similar idea (but it may be detached to new topic - or taken to consideration as part for this Fabio's one): full hiding also for player buildings - it means station extensions and headquarters. I don't know about any more buildings which are not hidden fully.

Ordinary buildings are hidden in two steps - full hidden basic buildings (res, com, ind), skrewed (partly hidden) factories -> basic and factories full hidden ... but player's buildings stay not hidden. And it is very bothering.

... and there is one important question: what would happen with buildings that would be greater than 1*1 tile - if they would be in range of this limited hiding?

Chybami se člověk učí - ale někteří lidé jsou nepoučitelní

prissi

Building are made tilewise, so it would be very easy to only hide those tiles. It just depends on how they were cutted.

greenling

Those idea it´s good.
I must be often switch out the Building the i want to build a road or a Station.
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

falconne

I've noticed that I mostly tend to hide trees and buildings when I'm creating a route (laying roads, rail, etc) and other times I prefer to have all the eye candy visible.

This patch adds an option that allows you to keep all buildings and trees visible, but have them automatically hide (or go transparent) when you select an "Infrastructure" building tool (i.e. roads, tracks, tunnels and bridges) or a "Landscaping" tool (raise/lower land, slopes). That way buildings and trees should stay hidden while you lay your route. They will be restored to their previous visibility state when you select some other kind of tool. The patch preserves whatever visibility state they already had, so if you already had trees hidden for example, they will not get unhidden. There should be no interference with your normal visibility settings. The easiest way to restore visibility is to select the Query tool when you're done building the route, but any persistent tool that's not in the above list will do.

Additionally, this patch turns on the grid while Infrastructure or Landscaping tools are selected. Again, the previous state of the grid is respected and it will not be turned off again if it wasn't off to begin with.

This should allow you to have the game looking like this normally: http://i.imgur.com/N61pW.jpg
To automatically becoming this when you are route building: http://i.imgur.com/STLSf.jpg

One thing to note is that because dialogs in Simutrans are not modal, if you have an infrastructure tool selected like a rail track and you open something like the Line Management dialog, this doesn't change the "tool" you have selected, it's still that rail track and therefore the buildings and trees will not be restored just by opening a dialog (technically you're still laying track). To restore visibility, select another persistent tool, like the Query tool.

This option can be turned off from the Display config dialog in-game (auto hide trees and buildings), but the setting will not persist across sessions (i.e. you'd have to unset it again the next time you start Simutrans). This is because I don't think I can add a new option to settings.xml without bumping up the version, which would also cause a user's settings file to be recreated? Anyway, if you want to invert the default state you can set "auto_hide_buildings_and_trees = false" in umgebung.cc:124 before compiling the patch.

Fabio

Awesome idea!

and you might want to consider also this request (in the same or in a new patch): http://forum.simutrans.com/index.php?topic=8168.0

Thanks!

falconne


Quote from: fabio on November 24, 2011, 11:21:31 AM
and you might want to consider also this request (in the same or in a new patch): http://forum.simutrans.com/index.php?topic=8168.0


Interesting idea. Here's a patch to do that. It won't work with the other patch so you'd want to revert that before trying this.


Here's a screenshot of how it looks (in my case I have "transparent instead of hide" set): http://i.imgur.com/9dS0Q.jpg


The setting can be turned on in the display config screen as you can see (though the setting won't persist between sessions). You can also set the range around the cursor to hide. The default is 2 (5x5 square) but I've increased it to 4 in the screenshot to make it more obvious.


I think the best way to toggle this setting is with a toolbar button with a shortcut key, like the "toggle grid" toolbar button. I can't add toolbar buttons with a patch, as they need to be defined in the pak. However the patch includes all the code necessary to have this functionality available as a toolbar button. All you have to do is edit the menuconf.tab file in your pak's config directory, define a "simple_tool[35]" element and add it to the main toolbar, using an existing icon and it will be available in the game. This is why my screenshot shows a second "Pause" button at the end of the toolbar.


Hope this is what you were thinking of.

prissi

I wanted to do this for quite some time. You solved it very efficiently.

I just added grid and some small other stuff. Great works, thanks.

Isaac Eiland-Hall

That is **slick**. Does any other game of our class do this? Surely not. That's awesome. :D

prissi


falconne

Quote from: prissi on November 25, 2011, 10:29:07 PM
I just added grid and some small other stuff. Great works, thanks.

Thanks. I somehow forgot that I could enable the grid around the cursor too :) Looks quite nice with a partial grid.

Fabio

Awesome! thank you falconne. I'll try this one out in latest nightly. I merged the two threads as well.

falconne

Regarding auto hide under cursor, wouldn't it be better if that also only happened when you have route building tools selected? I can see it being annoying to use if it's always hiding objects when you're trying to query objects or look around the map. I already have the code for that so it's quite easy to do.

prissi

But to get a bus stop behind a building, this is needed too. It can be switched off with a key. But a tool which is only present some times will confuse the user. Of course when dragging, actually larger area would be needed to exclude to see the entire route. But currently I think this is a nice compromise.

VS

Most tools need better visibility, and this helps. But... since Simutrans works in such a way that you have to have a tool selected, and cursor can't leave viewport, there will be always a transparent hole in landscape on your screen. That is not a good thing ;)

I think at least the query tool should not hide stuff. Almost everything else is related to construction, so no argument there.

edit: Of course you can switch off hiding manually, but... there's simply something missing!

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

falconne

Quote from: prissi on November 30, 2011, 09:41:43 PM
But to get a bus stop behind a building, this is needed too. It can be switched off with a key. But a tool which is only present some times will confuse the user. Of course when dragging, actually larger area would be needed to exclude to see the entire route. But currently I think this is a nice compromise.

Well I could include those tools in the check as well. Or just consider any tool other than the Query tool as a construction tool, so at least when the Query tool is selected the hiding can be turned off. Using a shortcut to turn the feature on and off defeats the purpose, since you can do that with buildings anyway. My aim was to have something that works intelligently enough that you don't have to manually intervene.

As it is I think it's too annoying to use if it's always hiding objects and most people will just use the regular hide/unhide buildings shortcuts.

jamespetts

Quote from: VS on November 30, 2011, 10:35:30 PM
I think at least the query tool should not hide stuff. Almost everything else is related to construction, so no argument there.

edit: Of course you can switch off hiding manually, but... there's simply something missing!

I agree with this - the feature should be disabled for the query tool, which is what I use as a default option when I am not engaged in construction.
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.

falconne

I'll submit a new patch with that change. It's quite easy to do and I don't think many people will use this feature without that functionality.

Fabio

And for query tool... I would use [CTRL] or [SHIFT] (or even better [ALT], which is completely unused) to force hiding on, for all the other it should be on by default.




A little bit OT, it would be nice if transparent hiding could set the transparency (0% - 100%) in the display dialog, whereas now it's 50% IIRC.

TurfIt

Quote from: falconne on November 30, 2011, 11:09:46 PM
so at least when the Query tool is selected the hiding can be turned off. Using a shortcut to turn the feature on and off defeats the purpose, since you can do that with buildings anyway. My aim was to have something that works intelligently enough that you don't have to manually intervene.
I agree with prissi, if you have to hide things to build something, you'll probably need to hide them to query the something too... Intelligent tools aka mind readers usually end up more frustrating than anything.

Instead of a bound key toggling it on/off, how about auto/on/off? Better than having to hold down a modifier key to force on IMHO.