summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/branch.cc44
-rw-r--r--crawl-ref/source/branch.h1
-rw-r--r--crawl-ref/source/dungeon.cc50
3 files changed, 50 insertions, 45 deletions
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc
index ff56d2fe1b..1f7409a451 100644
--- a/crawl-ref/source/branch.cc
+++ b/crawl-ref/source/branch.cc
@@ -19,7 +19,7 @@ Branch branches[] = {
"Dungeon", "the Dungeon", "D",
NULL,
true, true, LIGHTGREY, BROWN,
- mons_standard_rare, mons_standard_level, NULL,
+ mons_standard_rare, mons_standard_level,
8, 'D'
},
@@ -28,7 +28,7 @@ Branch branches[] = {
"Temple", "the Ecumenical Temple", "Temple",
NULL,
false, false, LIGHTGREY, LIGHTGREY,
- mons_standard_rare, mons_standard_level, NULL,
+ mons_standard_rare, mons_standard_level,
0, 'T' },
{ BRANCH_ORCISH_MINES, BRANCH_MAIN_DUNGEON, 4, 6,
@@ -36,7 +36,7 @@ Branch branches[] = {
"Orcish Mines", "the Orcish Mines", "Orc",
NULL,
true, false, BROWN, BROWN,
- mons_mineorc_rare, mons_mineorc_level, NULL,
+ mons_mineorc_rare, mons_mineorc_level,
20, 'O' },
{ BRANCH_ELVEN_HALLS, BRANCH_ORCISH_MINES, 7, 4,
@@ -44,7 +44,7 @@ Branch branches[] = {
"Elven Halls", "the Elven Halls", "Elf",
NULL,
true, true, DARKGREY, LIGHTGREY,
- mons_hallelf_rare, mons_hallelf_level, NULL,
+ mons_hallelf_rare, mons_hallelf_level,
8, 'E' },
{ BRANCH_LAIR, BRANCH_MAIN_DUNGEON, 10, 8,
@@ -52,7 +52,7 @@ Branch branches[] = {
"Lair", "the Lair of Beasts", "Lair",
NULL,
true, false, GREEN, BROWN,
- mons_lair_rare, mons_lair_level, NULL,
+ mons_lair_rare, mons_lair_level,
5, 'L' },
{ BRANCH_SWAMP, BRANCH_LAIR, 5, 3,
@@ -60,7 +60,7 @@ Branch branches[] = {
"Swamp", "the Swamp", "Swamp",
NULL,
true, true, BROWN, BROWN,
- mons_swamp_rare, mons_swamp_level, NULL,
+ mons_swamp_rare, mons_swamp_level,
0, 'S' },
{ BRANCH_SLIME_PITS, BRANCH_LAIR, 6, 4,
@@ -68,7 +68,7 @@ Branch branches[] = {
"Slime Pits", "the Pits of Slime", "Slime",
NULL,
false, false, GREEN, LIGHTGREEN,
- mons_pitslime_rare, mons_pitslime_level, NULL,
+ mons_pitslime_rare, mons_pitslime_level,
5, 'M' },
{ BRANCH_SNAKE_PIT, BRANCH_LAIR, 5, 7,
@@ -76,7 +76,7 @@ Branch branches[] = {
"Snake Pit", "the Snake Pit", "Snake",
NULL,
true, true, LIGHTGREEN, YELLOW,
- mons_pitsnake_rare, mons_pitsnake_level, NULL,
+ mons_pitsnake_rare, mons_pitsnake_level,
10, 'P' },
{ BRANCH_HIVE, BRANCH_MAIN_DUNGEON, 4, 15,
@@ -84,7 +84,7 @@ Branch branches[] = {
"Hive", "the Hive", "Hive",
"You hear a buzzing sound coming from all directions.",
false, false, YELLOW, BROWN,
- mons_hive_rare, mons_hive_level, NULL,
+ mons_hive_rare, mons_hive_level,
0, 'H' },
{ BRANCH_VAULTS, BRANCH_MAIN_DUNGEON, 8, 17,
@@ -92,7 +92,7 @@ Branch branches[] = {
"Vaults", "the Vaults", "Vault",
NULL,
true, true, LIGHTGREY, BROWN,
- mons_standard_rare, mons_standard_level, NULL,
+ mons_standard_rare, mons_standard_level,
5, 'V' },
@@ -101,7 +101,7 @@ Branch branches[] = {
"Hall of Blades", "the Hall of Blades", "Blade",
NULL,
false, true, LIGHTGREY, LIGHTGREY,
- mons_hallblade_rare, mons_hallblade_level, NULL,
+ mons_hallblade_rare, mons_hallblade_level,
0, 'B' },
{ BRANCH_CRYPT, BRANCH_VAULTS, 5, 3,
@@ -109,7 +109,7 @@ Branch branches[] = {
"Crypt", "the Crypt", "Crypt",
NULL,
false, true, LIGHTGREY, LIGHTGREY,
- mons_crypt_rare, mons_crypt_level, NULL,
+ mons_crypt_rare, mons_crypt_level,
5, 'C' },
{ BRANCH_TOMB, BRANCH_CRYPT, 3, 5,
@@ -117,7 +117,7 @@ Branch branches[] = {
"Tomb", "the Tomb of the Ancients", "Tomb",
NULL,
false, true, YELLOW, LIGHTGREY,
- mons_tomb_rare, mons_tomb_level, NULL,
+ mons_tomb_rare, mons_tomb_level,
0, 'G' },
{ BRANCH_VESTIBULE_OF_HELL, BRANCH_MAIN_DUNGEON, 1, -1,
@@ -125,7 +125,7 @@ Branch branches[] = {
"Hell", "The Vestibule of Hell", "Hell",
NULL,
false, true, LIGHTGREY, LIGHTGREY,
- mons_standard_rare, mons_standard_level, NULL,
+ mons_standard_rare, mons_standard_level,
0, 'U'
},
@@ -134,7 +134,7 @@ Branch branches[] = {
"Dis", "the Iron City of Dis", "Dis",
NULL,
false, false, CYAN, CYAN,
- mons_dis_rare, mons_dis_level, NULL,
+ mons_dis_rare, mons_dis_level,
0, 'I'
},
@@ -143,7 +143,7 @@ Branch branches[] = {
"Gehenna", "Gehenna", "Geh",
NULL,
false, false, DARKGREY, RED,
- mons_gehenna_rare, mons_gehenna_level, NULL,
+ mons_gehenna_rare, mons_gehenna_level,
0, 'N'
},
@@ -152,7 +152,7 @@ Branch branches[] = {
"Cocytus", "Cocytus", "Coc",
NULL,
false, false, LIGHTBLUE, LIGHTCYAN,
- mons_cocytus_rare, mons_cocytus_level, NULL,
+ mons_cocytus_rare, mons_cocytus_level,
0, 'X'
},
@@ -161,7 +161,7 @@ Branch branches[] = {
"Tartarus", "Tartarus", "Tar",
NULL,
false, false, DARKGREY, DARKGREY,
- mons_tartarus_rare, mons_tartarus_level, NULL,
+ mons_tartarus_rare, mons_tartarus_level,
0, 'Y'
},
@@ -170,7 +170,7 @@ Branch branches[] = {
NULL, NULL, NULL,
NULL,
false, false, BLACK, BLACK,
- NULL, NULL, NULL,
+ NULL, NULL,
0, 'R'
},
@@ -179,7 +179,7 @@ Branch branches[] = {
NULL, NULL, NULL,
NULL,
false, false, BLACK, BLACK,
- NULL, NULL, NULL,
+ NULL, NULL,
0, '0'
},
@@ -188,7 +188,7 @@ Branch branches[] = {
"Zot", "the Realm of Zot", "Zot",
NULL,
false, true, BLACK, BLACK,
- mons_hallzot_rare, mons_hallzot_level, NULL,
+ mons_hallzot_rare, mons_hallzot_level,
1, 'Z' },
{ BRANCH_CAVERNS, BRANCH_MAIN_DUNGEON, -1, -1,
@@ -196,7 +196,7 @@ Branch branches[] = {
NULL, NULL, NULL,
NULL,
false, false, BLACK, BLACK,
- NULL, NULL, NULL,
+ NULL, NULL,
0, 0
}
};
diff --git a/crawl-ref/source/branch.h b/crawl-ref/source/branch.h
index 8246f7128c..b9fe0774f8 100644
--- a/crawl-ref/source/branch.h
+++ b/crawl-ref/source/branch.h
@@ -31,7 +31,6 @@ struct Branch
char rock_colour;
int (*mons_rarity_function)(int);
int (*mons_level_function)(int);
- void (*level_builder_function)(int);
int altar_chance; // in percent
int travel_shortcut; // which key to press for travel
};
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index c7a780606e..314ddf5d8e 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -136,7 +136,7 @@ static void diamond_rooms(int level_number);
// ITEM & SHOP FUNCTIONS
static void place_shops(int level_number);
-static unsigned char item_in_shop(unsigned char shop_type);
+static object_class_type item_in_shop(unsigned char shop_type);
static bool treasure_area(int level_number, unsigned char ta1_x,
unsigned char ta2_x, unsigned char ta1_y,
unsigned char ta2_y);
@@ -166,7 +166,7 @@ static int vault_grid( vault_placement &,
int &num_runes, int rune_subst = -1, bool foll = false);
// ALTAR FUNCTIONS
-static int pick_an_altar(void);
+static dungeon_feature_type pick_an_altar(void);
static void place_altar(void);
//////////////////////////////////////////////////////////////////////////
@@ -415,6 +415,15 @@ static void build_layout_skeleton(int level_number, int level_type,
}
}
+static int num_items_wanted(int level_number)
+{
+ if (level_number > 5 && one_chance_in(500 - 5 * level_number))
+ return 10 + random2avg( 90, 2 ); // rich level!
+ else
+ return 3 + roll_dice( 3, 11 );
+}
+
+
static int num_mons_wanted(int level_type)
{
if (level_type == LEVEL_ABYSS ||
@@ -551,17 +560,12 @@ static void build_dungeon_level(int level_number, int level_type)
if (!player_in_branch( BRANCH_ECUMENICAL_TEMPLE ))
place_traps(level_number);
- int items_wanted = 3 + roll_dice( 3, 11 );
-
- if (level_number > 5 && one_chance_in(500 - 5 * level_number))
- items_wanted = 10 + random2avg( 90, 2 ); // rich level!
-
// change pre-rock (105) to rock, and pre-floor (106) to floor
replace_area( 0,0,GXM-1,GYM-1, DNGN_BUILDER_SPECIAL_WALL, DNGN_ROCK_WALL );
replace_area( 0,0,GXM-1,GYM-1, DNGN_BUILDER_SPECIAL_FLOOR, DNGN_FLOOR );
// place items
- builder_items(level_number, level_type, items_wanted);
+ builder_items(level_number, level_type, num_items_wanted(level_number));
// place monsters
builder_monsters(level_number, level_type, num_mons_wanted(level_type));
@@ -591,7 +595,7 @@ void init_rod_mp(item_def &item)
else
item.plus2 = random_range(9, 14) * ROD_CHARGE_MULT;
- item.plus = item.plus2;
+ item.plus = item.plus2;
}
static bool weapon_is_visibly_special(const item_def &item)
@@ -620,8 +624,8 @@ int items( int allow_uniques, // not just true-false,
bool dont_place, // don't randomly place item on level
int item_level, // level of the item, can differ from global
int item_race, // weapon / armour racial categories
- const dgn_region_list &forbidden)
// item_race also gives type of rune!
+ const dgn_region_list &forbidden)
{
int temp_rand = 0; // probability determination {dlb}
int range_charges = 0; // for OBJ_WANDS charge count {dlb}
@@ -2729,7 +2733,7 @@ static void give_monster_item(monsters *mon, int thing, bool force_item = false)
break;
}
- const int mholy = mons_holiness(mon);
+ const mon_holy_type mholy = mons_holiness(mon);
if (get_weapon_brand( mthing ) == SPWPN_PROTECTION )
mon->ac += 5;
@@ -4778,14 +4782,14 @@ static int place_uniques(int level_number, char level_type)
return num_placed;
}
-static int place_monster_vector(int* montypes, int numtypes,
+static int place_monster_vector(std::vector<int> montypes,
int level_number, int num_to_place)
{
int result = 0;
int not_used = 0;
for (int i = 0; i < num_to_place; i++)
{
- if (place_monster( not_used, montypes[random2(numtypes)],
+ if (place_monster( not_used, montypes[random2((int)montypes.size())],
level_number, BEH_SLEEP, MHITNOT,
false, 1, 1, true, PROX_ANYWHERE, 250, 0,
no_monster_zones ))
@@ -4800,7 +4804,7 @@ static int place_monster_vector(int* montypes, int numtypes,
static void place_aquatic_monsters(int level_number, char level_type)
{
int lava_spaces = 0, water_spaces = 0;
- int swimming_things[4];
+ std::vector<int> swimming_things(4u, NON_MONSTER);
// count the number of lava and water tiles {dlb}:
for (int x = 0; x < GXM; x++)
@@ -4823,7 +4827,7 @@ static void place_aquatic_monsters(int level_number, char level_type)
swimming_things[i] = MONS_SALAMANDER;
}
- place_monster_vector(swimming_things, 4, level_number,
+ place_monster_vector(swimming_things, level_number,
std::min(random2avg(9, 2) +
(random2(lava_spaces) / 10), 15));
}
@@ -4843,7 +4847,7 @@ static void place_aquatic_monsters(int level_number, char level_type)
if (player_in_branch( BRANCH_COCYTUS ))
swimming_things[3] = MONS_WATER_ELEMENTAL;
- place_monster_vector(swimming_things, 4, level_number,
+ place_monster_vector(swimming_things, level_number,
std::min(random2avg(9, 2) +
(random2(water_spaces) / 10), 15));
}
@@ -7278,9 +7282,9 @@ void item_colour( item_def &item )
} // end item_colour()
//jmf: generate altar based on where you are, or possibly randomly
-static int pick_an_altar(void)
+static dungeon_feature_type pick_an_altar(void)
{
- int altar_type = 0;
+ dungeon_feature_type altar_type;
int temp_rand; // probability determination {dlb}
if (player_in_branch( BRANCH_SLIME_PITS )
@@ -7339,7 +7343,9 @@ static int pick_an_altar(void)
default:
do
{
- altar_type = DNGN_ALTAR_ZIN + random2(NUM_GODS - 1);
+ altar_type =
+ static_cast<dungeon_feature_type>(DNGN_ALTAR_ZIN +
+ random2(NUM_GODS - 1));
}
while (altar_type == DNGN_ALTAR_NEMELEX_XOBEH
|| altar_type == DNGN_ALTAR_LUGONU);
@@ -7348,7 +7354,7 @@ static int pick_an_altar(void)
}
else
{
- // Note: this case includes the pandemonium or the abyss.
+ // Note: this case includes Pandemonium or the Abyss.
temp_rand = random2(9);
altar_type = ((temp_rand == 0) ? DNGN_ALTAR_ZIN :
@@ -7370,7 +7376,7 @@ static void place_altar(void)
int px, py;
int i, j;
int k = 0, l = 0;
- int altar_type = pick_an_altar();
+ const dungeon_feature_type altar_type = pick_an_altar();
while(true)
{
@@ -7579,7 +7585,7 @@ void place_spec_shop( int level_number,
activate_notes(note_status);
} // end place_spec_shop()
-static unsigned char item_in_shop(unsigned char shop_type)
+static object_class_type item_in_shop(unsigned char shop_type)
{
switch (shop_type)
{