summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/randart.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 04:25:42 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 04:25:42 +0000
commitc2934ef52cd1c8e65712f0800f19080981e0db81 (patch)
tree2f1880e114a13e3cd940f7bd057e5c5c0363d5d1 /crawl-ref/source/randart.cc
parent1eb7f2d5a83ed55299e3ed5c11aab34eb70732f4 (diff)
downloadcrawl-ref-c2934ef52cd1c8e65712f0800f19080981e0db81.tar.gz
crawl-ref-c2934ef52cd1c8e65712f0800f19080981e0db81.zip
The wizard "tweak item" command can now alter randart properties.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5429 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/randart.cc')
-rw-r--r--crawl-ref/source/randart.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 5239139a0a..951ab6427e 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -1929,3 +1929,35 @@ const char *unrandart_descrip( int which_descrip, const item_def &item )
(which_descrip == 2) ? unrand->spec_descrip3
: "Unknown.");
}
+
+void randart_set_properties( item_def &item,
+ randart_properties_t &proprt )
+{
+ ASSERT( is_random_artefact( item ) );
+ ASSERT( !is_unrandom_artefact ( item ) );
+ ASSERT( item.props.exists( RANDART_PROPS_KEY ) );
+
+ CrawlVector &rap_vec = item.props[RANDART_PROPS_KEY].get_vector();
+ ASSERT( rap_vec.get_type() == SV_SHORT );
+ ASSERT( rap_vec.size() == RA_PROPERTIES);
+ ASSERT( rap_vec.get_max_size() == RA_PROPERTIES);
+
+ for (vec_size i = 0; i < RA_PROPERTIES; i++)
+ rap_vec[i].get_short() = proprt[i];
+}
+
+void randart_set_property( item_def &item,
+ randart_prop_type prop,
+ int val )
+{
+ ASSERT( is_random_artefact( item ) );
+ ASSERT( !is_unrandom_artefact ( item ) );
+ ASSERT( item.props.exists( RANDART_PROPS_KEY ) );
+
+ CrawlVector &rap_vec = item.props[RANDART_PROPS_KEY].get_vector();
+ ASSERT( rap_vec.get_type() == SV_SHORT );
+ ASSERT( rap_vec.size() == RA_PROPERTIES);
+ ASSERT( rap_vec.get_max_size() == RA_PROPERTIES);
+
+ rap_vec[prop].get_short() = val;
+}