Currently this variable is used for at least:
- References to ownership by the server (Unowned)
- A flag for no empire selection
- An invalid value
- All playable empires (human and ai)
- All empires (including Unowned)
- Any single empire
I'm looking at putting these into a common UniverseFwd.h replacing the various "extern ALL_EMPIRES" with an include.
Will retain the int type instead of an enum, so it is easier to transition to a UUID if that is done later.
Code: Select all
// UniverseFwd.h
namespace FactionID {
extern FO_COMMON_API const int ANY_OWNED; // 0 Any single empire controlled by human or AI
extern FO_COMMON_API const int INVALID; // -1 Bad return value, issue a warning when received or an error if initially returning
extern FO_COMMON_API const int NONE; // -2 No empire
extern FO_COMMON_API const int UNIVERSE; // -10 Universe as an empire aka Unowned
extern FO_COMMON_API const int ALL; // -20 All empires, including UNIVERSE
extern FO_COMMON_API const int ALL_OWNED; // -21 All empires controlled by human or AI
}
Values are grouped so code can refer to Foo < FactionID::ALL or Foo <= FactionID::INVALID
Those portions of code may need to further change if and how UUIDs are implemented, but the determination will be clearer.
The definitions would remain in Universe.cpp
I'm in favor of namespace for linting and ease of determining options for type vs. consistency with the other forms (INVALID_EMPIRE_ID, ALL_EMPIRE_IDS, etc).