summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-11-14 09:58:52 +0000
committeralberth <alberth@openttd.org>2009-11-14 09:58:52 +0000
commit94261ad01a1ebb5e19fcf37c3e623a0676b2c967 (patch)
treec7beaceec5c994c7411249dc54960aac1baefb6f /src
parent4d84dbb26b5dff5177fd5c6c60398d4748f2ece8 (diff)
downloadopenttd-94261ad01a1ebb5e19fcf37c3e623a0676b2c967.tar.xz
(svn r18069) -Codechange: Initialize window flags at the same tme as the other fields instead of afterwards.
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp10
-rw-r--r--src/window_gui.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 30ce10192..0a1de820f 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -915,11 +915,12 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget)
* @param cls Class of the window, used for identification and grouping. @see WindowClass
* @param *widget Pointer to the widget array, it is \c NULL when nested widgets are used. @see Widget
* @param window_number Number being assigned to the new window
+ * @param desc_flags Window flags. @see WindowDefaultFlag
* @return Window pointer of the newly created window
* @pre If nested widgets are used (\a widget is \c NULL), #nested_root and #nested_array_size must be initialized.
* In addition, #nested_array is either \c NULL, or already initialized.
*/
-void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number)
+void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number, uint32 desc_flags)
{
/* Set up window properties; some of them are needed to set up smallest size below */
this->window_class = cls;
@@ -928,6 +929,7 @@ void Window::InitializeData(WindowClass cls, const Widget *widget, int window_nu
this->focused_widget = NULL;
this->nested_focus = NULL;
this->window_number = window_number;
+ this->desc_flags = desc_flags;
/* If available, initialize nested widget tree. */
if (widget == NULL) {
@@ -1312,8 +1314,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
*/
Window::Window(const WindowDesc *desc, WindowNumber window_number)
{
- this->InitializeData(desc->cls, desc->GetWidgets(), window_number);
- this->desc_flags = desc->flags;
+ this->InitializeData(desc->cls, desc->GetWidgets(), window_number, desc->flags);
Point pt = LocalGetWindowPlacement(desc, desc->minimum_width, desc->minimum_height, window_number);
this->InitializePositionSize(pt.x, pt.y, desc->minimum_width, desc->minimum_height);
}
@@ -1346,8 +1347,7 @@ void Window::CreateNestedTree(const WindowDesc *desc, bool fill_nested)
*/
void Window::FinishInitNested(const WindowDesc *desc, WindowNumber window_number)
{
- this->InitializeData(desc->cls, NULL, window_number);
- this->desc_flags = desc->flags;
+ this->InitializeData(desc->cls, NULL, window_number, desc->flags);
Point pt = this->OnInitialPosition(desc, 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(desc->default_width, desc->default_height);
diff --git a/src/window_gui.h b/src/window_gui.h
index 57fcd5a02..0a529fffe 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -335,7 +335,7 @@ struct Window : ZeroedMemoryAllocator {
};
protected:
- void InitializeData(WindowClass cls, const Widget *widget, int window_number);
+ void InitializeData(WindowClass cls, const Widget *widget, int window_number, uint32 desc_flags);
void InitializePositionSize(int x, int y, int min_width, int min_height);
void FindWindowPlacementAndResize(int def_width, int def_height);
void FindWindowPlacementAndResize(const WindowDesc *desc);