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

Method OnClick

src/league_gui.cpp:395–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393 }
394
395 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
396 {
397 if (widget != WID_SLT_BACKGROUND) return;
398
399 auto *wid = this->GetWidget<NWidgetResizeBase>(WID_SLT_BACKGROUND);
400 int index = (pt.y - WidgetDimensions::scaled.framerect.top - wid->pos_y - this->header_height) / this->line_height;
401 if (index >= 0 && static_cast<uint>(index) < this->rows.size()) {
402 const LeagueTableElement *lte = this->rows[index].second;
403 HandleLinkClick(lte->link);
404 }
405 }
406
407 /**
408 * Some data on this window has become invalid.

Callers

nothing calls this directly

Calls 2

HandleLinkClickFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected