summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-08 13:11:12 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-12-08 13:11:12 +0000
commit51327cc685e971ea15799d8ed926d6fbafebcb5a (patch)
tree14bd4ceb661264236295432056d29ef2293e7528 /crawl-ref/source/dungeon.cc
parent6c99170d8941c25c6aac7f131f0d55df52caa63a (diff)
downloadcrawl-ref-51327cc685e971ea15799d8ed926d6fbafebcb5a.tar.gz
crawl-ref-51327cc685e971ea15799d8ed926d6fbafebcb5a.zip
Better handling for entry minivaults and minivaults that specify PLACE:
Force the parser to flag an error when it finds embedded spaces in a map. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@597 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc48
1 files changed, 25 insertions, 23 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 4bd498f668..c825264e03 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
+#include <set>
#include "AppHdr.h"
#include "abyss.h"
@@ -84,7 +85,7 @@ static void builder_items(int level_number, char level_type, int items_wanted);
static void builder_monsters(int level_number, char level_type, int mon_wanted);
static void place_specific_stair(unsigned char stair);
static void place_branch_entrances(int dlevel, char level_type);
-static void place_entry_minivaults(int level_number);
+static void place_special_minivaults(int level_number, int level_type);
static void place_traps( int level_number );
static void prepare_swamp(void);
static void prepare_water( int level_number );
@@ -303,6 +304,10 @@ void builder(int level_number, char level_type)
}
}
+ // Try to place minivaults that really badly want to be placed. Still
+ // no guarantees, seeing this is a minivault.
+ place_special_minivaults(level_number, level_type);
+
// hook up the special room (if there is one, and it hasn't
// been hooked up already in roguey_level()
if (sr.created && !sr.hooked_up)
@@ -3781,7 +3786,7 @@ static int builder_by_type(int level_number, char level_type)
return 0;
}
-static int random_map_for_dlevel(int level_number)
+static int random_map_for_dlevel(int level_number, bool wantmini = false)
{
int subdepth = subdungeon_depth(you.where_are_you, level_number);
const std::string name = level_name(subdepth);
@@ -3792,16 +3797,16 @@ static int random_map_for_dlevel(int level_number)
if (subdepth == branch_depth( branch_stair(you.where_are_you) ))
altname = level_name(0);
- int vault = random_map_for_place(name);
+ int vault = random_map_for_place(name, wantmini);
if (vault == -1)
- vault = random_map_for_place(altname);
+ vault = random_map_for_place(altname, wantmini);
if (vault == -1
&& you.where_are_you == BRANCH_MAIN_DUNGEON
&& level_number == 0)
{
- vault = random_map_for_tag("entry", false);
+ vault = random_map_for_tag("entry", wantmini);
}
return (vault);
@@ -3816,15 +3821,6 @@ static int builder_by_branch(int level_number)
if (vault != -1)
{
build_vaults(level_number, vault);
- place_entry_minivaults(level_number);
-
- // link_items() is only needed if we're going to bypass the
- // rest of the dungeon generation process (previously done
- // only for the Vestibule of Hell). We really don't need it
- // any more since we use the regular generation process even
- // for the Vestibule (the Vestibule now also gets random
- // monsters in addition to the loser Geryon).
- link_items();
return 1;
}
@@ -3856,19 +3852,30 @@ static int builder_by_branch(int level_number)
return 0;
}
-static void place_entry_minivaults(int level_number)
+static void place_special_minivaults(int level_number, int level_type)
{
- if (level_number > 0 || you.where_are_you != BRANCH_MAIN_DUNGEON)
+ // Dungeon-style branches only, thankyouverymuch.
+ if (level_type != LEVEL_DUNGEON)
return;
- int chance = 50;
+ int chance = level_number == 0? 50 : 100;
+ std::set<int> used;
while (chance && random2(100) < chance)
{
- const int vault = random_map_for_tag("entry", true);
+ const int vault = random_map_for_dlevel(level_number, true);
if (vault == -1)
break;
+ // If we've already used this minivault and it doesn't want duplicates,
+ // break.
+ if (used.find(vault) != used.end()
+ && !map_by_index(vault)->has_tag("allow_dup"))
+ {
+ break;
+ }
+
build_minivaults(level_number, vault);
+ used.insert(vault);
chance /= 4;
}
}
@@ -3895,7 +3902,6 @@ static int builder_normal(int level_number, char level_type, spec_room &sr)
if (vault != -1)
{
build_vaults(level_number, vault);
- place_entry_minivaults(level_number);
return 1;
}
@@ -3976,10 +3982,6 @@ static int builder_normal(int level_number, char level_type, spec_room &sr)
}
}
- // On D:1, try to place minivaults tagged "entry". This is over
- // and above full-fledged entry vaults.
- place_entry_minivaults(level_number);
-
// maybe create a special room, if roguey_level hasn't done it
// already.
if (!sr.created && level_number > 5 && !done_city && one_chance_in(5))