From 437d51508324242d03d1ad0978f71ffcc333a138 Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Thu, 7 Jan 2010 17:13:52 +0530 Subject: Fix rare hang attempting to generate item with spec "acquire:the_shining_one any". --- crawl-ref/source/artefact.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc index 007a799cfe..a8648bf4d2 100644 --- a/crawl-ref/source/artefact.cc +++ b/crawl-ref/source/artefact.cc @@ -780,7 +780,7 @@ void static _get_randart_properties(const item_def &item, proprt[ARTP_BRAND] = SPWPN_NORMAL; // XXX: Only allow reaping brand on bows. This may change. - if (atype != WPN_BOW && atype != WPN_LONGBOW + if (atype != WPN_BOW && atype != WPN_LONGBOW && proprt[ARTP_BRAND] == SPWPN_REAPING) { proprt[ARTP_BRAND] = SPWPN_NORMAL; @@ -1947,11 +1947,12 @@ bool make_item_randart( item_def &item, bool force_mundane ) god_type god_gift; (void) origin_is_god_gift(item, &god_gift); + int randart_tries = 500; do { item.special = (random_int() & RANDART_SEED_MASK); // Now that we found something, initialise the props array. - if (!_init_artefact_properties(item)) + if (--randart_tries <= 0 || !_init_artefact_properties(item)) { // Something went wrong that no amount of changing // item.special will fix. -- cgit v1.2.3-54-g00ecf