From c2934ef52cd1c8e65712f0800f19080981e0db81 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Mon, 2 Jun 2008 04:25:42 +0000 Subject: 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 --- crawl-ref/source/randart.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'crawl-ref/source/randart.cc') 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; +} -- cgit v1.2.3-54-g00ecf