diff options
Diffstat (limited to 'src/obj_theme.hpp')
-rw-r--r-- | src/obj_theme.hpp | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/obj_theme.hpp b/src/obj_theme.hpp index 13f185e8..d10d17fa 100644 --- a/src/obj_theme.hpp +++ b/src/obj_theme.hpp @@ -8,8 +8,45 @@ */ struct obj_theme { - byte treasure; - byte combat; - byte magic; - byte tools; + byte treasure = 0; + byte combat = 0; + byte magic = 0; + byte tools = 0; + + bool operator == (obj_theme const &other) const + { + return + (treasure == other.treasure) && + (combat == other.combat) && + (magic == other.magic) && + (tools == other.tools); + } + + bool operator != (obj_theme const &other) const + { + return !(*this == other); + } + + static constexpr obj_theme no_theme() + { + return equal_spread(100); + } + + static constexpr obj_theme defaults() + { + return equal_spread(20); + } + +private: + + static constexpr obj_theme equal_spread(byte v) + { + obj_theme ot; + ot.treasure = v; + ot.combat = v; + ot.magic = v; + ot.tools = v; + return ot; + } + }; |