Changeset - r21250:73db1c02a3c0
[Not reviewed]
master
0 2 0
fonsinchen - 10 years ago 2014-02-15 12:19:46
fonsinchen@openttd.org
(svn r26338) -Fix [FS#5908]: Don't redraw the link graph overlay if it's empty (MJP)
2 files changed with 23 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/main_gui.cpp
Show inline comments
 
@@ -253,11 +253,17 @@ struct MainWindow : Window
 

	
 
	virtual void OnTick()
 
	{
 
		if (--refresh == 0) {
 
			this->viewport->overlay->RebuildCache();
 
			this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
 
			this->refresh = LINKGRAPH_REFRESH_PERIOD;
 
		if (--this->refresh > 0) return;
 

	
 
		this->refresh = LINKGRAPH_REFRESH_PERIOD;
 

	
 
		if (this->viewport->overlay->GetCargoMask() == 0 ||
 
				this->viewport->overlay->GetCompanyMask() == 0) {
 
			return;
 
		}
 

	
 
		this->viewport->overlay->RebuildCache();
 
		this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
 
	}
 

	
 
	virtual void OnPaint()
src/viewport.cpp
Show inline comments
 
@@ -1477,17 +1477,19 @@ void ViewportDoDraw(const ViewPort *vp, 
 
	dp.height = UnScaleByZoom(dp.height, zoom);
 
	_cur_dpi = &dp;
 

	
 
	/* translate to window coordinates */
 
	dp.left = x;
 
	dp.top = y;
 

	
 
	if (vp->overlay != NULL) vp->overlay->Draw(&dp);
 

	
 
	/* translate back to world coordinates */
 
	dp.left = UnScaleByZoom(_vd.dpi.left, zoom);
 
	dp.top = UnScaleByZoom(_vd.dpi.top, zoom);
 

	
 
	if (_vd.string_sprites_to_draw.Length() != 0) ViewportDrawStrings(zoom, &_vd.string_sprites_to_draw);
 
	if (vp->overlay != NULL && vp->overlay->GetCargoMask() != 0 && vp->overlay->GetCompanyMask() != 0) {
 
		/* translate to window coordinates */
 
		dp.left = x;
 
		dp.top = y;
 
		vp->overlay->Draw(&dp);
 
	}
 

	
 
	if (_vd.string_sprites_to_draw.Length() != 0) {
 
		/* translate to world coordinates */
 
		dp.left = UnScaleByZoom(_vd.dpi.left, zoom);
 
		dp.top = UnScaleByZoom(_vd.dpi.top, zoom);
 
		ViewportDrawStrings(zoom, &_vd.string_sprites_to_draw);
 
	}
 

	
 
	_cur_dpi = old_dpi;
 

	
0 comments (0 inline, 0 general)