diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 14:09:40 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 14:09:40 -0400 |
commit | dc4a14397ae226d91041389c2a47993f9c22f83d (patch) | |
tree | e881fcac382d53961899bd60565ef77422101f6d /game_data.cpp | |
parent | 02c331f4e766558bba580d5b7db883357be005d5 (diff) | |
download | lingo-ap-tracker-dc4a14397ae226d91041389c2a47993f9c22f83d.tar.gz lingo-ap-tracker-dc4a14397ae226d91041389c2a47993f9c22f83d.tar.bz2 lingo-ap-tracker-dc4a14397ae226d91041389c2a47993f9c22f83d.zip |
Added painting shuffle support
Diffstat (limited to 'game_data.cpp')
-rw-r--r-- | game_data.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/game_data.cpp b/game_data.cpp index 80ffd97..2f8f505 100644 --- a/game_data.cpp +++ b/game_data.cpp | |||
@@ -63,6 +63,10 @@ GameData::GameData() { | |||
63 | door_room, entrance_it.second["door"].as<std::string>()); | 63 | door_room, entrance_it.second["door"].as<std::string>()); |
64 | } | 64 | } |
65 | 65 | ||
66 | if (entrance_it.second["painting"]) { | ||
67 | exit_obj.painting = entrance_it.second["painting"].as<bool>(); | ||
68 | } | ||
69 | |||
66 | from_room_obj.exits.push_back(exit_obj); | 70 | from_room_obj.exits.push_back(exit_obj); |
67 | break; | 71 | break; |
68 | } | 72 | } |
@@ -78,6 +82,10 @@ GameData::GameData() { | |||
78 | exit_obj.door = | 82 | exit_obj.door = |
79 | AddOrGetDoor(door_room, option["door"].as<std::string>()); | 83 | AddOrGetDoor(door_room, option["door"].as<std::string>()); |
80 | 84 | ||
85 | if (option["painting"]) { | ||
86 | exit_obj.painting = option["painting"].as<bool>(); | ||
87 | } | ||
88 | |||
81 | from_room_obj.exits.push_back(exit_obj); | 89 | from_room_obj.exits.push_back(exit_obj); |
82 | } | 90 | } |
83 | 91 | ||
@@ -225,6 +233,31 @@ GameData::GameData() { | |||
225 | } | 233 | } |
226 | } | 234 | } |
227 | } | 235 | } |
236 | |||
237 | if (room_it.second["paintings"]) { | ||
238 | for (const auto& painting : room_it.second["paintings"]) { | ||
239 | std::string painting_id = painting["id"].as<std::string>(); | ||
240 | room_by_painting_[painting_id] = room_id; | ||
241 | |||
242 | if (!painting["exit_only"] || !painting["exit_only"].as<bool>()) { | ||
243 | PaintingExit painting_exit; | ||
244 | painting_exit.id = painting_id; | ||
245 | |||
246 | if (painting["required_door"]) { | ||
247 | std::string rd_room = room_obj.name; | ||
248 | if (painting["required_door"]["room"]) { | ||
249 | rd_room = painting["required_door"]["room"].as<std::string>(); | ||
250 | } | ||
251 | |||
252 | painting_exit.door = AddOrGetDoor( | ||
253 | rd_room, | ||
254 | painting["required_door"]["door"].as<std::string>()); | ||
255 | } | ||
256 | |||
257 | room_obj.paintings.push_back(painting_exit); | ||
258 | } | ||
259 | } | ||
260 | } | ||
228 | } | 261 | } |
229 | 262 | ||
230 | map_areas_.reserve(areas_config.size()); | 263 | map_areas_.reserve(areas_config.size()); |