summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/FixVec.h
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-24 22:38:41 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-24 22:38:41 +0000
commit9304ae6cc3684377e50e6fcbc3d13e80fa092b6a (patch)
treeb0b15e708dbca7e6455bf0e6e3726b75037f937b /crawl-ref/source/FixVec.h
parent56b6c4f46ec7516396c1473e9d5bfef7ea79765f (diff)
downloadcrawl-ref-9304ae6cc3684377e50e6fcbc3d13e80fa092b6a.tar.gz
crawl-ref-9304ae6cc3684377e50e6fcbc3d13e80fa092b6a.zip
Cleaned up shop-handling code considerably.
Instead of shops passing around global id_arr arrays, shops use the newly added third argument to item_def::name() which indicates whether to override item ID status. This means that the shop ID SIGHUP protection is now unnecessary; it's been removed. Hopefully I caught all the places where the stash tracker tries to get item names and fixed them, but I might have missed something. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1359 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/FixVec.h')
-rw-r--r--crawl-ref/source/FixVec.h51
1 files changed, 23 insertions, 28 deletions
diff --git a/crawl-ref/source/FixVec.h b/crawl-ref/source/FixVec.h
index 0086750ae3..f574f8fa1c 100644
--- a/crawl-ref/source/FixVec.h
+++ b/crawl-ref/source/FixVec.h
@@ -59,40 +59,35 @@ public:
// instead of "int a[3] = {0, 1, 2}" you'd use "FixedVector<int, 3>
// a(0, 1, 2)". Note that there must be SIZE arguments.
-// public:
-// FixedVector(const FixedVector& rhs);
-//
-// FixedVector& operator=(const FixedVector& rhs);
-
//-----------------------------------
// API
//
public:
-// ----- Size -----
- bool empty() const {return SIZE == 0;}
- size_t size() const {return SIZE;}
-
-// ----- Access -----
- TYPE& operator[](unsigned long index) {ASSERT(index < SIZE); return mData[index];}
- const TYPE& operator[](unsigned long index) const {ASSERT(index < SIZE); return mData[index];}
-
- TYPE& front() {ASSERT(SIZE > 0); return mData[0];}
- const TYPE& front() const {ASSERT(SIZE > 0); return mData[0];}
-
- TYPE& back() {ASSERT(SIZE > 0); return mData[SIZE - 1];}
- const TYPE& back() const {ASSERT(SIZE > 0); return mData[SIZE - 1];}
-
- TYPE* buffer() {return mData;}
- const TYPE* buffer() const {return mData;}
+ // ----- Size -----
+ bool empty() const { return SIZE == 0; }
+ size_t size() const { return SIZE; }
+
+ // ----- Access -----
+ TYPE& operator[](unsigned long index) {
+ ASSERT(index < SIZE);
+ return mData[index];
+ }
+
+ const TYPE& operator[](unsigned long index) const {
+ ASSERT(index < SIZE);
+ return mData[index];
+ }
-// ----- Iterating -----
- iterator begin() {return mData;}
- const_iterator begin() const {return mData;}
+ const TYPE* buffer() const { return mData; }
+ TYPE* buffer() { return mData; }
- iterator end() {return this->begin() + this->size();}
- const_iterator end() const {return this->begin() + this->size();}
+ // ----- Iterating -----
+ iterator begin() { return mData; }
+ const_iterator begin() const { return mData; }
- void init(TYPE def);
+ iterator end() { return this->begin() + this->size(); }
+ const_iterator end() const { return this->begin() + this->size(); }
+ void init(const TYPE& def);
//-----------------------------------
// Member Data
@@ -124,7 +119,7 @@ FixedVector<TYPE, SIZE>::FixedVector(TYPE value0, TYPE value1, ...)
}
template <class TYPE, int SIZE>
-void FixedVector<TYPE, SIZE>::init(TYPE def)
+void FixedVector<TYPE, SIZE>::init(const TYPE& def)
{
for (int i = 0; i < SIZE; ++i)
mData[i] = def;