| 1972 | } |
| 1973 | |
| 1974 | void AEquipScreen::updateAgentControl(sp<Agent> agent) |
| 1975 | { |
| 1976 | UnitSelectionState selstate = UnitSelectionState::Unselected; |
| 1977 | if (!selectedAgents.empty()) |
| 1978 | { |
| 1979 | auto pos = std::find(selectedAgents.begin(), selectedAgents.end(), agent); |
| 1980 | if (pos == selectedAgents.begin()) |
| 1981 | { |
| 1982 | selstate = UnitSelectionState::FirstSelected; |
| 1983 | } |
| 1984 | else if (pos != selectedAgents.end()) |
| 1985 | { |
| 1986 | selstate = UnitSelectionState::Selected; |
| 1987 | } |
| 1988 | } |
| 1989 | |
| 1990 | auto agentList = formMain->findControlTyped<ListBox>("AGENT_SELECT_BOX"); |
| 1991 | auto control = ControlGenerator::createLargeAgentControl( |
| 1992 | *state, agent, agentList->Size.x, UnitSkillState::Hidden, selstate, !isInVicinity(agent)); |
| 1993 | control->addCallback( |
| 1994 | FormEventType::MouseEnter, |
| 1995 | [this, agent](FormsEvent *e [[maybe_unused]]) |
| 1996 | { |
| 1997 | AgentSheet(formAgentStats).display(*agent, bigUnitRanks, isTurnBased()); |
| 1998 | formAgentStats->setVisible(true); |
| 1999 | formAgentItem->setVisible(false); |
| 2000 | }); |
| 2001 | control->addCallback(FormEventType::MouseLeave, |
| 2002 | [this](FormsEvent *e [[maybe_unused]]) |
| 2003 | { |
| 2004 | AgentSheet(formAgentStats) |
| 2005 | .display(*selectedAgents.front(), bigUnitRanks, isTurnBased()); |
| 2006 | formAgentStats->setVisible(true); |
| 2007 | formAgentItem->setVisible(false); |
| 2008 | }); |
| 2009 | agentList->replaceItem(control); |
| 2010 | } |
| 2011 | |
| 2012 | void AEquipScreen::updateFirstAgent() |
| 2013 | { |
nothing calls this directly
no test coverage detected