From 9304ae6cc3684377e50e6fcbc3d13e80fa092b6a Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 24 Apr 2007 22:38:41 +0000 Subject: 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 --- crawl-ref/source/FixAry.h | 55 +++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'crawl-ref/source/FixAry.h') diff --git a/crawl-ref/source/FixAry.h b/crawl-ref/source/FixAry.h index 3db9d49abd..ba4b863866 100644 --- a/crawl-ref/source/FixAry.h +++ b/crawl-ref/source/FixAry.h @@ -34,46 +34,41 @@ public: typedef unsigned long size_type; typedef long difference_type; - typedef FixedVector Column; // operator[] needs to return one of these to avoid breaking client code (if inlining is on there won't be a speed hit) + // operator[] should return one of these to avoid breaking + // client code (if inlining is on there won't be a speed hit) + typedef FixedVector Column; -//----------------------------------- -// Initialization/Destruction -// -public: - ~FixedArray() {} - - FixedArray() {} - //----------------------------------- // API // public: // ----- Size ----- - bool empty() const {return WIDTH == 0 || HEIGHT == 0;} - int size() const {return WIDTH*HEIGHT;} + bool empty() const { return WIDTH == 0 || HEIGHT == 0; } + int size() const { return WIDTH*HEIGHT; } + int width() const { return WIDTH; } + int height() const { return HEIGHT; } - int width() const {return WIDTH;} - int height() const {return HEIGHT;} - // ----- Access ----- - Column& operator[](unsigned long index) {return mData[index];} - const Column& operator[](unsigned long index) const {return mData[index];} - template TYPE& operator () (const Indexer &i) - { - return mData[i.x][i.y]; - } + Column& operator[](unsigned long index) { return mData[index]; } + const Column& operator[](unsigned long index) const { + return mData[index]; + } + + template TYPE& operator () (const Indexer &i) { + return mData[i.x][i.y]; + } + + template const TYPE& operator () (const Indexer &i) const { + return mData[i.x][i.y]; + } + + void init(const TYPE& def) { + for ( int i = 0; i < WIDTH; ++i ) + mData[i].init(def); + } - template const TYPE& operator () (const Indexer &i) - const - { - return mData[i.x][i.y]; - } - -//----------------------------------- -// Member Data -// protected: - FixedVector mData; + FixedVector mData; }; -- cgit v1.2.3-54-g00ecf