#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]; }