changeset 14062:9103e248263f draft

(svn r18605) -Codechange: Coding style fixes, prevent useless calls to UpdateWidgetSize().
author alberth <alberth@openttd.org>
date Tue, 22 Dec 2009 19:40:23 +0000
parents 2d6fe02f34f1
children 4eb2be463cc4
files src/company_gui.cpp src/order_gui.cpp src/widget.cpp
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -392,7 +392,7 @@
 	 */
 	void SetupWidgets()
 	{
-		int plane = small ? STACKED_SELECTION_ZERO_SIZE : 0;
+		int plane = this->small ? STACKED_SELECTION_ZERO_SIZE : 0;
 		this->GetWidget<NWidgetStacked>(CFW_SEL_PANEL)->SetDisplayedPlane(plane);
 		this->GetWidget<NWidgetStacked>(CFW_SEL_MAXLOAN)->SetDisplayedPlane(plane);
 
@@ -404,7 +404,7 @@
 	virtual void OnPaint()
 	{
 		if (!this->IsShaded()) {
-			if (!small) {
+			if (!this->small) {
 				/* Check that the expenses panel height matches the height needed for the layout. */
 				int type = _settings_client.gui.expenses_layout;
 				if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) {
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1057,7 +1057,7 @@
 				break;
 
 			case ORDER_WIDGET_NON_STOP:
-				if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
+				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 					this->OrderClick_Nonstop(-1);
 				} else {
 					const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
@@ -1067,7 +1067,7 @@
 				break;
 
 			case ORDER_WIDGET_GOTO:
-				if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
+				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 					this->OrderClick_Goto(0);
 				} else {
 					ShowDropDownMenu(this, this->vehicle->type == VEH_AIRCRAFT ? _order_goto_dropdown_aircraft : _order_goto_dropdown, 0, ORDER_WIDGET_GOTO, 0, 0);
@@ -1075,7 +1075,7 @@
 				break;
 
 			case ORDER_WIDGET_FULL_LOAD:
-				if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
+				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 					this->OrderClick_FullLoad(-1);
 				} else {
 					ShowDropDownMenu(this, _order_full_load_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetLoadType(), ORDER_WIDGET_FULL_LOAD, 0, 2);
@@ -1083,7 +1083,7 @@
 				break;
 
 			case ORDER_WIDGET_UNLOAD:
-				if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
+				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 					this->OrderClick_Unload(-1);
 				} else {
 					ShowDropDownMenu(this, _order_unload_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetUnloadType(), ORDER_WIDGET_UNLOAD, 0, 8);
@@ -1095,7 +1095,7 @@
 				break;
 
 			case ORDER_WIDGET_SERVICE:
-				if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
+				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 					this->OrderClick_Service(-1);
 				} else {
 					ShowDropDownMenu(this, _order_depot_action_dropdown, DepotActionStringIndex(this->vehicle->GetOrder(this->OrderGetSel())), ORDER_WIDGET_SERVICE, 0, 0);
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -971,7 +971,7 @@
 		Dimension fill = {0, 0};
 		Dimension resize = {0, 0};
 		/* Here we're primarily interested in the value of resize */
-		w->UpdateWidgetSize(this->index, &size, padding, &fill, &resize);
+		if (this->index >= 0) w->UpdateWidgetSize(this->index, &size, padding, &fill, &resize);
 
 		this->smallest_x = size.width;
 		this->smallest_y = size.height;