diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-05-26 22:47:05 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-05-26 22:47:50 +0200 |
commit | f9d2368b7d27f9aaa27bbbe243a1cd0bf79b1b2e (patch) | |
tree | 37414061b47ba3edc054d9dbfcf7a1aad9b03437 /crawl-ref/source/bitary.h | |
parent | 0c5cc7a416c7896242eaaa4048b2fc0c2210eb2c (diff) | |
download | crawl-ref-f9d2368b7d27f9aaa27bbbe243a1cd0bf79b1b2e.tar.gz crawl-ref-f9d2368b7d27f9aaa27bbbe243a1cd0bf79b1b2e.zip |
Allow more than 64 mon_info flags.
Diffstat (limited to 'crawl-ref/source/bitary.h')
-rw-r--r-- | crawl-ref/source/bitary.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h index c93be0e7dd..291ca4bb88 100644 --- a/crawl-ref/source/bitary.h +++ b/crawl-ref/source/bitary.h @@ -65,7 +65,7 @@ public: return get(i); } - inline void set(unsigned int i, bool value) + inline void set(unsigned int i, bool value = true) { #ifdef ASSERTS if (i >= SIZE) @@ -76,6 +76,20 @@ public: else data[i / LONGSIZE] &= ~(1UL << i % LONGSIZE); } + + inline FixedBitArray<SIZE>& operator|=(const FixedBitArray<SIZE>&x) + { + for (unsigned int i = 0; i < sizeof(data) / sizeof(unsigned long); i++) + data[i] |= x.data[i]; + return *this; + } + + inline FixedBitArray<SIZE>& operator&=(const FixedBitArray<SIZE>&x) + { + for (unsigned int i = 0; i < sizeof(data) / sizeof(unsigned long); i++) + data[i] &= x.data[i]; + return *this; + } }; #endif |