diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 17:13:52 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-07 17:19:31 +0530 |
commit | 437d51508324242d03d1ad0978f71ffcc333a138 (patch) | |
tree | 4e0f8d74dd956670dcd34fcfbab00593a9293717 /crawl-ref/source/artefact.cc | |
parent | b5014a90345dafc41f4a1379279bd5949c57313e (diff) | |
download | crawl-ref-437d51508324242d03d1ad0978f71ffcc333a138.tar.gz crawl-ref-437d51508324242d03d1ad0978f71ffcc333a138.zip |
Fix rare hang attempting to generate item with spec "acquire:the_shining_one any".
Diffstat (limited to 'crawl-ref/source/artefact.cc')
-rw-r--r-- | crawl-ref/source/artefact.cc | 5 |
1 files changed, 3 insertions, 2 deletions
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. |