diff options
Diffstat (limited to 'src/game_data.cpp')
-rw-r--r-- | src/game_data.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 7c9564b..4dd69e2 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp | |||
@@ -284,7 +284,7 @@ struct GameData { | |||
284 | .as<int>(); | 284 | .as<int>(); |
285 | } else { | 285 | } else { |
286 | wxLogError("Missing AP location ID for panel %s - %s", | 286 | wxLogError("Missing AP location ID for panel %s - %s", |
287 | rooms_[room_id].name, panels_[panel_id].name); | 287 | rooms_[room_id].name, panels_[panel_id].name); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
@@ -348,7 +348,7 @@ struct GameData { | |||
348 | .as<int>(); | 348 | .as<int>(); |
349 | } else { | 349 | } else { |
350 | wxLogError("Missing AP item ID for door %s - %s", | 350 | wxLogError("Missing AP item ID for door %s - %s", |
351 | rooms_[room_id].name, doors_[door_id].name); | 351 | rooms_[room_id].name, doors_[door_id].name); |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
@@ -422,7 +422,8 @@ struct GameData { | |||
422 | std::string painting_id = painting["id"].as<std::string>(); | 422 | std::string painting_id = painting["id"].as<std::string>(); |
423 | room_by_painting_[painting_id] = room_id; | 423 | room_by_painting_[painting_id] = room_id; |
424 | 424 | ||
425 | if (!painting["exit_only"] || !painting["exit_only"].as<bool>()) { | 425 | if ((!painting["exit_only"] || !painting["exit_only"].as<bool>()) && |
426 | (!painting["disable"] || !painting["disable"].as<bool>())) { | ||
426 | PaintingExit painting_exit; | 427 | PaintingExit painting_exit; |
427 | painting_exit.id = painting_id; | 428 | painting_exit.id = painting_id; |
428 | 429 | ||
@@ -594,11 +595,28 @@ struct GameData { | |||
594 | } | 595 | } |
595 | } | 596 | } |
596 | 597 | ||
598 | for (const Room &room : rooms_) { | ||
599 | std::string area_name = room.name; | ||
600 | if (fold_areas.count(room.name)) { | ||
601 | int fold_area_id = fold_areas[room.name]; | ||
602 | area_name = map_areas_[fold_area_id].name; | ||
603 | } | ||
604 | |||
605 | if (!room.paintings.empty()) { | ||
606 | int area_id = AddOrGetArea(area_name); | ||
607 | MapArea &map_area = map_areas_[area_id]; | ||
608 | |||
609 | for (const PaintingExit &painting : room.paintings) { | ||
610 | map_area.paintings.push_back(painting); | ||
611 | } | ||
612 | } | ||
613 | } | ||
614 | |||
597 | // Report errors. | 615 | // Report errors. |
598 | for (const std::string &area : malconfigured_areas_) { | 616 | for (const std::string &area : malconfigured_areas_) { |
599 | wxLogError("Area data not found for: %s", area); | 617 | wxLogError("Area data not found for: %s", area); |
600 | } | 618 | } |
601 | 619 | ||
602 | // Read in subway items. | 620 | // Read in subway items. |
603 | YAML::Node subway_config = | 621 | YAML::Node subway_config = |
604 | YAML::LoadFile(GetAbsolutePath("assets/subway.yaml")); | 622 | YAML::LoadFile(GetAbsolutePath("assets/subway.yaml")); |
@@ -687,7 +705,8 @@ struct GameData { | |||
687 | if (!door_by_id_.count(full_name)) { | 705 | if (!door_by_id_.count(full_name)) { |
688 | int door_id = doors_.size(); | 706 | int door_id = doors_.size(); |
689 | door_by_id_[full_name] = doors_.size(); | 707 | door_by_id_[full_name] = doors_.size(); |
690 | doors_.push_back({.id = door_id, .room = AddOrGetRoom(room), .name = door}); | 708 | doors_.push_back( |
709 | {.id = door_id, .room = AddOrGetRoom(room), .name = door}); | ||
691 | } | 710 | } |
692 | 711 | ||
693 | return door_by_id_[full_name]; | 712 | return door_by_id_[full_name]; |
@@ -728,7 +747,7 @@ GameData &GetState() { | |||
728 | 747 | ||
729 | } // namespace | 748 | } // namespace |
730 | 749 | ||
731 | bool SubwaySunwarp::operator<(const SubwaySunwarp& rhs) const { | 750 | bool SubwaySunwarp::operator<(const SubwaySunwarp &rhs) const { |
732 | return std::tie(dots, type) < std::tie(rhs.dots, rhs.type); | 751 | return std::tie(dots, type) < std::tie(rhs.dots, rhs.type); |
733 | } | 752 | } |
734 | 753 | ||
@@ -782,7 +801,7 @@ const SubwayItem &GD_GetSubwayItem(int id) { | |||
782 | return GetState().subway_items_.at(id); | 801 | return GetState().subway_items_.at(id); |
783 | } | 802 | } |
784 | 803 | ||
785 | int GD_GetSubwayItemForPainting(const std::string& painting_id) { | 804 | int GD_GetSubwayItemForPainting(const std::string &painting_id) { |
786 | #ifndef NDEBUG | 805 | #ifndef NDEBUG |
787 | if (!GetState().subway_item_by_painting_.count(painting_id)) { | 806 | if (!GetState().subway_item_by_painting_.count(painting_id)) { |
788 | wxLogError("No subway item for painting %s", painting_id); | 807 | wxLogError("No subway item for painting %s", painting_id); |