diff options
author | Peter Nelson <peter1138@openttd.org> | 2021-05-04 00:24:14 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2021-05-08 09:53:55 +0100 |
commit | d8e06e590aff56c837b29ddbba3764292ea08d85 (patch) | |
tree | bb50b42e03d5e61442ce98d63001426c7dadfa56 /src/window.cpp | |
parent | 52b16237ad863ce30746ac7efc46a9ece7e3bdd2 (diff) | |
download | openttd-d8e06e590aff56c837b29ddbba3764292ea08d85.tar.xz |
Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
Similar code is already repeated in other locations.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/window.cpp b/src/window.cpp index d69a34144..3fcda7d42 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2097,10 +2097,7 @@ static void EnsureVisibleCaption(Window *w, int nx, int ny) Rect caption_rect; const NWidgetBase *caption = w->nested_root->GetWidgetOfType(WWT_CAPTION); if (caption != nullptr) { - caption_rect.left = caption->pos_x; - caption_rect.right = caption->pos_x + caption->current_x; - caption_rect.top = caption->pos_y; - caption_rect.bottom = caption->pos_y + caption->current_y; + caption_rect = caption->GetCurrentRect(); /* Make sure the window doesn't leave the screen */ nx = Clamp(nx, MIN_VISIBLE_TITLE_BAR - caption_rect.right, _screen.width - MIN_VISIBLE_TITLE_BAR - caption_rect.left); |