s2client-api icon indicating copy to clipboard operation
s2client-api copied to clipboard

'None' values for various types

Open davechurchill opened this issue 7 years ago • 3 comments

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

davechurchill avatar Aug 08 '17 00:08 davechurchill

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.

KevinCalderone avatar Aug 14 '17 17:08 KevinCalderone

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.

KevinCalderone avatar Sep 01 '17 01:09 KevinCalderone

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.

IanGallacher avatar Nov 06 '17 20:11 IanGallacher