summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-05-04 18:40:37 +0000
committeralberth <alberth@openttd.org>2009-05-04 18:40:37 +0000
commitefde51e4523b4e74f16b43579d7894ac3387dab0 (patch)
treec7f131ac0170f75f3d8d8ee075786d6b513708f5 /src/window.cpp
parentd953f3e4c79cd4bda9297d721e64d8579ece5425 (diff)
downloadopenttd-efde51e4523b4e74f16b43579d7894ac3387dab0.tar.xz
(svn r16226) -Codechange: Separating generation of a widget array from WindowDesc to the InitializeWidgetArrayFromNestedWidgets function.
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 22cae5e84..fa56189a5 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -75,28 +75,9 @@ WindowDesc::WindowDesc(int16 left, int16 top, int16 min_width, int16 min_height,
/** Get widget array of the window description. */
const Widget *WindowDesc::GetWidgets() const
{
- const bool rtl = false; // Direction of the language is left-to-right
-
- /* If nested widgets are present, convert them to a widget array. */
- if (this->nwid_parts != NULL && nwid_length > 0 && this->new_widgets == NULL) {
- NWidgetContainer *nwid = MakeNWidgets(this->nwid_parts, this->nwid_length);
- this->new_widgets = InitializeNWidgets(nwid, rtl);
-
- if (!rtl && this->widgets != NULL) {
- /* There are two descriptions, compare them.
- * Comparing only makes sense when using a left-to-right language.
- */
- bool ok = CompareWidgetArrays(this->widgets, this->new_widgets, false);
- if (ok) {
- DEBUG(misc, 1, "Nested widgets are equal, min-size(%u, %u)", nwid->min_x, nwid->min_y);
- } else {
- DEBUG(misc, 0, "Nested widgets give different results");
- CompareWidgetArrays(this->widgets, this->new_widgets, true);
- }
- }
- delete nwid;
+ if (this->nwid_parts != NULL) {
+ InitializeWidgetArrayFromNestedWidgets(this->nwid_parts, this->nwid_length, this->widgets, &this->new_widgets);
}
-
const Widget *wids = (this->new_widgets != NULL) ? this->new_widgets : this->widgets;
assert(wids != NULL);
return wids;