MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawLinks

Method DrawLinks

src/linkgraph/linkgraph_gui.cpp:276–289  ·  view source on GitHub ↗

* Draw the cached links or part of them into the given area. * @param dpi Area to be drawn to. */

Source from the content-addressed store, hash-verified

274 * @param dpi Area to be drawn to.
275 */
276void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const
277{
278 int width = ScaleGUITrad(this->scale);
279 for (const auto &i : this->cached_links) {
280 if (!Station::IsValidID(i.first)) continue;
281 Point pta = this->GetStationMiddle(Station::Get(i.first));
282 for (const auto &j : i.second) {
283 if (!Station::IsValidID(j.first)) continue;
284 Point ptb = this->GetStationMiddle(Station::Get(j.first));
285 if (!this->IsLinkVisible(pta, ptb, dpi, width + 2)) continue;
286 this->DrawContent(pta, ptb, j.second);
287 }
288 }
289}
290
291/**
292 * Draw one specific link.

Callers 1

DrawMethod · 0.95

Calls 4

GetStationMiddleMethod · 0.95
IsLinkVisibleMethod · 0.95
DrawContentMethod · 0.95
ScaleGUITradFunction · 0.50

Tested by

no test coverage detected