summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/FixAry.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-27 10:59:19 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-27 10:59:19 +0000
commita5f48b90bfa5f11717385652e57aca472c8b38b7 (patch)
tree8ee854a6b1fb8b14259526e9b8b23f9c67df85e9 /crawl-ref/source/FixAry.h
parent4db647cad870c687095ccd6c507d330ad31e05ca (diff)
downloadcrawl-ref-a5f48b90bfa5f11717385652e57aca472c8b38b7.tar.gz
crawl-ref-a5f48b90bfa5f11717385652e57aca472c8b38b7.zip
Bumped piety cost for brothers-in-arms and greater healing.
Added COLOUR: directive to maps to allow custom colouring of features by glyph, and tweaked the strawberry fields variants to use it. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2227 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/FixAry.h')
-rw-r--r--crawl-ref/source/FixAry.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/FixAry.h b/crawl-ref/source/FixAry.h
index ba4b863866..4e3ab70514 100644
--- a/crawl-ref/source/FixAry.h
+++ b/crawl-ref/source/FixAry.h
@@ -71,5 +71,54 @@ protected:
FixedVector<Column, WIDTH> mData;
};
+template <typename Z>
+class Matrix {
+public:
+ Matrix(int width, int height, const Z &initial);
+ Matrix(int width, int height);
+ ~Matrix();
+
+ void init(const Z &initial);
+ Z &operator () (int x, int y)
+ {
+ return data[x + y * width];
+ }
+ const Z &operator () (int x, int y) const
+ {
+ return data[x + y * width];
+ }
+
+private:
+ Z *data;
+ int width, height, size;
+};
+
+template <typename Z>
+Matrix<Z>::Matrix(int _width, int _height, const Z &initial)
+ : data(NULL), width(_width), height(_height), size(_width * _height)
+{
+ data = new Z [ size ];
+ init(initial);
+}
+
+template <typename Z>
+Matrix<Z>::Matrix(int _width, int _height)
+ : data(NULL), width(_width), height(_height), size(_width * _height)
+{
+ data = new Z [ size ];
+}
+
+template <typename Z>
+Matrix<Z>::~Matrix()
+{
+ delete [] data;
+}
+
+template <typename Z>
+void Matrix<Z>::init(const Z &initial)
+{
+ for (int i = 0; i < size; ++i)
+ data[i] = initial;
+}
#endif // FIXARY_H