diff -r 644d0835a358 src/widget.cpp --- a/src/widget.cpp Sat Mar 07 19:40:36 2009 +0100 +++ b/src/widget.cpp Sun Mar 15 09:51:54 2009 +0100 @@ -1280,6 +1280,9 @@ this->SetResize(0, 0); switch (tp) { + case WWT_EMPTY: + break; + case WWT_PUSHBTN: this->SetFill(false, false); break; @@ -1395,35 +1398,41 @@ */ bool CompareWidgetArrays(const Widget *orig, const Widget *gen, bool report) { +#define CHECK(var, prn) \ + if (ow->var != gw->var) { \ + same = false; \ + if (report) DEBUG(misc, 1, "index %d, \"" #var "\" field: original " prn ", generated " prn, idx, ow->var, gw->var); \ + } +#define CHECK_COORD(var) \ + if (ow->var != gw->var) { \ + same = false; \ + if (report) DEBUG(misc, 1, "index %d, \"" #var "\" field: original %d, generated %d, (difference %d)", idx, ow->var, gw->var, ow->var - gw->var); \ + } + int idx = 0; bool same = true; - for(;;) { const Widget *ow = orig + idx; const Widget *gw = gen + idx; -#define CHECK(var, prn) \ - if (ow->var != gw->var) { \ - same = false; \ - if (report) DEBUG(misc, 1, "index %d, \"" #var "\" field: orig " prn ", gen " prn "\n", idx, ow->var, gw->var); \ - } CHECK(type, "%d") CHECK(display_flags, "0x%x") CHECK(colour, "%d") - CHECK(left, "%d") - CHECK(right, "%d") - CHECK(top, "%d") - CHECK(bottom, "%d") + CHECK_COORD(left) + CHECK_COORD(right) + CHECK_COORD(top) + CHECK_COORD(bottom) CHECK(data, "%u") CHECK(tooltips, "%u") -#undef CHECK if (ow->type == WWT_LAST || gw->type == WWT_LAST) break; - idx++; } return same; + +#undef CHECK +#undef CHECK_COORD } /* == Conversion code from NWidgetPart array to NWidgetBase* tree == */ diff -r 644d0835a358 src/window.cpp --- a/src/window.cpp Sat Mar 07 19:40:36 2009 +0100 +++ b/src/window.cpp Sun Mar 15 09:51:54 2009 +0100 @@ -81,24 +81,24 @@ NWidgetContainer *nwid = MakeNWidgets(this->nwid_parts, this->nwid_length); this->new_widgets = InitializeNWidgets(nwid, RTL); delete nwid; - } - if (!RTL && this->widgets != NULL && this->new_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"); - } else { - DEBUG(misc, 0, "Nested widgets give different results"); - CompareWidgetArrays(this->widgets, this->new_widgets, true); + 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"); + } else { + DEBUG(misc, 0, "Nested widgets give different results"); + CompareWidgetArrays(this->widgets, this->new_widgets, true); + } } } - const Widget *widgets = (this->widgets != NULL) ? this->widgets : this->new_widgets; - assert(widgets != NULL); - return widgets; + const Widget *wids = (this->widgets != NULL) ? this->widgets : this->new_widgets; + assert(wids != NULL); + return wids; } WindowDesc::~WindowDesc()