From fcfefe57d9d0b9d8eb3e149e68605103a9e6b490 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 11 Sep 2025 20:08:32 -0400 Subject: [Data] Fixed connection target required door logic bugs --- tools/validator/human_processor.cpp | 26 ++++++++++++++++---- tools/validator/structs.h | 3 +++ tools/validator/validator.cpp | 48 +++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 561225e..2c978bf 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp @@ -394,7 +394,9 @@ class HumanProcessor { } } else if (human_connection.has_from()) { ProcessSingleConnection(human_connection, human_connection.from(), - current_map_name); + current_map_name, + /*is_target=*/!human_connection.oneway() && + !human_connection.bypass_target_door()); } if (human_connection.has_to_room()) { @@ -410,8 +412,9 @@ class HumanProcessor { std::cout << "A global connection used to_room." << std::endl; } } else if (human_connection.has_to()) { - ProcessSingleConnection(human_connection, human_connection.to(), - current_map_name); + ProcessSingleConnection( + human_connection, human_connection.to(), current_map_name, + /*is_target=*/!human_connection.bypass_target_door()); } if (human_connection.has_door()) { @@ -432,7 +435,7 @@ class HumanProcessor { void ProcessSingleConnection( const HumanConnection& human_connection, const HumanConnection::Endpoint& endpoint, - const std::optional& current_map_name) { + const std::optional& current_map_name, bool is_target) { if (endpoint.has_room()) { auto room_identifier = GetCompleteRoomIdentifier(endpoint.room(), current_map_name); @@ -451,6 +454,11 @@ class HumanProcessor { if (painting_identifier) { PaintingInfo& painting_info = info_.paintings[*painting_identifier]; painting_info.connections_referenced_by.push_back(human_connection); + + if (is_target) { + painting_info.target_connections_referenced_by.push_back( + human_connection); + } } else { // Not sure where else to store this right now. std::cout @@ -463,6 +471,11 @@ class HumanProcessor { if (port_identifier) { PortInfo& port_info = info_.ports[*port_identifier]; port_info.connections_referenced_by.push_back(human_connection); + + if (is_target) { + port_info.target_connections_referenced_by.push_back( + human_connection); + } } else { // Not sure where else to store this right now. std::cout @@ -480,6 +493,11 @@ class HumanProcessor { panel_info.proxies[endpoint.panel().answer()] .connections_referenced_by.push_back(human_connection); } + + if (is_target) { + panel_info.target_connections_referenced_by.push_back( + human_connection); + } } } } diff --git a/tools/validator/structs.h b/tools/validator/structs.h index 17ed33a..d1d45f2 100644 --- a/tools/validator/structs.h +++ b/tools/validator/structs.h @@ -56,12 +56,14 @@ struct PortInfo { std::vector definitions; std::vector connections_referenced_by; + std::vector target_connections_referenced_by; }; struct PaintingInfo { std::vector definitions; std::vector connections_referenced_by; + std::vector target_connections_referenced_by; std::vector doors_referenced_by; }; @@ -79,6 +81,7 @@ struct PanelInfo { std::string map_area_name; std::vector connections_referenced_by; + std::vector target_connections_referenced_by; std::vector doors_referenced_by; std::map proxies; diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index 4149caa..e4c6324 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp @@ -256,6 +256,22 @@ class Validator { std::cout << "Port " << port_identifier.ShortDebugString() << " was defined multiple times." << std::endl; } + + if (!port_info.target_connections_referenced_by.empty()) { + for (const HumanPort& port : port_info.definitions) { + if (port.has_required_door()) { + std::cout << "Port " << port_identifier.ShortDebugString() + << " has a required door but is the target of a connection:" + << std::endl; + + for (const HumanConnection& connection : + port_info.target_connections_referenced_by) { + std::cout << " CONNECTION " << connection.ShortDebugString() + << std::endl; + } + } + } + } } void ValidatePainting(const PaintingIdentifier& painting_identifier, @@ -279,6 +295,22 @@ class Validator { std::cout << "Painting " << painting_identifier.ShortDebugString() << " was defined multiple times." << std::endl; } + + if (!painting_info.target_connections_referenced_by.empty()) { + for (const HumanPainting& painting : painting_info.definitions) { + if (painting.has_required_door()) { + std::cout << "Painting " << painting_identifier.ShortDebugString() + << " has a required door but is the target of a connection:" + << std::endl; + + for (const HumanConnection& connection : + painting_info.target_connections_referenced_by) { + std::cout << " CONNECTION " << connection.ShortDebugString() + << std::endl; + } + } + } + } } void ValidatePanel(const PanelIdentifier& panel_identifier, @@ -340,6 +372,22 @@ class Validator { std::cout << "Panel " << panel_identifier.ShortDebugString() << " is missing an AP ID." << std::endl; } + + if (!panel_info.target_connections_referenced_by.empty()) { + for (const HumanPanel& panel : panel_info.definitions) { + if (panel.has_required_door()) { + std::cout << "Panel " << panel_identifier.ShortDebugString() + << " has a required door but is the target of a connection:" + << std::endl; + + for (const HumanConnection& connection : + panel_info.target_connections_referenced_by) { + std::cout << " CONNECTION " << connection.ShortDebugString() + << std::endl; + } + } + } + } } void ValidateKeyholder(const KeyholderIdentifier& keyholder_identifier, -- cgit 1.4.1