This issue mainly relates to this fact, from SetUnitSelected:
If the unit can not be selected, this call has no effect.
This makes sense at first glance, but a pitfall is created when one considers that SetUnitSelectable does not automatically deselect a unit.
If a player selects a unit before 4RPL makes it unselectable with FALSE SetUnitSelectable, the unit remains selected. If a programmer then tries to apply FALSE SetUnitSelected on that unit, the call will fizzle out due to the unit being unselectable, and the unit will remain selected.
This means that in order to make the player truly unable to suddenly interact with a unit at runtime, one has to be extra careful and ensure that they call FALSE SetUnitSelectedbeforeFALSE SetUnitSelectable.
This easy to cause unintended behavior can be solved in two ways in a future game:
SetUnitSelected, instead of fizzling out at its root, should have the ability to deselect a unit regardless of whether it is selectable. If the unit is unselectable, SetUnitSelected should only be unable to select the unit.
FALSE SetUnitSelectable should just deselect the unit, similar to the behavior of SetUnitsSelectable
I implemented both... SetUnitSelected will now unselect a unit even it is is set to unselectable. SetUnitSelectable will now unselect the unit if the unit is being set to unselectable.
This issue mainly relates to this fact, from SetUnitSelected:
This makes sense at first glance, but a pitfall is created when one considers that SetUnitSelectable does not automatically deselect a unit.
If a player selects a unit before 4RPL makes it unselectable with
FALSE SetUnitSelectable
, the unit remains selected. If a programmer then tries to applyFALSE SetUnitSelected
on that unit, the call will fizzle out due to the unit being unselectable, and the unit will remain selected.This means that in order to make the player truly unable to suddenly interact with a unit at runtime, one has to be extra careful and ensure that they call
FALSE SetUnitSelected
beforeFALSE SetUnitSelectable
.This easy to cause unintended behavior can be solved in two ways in a future game:
SetUnitSelected
, instead of fizzling out at its root, should have the ability to deselect a unit regardless of whether it is selectable. If the unit is unselectable,SetUnitSelected
should only be unable to select the unit.FALSE SetUnitSelectable
should just deselect the unit, similar to the behavior ofSetUnitsSelectable