Fix: wrong icons showing when selecting invisible units (Spectator/Ch…
…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()
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)
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.
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.
Cool, thanks!