Codechange: Don't access SmallMapWindow method directly from LinkGraphOverlay.

This commit is contained in:
Peter Nelson 2023-10-31 01:29:16 +00:00 committed by Peter Nelson
parent ff5e8bb9a3
commit f91462f54b
3 changed files with 13 additions and 1 deletions

View File

@ -425,7 +425,7 @@ Point LinkGraphOverlay::GetStationMiddle(const Station *st) const
return GetViewportStationMiddle(this->window->viewport, st);
} else {
/* assume this is a smallmap */
return static_cast<const SmallMapWindow *>(this->window)->GetStationMiddle(st);
return GetSmallMapStationMiddle(this->window, st);
}
}

View File

@ -1888,3 +1888,13 @@ bool ScrollMainWindowTo(int x, int y, int z, bool instant)
return res;
}
/**
* Determine the middle of a station in the smallmap window.
* @param st The station we're looking for.
* @return Middle point of the station in the smallmap window.
*/
Point GetSmallMapStationMiddle(const Window *w, const Station *st)
{
return static_cast<const SmallMapWindow *>(w)->GetStationMiddle(st);
}

View File

@ -212,4 +212,6 @@ public:
void OnMouseOver([[maybe_unused]] Point pt, int widget) override;
};
Point GetSmallMapStationMiddle(const Window *w, const Station *st);
#endif /* SMALLMAP_GUI_H */