diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/mmo.hpp | 6 | ||||
-rw-r--r-- | src/common/utils2.hpp | 40 |
2 files changed, 45 insertions, 1 deletions
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp index 178247c..8489ef1 100644 --- a/src/common/mmo.hpp +++ b/src/common/mmo.hpp @@ -82,6 +82,9 @@ struct global_reg int value; }; +// Option and Opt1..3 in map.hpp +enum class Option : uint16_t; + struct mmo_charstatus { int char_id; @@ -93,7 +96,8 @@ struct mmo_charstatus short pc_class; short status_point, skill_point; int hp, max_hp, sp, max_sp; - short option, karma, manner; + Option option; + short karma, manner; short hair, hair_color, clothes_color; int party_id; diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp index c92fdae..326b12f 100644 --- a/src/common/utils2.hpp +++ b/src/common/utils2.hpp @@ -93,6 +93,46 @@ struct underlying_type >::type type; }; +#define ENUM_BITWISE_OPERATORS(E) \ +inline \ +E operator & (E l, E r) \ +{ \ + typedef typename underlying_type<E>::type U;\ + return E(U(l) & U(r)); \ +} \ +inline \ +E operator | (E l, E r) \ +{ \ + typedef typename underlying_type<E>::type U;\ + return E(U(l) | U(r)); \ +} \ +inline \ +E operator ^ (E l, E r) \ +{ \ + typedef typename underlying_type<E>::type U;\ + return E(U(l) ^ U(r)); \ +} \ +inline \ +E& operator &= (E& l, E r) \ +{ \ + return l = l & r; \ +} \ +inline \ +E& operator |= (E& l, E r) \ +{ \ + return l = l | r; \ +} \ +inline \ +E& operator ^= (E& l, E r) \ +{ \ + return l = l ^ r; \ +} \ +inline \ +E operator ~ (E r) \ +{ \ + return E(-1) ^ r; \ +} + template<class E> class EnumValueIterator { |