Changeset - r19856:877797b48845
[Not reviewed]
master
0 2 0
frosch - 12 years ago 2012-12-09 16:55:21
frosch@openttd.org
(svn r24811) -Add: Close engine preview window when another client accepts it.
2 files changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -749,6 +749,13 @@ static void AcceptEnginePreview(EngineID
 
	/* Update the toolbar. */
 
	if (e->type == VEH_ROAD) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_ROAD);
 
	if (e->type == VEH_SHIP) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_WATER);
 

	
 
	/* Notify preview window, that it might want to close.
 
	 * Note: We cannot directly close the window.
 
	 *       In singleplayer this function is called from the preview window, so
 
	 *       we have to use the GUI-scope scheduling of InvalidateWindowData.
 
	 */
 
	InvalidateWindowData(WC_ENGINE_PREVIEW, eid);
 
}
 

	
 
/**
src/engine_gui.cpp
Show inline comments
 
@@ -110,6 +110,14 @@ struct EnginePreviewWindow : Window {
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 

	
 
		EngineID engine = this->window_number;
 
		if (Engine::Get(engine)->preview_company != _local_company) delete this;
 
	}
 
};
 

	
 
static const WindowDesc _engine_preview_desc(
0 comments (0 inline, 0 general)