diff options
Diffstat (limited to 'tools/validator/human_processor.cpp')
-rw-r--r-- | tools/validator/human_processor.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 5720ba9..561225e 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp | |||
@@ -43,6 +43,7 @@ class HumanProcessor { | |||
43 | ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); | 43 | ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); |
44 | ProcessMaps(datadir_path); | 44 | ProcessMaps(datadir_path); |
45 | ProcessProgressivesFile(datadir_path / "progressives.txtpb"); | 45 | ProcessProgressivesFile(datadir_path / "progressives.txtpb"); |
46 | ProcessDoorGroupsFile(datadir_path / "door_groups.txtpb"); | ||
46 | ProcessIdsFile(datadir_path / "ids.yaml"); | 47 | ProcessIdsFile(datadir_path / "ids.yaml"); |
47 | } | 48 | } |
48 | 49 | ||
@@ -510,6 +511,33 @@ class HumanProcessor { | |||
510 | } | 511 | } |
511 | } | 512 | } |
512 | 513 | ||
514 | void ProcessDoorGroupsFile(std::filesystem::path path) { | ||
515 | if (!std::filesystem::exists(path)) { | ||
516 | return; | ||
517 | } | ||
518 | |||
519 | auto h_groups = ReadMessageFromFile<HumanDoorGroups>(path.string()); | ||
520 | |||
521 | for (const HumanDoorGroup& h_group : h_groups.door_groups()) { | ||
522 | ProcessDoorGroup(h_group); | ||
523 | } | ||
524 | } | ||
525 | |||
526 | void ProcessDoorGroup(const HumanDoorGroup& h_group) { | ||
527 | DoorGroupInfo& group_info = info_.door_groups[h_group.name()]; | ||
528 | group_info.definitions.push_back(h_group); | ||
529 | |||
530 | for (const DoorIdentifier& di : h_group.doors()) { | ||
531 | if (!di.has_map()) { | ||
532 | group_info.malformed_doors.push_back(di); | ||
533 | continue; | ||
534 | } | ||
535 | |||
536 | DoorInfo& door_info = info_.doors[di]; | ||
537 | door_info.door_groups_referenced_by.push_back(h_group.name()); | ||
538 | } | ||
539 | } | ||
540 | |||
513 | void ProcessIdsFile(std::filesystem::path path) { | 541 | void ProcessIdsFile(std::filesystem::path path) { |
514 | auto ids = ReadIdsFromYaml(path.string()); | 542 | auto ids = ReadIdsFromYaml(path.string()); |
515 | 543 | ||
@@ -573,6 +601,11 @@ class HumanProcessor { | |||
573 | ProgressiveInfo& prog_info = info_.progressives[prog_name]; | 601 | ProgressiveInfo& prog_info = info_.progressives[prog_name]; |
574 | prog_info.has_id = true; | 602 | prog_info.has_id = true; |
575 | } | 603 | } |
604 | |||
605 | for (const auto& [group_name, ap_id] : ids.door_groups()) { | ||
606 | DoorGroupInfo& group_info = info_.door_groups[group_name]; | ||
607 | group_info.has_id = true; | ||
608 | } | ||
576 | } | 609 | } |
577 | 610 | ||
578 | std::string mapdir_; | 611 | std::string mapdir_; |