aboutsummaryrefslogtreecommitdiff
path: root/frontend/generate_dungeon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/generate_dungeon.cpp')
-rw-r--r--frontend/generate_dungeon.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/generate_dungeon.cpp b/frontend/generate_dungeon.cpp
index 6393abb..99b30a3 100644
--- a/frontend/generate_dungeon.cpp
+++ b/frontend/generate_dungeon.cpp
@@ -44,22 +44,22 @@ unique_ptr<Dungeon> generate_dungeon() {
size_t index = 0;
RNG & rng = RNG::get();
for (const string & name : locations) {
- Location * location = gd.create_location(name);
+ auto location = gd.create_location(name);
if (index % 3 == 0) {
- location->add_enemy(gd.create_enemy(gd.random_enemy()));
+ location->add_enemy(gd.create_enemy(gd.random_enemy()).release());
}
for (const string & object : gd.random_objects(rng.rand_int(Range<int> { 0, 3 }))) {
- location->add_visible_object(gd.create_object(object));
+ location->add_visible_object(gd.create_object(object).release());
}
for (const string & object : gd.random_objects(rng.rand_int(Range<int> { 0, 2 }))) {
- location->add_hidden_object(gd.create_object(object));
+ location->add_hidden_object(gd.create_object(object).release());
}
auto & temp = temp_map[index];
- temp.location = location;
+ temp.location = location.get();
for (Direction direction : shuffled_directions()) {
// skip over already connected edges
if (temp.edges[direction] >= 0) continue;
@@ -75,7 +75,7 @@ unique_ptr<Dungeon> generate_dungeon() {
if (rng.rand_double() < 0.8) break;
}
- dungeon->add_location(location);
+ dungeon->add_location(location.release());
index++;
}
@@ -83,7 +83,7 @@ unique_ptr<Dungeon> generate_dungeon() {
for (Direction direction : DIRECTIONS) {
unsigned id = temp.edges[direction];
if (temp.edges[direction] < 0) continue;
- temp.location->set_exit(direction, temp_map[id].location);
+ temp.location->set_exit(direction, *temp_map[id].location);
}
}