aboutsummaryrefslogtreecommitdiff
path: root/frontend/load_dungeon.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 23:30:57 +0100
commit5c34847218e8d754447f5cf71ed595bbb412eee7 (patch)
tree2872948e6d2f566dd66cb1a9b2a5d9900db4c44f /frontend/load_dungeon.cpp
parenta04cb74fee079e3ee43ae5fae32fc2674409822c (diff)
more WIP
Diffstat (limited to 'frontend/load_dungeon.cpp')
-rw-r--r--frontend/load_dungeon.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/frontend/load_dungeon.cpp b/frontend/load_dungeon.cpp
index e94cbcb..b60a7b9 100644
--- a/frontend/load_dungeon.cpp
+++ b/frontend/load_dungeon.cpp
@@ -1,3 +1,4 @@
+#include <csignal>
#include <memory>
#include <filesystem>
#include <pugixml.hpp>
@@ -54,22 +55,22 @@ unique_ptr<Dungeon> load_dungeon(const string & filename) {
temp_map[tag.attribute("id").as_uint()] = {
.location = location,
.edges = {
- tag.attribute("noord").as_uint(0),
- tag.attribute("oost").as_uint(0),
- tag.attribute("zuid").as_uint(0),
- tag.attribute("west").as_uint(0),
+ [Direction::NORTH] = tag.attribute("noord").as_uint(0),
+ [Direction::EAST] = tag.attribute("oost").as_uint(0),
+ [Direction::SOUTH] = tag.attribute("zuid").as_uint(0),
+ [Direction::WEST] = tag.attribute("west").as_uint(0),
},
};
dungeon->add_location(location);
}
// connect edges after creating all locations
- for (auto & [here, temp] : temp_map) {
+ for (auto & [_, temp] : temp_map) {
for (Direction direction : DIRECTIONS) {
- unsigned there = temp.edges[direction];
+ unsigned id = temp.edges[direction];
if (temp.edges[direction] == 0) continue;
- if (!temp_map.contains(there)) continue;
- temp.location->set_exit(direction, temp_map[there].location);
+ if (!temp_map.contains(id)) continue;
+ temp.location->set_exit(direction, temp_map[id].location);
}
}