summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-28 13:09:38 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-28 13:12:13 +1000
commit6d16cbb7c1a0c2d9895bc02beebbf1dee3236dc0 (patch)
treeefed0a9d3cc7afa1474faf359ffd17f9277e2fdd /crawl-ref
parentf886116c80ba004997d72623114d8f332a95b7a7 (diff)
downloadcrawl-ref-6d16cbb7c1a0c2d9895bc02beebbf1dee3236dc0.tar.gz
crawl-ref-6d16cbb7c1a0c2d9895bc02beebbf1dee3236dc0.zip
Make RANDOM_MONSTER work properly in portal vaults.
When the random monster list isn't set in a portal vault, it generates MONS_PROGRAM_BUGS. Instead of doing this, pick random monsters from where you entered the portal vault from. Hopefully this code doesn't cause any bugs.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/mon-place.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index 95d2c6897e..9ef799590c 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -592,11 +592,9 @@ static monster_type _resolve_monster_type(monster_type mon_type,
mon_type = MONS_DANCING_WEAPON;
else
{
- if (you.level_type == LEVEL_PORTAL_VAULT)
+ if (you.level_type == LEVEL_PORTAL_VAULT
+ && vault_mon_types.size() > 0)
{
- if (vault_mon_types.size() == 0)
- return (MONS_PROGRAM_BUG);
-
int i = choose_random_weighted(vault_mon_weights.begin(),
vault_mon_weights.end());
int type = vault_mon_types[i];
@@ -630,6 +628,13 @@ static monster_type _resolve_monster_type(monster_type mon_type,
return (mon_type);
}
}
+ else if (you.level_type == LEVEL_PORTAL_VAULT)
+ {
+ // XXX: We don't have a random monster list here, so pick one
+ // from where we were.
+ place.level_type = LEVEL_DUNGEON;
+ *lev_mons = place.absdepth();
+ }
int tries = 0;
while (tries++ < 300)