diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2012-12-20 18:32:32 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2012-12-24 10:02:19 -0800 |
commit | 2b092c150e1226decc48160316070fc44d5fbba0 (patch) | |
tree | 48456d14896059fd223401aa15d4e29010a81436 /src/common | |
parent | b52127bcbf817ff8285b36d22198b275327e16bb (diff) | |
download | tmwa-2b092c150e1226decc48160316070fc44d5fbba0.tar.gz tmwa-2b092c150e1226decc48160316070fc44d5fbba0.tar.bz2 tmwa-2b092c150e1226decc48160316070fc44d5fbba0.tar.xz tmwa-2b092c150e1226decc48160316070fc44d5fbba0.zip |
Enumify option, opt1, opt2, and opt3
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 { |