summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/bitary.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-07-26 20:47:32 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-07-26 20:47:32 +0200
commit4bfc2a7d9f9ce6b671eb5798d361e5a93016e627 (patch)
tree1abd243aded1901a8bc6a537540fad342e357e33 /crawl-ref/source/bitary.h
parent25d89c210654da5c1f81503eec02bc65df011f50 (diff)
downloadcrawl-ref-4bfc2a7d9f9ce6b671eb5798d361e5a93016e627.tar.gz
crawl-ref-4bfc2a7d9f9ce6b671eb5798d361e5a93016e627.zip
Allow reading FixedBitArray(...) without having to type ".get".
This works only for reading, as we can't return a reference to a single bit. Also, [x][y] doesn't work either: FixedArray can return a column vector which then can be dereferenced further, bit arrays here are packed so returning a slice would require a whole new class.
Diffstat (limited to 'crawl-ref/source/bitary.h')
-rw-r--r--crawl-ref/source/bitary.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h
index 28f1a16867..7935d6060e 100644
--- a/crawl-ref/source/bitary.h
+++ b/crawl-ref/source/bitary.h
@@ -124,6 +124,16 @@ public:
return get(c.x, c.y);
}
+ inline bool operator () (int x, int y) const
+ {
+ return get(x, y);
+ }
+
+ template<class Indexer> inline bool operator () (const Indexer &i) const
+ {
+ return get(i.x, i.y);
+ }
+
inline void set(int x, int y, bool value = true)
{
#ifdef ASSERTS