Patch: Track and road types on main toolbar [r14089]

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
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

This little patch puts icons of individual track and road types on main toolbar - significantly speeding up tasks like switching from tram to road etc.

Bugs:
- taking screenshot crashes the game (omg, why?)
- sometimes it takes a while until the toolbar repaints. Clicking on something on the toolbar can bypass it. I will have toplace repaint requests on several places in the code (year change, cheat year change, maybe also patch settings).

If I see interest in this, I will try to rewrite it somehow, so it is patch configurable (it is hardcoded right now).

Patch and Win32 package attached.
Attachments
Year 2001 - all track types but maglev are enabled
Year 2001 - all track types but maglev are enabled
toolbar.jpg (18.93 KiB) Viewed 8045 times
track types on toolbar r14089.patch
Patch against r14089
(6.9 KiB) Downloaded 218 times
track types on toolbar r14089.zip
Ready to use Win32 package with the patch applied
(2.9 MiB) Downloaded 265 times
MJS
Director
Director
Posts: 540
Joined: 28 Jul 2005 09:31

Re: Patch: Track and road types on main toolbar [r14089]

Post by MJS »

Pity about the bugs, but the idea is very good!
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Track and road types on main toolbar [r14089]

Post by Roujin »

I like it too :)
About the not-redrawing: that happens in trunk too iirc, it's just not as easily noticed as with your patch.
So you needn't change redrawing, but insert redrawing in some places.

Keep in mind that availablility of rail(/road) types comes with availability of rail/road vehicles, so whenever a player gets access to a new vehicle (also e.g. by changing newGrfs during the game), it should invoke a redraw of the toolbar.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

About the not-redrawing: that happens in trunk too iirc, it's just not as easily noticed as with your patch.
So you needn't change redrawing, but insert redrawing in some places..
This is not hard, it should be easy to do. I'm much more afraid of the possibility to turn it off or on.
Keep in mind that availablility of rail(/road) types comes with availability of rail/road vehicles
Thanks, I would maybe forget this (I thought the tracks are enabled by year).
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by FooBar »

I like the idea of having quick access, but I'm missing the spacers in your screenshot. It currently is a big mess of buttons pasted together. The toolbar already resizes on resolutions w<640px, so I don't really see why you left those out. Otherwise, very nice!
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

It seems like another bug I missed, thanks.
Mchl
Director
Director
Posts: 611
Joined: 05 Jan 2007 15:50
Location: Poland
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by Mchl »

That's really nice idea! Me like!
User avatar
mkxx
Engineer
Engineer
Posts: 65
Joined: 06 Jun 2005 22:15
Location: Czech Republic, Prague

Re: Patch: Track and road types on main toolbar [r14089]

Post by mkxx »

I really like this idea - would like to see it in trunk as an option. :wink:
If you add the spacers between buttons and between RAIL / ROAD / other_transport sections, I'll be happy.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Patch: Track and road types on main toolbar [r14089]

Post by peter1138 »

Now make it work with variable rail and road types.
He's like, some kind of OpenTTD developer.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

There is something like that in the game? If you mean the GRF track type mods like purno's metro or the suspended tram, then yes, it should work (in theory, I will have to try it).
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2897
Joined: 16 May 2007 16:59

Re: Patch: Track and road types on main toolbar [r14089]

Post by Zephyris »

I think he means making it cope with some kind of newgrf rail/road types...
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: Patch: Track and road types on main toolbar [r14089]

Post by peter1138 »

The existing drop down list is easily extendable for adding more rail and road types. The toolbar buttons are not.
He's like, some kind of OpenTTD developer.
Mchl
Director
Director
Posts: 611
Joined: 05 Jan 2007 15:50
Location: Poland
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by Mchl »

Are we expecting new rail/road types anytime soon?
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by belugas »

Should we add "features" that would block us from doing that, eventually?
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by Gremnon »

It can be extended. It would just need an additional button, that's all.
Besides, to my knowledge all additional road/rail types overide an existing one presently, so as to be patch compatible.
Agent_N
Engineer
Engineer
Posts: 4
Joined: 18 Aug 2008 15:17

Re: Patch: Track and road types on main toolbar [r14089]

Post by Agent_N »

I've just tested this patch and recognized that the airport build tool is not working. After looking at it I've seen that the menu handler array _menu_clicked_procs was not changed. I've updated the handler array and attached a new patch with it. This also seem to be the bug which crashes while trying to take a screenshot.
Attachments
track types on toolbar r14097.patch
(7.23 KiB) Downloaded 100 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Patch: Track and road types on main toolbar [r14089]

Post by DJ Nekkid »

as the idea is good, i think i'd rather would like to see a keyboard shortcut where i change to the "next type" of rail/road, and even change from rail to road to air to ship to rail to road to air to ship ........ :) This because the A-key open the autorail-tool, and it would be nice to have a shortcut that can change in "local" type (i.e. from rail - elrail etc) or change the "global" type (from rail to road etc).

Sorry if this already exist, but i've never found it ...
Member of the
ImageImage
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

Welcome to TT-forums, nice first post.
Agent_N wrote:I've just tested this patch and recognized that the airport build tool is not working. After looking at it I've seen that the menu handler array _menu_clicked_procs was not changed. I've updated the handler array and attached a new patch with it.
Thanks, I will have look at it
This also seem to be the bug which crashes while trying to take a screenshot.
I think you are wrong. The bug was imo present in trunk too and was fixed in r14094 (so you removed it by updating the patch).
as the idea is good, i think i'd rather would like to see a keyboard shortcut where i change to the "next type" of rail/road, and even change from rail to road to air to ship to rail to road to air to ship ........ This because the A-key open the autorail-tool, and it would be nice to have a shortcut that can change in "local" type (i.e. from rail - elrail etc) or change the "global" type (from rail to road etc).
This is task for another patch (of probably another author) :)
Should we add "features" that would block us from doing that, eventually?
I hope the code can be improved to be able to reflect this :|
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by DaleStan »

Gremnon wrote:It can be extended. It would just need an additional button, that's all.
As easily as you could (ie without drawing a new sprite) with the dropdown?

Also, "Without breaking the display on devices that are limited to 640x480?"
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: Track and road types on main toolbar [r14089]

Post by CommanderZ »

That's why I want it to be optional.

Btw, as you can see, I'm using construction sprites, which have to be made anyways.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 18 guests