changeset 12380:4be044af31ec draft

(svn r16809) -Fix [FS#3021](r13096): automatic resizing of SelectCompanyLiveryWindow wasn't working as expected
author smatz <smatz@openttd.org>
date Mon, 13 Jul 2009 12:00:56 +0000
parents a93218f2ff6f
children 2fcd8c254149
files src/company_gui.cpp src/saveload/afterload.cpp
diffstat 2 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -559,7 +559,7 @@
 		this->livery_class = LC_OTHER;
 		this->sel = 1;
 		this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL);
-		this->OnInvalidateData(_loaded_newgrf_features.has_2CC);
+		this->OnInvalidateData();
 		this->FindWindowPlacementAndResize(desc);
 	}
 
@@ -692,14 +692,8 @@
 
 	virtual void OnInvalidateData(int data = 0)
 	{
-		static bool has2cc = true;
-
-		if (has2cc == !!data) return;
-
-		has2cc = !!data;
-
-		int r = this->widget[has2cc ? SCLW_WIDGET_SEC_COL_DROPDOWN : SCLW_WIDGET_PRI_COL_DROPDOWN].right;
-		this->SetWidgetHiddenState(SCLW_WIDGET_SEC_COL_DROPDOWN, !has2cc);
+		int r = this->widget[_loaded_newgrf_features.has_2CC ? SCLW_WIDGET_SEC_COL_DROPDOWN : SCLW_WIDGET_PRI_COL_DROPDOWN].right;
+		this->SetWidgetHiddenState(SCLW_WIDGET_SEC_COL_DROPDOWN, !_loaded_newgrf_features.has_2CC);
 		this->widget[SCLW_WIDGET_CAPTION].right = r;
 		this->widget[SCLW_WIDGET_SPACER_CLASS].right = r;
 		this->widget[SCLW_WIDGET_MATRIX].right = r;
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1987,7 +1987,7 @@
 	/* Check and update house and town values */
 	UpdateHousesAndTowns();
 	/* Update livery selection windows */
-	for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) InvalidateWindowData(WC_COMPANY_COLOUR, i, _loaded_newgrf_features.has_2CC);
+	for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) InvalidateWindowData(WC_COMPANY_COLOUR, i);
 	/* redraw the whole screen */
 	MarkWholeScreenDirty();
 	CheckTrainsLengths();