diff options
Diffstat (limited to 'tools/validator/human_processor.cpp')
| -rw-r--r-- | tools/validator/human_processor.cpp | 56 |
1 files changed, 46 insertions, 10 deletions
| diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 2c978bf..d6fcfa6 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp | |||
| @@ -74,9 +74,35 @@ class HumanProcessor { | |||
| 74 | MapInfo& map_info = info_.maps[current_map_name]; | 74 | MapInfo& map_info = info_.maps[current_map_name]; |
| 75 | 75 | ||
| 76 | auto metadata = ReadMessageFromFile<HumanMap>(path.string()); | 76 | auto metadata = ReadMessageFromFile<HumanMap>(path.string()); |
| 77 | map_info.definitions.push_back(metadata); | ||
| 78 | |||
| 77 | for (const std::string& path : metadata.excluded_nodes()) { | 79 | for (const std::string& path : metadata.excluded_nodes()) { |
| 78 | map_info.game_nodes[path].uses++; | 80 | map_info.game_nodes[path].uses++; |
| 79 | } | 81 | } |
| 82 | |||
| 83 | for (const std::string& path : metadata.custom_nodes()) { | ||
| 84 | map_info.game_nodes[path].defined = true; | ||
| 85 | } | ||
| 86 | |||
| 87 | if (metadata.has_worldport_entrance()) { | ||
| 88 | auto port_identifier = GetCompletePortIdentifier( | ||
| 89 | metadata.worldport_entrance(), current_map_name, std::nullopt); | ||
| 90 | if (port_identifier) { | ||
| 91 | PortInfo& port_info = info_.ports[*port_identifier]; | ||
| 92 | port_info.map_worldport_entrances.push_back(current_map_name); | ||
| 93 | } else { | ||
| 94 | map_info.malformed_worldport_entrance = metadata.worldport_entrance(); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | if (metadata.has_rte_room()) { | ||
| 99 | RoomIdentifier room_identifier; | ||
| 100 | room_identifier.set_map(current_map_name); | ||
| 101 | room_identifier.set_name(metadata.rte_room()); | ||
| 102 | |||
| 103 | RoomInfo& room_info = info_.rooms[room_identifier]; | ||
| 104 | room_info.map_rtes_referenced_by.push_back(current_map_name); | ||
| 105 | } | ||
| 80 | } | 106 | } |
| 81 | 107 | ||
| 82 | void ProcessRooms(std::filesystem::path path, | 108 | void ProcessRooms(std::filesystem::path path, |
| @@ -358,11 +384,6 @@ class HumanProcessor { | |||
| 358 | DoorInfo& other_door_info = info_.doors[complete_door_identifier]; | 384 | DoorInfo& other_door_info = info_.doors[complete_door_identifier]; |
| 359 | other_door_info.doors_referenced_by.push_back(door_identifier); | 385 | other_door_info.doors_referenced_by.push_back(door_identifier); |
| 360 | } | 386 | } |
| 361 | |||
| 362 | for (const std::string& ei : h_door.endings()) { | ||
| 363 | EndingInfo& ending_info = info_.endings[ei]; | ||
| 364 | ending_info.doors_referenced_by.push_back(door_identifier); | ||
| 365 | } | ||
| 366 | } | 387 | } |
| 367 | 388 | ||
| 368 | void ProcessConnectionsFile(std::filesystem::path path, | 389 | void ProcessConnectionsFile(std::filesystem::path path, |
| @@ -560,12 +581,14 @@ class HumanProcessor { | |||
| 560 | auto ids = ReadIdsFromYaml(path.string()); | 581 | auto ids = ReadIdsFromYaml(path.string()); |
| 561 | 582 | ||
| 562 | DoorIdentifier di; | 583 | DoorIdentifier di; |
| 563 | PanelIdentifier pi; | 584 | PanelIdentifier pai; |
| 585 | PortIdentifier poi; | ||
| 564 | KeyholderIdentifier ki; | 586 | KeyholderIdentifier ki; |
| 565 | 587 | ||
| 566 | for (const auto& [map_name, map] : ids.maps()) { | 588 | for (const auto& [map_name, map] : ids.maps()) { |
| 567 | di.set_map(map_name); | 589 | di.set_map(map_name); |
| 568 | pi.set_map(map_name); | 590 | pai.set_map(map_name); |
| 591 | poi.set_map(map_name); | ||
| 569 | ki.set_map(map_name); | 592 | ki.set_map(map_name); |
| 570 | 593 | ||
| 571 | for (const auto& [door_name, ap_id] : map.doors()) { | 594 | for (const auto& [door_name, ap_id] : map.doors()) { |
| @@ -576,13 +599,14 @@ class HumanProcessor { | |||
| 576 | } | 599 | } |
| 577 | 600 | ||
| 578 | for (const auto& [room_name, room] : map.rooms()) { | 601 | for (const auto& [room_name, room] : map.rooms()) { |
| 579 | pi.set_room(room_name); | 602 | pai.set_room(room_name); |
| 603 | poi.set_room(room_name); | ||
| 580 | ki.set_room(room_name); | 604 | ki.set_room(room_name); |
| 581 | 605 | ||
| 582 | for (const auto& [panel_name, ap_id] : room.panels()) { | 606 | for (const auto& [panel_name, ap_id] : room.panels()) { |
| 583 | pi.set_name(panel_name); | 607 | pai.set_name(panel_name); |
| 584 | 608 | ||
| 585 | PanelInfo& panel_info = info_.panels[pi]; | 609 | PanelInfo& panel_info = info_.panels[pai]; |
| 586 | panel_info.has_id = true; | 610 | panel_info.has_id = true; |
| 587 | } | 611 | } |
| 588 | 612 | ||
| @@ -596,6 +620,18 @@ class HumanProcessor { | |||
| 596 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; | 620 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; |
| 597 | keyholder_info.has_id = true; | 621 | keyholder_info.has_id = true; |
| 598 | } | 622 | } |
| 623 | |||
| 624 | for (const auto& [port_name, ap_id] : room.ports()) { | ||
| 625 | poi.set_name(port_name); | ||
| 626 | |||
| 627 | PortInfo& port_info = info_.ports[poi]; | ||
| 628 | port_info.has_id = true; | ||
| 629 | } | ||
| 630 | } | ||
| 631 | |||
| 632 | if (map.has_rte()) { | ||
| 633 | MapInfo& map_info = info_.maps[map_name]; | ||
| 634 | map_info.has_rte_id = true; | ||
| 599 | } | 635 | } |
| 600 | } | 636 | } |
| 601 | 637 | ||
