diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 17:25:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 17:25:41 -0400 |
commit | 08ffb400114029569b4043b4f4c5a3f2af9b37b8 (patch) | |
tree | be79e53b617230007fe64c0fd1a900ef8c8434d2 /game_data.cpp | |
parent | f960478d05222fc54f466fc863983fcc3a5eaaeb (diff) | |
download | lingo-ap-tracker-08ffb400114029569b4043b4f4c5a3f2af9b37b8.tar.gz lingo-ap-tracker-08ffb400114029569b4043b4f4c5a3f2af9b37b8.tar.bz2 lingo-ap-tracker-08ffb400114029569b4043b4f4c5a3f2af9b37b8.zip |
Added progressive items
Diffstat (limited to 'game_data.cpp')
-rw-r--r-- | game_data.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/game_data.cpp b/game_data.cpp index 2f8f505..9b31f89 100644 --- a/game_data.cpp +++ b/game_data.cpp | |||
@@ -235,7 +235,7 @@ GameData::GameData() { | |||
235 | } | 235 | } |
236 | 236 | ||
237 | if (room_it.second["paintings"]) { | 237 | if (room_it.second["paintings"]) { |
238 | for (const auto& painting : room_it.second["paintings"]) { | 238 | for (const auto &painting : room_it.second["paintings"]) { |
239 | std::string painting_id = painting["id"].as<std::string>(); | 239 | std::string painting_id = painting["id"].as<std::string>(); |
240 | room_by_painting_[painting_id] = room_id; | 240 | room_by_painting_[painting_id] = room_id; |
241 | 241 | ||
@@ -250,14 +250,36 @@ GameData::GameData() { | |||
250 | } | 250 | } |
251 | 251 | ||
252 | painting_exit.door = AddOrGetDoor( | 252 | painting_exit.door = AddOrGetDoor( |
253 | rd_room, | 253 | rd_room, painting["required_door"]["door"].as<std::string>()); |
254 | painting["required_door"]["door"].as<std::string>()); | ||
255 | } | 254 | } |
256 | 255 | ||
257 | room_obj.paintings.push_back(painting_exit); | 256 | room_obj.paintings.push_back(painting_exit); |
258 | } | 257 | } |
259 | } | 258 | } |
260 | } | 259 | } |
260 | |||
261 | if (room_it.second["progression"]) { | ||
262 | for (const auto &progression_it : room_it.second["progression"]) { | ||
263 | std::string progressive_item_name = | ||
264 | progression_it.first.as<std::string>(); | ||
265 | |||
266 | int index = 1; | ||
267 | for (const auto &stage : progression_it.second) { | ||
268 | int door_id = -1; | ||
269 | |||
270 | if (stage.IsScalar()) { | ||
271 | door_id = AddOrGetDoor(room_obj.name, stage.as<std::string>()); | ||
272 | } else { | ||
273 | door_id = AddOrGetDoor(stage["room"].as<std::string>(), | ||
274 | stage["door"].as<std::string>()); | ||
275 | } | ||
276 | |||
277 | doors_[door_id].progressives.push_back( | ||
278 | {.item_name = progressive_item_name, .quantity = index}); | ||
279 | index++; | ||
280 | } | ||
281 | } | ||
282 | } | ||
261 | } | 283 | } |
262 | 284 | ||
263 | map_areas_.reserve(areas_config.size()); | 285 | map_areas_.reserve(areas_config.size()); |
@@ -341,10 +363,7 @@ int GameData::AddOrGetDoor(std::string room, std::string door) { | |||
341 | 363 | ||
342 | if (!door_by_id_.count(full_name)) { | 364 | if (!door_by_id_.count(full_name)) { |
343 | door_by_id_[full_name] = doors_.size(); | 365 | door_by_id_[full_name] = doors_.size(); |
344 | doors_.push_back({ | 366 | doors_.push_back({.room = AddOrGetRoom(room), .name = door}); |
345 | .room = AddOrGetRoom(room), | ||
346 | .name = door | ||
347 | }); | ||
348 | } | 367 | } |
349 | 368 | ||
350 | return door_by_id_[full_name]; | 369 | return door_by_id_[full_name]; |