make tooltip detection recursive

This commit is contained in:
2025-08-31 20:26:18 -05:00
parent f2481fb8f0
commit 3f1be300d8

View File

@@ -809,7 +809,9 @@ void cDialog::handle_one_event(const sf::Event& currentEvent, cFramerateLimiter&
bool inField = false; bool inField = false;
bool onTooltip = false; bool onTooltip = false;
for(auto& ctrl : controls) { // Have to use begin() and end() for recursion into containers!
for(cDialogIterator iter = begin(); iter != end(); ++iter) {
auto& ctrl = *iter;
if(!ctrl.second->tooltip_text.empty() && ctrl.second->getBounds().contains(x, y)){ if(!ctrl.second->tooltip_text.empty() && ctrl.second->getBounds().contains(x, y)){
if(tooltip_control.empty()){ if(tooltip_control.empty()){
LOG("Warning! Tooltip activated but nowhere to show it!"); LOG("Warning! Tooltip activated but nowhere to show it!");