diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-08 05:55:47 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-08 05:55:47 +0000 |
commit | e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36 (patch) | |
tree | 31ecdc6a9945ba6bfb8e1b35cb484808df1f4f57 /crawl-ref/source/externs.h | |
parent | 16a8b1fe4a5acec73e490b9f7d3e53f567673763 (diff) | |
download | crawl-ref-e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36.tar.gz crawl-ref-e7240df9978d7ba42ed7dcfdf9ab385b2ce74d36.zip |
Added class CrawlHashTable, a savable/loadable string-keyed
associative array with heterogeneous values, capable of holding
booleans, bytes, shorts, longs, floats, string, coordinates
(coord_def), items (item_def) and nested hash tables. A table can be
made to be homogeneous by giving it a value type, which causes dynamic
type checking to be performed. The same type checking can be
performed for individual member values of a heterogeneous table by
setting a flag on that value. A flag can also be set on an individual
member value to prevent its value from being changed.
CrawlHashTable is currently only used for the props field of the
item_def struct (though it could easily be added elsewhere), and is
only being used by decks. The deck structure has been changed so that
deck.plus is the original number of cards in the deck, deck.plus2 is
either the number of cards used or the number of cards left, and
deck.special hold the deck's rarity. The cards themselves are
selected at deck creation time and stored in the nested hash table
deck.props["cards"]. The Nemelex "Peek Deck" ability has been changed
to identify the deck, draw three cards from it, show them to the user,
and shuffle them back into the deck (with special cases for decks
containing only one or two cards). A fourth Nemelex ability, "Mark
Deck", has been added, which picks four cards from the deck, marks
them, and then shuffles them back into the deck, creating a deck with
a mixture of marked and unmarked cards.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2370 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/externs.h')
-rw-r--r-- | crawl-ref/source/externs.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 5bff06df19..5a6cfca733 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -30,6 +30,7 @@ #include "defines.h" #include "enum.h" #include "FixAry.h" +#include "hash.h" #include "libutil.h" #include "mpr.h" @@ -354,6 +355,8 @@ struct item_def std::string inscription; + CrawlHashTable props; + public: item_def() : base_type(OBJ_UNASSIGNED), sub_type(0), plus(0), plus2(0), special(0L), colour(0), flags(0L), quantity(0), |