Page 1 of 8

[Patch] Improved Build Station GUI [r19159]

Posted: 31 Dec 2008 09:20
by scoz
All hail sbr, the mighty renewer.

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

Image

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 09:35
by Hamilton2007
Does your binarie have daylenght patch?

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 09:36
by CommanderZ
: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 :)

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 10:13
by yorick
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

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 10:21
by scoz
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?

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 10:55
by CommanderZ
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)?

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 11:24
by MJS
Whooo, a cargodest+Itim+this patch+distant_join+daylength would be marvellous!

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 11:50
by Torben DH
MJS wrote:Whooo, a cargodest+Itim+this patch+distant_join+daylength would be marvellous!
X2 i would like that very much indeed

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 11:55
by habell
Image
When will this be in de trunck ;)
Very nice! 8o

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:09
by FooBar
I just have no comment on this patch. It's just great!

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:37
by Hyronymus
FooBar wrote:I just have no comment on this patch. It's just great!
I agree. Oh wait, that is a comment ;).

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:41
by Rubidium
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.

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:46
by Darkvater
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 :)

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:50
by Hamilton2007
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. :)

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 12:55
by CommanderZ
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.

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 14:46
by Rubidium
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.

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 15:38
by Hamilton2007
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:

Re: [Patch] Improved Build Station GUI

Posted: 31 Dec 2008 19:10
by TrainTraveller
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 26762 times
Edit: Perhaps I should note I'm using OpenTTD r14776 with daylength, custom station GUI and custom town count patches.

Re: [Patch] Improved Build Station GUI

Posted: 01 Jan 2009 07:56
by scoz
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)

Re: [Patch] Improved Build Station GUI

Posted: 01 Jan 2009 09:35
by TrainTraveller
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();