Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
477 stars 75 forks source link

Fix button placement in minimized in-game windows #1614

Closed falbrechtskirchinger closed 1 year ago

falbrechtskirchinger commented 1 year ago

As mentioned, I've discovered a bug introduced in 938f355891d #1609. This is a very quick fix. Let me know if you'd prefer to store the full size in IngameWindow and add a GetFullSize() member function, or maybe a different solution entirely.

inventory_buttons

Commit message follows:


Some windows position their buttons based on GetSize().y, which results in incorrect placement if the window is persisted and minimized. Replace uses of GetSize().y with the full window height.

Affected windows:

Flamefire commented 1 year ago

Let me know if you'd prefer to store the full size in IngameWindow and add a GetFullSize() member function, or maybe a different solution entirely.

Sounds more reasonable to me as it has less constants floating around. That member function looks easy to implement too: combine iwHeight and contentOffset + contentOffsetEnd similar to what is done (in reverse) in https://github.com/Return-To-The-Roots/s25client/blob/master/libs/s25main/ingameWindows/IngameWindow.cpp#L89C20-L89C29