From a04cb74fee079e3ee43ae5fae32fc2674409822c Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 29 Oct 2024 21:30:38 +0100 Subject: implement movement --- backend/Dungeon.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'backend/Dungeon.cpp') diff --git a/backend/Dungeon.cpp b/backend/Dungeon.cpp index 55dccec..3de2f11 100644 --- a/backend/Dungeon.cpp +++ b/backend/Dungeon.cpp @@ -1,4 +1,5 @@ #include "Dungeon.h" +#include "RNG.h" void Dungeon::update() { @@ -8,3 +9,10 @@ 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]; +} + -- cgit v1.2.3