Partial relayout does not make a grid yield more space to its parent grid.
Thus, only firing partial relayout as a result of hiding a widget is *not*
safe.
Fixed by triggering full relayout instead, like the code already does
without --new-widgets.
This appears to be an unused relic from before the animation system was more fleshed out, and doesn't appear
to currently have any purpose, nor is it documented anywhere.
previously listbox::clear() removed all elements one by one.
This was quite ineffective since due to the listbox always-one-element-selected behviour this required calculating which is the next element in this list in the current order. Which then again requires resorting of the whole list since due to the list content change (removal) the order cache is cleared.
this could also fix https://gna.org/bugs/?25504
this also fixed a bug in generator::clear()
Explanations:
- Removed all the redundant constructor initializers
- Don't initialize the color members.
(Otherwise what's the point of it being an optional?)
- Some collapsing of stuff like ? true : false and similar cases
- Use operator* and operator-> instead of get() for optionals
-
I just changed URLs to the wesnoth.org webpages to use https instead of http.
This will make users go directly to the webpages linked, instead of automatically being redirected to the https version by the website.
Should be very slightly better for user experience! 😊
Please note: http://manual.wesnoth.org/ redirects to https://wiki.wesnoth.org/WesnothManual, but https://manual.wesnoth.org/ breaks, so I left it unchanged.
PS: Thank you for making an awesome game!
It turns out that I had misunderstood the purpose of widget::layout_size_.
It's not a cache, it's an override. It's only set for widgets which have
been shrunk or whose sizes have otherwise been changed from the preferred
size.
As a result, commit c4be6a7ec881d74a0d46f3b068053b86bc1c7e17 ended up skipping relayout way too often.
This is pretty hacky and you can see the bars and numbers flicker purple during advancement, so this can be removed if a better way to achieve the same thing is implemented.
although stacked_widget supports similar functionality this is currently
not easily doable from the lua gui2 api. In particular
1) stacked_widget cannot add pages dynamically
2) multi_page can only contain one type of widget.
3) a stacked_widget inside a multi_page is ineffective since it
generates many unused widgets
4) a multi_page inside a stacked_widget is just unhandy to use