mirror of https://github.com/OpenTTD/OpenTTD
(svn r26338) -Fix [FS#5908]: Don't redraw the link graph overlay if it's empty (MJP)
parent
4a00552a09
commit
4055397915
|
@ -253,11 +253,17 @@ struct MainWindow : Window
|
||||||
|
|
||||||
virtual void OnTick()
|
virtual void OnTick()
|
||||||
{
|
{
|
||||||
if (--refresh == 0) {
|
if (--this->refresh > 0) return;
|
||||||
this->viewport->overlay->RebuildCache();
|
|
||||||
this->GetWidget<NWidgetBase>(WID_M_VIEWPORT)->SetDirty(this);
|
this->refresh = LINKGRAPH_REFRESH_PERIOD;
|
||||||
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()
|
virtual void OnPaint()
|
||||||
|
|
|
@ -1477,17 +1477,19 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
|
||||||
dp.height = UnScaleByZoom(dp.height, zoom);
|
dp.height = UnScaleByZoom(dp.height, zoom);
|
||||||
_cur_dpi = &dp;
|
_cur_dpi = &dp;
|
||||||
|
|
||||||
/* translate to window coordinates */
|
if (vp->overlay != NULL && vp->overlay->GetCargoMask() != 0 && vp->overlay->GetCompanyMask() != 0) {
|
||||||
dp.left = x;
|
/* translate to window coordinates */
|
||||||
dp.top = y;
|
dp.left = x;
|
||||||
|
dp.top = y;
|
||||||
|
vp->overlay->Draw(&dp);
|
||||||
|
}
|
||||||
|
|
||||||
if (vp->overlay != NULL) vp->overlay->Draw(&dp);
|
if (_vd.string_sprites_to_draw.Length() != 0) {
|
||||||
|
/* translate to world coordinates */
|
||||||
/* translate back to world coordinates */
|
dp.left = UnScaleByZoom(_vd.dpi.left, zoom);
|
||||||
dp.left = UnScaleByZoom(_vd.dpi.left, zoom);
|
dp.top = UnScaleByZoom(_vd.dpi.top, zoom);
|
||||||
dp.top = UnScaleByZoom(_vd.dpi.top, zoom);
|
ViewportDrawStrings(zoom, &_vd.string_sprites_to_draw);
|
||||||
|
}
|
||||||
if (_vd.string_sprites_to_draw.Length() != 0) ViewportDrawStrings(zoom, &_vd.string_sprites_to_draw);
|
|
||||||
|
|
||||||
_cur_dpi = old_dpi;
|
_cur_dpi = old_dpi;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue