summaryrefslogtreecommitdiff
path: root/src/obj_theme.hpp
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2020-05-23 00:33:19 -0700
committerManoj Srivastava <srivasta@debian.org>2020-05-23 00:33:19 -0700
commitd6b913d3ca2e84b75f3675fd6e9f5246c100cf27 (patch)
tree5fc28b7efc737bf2c79dc7d799e0a6013957fe11 /src/obj_theme.hpp
parentc42f029316c0c004a795ca170bdb50644a800534 (diff)
parent73a0259be1d44fdb2ab34266ae0ff63f0d8f0b60 (diff)
Merge branch 'master' into dgit/siddebian/2.4.0-ah-1archive/debian/2.4.0-ah-1
Diffstat (limited to 'src/obj_theme.hpp')
-rw-r--r--src/obj_theme.hpp45
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;
+ }
+
};