[Patch] Improved Build Station GUI [r19159]

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
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Vaulter »

Here patch against 1.0.2 + some additions
Thanks for such good stuff!
1.0.2-station-build.png
(216.15 KiB) Not downloaded yet
Attachments
station-build-gui_v6.2.r20167.patch
Patch against 1.0.2
(37.01 KiB) Downloaded 103 times

maquinista
Tycoon
Tycoon
Posts: 1812
Joined: 10 Jul 2006 00:43
Location: Spain

Re: [Patch] Improved Build Station GUI [r19159]

Post by maquinista »

Thanks. It looks nice, but I see a problem: There are a empty space in the buttons, and tall sprites are cut. If the sprites are drawn 25 pixels down, most of them would fit in the space.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]

User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Ammler »

maquinista wrote:Thanks. It looks nice, but I see a problem: There are a empty space in the buttons, and tall sprites are cut. If the sprites are drawn 25 pixels down, most of them would fit in the space.
Be aware that the patch from Vaulter is just a backport to 1.0.2, the trunk patch from sbr doesn't have this glitch:
Image

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2658
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: [Patch] Improved Build Station GUI [r19159]

Post by ChillCore »

Hello scoz,

Attached is the patch (by sbr) updated to current trunk.

I have added the needed lines and code changes to make the patch work in current trunk.
Also I have unified the breaks in "case ...:" with the recent trunk change and I have added a few accolades that were missing in trunk (see line 366 in the patch for an example)
Also I have added 1 todo which is not a really a todo but a to check if I did it correctly.
Otherwise no changes have been made and functionality is the same as before.

ps:
Vaulter, changing the possible number of tracks to build or max lenght in one go is something for a separate patch. ;)
Attachments
station-build-gui_v6.3-r20527.diff
(41.13 KiB) Downloaded 87 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] Improved Build Station GUI [r19159]

Post by Alberth »

ChillCore wrote:.... and I have added a few accolades that were missing in trunk (see line 366 in the patch for an example)
Just to clear this up, those curly brackets are not missing.

The aim in trunk is not to add curly brackets everywhere, but only when needed, ie when a local variable is defined inside a case.

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2658
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: [Patch] Improved Build Station GUI [r19159]

Post by ChillCore »

Alberth wrote: The aim in trunk is not to add curly brackets everywhere, but only when needed, ie when a local variable is defined inside a case.
I see. Thank you for the clarification Alberth.
Attached patch removes the unneeded curly braces I added to trunk outside the patch.
I have not yet looked at the rest of the code to see if some more could/should be removed.
Attachments
station-build-gui_v6.3.1-r20566.diff
(40.11 KiB) Downloaded 108 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: [Patch] Improved Build Station GUI [r19159]

Post by Terkhen »

After discussing this feature for a while, we have two suggestions to make.

The first one is somewhat complicated. Waypoints are basically the same thing than stations, and as a result their building window could also benefit from some of the features introduced by this patch. Because of this, the build waypoint window should be merged into the build station window as additional prerrequisite patches, and after that it would be trivial for both waypoints and station to use the new features. In the following screenshot, the suggested build waypoint window would only use the right part of the current build station window.

Image

Codewise, both windows could share the same code but use different NWidgetPart arrays during creation (as done for the vehicle details window). Using NWID_SELECTION is a possibility too.

About the station name, we think that it should be shown more clearly. A possibility could be displaying the name of the currently selected station under the matrix. This also has the advantage of being in the part of the window that waypoints would need to use.

Before reaching these conclusions, I updated the three parts and fixed a few issues with 02 (the most important being that OpenTTD would crash if the station class dropdown was down and a station NewGRF was removed). IMO these three patches are ready for trunk inclusion, but I have not commited them just in case they need to be reworked because of the waypoint window unification. They can be found here.

User avatar
sbr
Engineer
Engineer
Posts: 13
Joined: 13 Apr 2008 18:35

Re: [Patch] Improved Build Station GUI [r19159]

Post by sbr »

An update against r21062:
  • Show station name under the station class matrix.
  • Move station type matrix code inside a separate widget.
  • Use this widget to display waypoints in their window.
  • Make the waypoint window support NewGRF reloading, resizable and able to restore its previous size.
Attachments
rail station and waypoint windows
rail station and waypoint windows
buildrailstation-waypointwindow.png (44.23 KiB) Viewed 3923 times
station-build-gui_v7.0-hg-fa663195a4db_small-patches.tar
against r21062, small patches, for '-p1' users
(120 KiB) Downloaded 113 times
station-build-gui_v7.0-r21062.patch
for subversion users, with all the files included
(59.06 KiB) Downloaded 80 times
Last edited by sbr on 16 Nov 2010 04:11, edited 1 time in total.

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: [Patch] Improved Build Station GUI [r19159]

Post by Kogut »

Nice!
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2367
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Lord Aro »

i love itwhen some random newbie (no offense) coder appears with an updated patch...
Nice work!
Hope this makes trunk soon...
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra

Dante123
Chief Executive
Chief Executive
Posts: 670
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Dante123 »

would be great to have this default in Ottd :wink: (and for the NewObjects too :wink: )

User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 621
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by glx »

sbr wrote:An update against r21062:
  • Show station name under the station class matrix.
  • Move station type matrix code inside a separate widget.
  • Use this widget to display waypoints in their window.
  • Make the waypoint window support NewGRF reloading, resizable and able to restore its previous size.
You forgot to svn add the new file, so it's not in the diff.

User avatar
sbr
Engineer
Engineer
Posts: 13
Joined: 13 Apr 2008 18:35

Re: [Patch] Improved Build Station GUI [r19159]

Post by sbr »

I should have better check the svn diff. Attached is, hopefully, the correct patch file (the previous post is also updated).

There is still a lot of things to clean up to properly merge the BuildWaypoint and BuildRailStation windows. That patch present a way to do it even if far from perfect. Thanks for reviewing it.
Attachments
station-build-gui_v7.0-r21062.patch
for subversion users
(59.06 KiB) Downloaded 147 times

Dante123
Chief Executive
Chief Executive
Posts: 670
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Dante123 »

any chance this patch will ever make it to trunk ? seems to me (as just a plain user) far better than the current one in very way.
but dont know about any other clashes in code that i dont notice as just that plain user.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] Improved Build Station GUI [r19159]

Post by Alberth »

Dante123 wrote:any chance this patch will ever make it to trunk ? seems to me (as just a plain user) far better than the current one in very way.
Yeah, selecting a picture is way nicer.

The matrix widget file is still not added (station-build-gui_v7.0-r21062.patch).
In addition, I wonder about airports.
Having them for other buildable things may be nice too, but I don't know whether there are any graphics for them (at least industries don't iirc).

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: [Patch] Improved Build Station GUI [r19159]

Post by Terkhen »

I think that it could also be used for newobjects.

Dante123
Chief Executive
Chief Executive
Posts: 670
Joined: 11 Aug 2009 16:10
Location: The Nederlands
Contact:

Re: [Patch] Improved Build Station GUI [r19159]

Post by Dante123 »

Terkhen wrote:I think that it could also be used for newobjects.
for that it would be extremely usefull.
for example new graphics need 1 line of text for each view in in the current way. think of a newgrf that will add sound barrier graphics as new-objects, you end up with huge lists of text where you cant find back the graphics you want i guess.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] Improved Build Station GUI [r19159]

Post by Alberth »

I downloaded a few other patch versions, and found the widgets/station_type_matrix.cpp file. It appears to be very special purpose for station previewing.
The widget needs to be generalized first before being able to use it in an other context.

Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: [Patch] Improved Build Station GUI [r19159]

Post by Timmaexx »

8) Some parts of this Patch are now in trunk! :D
Thank you for your Ideas!

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] Improved Build Station GUI [r19159]

Post by Alberth »

Timmaexx wrote:8) Some parts of this Patch are now in trunk! :D
Thank you for your Ideas!
Although I build the patch from scratch using the new NWidgetMatrix widget, I indeed used a lot of the ideas expressed here.

Thank you for your efforts.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests