Zero-K icon indicating copy to clipboard operation
Zero-K copied to clipboard

Fix: wrong icons showing when selecting invisible units (Spectator/Ch…

Open Helwor opened this issue 1 year ago • 3 comments

…eat)

While it is not possible to retrieve the defID through spGetUnitDefID, spGetSelectedUnitsSorted can give them. By the way some optimization, saving multiple call of spGetUnitDefID aswell as the whole process widget:SelectionChanged()

Helwor avatar Jul 14 '24 05:07 Helwor

While it is not possible to retrieve the defID through spGetUnitDefID, spGetSelectedUnitsSorted can give them

Sounds like engine bug if these functions are so inconsistent. And generally, the whole "selecting invisible units" behaviour is probably engine bug.

But if this patch also works as an optimisation for the normal case then I think we can take it. ~~I'll test on the weekend.~~ (edit: was busy, will try to find some time asap)

sprunk avatar Jul 18 '24 11:07 sprunk

I don't know if I would consider a bug being able to select and control units in god mode just because not having global vision. But I can tell that's pretty useful as dev to have this ability.

Helwor avatar Aug 04 '24 22:08 Helwor

hi, so SelectionChanged is used for modifying the selection on the fly by returning an array, and if it happens, SelectionChanged will be immediately called again. That's why I was saying in the description "aswell as the whole process widget:SelectionChanged()". In the opposite, CommandsChanged is called only once when the selection is finally made. You can check that by right clicking some units of your selection IIRC, SelectionChanged will be called twice. So using CommandsChanged prevent redundancies of the whole process.

Helwor avatar Aug 22 '24 16:08 Helwor

Cool, thanks!

sprunk avatar Aug 24 '24 18:08 sprunk