Use the "Forum Search"
It may help you to find anything in the forum ;).

Large convoi (and other lists) almost unresizable

Started by prissi, November 25, 2020, 01:05:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Opening a convoi list with many entries (like the yoshi testgame) freezes the game a long time and makes window resizing almost impossible. I tried chacing of get_min_size and get_max_size of but without luck. Still for every resizing the container calculates for each convoi again get_min_size (seen by calling gui_convoi_images_t::get_min_size()) and ignopres the overridden get_min_size().

I admid, I am confused why this happens and gave up. Any hint are greatlz appreciated.


This is how it is implemented :/ gui_aligned_container_t::set_size calls get_min/max_size for all children, then set_size for all. If one of these children is another container, then its children get multiple get_min/max_size calls. Nothing is cached. I think one can implement some caching at least for one call to window resizing. I will try.

It seems to be exceptionally worse for these convoi-images. They are at level 4 of nested tables, so one call to window-resize will process each convoi-image object several times.

Which overridden get_min_size are ignored?
Parsley, sage, rosemary, and maggikraut.


Did some small changes in r9442 & 9443. Still the problem with these large lists persists.
Parsley, sage, rosemary, and maggikraut.


Unfortunately, with these cahnges the modal pak set selector at the beginning does no longer show up and simutrans freezes.

Maybe a gui_aligned_container_t should cache its min/max size unless there was a draw or an add/remove component call. Because the five tabs in the convoi list have all the same container but it seems that it is called five times when resizing. This of course implies to remove the const from all get_min_size() calls.

Or at least teh scrollpane should cache the minimum size before each draw event. Now even updating the slider seems to call the scrollpane in all tabs.


Pak-selector is fixed in r9448, calls to duplicate components are caught in r9449.  Still the list is not as reactive as it should be. Edit: with optimized build it is acceptable.

What do you mean with "Now even updating the slider seems to call the scrollpane in all tabs." ?

I tried caching some stuff within gui_aligned_container, but it did not work. Scrolled lists appeared empty.
Parsley, sage, rosemary, and maggikraut.


Ok, heavy EDIT!

I tried also some caching. I noticed that during one resize event before the next draw the gui_scrollpane_t::set_size is called 20x times, but only 4 times after your optimisation. I think you did a good job already.

I noticed, clicking on the resize button (but not resizing) enlarged the convoi to the max width (seen by the loading bar).