|
|
@@ -59,6 +59,11 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
+ {
|
|
|
+ h & num;
|
|
|
+ }
|
|
|
+
|
|
|
constexpr void advance(int change)
|
|
|
{
|
|
|
num += change;
|
|
|
@@ -87,11 +92,6 @@ public:
|
|
|
:IdentifierBase(_num)
|
|
|
{}
|
|
|
|
|
|
- template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
- {
|
|
|
- h & BaseClass::num;
|
|
|
- }
|
|
|
-
|
|
|
constexpr bool operator == (const Identifier & b) const { return BaseClass::num == b.num; }
|
|
|
constexpr bool operator <= (const Identifier & b) const { return BaseClass::num <= b.num; }
|
|
|
constexpr bool operator >= (const Identifier & b) const { return BaseClass::num >= b.num; }
|
|
|
@@ -122,21 +122,11 @@ class IdentifierWithEnum : public BaseClass
|
|
|
|
|
|
static_assert(std::is_same_v<std::underlying_type_t<EnumType>, int32_t>, "Entity Identifier must use int32_t");
|
|
|
public:
|
|
|
- constexpr int32_t getNum() const
|
|
|
- {
|
|
|
- return BaseClass::num;
|
|
|
- }
|
|
|
-
|
|
|
constexpr EnumType toEnum() const
|
|
|
{
|
|
|
return static_cast<EnumType>(BaseClass::num);
|
|
|
}
|
|
|
|
|
|
- template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
- {
|
|
|
- h & BaseClass::num;
|
|
|
- }
|
|
|
-
|
|
|
constexpr IdentifierWithEnum(const EnumType & enumValue)
|
|
|
{
|
|
|
BaseClass::num = static_cast<int32_t>(enumValue);
|
|
|
@@ -230,7 +220,7 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-class PlayerColor : public Identifier<PlayerColor>
|
|
|
+class DLL_LINKAGE PlayerColor : public Identifier<PlayerColor>
|
|
|
{
|
|
|
public:
|
|
|
using Identifier<PlayerColor>::Identifier;
|
|
|
@@ -240,19 +230,20 @@ public:
|
|
|
PLAYER_LIMIT_I = 8,
|
|
|
};
|
|
|
|
|
|
- using Mask = uint8_t;
|
|
|
+ static const PlayerColor SPECTATOR; //252
|
|
|
+ static const PlayerColor CANNOT_DETERMINE; //253
|
|
|
+ static const PlayerColor UNFLAGGABLE; //254 - neutral objects (pandora, banks)
|
|
|
+ static const PlayerColor NEUTRAL; //255
|
|
|
+ static const PlayerColor PLAYER_LIMIT; //player limit per map
|
|
|
|
|
|
- DLL_LINKAGE static const PlayerColor SPECTATOR; //252
|
|
|
- DLL_LINKAGE static const PlayerColor CANNOT_DETERMINE; //253
|
|
|
- DLL_LINKAGE static const PlayerColor UNFLAGGABLE; //254 - neutral objects (pandora, banks)
|
|
|
- DLL_LINKAGE static const PlayerColor NEUTRAL; //255
|
|
|
- DLL_LINKAGE static const PlayerColor PLAYER_LIMIT; //player limit per map
|
|
|
+ bool isValidPlayer() const; //valid means < PLAYER_LIMIT (especially non-neutral)
|
|
|
+ bool isSpectator() const;
|
|
|
|
|
|
- DLL_LINKAGE bool isValidPlayer() const; //valid means < PLAYER_LIMIT (especially non-neutral)
|
|
|
- DLL_LINKAGE bool isSpectator() const;
|
|
|
+ std::string getStr(bool L10n = false) const;
|
|
|
+ std::string getStrCap(bool L10n = false) const;
|
|
|
|
|
|
- DLL_LINKAGE std::string getStr(bool L10n = false) const;
|
|
|
- DLL_LINKAGE std::string getStrCap(bool L10n = false) const;
|
|
|
+ static si32 decode(const std::string& identifier);
|
|
|
+ static std::string encode(const si32 index);
|
|
|
};
|
|
|
|
|
|
class TeamID : public Identifier<TeamID>
|