If there are idle villagers, the idle villager button should be yellow instead of grayed out. The number of idle villagers should be shown in the bottom-right of the button.
Clicking the button (or pressing the corresponding hotkey) should toggle between all idle villagers.
Hints: Iterate over map->GetObjects(), check IsUnit(), GetPlayerIndex() == match->GetPlayerIndex(), and IsVillager() for each entry, and check whether the UnitAction is UnitAction::Idle to find the idle villagers. Use ClearSelection(), AddToSelection(), and SelectionChanged() to modify the selection.
Hints: Iterate over
map->GetObjects()
, checkIsUnit()
,GetPlayerIndex() == match->GetPlayerIndex()
, andIsVillager()
for each entry, and check whether theUnitAction
isUnitAction::Idle
to find the idle villagers. UseClearSelection()
,AddToSelection()
, andSelectionChanged()
to modify the selection.