blob: d4df1efec6a3664aaff9ea0d27fa7795935b175e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "Location.h"
#include "Dungeon.h"
#include "RNG.h"
void Dungeon::update() {
// TODO: iterators are broken (!????)
// for (Location * location : this->locations) {
// for (Enemy * enemy : location->get_enemies()) {
// if (RNG::get().rand_double() < 0.5) continue;
// Direction direction = random_direction(*location);
// // location->remove_enemy(enemy); // TODO: this breaks the for loop
// location->get_exit(direction)->add_enemy(enemy);
// }
// }
}
void Dungeon::add_location(Location * location) {
this->locations.push_back(location);
}
Location * Dungeon::get_start_location() {
size_t size = this->locations.size();
if (size == 0) return nullptr;
size_t index = RNG::get().rand_int(size);
return this->locations[index];
}
|