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

Method GetCurrentActivePosition

src/newgrf_gui.cpp:677–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675 }
676
677 int GetCurrentActivePosition() const
678 {
679 if (this->active_sel != nullptr) {
680 auto it = std::ranges::find_if(this->actives, [this](const auto &c) { return c.get() == this->active_sel; });
681 if (it != std::end(this->actives)) return static_cast<int>(std::distance(std::begin(this->actives), it));
682 }
683 return -1;
684 }
685
686 /**
687 * Test whether the currently active set of NewGRFs can be upgraded with the available NewGRFs.

Callers 4

DrawWidgetMethod · 0.95
OnClickMethod · 0.95
OnDragDropMethod · 0.95

Calls 3

endFunction · 0.50
beginFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected