diff options
author | Neil Moore <neil@s-z.org> | 2014-05-05 20:01:05 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-05-05 20:01:06 -0400 |
commit | 86354defe9dc5cb3d15b7596668d15c0c946aaac (patch) | |
tree | 69cc63f6ad95f086fcf0301714ad5ff754d059b0 /crawl-ref/source/mon-place.cc | |
parent | b4200a85f171c7836e69b52cd444e9ef99433049 (diff) | |
download | crawl-ref-86354defe9dc5cb3d15b7596668d15c0c946aaac.tar.gz crawl-ref-86354defe9dc5cb3d15b7596668d15c0c946aaac.zip |
Fix place: random monsters for real.
In 0.15-a0-360-gf5e0bc2 I made a monster_type variable that could
sometimes hold a -1... but then the == -1 check was being optimised
away. I didn't see it locally because I compiled with -O0, where the
code worked as expected.
Diffstat (limited to 'crawl-ref/source/mon-place.cc')
-rw-r--r-- | crawl-ref/source/mon-place.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index 1e7f91f331..72b9e28957 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -656,12 +656,12 @@ monster_type resolve_monster_type(monster_type mon_type, if (!vault_mon_types.empty()) { int i = 0; - monster_type type; + int type; do { i = choose_random_weighted(vault_mon_weights.begin(), vault_mon_weights.end()); - type = (monster_type) vault_mon_types[i]; + type = vault_mon_types[i]; // If the monster list says not to place, or to place // by level, accept that. @@ -669,11 +669,11 @@ monster_type resolve_monster_type(monster_type mon_type, break; } while (mon_type == RANDOM_MOBILE_MONSTER - && mons_class_is_stationary(type) + && mons_class_is_stationary((monster_type)type) || mon_type == RANDOM_COMPATIBLE_MONSTER - && _is_incompatible_monster(type) + && _is_incompatible_monster((monster_type)type) || mon_type == RANDOM_BANDLESS_MONSTER - && _is_banded_monster(type)); + && _is_banded_monster((monster_type)type)); int base = vault_mon_bases[i]; bool banded = vault_mon_bands[i]; @@ -683,7 +683,7 @@ monster_type resolve_monster_type(monster_type mon_type, else { base_type = (monster_type) base; - mon_type = type; + mon_type = (monster_type) type; if (want_band) *want_band = banded; if (needs_resolution(mon_type)) |