[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

Post Reply
scoz
Engineer
Engineer
Posts: 19
Joined: 21 Dec 2008 09:22

[Patch] Improved Build Station GUI [r19159]

Post by scoz » 31 Dec 2008 09:20

All hail sbr, the mighty renewer.

Check:
https://www.tt-forums.net/viewtopic.php?p=864002#p864002
For an awesome updated version.

Image
Last edited by scoz on 12 Mar 2010 18:58, edited 14 times in total.

User avatar
Hamilton2007
Transport Coordinator
Transport Coordinator
Posts: 289
Joined: 16 Nov 2008 10:57
Location: Belgium

Re: [Patch] Improved Build Station GUI

Post by Hamilton2007 » 31 Dec 2008 09:35

Does your binarie have daylenght patch?

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

Re: [Patch] Improved Build Station GUI

Post by CommanderZ » 31 Dec 2008 09:36

:shock: Why didn't anyone make this sooner? It is now so obvious, how user un-friendly the default station UI is...

And congratulations to a very nice start on TT-forums :)

EDIT: Is the window resizeable? it would be very nice if it was :)

yorick
Engineer
Engineer
Posts: 80
Joined: 23 Mar 2008 08:53

Re: [Patch] Improved Build Station GUI

Post by yorick » 31 Dec 2008 10:13

If the window could be made resizable, could you make it so that the dropdown list risizes, so that one could read the whole text :p

scoz
Engineer
Engineer
Posts: 19
Joined: 21 Dec 2008 09:22

Re: [Patch] Improved Build Station GUI

Post by scoz » 31 Dec 2008 10:21

CommanderZ wrote:EDIT: Is the window resizeable? it would be very nice if it was :)
Resizeable as in the more width added more station buttons would appear, and more height adds station buttons and station classes as well?

I'll add that to my list(which is very small, so I'll work on it soon :p) but I don't know how doable it would be 'hmmm
My first guess is there's no easy way to add/remove widgets runtime(currently the station buttons are each their own box that can be raise/lowered) so to keep the nice buttony look I'd probably have to create a max size and just hide the widgets until the window is big enough to show them. If you could help me find a window that uses actual separate widgets and add/removes em or if you know how I could definitely do it this way.

Or other idea would be to use a matrix for the buttony look, and just draw a white line around the station when its selected maybe. I could look at the code from the company vehicle window as far as changing the divisions in the matrix.

Or somebody could point me towards another solution :p My grasp of this windowing system is almost nil, so much room for more knowledge and ideas.

<Post added edit>

That would be another idea, to just let the list resize and keep the bits below the list just centered or something. Or I could reshuffle it in to a bit more width friendly default layout.

Hamilton2007 wrote:Does your binarie have daylenght patch?
Made myself a note. Just trunk+daylength or cargodest+daylength? Or should I post the builds I use which is cargodest+daylength+ITiM+distant_join? :p

Anybody know if the only things I need to include are the exe and english lang file?
Last edited by scoz on 31 Dec 2008 10:26, edited 1 time in total.

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

Re: [Patch] Improved Build Station GUI

Post by CommanderZ » 31 Dec 2008 10:55

Resizeable as in the more width added more station buttons would appear, and more height adds station buttons and station classes as well?
Exactly
Anybody know if the only things I need to include are the exe and english lang file?
You should include everything from the /bin folder from the source package and your openttd.exe, the strgen.exe is not necessary. If you have modified strings, ithen it is of course not necessary to provide obsolete language files you didn't adjust to your changes. If you don't provide the /data directory, then anyone who wants to try your mod needs to download the nightly too and use its /data.

Btw, does your GUI show the names of the station tiles somewhere (as tooltips or so)?

MJS
Director
Director
Posts: 539
Joined: 28 Jul 2005 09:31

Re: [Patch] Improved Build Station GUI

Post by MJS » 31 Dec 2008 11:24

Whooo, a cargodest+Itim+this patch+distant_join+daylength would be marvellous!

User avatar
Torben DH
Transport Coordinator
Transport Coordinator
Posts: 290
Joined: 31 Dec 2004 09:09
Location: Denmark

Re: [Patch] Improved Build Station GUI

Post by Torben DH » 31 Dec 2008 11:50

MJS wrote:Whooo, a cargodest+Itim+this patch+distant_join+daylength would be marvellous!
X2 i would like that very much indeed
TDH

User avatar
habell
Transport Coordinator
Transport Coordinator
Posts: 374
Joined: 04 Mar 2004 12:47
Location: Veenendaal, The Netherlands

Re: [Patch] Improved Build Station GUI

Post by habell » 31 Dec 2008 11:55

Image
When will this be in de trunck ;)
Very nice! 8o

User avatar
FooBar
Tycoon
Tycoon
Posts: 6559
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [Patch] Improved Build Station GUI

Post by FooBar » 31 Dec 2008 12:09

I just have no comment on this patch. It's just great!

User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13188
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: [Patch] Improved Build Station GUI

Post by Hyronymus » 31 Dec 2008 12:37

FooBar wrote:I just have no comment on this patch. It's just great!
I agree. Oh wait, that is a comment ;).

Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: [Patch] Improved Build Station GUI

Post by Rubidium » 31 Dec 2008 12:41

You can, at runtime, add widgets to a window. Window::widgets contains a malloced array of widgets and when you realloc it and add stuff to the end and redraw the window it should "just" work assuming you're adding the widgets with the right size/location.

Furthermore I suggest that you do not create binaries with other patches than your own applied as it'll only cause incompatible clients/servers when someone compiles your patch and when someone uses your build, which makes properly testing harder.

User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Re: [Patch] Improved Build Station GUI

Post by Darkvater » 31 Dec 2008 12:46

I concur :bow:

However do you have a screenshot when using the 'default station' or station layouts that don't have many choices?
Adding resizing is easy, but since window sizes aren't remembered it's pretty useless imho. However extending this functionality to Road/Air and Docks would be desirable if the GUI isn't unified already (don't know).

Someone should commit this :)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."

User avatar
Hamilton2007
Transport Coordinator
Transport Coordinator
Posts: 289
Joined: 16 Nov 2008 10:57
Location: Belgium

Re: [Patch] Improved Build Station GUI

Post by Hamilton2007 » 31 Dec 2008 12:50

Rubidium wrote: Furthermore I suggest that you do not create binaries with other patches than your own applied as it'll only cause incompatible clients/servers when someone compiles your patch and when someone uses your build, which makes properly testing harder.
I don't understand exactly what you are saying, but i mean, the russian patchpack works perfect. :)

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

Re: [Patch] Improved Build Station GUI

Post by CommanderZ » 31 Dec 2008 12:55

Adding resizing is easy, but since window sizes aren't remembered it's pretty useless imho.
It is not useless. Imagine you want to build a large station. You could resize the window alongside left or right side of the screen, so all the station tiles (and station tile categories) would fit there, so scrolling would be unnecessary. This way you could build the stations effectively and it would be a lot more fun than now.

Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: [Patch] Improved Build Station GUI

Post by Rubidium » 31 Dec 2008 14:46

Hamilton2007 wrote:I don't understand exactly what you are saying, but i mean, the russian patchpack works perfect. :)
Any idea how many people complain about bugs in modified builds in the official bug DB? And how useless their savegames are for us as we can't open them? And how unlikely it is for us to hunt for bugs in an old modification of trunk? Not to mention people already complaining that the latest ECS doesn't work in their Russian patchpack.

User avatar
Hamilton2007
Transport Coordinator
Transport Coordinator
Posts: 289
Joined: 16 Nov 2008 10:57
Location: Belgium

Re: [Patch] Improved Build Station GUI

Post by Hamilton2007 » 31 Dec 2008 15:38

Rubidium wrote:
Hamilton2007 wrote:I don't understand exactly what you are saying, but i mean, the russian patchpack works perfect. :)
Any idea how many people complain about bugs in modified builds in the official bug DB? And how useless their savegames are for us as we can't open them? And how unlikely it is for us to hunt for bugs in an old modification of trunk? Not to mention people already complaining that the latest ECS doesn't work in their Russian patchpack.
Now i understand you :lol:

I rest my case :wink:

TrainTraveller
Engineer
Engineer
Posts: 6
Joined: 31 Dec 2008 19:00

Re: [Patch] Improved Build Station GUI

Post by TrainTraveller » 31 Dec 2008 19:10

Great patch! However, I've found a problem with the list of station types. After just starting the game the list is fine (every entry is shown once), but every time the station window is reopened, entries for all station types are added again. (So first there are 10 entries, upon opening it a second time those 10 are there now twice, etc.)
You seem to be assuming _railstation.station_classes and _railstation.station_class_count are reset each time BuildRailStationWindow is called, but they are not. I've hackishly fixed it in my local copy by doing:

Code: Select all

if ( _railstation.station_class_count == 0)
before your for loop (around line 1026 of rail_gui.cpp), but I don't think that's actually the right way to fix it :-)

Also, the help text is wrong ('waypoint' should probably be 'station') :) Both problems can be seen in the screenshot:
station_gui_bugs.png
two bugs in station gui
station_gui_bugs.png (22.82 KiB) Viewed 26763 times
Edit: Perhaps I should note I'm using OpenTTD r14776 with daylength, custom station GUI and custom town count patches.

scoz
Engineer
Engineer
Posts: 19
Joined: 21 Dec 2008 09:22

Re: [Patch] Improved Build Station GUI

Post by scoz » 01 Jan 2009 07:56

Fixed bug found by TrainTraveller(thanks!) and it now recreates the list every time the window is opened(incase you add/remove newgrfs during the game or something?).

Station choice button tooltips are now the station tile name's. They have somewhat of a bug though, the strings provided in the newgrfs don't often have a {BLACK}(and/or they have another color) so the tooltip text shows up in some interesting colors sometimes :p (Seems to be pink/black/white for me) Is there a function out here for adding these color tags?
Rubidium wrote:You can, at runtime, add widgets to a window. Window::widgets contains a malloced array of widgets and when you realloc it and add stuff to the end and redraw the window it should "just" work assuming you're adding the widgets with the right size/location.
How did I not see that <_> That makes things quite a bit easier.[/quote]

Anyways my plans for the next version are to make it resizeable(more station tiles) and reorganize the left part of the window to be a bit wider so the longer station class names can be seen. I'm hoping to have it done by the end of this coming weekend but it might get pushed till mid next-week(Classes start up again monday)

Updated .patch and screenshot(shows a station class with less than 10 stations) available in first post. No binary as the attachment limit is 4megz and the nightly is larger then that now it seems(at least using winzip compatible compression)

TrainTraveller
Engineer
Engineer
Posts: 6
Joined: 31 Dec 2008 19:00

Re: [Patch] Improved Build Station GUI

Post by TrainTraveller » 01 Jan 2009 09:35

scoz wrote:Fixed bug found by TrainTraveller(thanks!) and it now recreates the list every time the window is opened(incase you add/remove newgrfs during the game or something?).
Nice, thanks :-)
Any particular reason you are using:

Code: Select all

_railstation.station_classes.erase(_railstation.station_classes.begin(), _railstation.station_classes.end());
Instead of just:

Code: Select all

_railstation.station_classes.clear();

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests