@@ -250,17 +250,23 @@ struct MainWindow : Window
this->viewport->overlay = new LinkGraphOverlay(this, WID_M_VIEWPORT, 0, 0, 3);
this->refresh = LINKGRAPH_DELAY;
}
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;
if (this->viewport->overlay->GetCargoMask() == 0 ||
this->viewport->overlay->GetCompanyMask() == 0) {
return;
virtual void OnPaint()
this->DrawWidgets();
if (_game_mode == GM_MENU) {
@@ -1474,23 +1474,25 @@ void ViewportDoDraw(const ViewPort *vp,
ZoomLevel zoom = _vd.dpi.zoom;
dp.zoom = ZOOM_LVL_NORMAL;
dp.width = UnScaleByZoom(dp.width, zoom);
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) {
vp->overlay->Draw(&dp);
if (_vd.string_sprites_to_draw.Length() != 0) {
/* translate to world coordinates */
ViewportDrawStrings(zoom, &_vd.string_sprites_to_draw);
_cur_dpi = old_dpi;
_vd.string_sprites_to_draw.Clear();
_vd.tile_sprites_to_draw.Clear();
_vd.parent_sprites_to_draw.Clear();
Status change: