s2client-api
s2client-api copied to clipboard
'None' values for various types
It would be quite nice if there were 'None' values for various types such as Race, UnitTypeID, etc, whose internal int is 0. This is very useful for 'error return' cases, such as not currently knowing what race the enemy is, or for returning a 'None' type for a prerequisite when a unit doesn't have one, etc.
sc2::UNIT_TYPEID::None sc2::Race::None
Unit and Ability already have 0 reserved as NULL, but there is no enum entry for it.
We forgot to reserve 0 for Upgrade/Buff. We should change the id mapping for 0 and then also add a NULL entry to those enums.
All the "sc2_typeenums.h" enums now have an "INVALID" entry.
Not sure what other enums we want to add a 0 entry to. I'll leave this open for now until we decide on that.
I would suggest adding a 0 for Unit::Alliance. Currently I have my own PlayerArrayIndex class with the same entries as Unit::Alliance. It might make sense for me to replace my PlayerArrayIndex class with that one. Right now I am using 0 for ERROR. It could also be called uninitialized.