aboutsummaryrefslogtreecommitdiff
path: root/frontend/generate_dungeon.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 14:07:01 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 14:07:01 +0100
commit862186ae7cbbd922057fa5f6b49509c36f9ade36 (patch)
tree10193494e1c4bdff793a2daafc2b3359e8794303 /frontend/generate_dungeon.cpp
parentb1d5d7936bed17a684daff15b0294ef70754e8b9 (diff)
generate dungeon kinda works
Diffstat (limited to 'frontend/generate_dungeon.cpp')
-rw-r--r--frontend/generate_dungeon.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/frontend/generate_dungeon.cpp b/frontend/generate_dungeon.cpp
index e2a7c74..80eb0cb 100644
--- a/frontend/generate_dungeon.cpp
+++ b/frontend/generate_dungeon.cpp
@@ -2,16 +2,39 @@
#include "backend/Dungeon.h"
+#include "rl.h"
+#include "print.h"
#include "generate_dungeon.h"
#include "GameData.h"
+#include "Exception.h"
using namespace std;
unique_ptr<Dungeon> generate_dungeon() {
unique_ptr<Dungeon> dungeon = make_unique<Dungeon>();
-
GameData & gd = GameData::get_instance();
+ lprtf("Hoeveel locaties moet de kerker hebben?\n");
+ unsigned location_count = 1;
+ try {
+ string filename = rl();
+ location_count = stoul(filename);
+ } catch (...) {
+ throw Exception("Geen geldig aantal ingevoerd");
+ }
+ if (location_count < 1)
+ throw Exception("Meer dan 1 locatie nodig");
+
+ vector<string> locations = gd.random_locations(location_count);
+ for (const string & name : locations) {
+ Location * location = gd.create_location(name);
+ dungeon->add_location(location);
+ }
+
+ // TODO: connect locations
+ // TODO: optionally add enemy
+ // TODO: generate items
+
return dungeon;
}