changeset 15548:4cff8c4bcc67 draft

(svn r20207) -Codechange: Move variable declaration to first use.
author alberth <alberth@openttd.org>
date Fri, 23 Jul 2010 18:40:39 +0000
parents d2079303e220
children 79711faf7037
files src/industry_gui.cpp
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -759,11 +759,9 @@
 
 	virtual void OnClick(Point pt, int widget, int click_count)
 	{
-		Industry *i;
-
 		switch (widget) {
 			case IVW_INFO: {
-				i = Industry::Get(this->window_number);
+				Industry *i = Industry::Get(this->window_number);
 
 				/* We should work if needed.. */
 				if (!IsProductionAlterable(i)) return;
@@ -799,14 +797,15 @@
 				}
 			} break;
 
-			case IVW_GOTO:
-				i = Industry::Get(this->window_number);
+			case IVW_GOTO: {
+				Industry *i = Industry::Get(this->window_number);
 				if (_ctrl_pressed) {
 					ShowExtraViewPortWindow(i->location.tile + TileDiffXY(1, 1));
 				} else {
 					ScrollMainWindowToTile(i->location.tile + TileDiffXY(1, 1));
 				}
 				break;
+			}
 		}
 	}