Merge branch 'master' into jgrpp
# Conflicts: # src/base_media_func.h # src/cargopacket.h # src/gfxinit.cpp # src/industry_cmd.cpp # src/window_gui.h
This commit is contained in:
@@ -1028,9 +1028,10 @@ void Window::SetDirtyAsBlocks()
|
||||
* Re-initialize a window, and optionally change its size.
|
||||
* @param rx Horizontal resize of the window.
|
||||
* @param ry Vertical resize of the window.
|
||||
* @param reposition If set, reposition the window to default location.
|
||||
* @note For just resizing the window, use #ResizeWindow instead.
|
||||
*/
|
||||
void Window::ReInit(int rx, int ry)
|
||||
void Window::ReInit(int rx, int ry, bool reposition)
|
||||
{
|
||||
this->SetDirtyAsBlocks(); // Mark whole current window as dirty.
|
||||
|
||||
@@ -1057,6 +1058,12 @@ void Window::ReInit(int rx, int ry)
|
||||
if (this->resize.step_width > 1) dx -= dx % (int)this->resize.step_width;
|
||||
if (this->resize.step_height > 1) dy -= dy % (int)this->resize.step_height;
|
||||
|
||||
if (reposition) {
|
||||
Point pt = this->OnInitialPosition(this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
|
||||
this->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
|
||||
this->FindWindowPlacementAndResize(this->window_desc->GetDefaultWidth(), this->window_desc->GetDefaultHeight());
|
||||
}
|
||||
|
||||
ResizeWindow(this, dx, dy);
|
||||
/* ResizeWindow() does this->SetDirty() already, no need to do it again here. */
|
||||
}
|
||||
|
Reference in New Issue
Block a user