From dc4a14397ae226d91041389c2a47993f9c22f83d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 3 May 2023 14:09:40 -0400 Subject: Added painting shuffle support --- game_data.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'game_data.cpp') 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() { door_room, entrance_it.second["door"].as()); } + if (entrance_it.second["painting"]) { + exit_obj.painting = entrance_it.second["painting"].as(); + } + from_room_obj.exits.push_back(exit_obj); break; } @@ -78,6 +82,10 @@ GameData::GameData() { exit_obj.door = AddOrGetDoor(door_room, option["door"].as()); + if (option["painting"]) { + exit_obj.painting = option["painting"].as(); + } + from_room_obj.exits.push_back(exit_obj); } @@ -225,6 +233,31 @@ GameData::GameData() { } } } + + if (room_it.second["paintings"]) { + for (const auto& painting : room_it.second["paintings"]) { + std::string painting_id = painting["id"].as(); + room_by_painting_[painting_id] = room_id; + + if (!painting["exit_only"] || !painting["exit_only"].as()) { + PaintingExit painting_exit; + painting_exit.id = painting_id; + + if (painting["required_door"]) { + std::string rd_room = room_obj.name; + if (painting["required_door"]["room"]) { + rd_room = painting["required_door"]["room"].as(); + } + + painting_exit.door = AddOrGetDoor( + rd_room, + painting["required_door"]["door"].as()); + } + + room_obj.paintings.push_back(painting_exit); + } + } + } } map_areas_.reserve(areas_config.size()); -- cgit 1.4.1