blob: 868fe43388926565d6065f11963523562310b1e6 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <memory>
#include "backend/Dungeon.h"
#include "backend/print.h"
#include "rl.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;
}
|