diff options
-rw-r--r-- | crawl-ref/source/artefact.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/artefact.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/spl-book.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/wiz-item.cc | 9 |
4 files changed, 5 insertions, 29 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc index 8ceaeaae41..5803293f10 100644 --- a/crawl-ref/source/artefact.cc +++ b/crawl-ref/source/artefact.cc @@ -416,11 +416,6 @@ void reveal_randapp_artefact(item_def &item) item.colour = unrand->colour; } -static uint32_t _calc_seed(const item_def &item) -{ - return (item.special & RANDART_SEED_MASK); -} - void artefact_desc_properties(const item_def &item, artefact_properties_t &proprt, artefact_known_props_t &known, @@ -699,10 +694,6 @@ void static _get_randart_properties(const item_def &item, const int atype = item.sub_type; int power_level = 0; - const uint32_t seed = _calc_seed(item); - rng_save_excursion exc; - seed_rng(seed); - if (aclass == OBJ_ARMOUR) power_level = item.plus / 2 + 2; else if (aclass == OBJ_JEWELLERY) @@ -1298,9 +1289,7 @@ void artefact_wpn_properties(const item_def &item, proprt[i] = static_cast<short>(unrand->prpty[i]); } else - { _get_randart_properties(item, proprt); - } } @@ -1449,8 +1438,6 @@ std::string artefact_name(const item_def &item, bool appearance) return unrand->unid_name; } - const uint32_t seed = _calc_seed(item); - std::string lookup; std::string result; @@ -1477,9 +1464,6 @@ std::string artefact_name(const item_def &item, bool appearance) // get base type lookup += _get_artefact_type(item, appearance); - rng_save_excursion rng_state; - seed_rng(seed); - if (appearance) { std::string appear = getRandNameString(lookup, " appearance"); @@ -1928,12 +1912,10 @@ bool make_item_randart(item_def &item, bool force_mundane) int randart_tries = 500; do { - item.special = (random_int() & RANDART_SEED_MASK); // Now that we found something, initialise the props array. if (--randart_tries <= 0 || !_init_artefact_properties(item)) { - // Something went wrong that no amount of changing - // item.special will fix. + // Something went wrong that no amount of rerolling will fix. item.special = 0; item.props.erase(ARTEFACT_PROPS_KEY); item.props.erase(KNOWN_PROPS_KEY); diff --git a/crawl-ref/source/artefact.h b/crawl-ref/source/artefact.h index 1edd0eec76..0702651dc1 100644 --- a/crawl-ref/source/artefact.h +++ b/crawl-ref/source/artefact.h @@ -15,9 +15,6 @@ struct bolt; #define ART_PROPERTIES ARTP_NUM_PROPERTIES -// Reserving the upper bits for later expansion/versioning. -#define RANDART_SEED_MASK 0x00ffffff - #define KNOWN_PROPS_KEY "artefact_known_props" #define ARTEFACT_PROPS_KEY "artefact_props" #define ARTEFACT_NAME_KEY "artefact_name" diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index fa38d916ed..06c9ec1d29 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1673,8 +1673,6 @@ static void _make_book_randart(item_def &book) { if (!is_artefact(book)) { - // This may need to get re-initialized at some point. - book.special = (random_int() & RANDART_SEED_MASK); book.flags |= ISFLAG_RANDART; if (!book.props.exists(ARTEFACT_APPEAR_KEY)) { diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index d10f140103..deb49890af 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -1294,6 +1294,7 @@ static void _debug_acquirement_stats(FILE *ostat) mpr("Results written into 'items.stat'."); } +#define MAX_TRIES 16777216 /* not special anymore */ static void _debug_rap_stats(FILE *ostat) { int i = prompt_invent_item("Generate randart stats on which item?", @@ -1376,7 +1377,7 @@ static void _debug_rap_stats(FILE *ostat) artefact_properties_t proprt; - for (i = 0; i < RANDART_SEED_MASK; ++i) + for (i = 0; i < MAX_TRIES; ++i) { if (kbhit()) { @@ -1385,8 +1386,6 @@ static void _debug_rap_stats(FILE *ostat) break; } - item.special = i; - // Generate proprt once and hand it off to randart_is_bad(), // so that randart_is_bad() doesn't generate it a second time. artefact_wpn_properties(item, proprt); @@ -1442,11 +1441,11 @@ static void _debug_rap_stats(FILE *ostat) total_bad_props += num_bad_props; total_balance_props += balance; - if (i % 16777 == 0) + if (i % 16767 == 0) { mesclr(); float curr_percent = (float) i * 1000.0 - / (float) RANDART_SEED_MASK; + / (float) MAX_TRIES; mprf("%4.1f%% done.", curr_percent / 10.0); } |