about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/game_data.cpp29
-rw-r--r--src/game_data.h1
2 files changed, 29 insertions, 1 deletions
diff --git a/src/game_data.cpp b/src/game_data.cpp index 828808f..0ac77af 100644 --- a/src/game_data.cpp +++ b/src/game_data.cpp
@@ -55,6 +55,7 @@ struct GameData {
55 std::map<std::string, int> painting_by_id_; 55 std::map<std::string, int> painting_by_id_;
56 56
57 std::vector<int> door_definition_order_; 57 std::vector<int> door_definition_order_;
58 std::vector<int> room_definition_order_;
58 59
59 std::map<std::string, int> room_by_painting_; 60 std::map<std::string, int> room_by_painting_;
60 std::map<int, int> room_by_sunwarp_; 61 std::map<int, int> room_by_sunwarp_;
@@ -104,6 +105,7 @@ struct GameData {
104 105
105 for (const auto &room_it : lingo_config) { 106 for (const auto &room_it : lingo_config) {
106 int room_id = AddOrGetRoom(room_it.first.as<std::string>()); 107 int room_id = AddOrGetRoom(room_it.first.as<std::string>());
108 room_definition_order_.push_back(room_id);
107 109
108 for (const auto &entrance_it : room_it.second["entrances"]) { 110 for (const auto &entrance_it : room_it.second["entrances"]) {
109 int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>()); 111 int from_room_id = AddOrGetRoom(entrance_it.first.as<std::string>());
@@ -722,6 +724,31 @@ struct GameData {
722 } 724 }
723 } 725 }
724 726
727 // As a workaround for a generator bug in 0.5.1, we are going to remove the
728 // panel door requirement on panels that are defined earlier in the file than
729 // the panel door is. This results in logic that matches the generator, even
730 // if it is not true to how the game should work. This will be reverted once
731 // the logic bug is fixed and released.
732 // See: https://github.com/ArchipelagoMW/Archipelago/pull/4342
733 for (Panel& panel : panels_) {
734 if (panel.panel_door == -1) {
735 continue;
736 }
737 const PanelDoor &panel_door = panel_doors_[panel.panel_door];
738 for (int room_id : room_definition_order_) {
739 if (room_id == panel_door.room) {
740 // The panel door was defined first (or at the same time as the panel),
741 // so we're good.
742 break;
743 } else if (room_id == panel.room) {
744 // The panel was defined first, so we have to pretend the panel door is
745 // not required for this panel.
746 panel.panel_door = -1;
747 break;
748 }
749 }
750 }
751
725 // Report errors. 752 // Report errors.
726 for (const std::string &area : malconfigured_areas_) { 753 for (const std::string &area : malconfigured_areas_) {
727 TrackerLog(fmt::format("Area data not found for: {}", area)); 754 TrackerLog(fmt::format("Area data not found for: {}", area));
@@ -853,7 +880,7 @@ struct GameData {
853 if (!panel_doors_by_id_.count(full_name)) { 880 if (!panel_doors_by_id_.count(full_name)) {
854 int panel_door_id = panel_doors_.size(); 881 int panel_door_id = panel_doors_.size();
855 panel_doors_by_id_[full_name] = panel_door_id; 882 panel_doors_by_id_[full_name] = panel_door_id;
856 panel_doors_.push_back({}); 883 panel_doors_.push_back({.room = AddOrGetRoom(room)});
857 } 884 }
858 885
859 return panel_doors_by_id_[full_name]; 886 return panel_doors_by_id_[full_name];
diff --git a/src/game_data.h b/src/game_data.h index b00bac9..31a1e78 100644 --- a/src/game_data.h +++ b/src/game_data.h
@@ -85,6 +85,7 @@ struct Door {
85}; 85};
86 86
87struct PanelDoor { 87struct PanelDoor {
88 int room;
88 int ap_item_id = -1; 89 int ap_item_id = -1;
89 int group_ap_item_id = -1; 90 int group_ap_item_id = -1;
90 std::vector<ProgressiveRequirement> progressives; 91 std::vector<ProgressiveRequirement> progressives;