summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mutation.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-06-10 23:49:56 -0400
committerNeil Moore <neil@s-z.org>2014-06-11 00:03:24 -0400
commite6c8f8b119f1eb522ce74e88a57d87747d36ab12 (patch)
tree6209505c85180e204c60358ee609a23d05ec9aa8 /crawl-ref/source/mutation.cc
parentf31cd5152f53cbc350f75d6b256ca0b0653a653f (diff)
downloadcrawl-ref-e6c8f8b119f1eb522ce74e88a57d87747d36ab12.tar.gz
crawl-ref-e6c8f8b119f1eb522ce74e88a57d87747d36ab12.zip
Don't check _accept_mutation in _get_mut_with_use.
Most of the code that was replaced by _get_mut_with_use did not care whether the mutation was acceptible, and some of the code was broken by the change. In particular, _delete_random_slime_mutation indexed you.mutations directly with the result, causing a crash when the selected mutation was unacceptible [1]---and even if the crash were fixed, the behaviour would be wrong because it would never select a maxed-out slime mutation. Move the _accept_mutation call out of _get_mut_with_use and into the one caller that needed it, _get_random_mutation. [1] For example, http://crawl.akrasiac.org/rawdata/DreamWalker/crash-DreamWalker-20140611-033210.txt
Diffstat (limited to 'crawl-ref/source/mutation.cc')
-rw-r--r--crawl-ref/source/mutation.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index c3e47da988..4ed32550d5 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -995,9 +995,7 @@ static mutation_type _get_mut_with_use(mut_use_type mt)
if (cweight >= 0)
continue;
- if (_accept_mutation(mut_data[i].mutation, true))
- return mut_data[i].mutation;
- return NUM_MUTATIONS;
+ return mut_data[i].mutation;
}
die("Error while selecting mutations");
@@ -1086,7 +1084,7 @@ static mutation_type _get_random_mutation(mutation_type mutclass)
for (int attempt = 0; attempt < 100; ++attempt)
{
mutation_type mut = _get_mut_with_use(mt);
- if (mut != NUM_MUTATIONS)
+ if (_accept_mutation(mut, true))
return mut;
}