From 6235e6f426a368740967eddc1db37029e665f2c2 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 25 Apr 2008 13:45:25 +0000 Subject: Fix props vector not being initialized for unrandarts (BR 1951367 and others). I'm really sorry about that! Modify pickup.lua to allow Vampires to pick up !berserk rage etc. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4619 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/randart.cc | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/randart.cc') diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 5f58edab16..8f58f30aa1 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -1147,6 +1147,13 @@ void randart_wpn_properties( const item_def &item, for (vec_size i = 0; i < RA_PROPERTIES; i++) proprt[i] = rap_vec[i].get_short(); } + else if (is_unrandom_artefact( item )) + { + const unrandart_entry *unrand = _seekunrandart( item ); + + for (int i = 0; i < RA_PROPERTIES; i++) + proprt[i] = (short) unrand->prpty[i]; + } else { _get_randart_properties(item, proprt); @@ -1882,18 +1889,28 @@ bool make_item_unrandart( item_def &item, int unrand_index ) known[i] = (bool) false; } - item.base_type = unranddata[unrand_index].ura_cl; - item.sub_type = unranddata[unrand_index].ura_ty; - item.plus = unranddata[unrand_index].ura_pl; - item.plus2 = unranddata[unrand_index].ura_pl2; - item.colour = unranddata[unrand_index].ura_col; + const unrandart_entry *unrand = &unranddata[unrand_index]; + item.base_type = unrand->ura_cl; + item.sub_type = unrand->ura_ty; + item.plus = unrand->ura_pl; + item.plus2 = unrand->ura_pl2; + item.colour = unrand->ura_col; item.flags |= ISFLAG_UNRANDART; - item.special = unranddata[ unrand_index ].prpty[ RAP_BRAND ]; + _init_randart_properties(item); - if (unranddata[ unrand_index ].prpty[ RAP_CURSED ] != 0) + item.special = unrand->prpty[ RAP_BRAND ]; + if (unrand->prpty[ RAP_CURSED ] != 0) do_curse_item( item ); + // get true artefact name + ASSERT(!item.props.exists( RANDART_NAME_KEY )); + item.props[RANDART_NAME_KEY].get_string() = unrand->name; + + // get artefact appearance + ASSERT(!item.props.exists( RANDART_APPEAR_KEY )); + item.props[RANDART_APPEAR_KEY].get_string() = unrand->unid_name; + set_unrandart_exist( unrand_index, true ); return (true); @@ -1901,8 +1918,8 @@ bool make_item_unrandart( item_def &item, int unrand_index ) const char *unrandart_descrip( int which_descrip, const item_def &item ) { -/* Eventually it would be great to have randomly generated descriptions for - randarts. */ +// Eventually it would be great to have randomly generated descriptions +// for randarts. const unrandart_entry *unrand = _seekunrandart( item ); return ((which_descrip == 0) ? unrand->spec_descrip1 : -- cgit v1.2.3-54-g00ecf