Here's the discussion on it:
https://forum.megaglest.org/index.php?topic=4171.msg22828#msg22828
https://forum.megaglest.org/index.php?topic=4644.0
Warning: Development discussion, contains much macro magic and a bit of template trickery, not recommended for people new to C++, and not required knowledge.
It might be good to have a short tutorial on how to use it in the Wiki.
Yes, I've been meaning to do just that, with Yggdrasil recently joining us, and now softcoder and titi looking over our source, this is a very good idea. Will make this a priority.
In the meantime here is the low-down,
STRINGY_ENUM is for enumerations where you need to print the value of the enumeration somewhere, and/or you need to match a string (ie, from XML) to get an enum value.
These
must be in game_constants.h. They are scoped, so they must be accessed like in Java or C#, but of course with the C++ scope resolution operator, ControlType::CPU_MEGA for example. The string support is supplied by a ancillary class, which is the enum name + 'Names', you use the [] operator to get a string, ie. ControlTypeNames[myControlType]. To match a enum from a string you use, ControlTypeNames.match(mystring).
REGULAR_ENUM is for enumerations where you do not need the string support in a release build, the Names classes are not generated for them, if NDEBUG is defined. Otherwise they are STRINGY, so you can use the Names classes in debug code. Again, these must be in game_constants.h.
For enums where you never ever want string support, you can use WRAPPED_ENUM, these never have the Names class built, and can be declared anywhere.
Can you use an = after the item to give it a custom value?
No. I did think of a way to do this, and to support automagic 'flag sets' (ie, enums with values 1, 2, 4, 8, etc) but at this time the enums are all sequentially numbered from 0, and also have INVALID = -1 added before the first value supplied, and COUNT appended to the end of the value list.
[Edit: typos]