changeset 15748:005b55dc4596 draft

(svn r20415) -Add: Clicking at the smallmap disables updates from the industry chain window.
author alberth <alberth@openttd.org>
date Sun, 08 Aug 2010 11:21:24 +0000
parents 1bfed1663ec4
children 7dfa31c5e2bb
files src/industry_gui.cpp src/smallmap_gui.cpp
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -2281,11 +2281,21 @@
 	}
 
 	/**
-	 * Notify the window to display another industry type.
-	 * @param data The new industry type to display.
+	 * Notify the window about external events.
+	 * - data = 0 .. NUM_INDUSTRYTYPES - 1: Display the chain around the given industry.
+	 * - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window.
+	 * @param data The event.
 	 */
 	virtual void OnInvalidateData(int data)
 	{
+		if (data == NUM_INDUSTRYTYPES) {
+			if (this->IsWidgetLowered(ICW_NOTIFY)) {
+				this->RaiseWidget(ICW_NOTIFY);
+				this->SetWidgetDirty(ICW_NOTIFY);
+			}
+			return;
+		}
+
 		assert(data >= 0 && data < NUM_INDUSTRYTYPES);
 		this->ComputeIndustryDisplay(data);
 	}
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1154,6 +1154,9 @@
 
 	virtual void OnClick(Point pt, int widget, int click_count)
 	{
+		/* User clicked something, notify the industry chain window to stop sending newly selected industries. */
+		InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
+
 		switch (widget) {
 			case SM_WIDGET_MAP: { // Map window
 				/*