diff options
Diffstat (limited to 'tools/validator')
| -rw-r--r-- | tools/validator/human_processor.cpp | 20 | ||||
| -rw-r--r-- | tools/validator/structs.h | 1 | ||||
| -rw-r--r-- | tools/validator/validator.cpp | 18 |
3 files changed, 32 insertions, 7 deletions
| diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 407d951..ffa9765 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp | |||
| @@ -570,12 +570,14 @@ class HumanProcessor { | |||
| 570 | auto ids = ReadIdsFromYaml(path.string()); | 570 | auto ids = ReadIdsFromYaml(path.string()); |
| 571 | 571 | ||
| 572 | DoorIdentifier di; | 572 | DoorIdentifier di; |
| 573 | PanelIdentifier pi; | 573 | PanelIdentifier pai; |
| 574 | PortIdentifier poi; | ||
| 574 | KeyholderIdentifier ki; | 575 | KeyholderIdentifier ki; |
| 575 | 576 | ||
| 576 | for (const auto& [map_name, map] : ids.maps()) { | 577 | for (const auto& [map_name, map] : ids.maps()) { |
| 577 | di.set_map(map_name); | 578 | di.set_map(map_name); |
| 578 | pi.set_map(map_name); | 579 | pai.set_map(map_name); |
| 580 | poi.set_map(map_name); | ||
| 579 | ki.set_map(map_name); | 581 | ki.set_map(map_name); |
| 580 | 582 | ||
| 581 | for (const auto& [door_name, ap_id] : map.doors()) { | 583 | for (const auto& [door_name, ap_id] : map.doors()) { |
| @@ -586,13 +588,14 @@ class HumanProcessor { | |||
| 586 | } | 588 | } |
| 587 | 589 | ||
| 588 | for (const auto& [room_name, room] : map.rooms()) { | 590 | for (const auto& [room_name, room] : map.rooms()) { |
| 589 | pi.set_room(room_name); | 591 | pai.set_room(room_name); |
| 592 | poi.set_room(room_name); | ||
| 590 | ki.set_room(room_name); | 593 | ki.set_room(room_name); |
| 591 | 594 | ||
| 592 | for (const auto& [panel_name, ap_id] : room.panels()) { | 595 | for (const auto& [panel_name, ap_id] : room.panels()) { |
| 593 | pi.set_name(panel_name); | 596 | pai.set_name(panel_name); |
| 594 | 597 | ||
| 595 | PanelInfo& panel_info = info_.panels[pi]; | 598 | PanelInfo& panel_info = info_.panels[pai]; |
| 596 | panel_info.has_id = true; | 599 | panel_info.has_id = true; |
| 597 | } | 600 | } |
| 598 | 601 | ||
| @@ -606,6 +609,13 @@ class HumanProcessor { | |||
| 606 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; | 609 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; |
| 607 | keyholder_info.has_id = true; | 610 | keyholder_info.has_id = true; |
| 608 | } | 611 | } |
| 612 | |||
| 613 | for (const auto& [port_name, ap_id] : room.ports()) { | ||
| 614 | poi.set_name(port_name); | ||
| 615 | |||
| 616 | PortInfo& port_info = info_.ports[poi]; | ||
| 617 | port_info.has_id = true; | ||
| 618 | } | ||
| 609 | } | 619 | } |
| 610 | } | 620 | } |
| 611 | 621 | ||
| diff --git a/tools/validator/structs.h b/tools/validator/structs.h index 51215e9..62974a8 100644 --- a/tools/validator/structs.h +++ b/tools/validator/structs.h | |||
| @@ -56,6 +56,7 @@ struct DoorInfo { | |||
| 56 | 56 | ||
| 57 | struct PortInfo { | 57 | struct PortInfo { |
| 58 | std::vector<HumanPort> definitions; | 58 | std::vector<HumanPort> definitions; |
| 59 | bool has_id = false; | ||
| 59 | 60 | ||
| 60 | std::vector<HumanConnection> connections_referenced_by; | 61 | std::vector<HumanConnection> connections_referenced_by; |
| 61 | std::vector<HumanConnection> target_connections_referenced_by; | 62 | std::vector<HumanConnection> target_connections_referenced_by; |
| diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index e1fc138..fe36be7 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp | |||
| @@ -227,7 +227,7 @@ class Validator { | |||
| 227 | 227 | ||
| 228 | if (h_door.type() == DoorType::STANDARD || | 228 | if (h_door.type() == DoorType::STANDARD || |
| 229 | h_door.type() == DoorType::LOCATION_ONLY || | 229 | h_door.type() == DoorType::LOCATION_ONLY || |
| 230 | h_door.type() == DoorType::GRAVESTONE) { | 230 | h_door.type() == DoorType::GRAVESTONE || h_door.legacy_location()) { |
| 231 | if (h_door.double_letters()) { | 231 | if (h_door.double_letters()) { |
| 232 | std::cout << "Door " << door_identifier.ShortDebugString() | 232 | std::cout << "Door " << door_identifier.ShortDebugString() |
| 233 | << " is a location that depends on double_letters." | 233 | << " is a location that depends on double_letters." |
| @@ -240,7 +240,8 @@ class Validator { | |||
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | bool needs_id = (h_door.type() != DoorType::EVENT || h_door.latch()); | 243 | bool needs_id = (h_door.type() != DoorType::EVENT || h_door.latch() || |
| 244 | h_door.legacy_location()); | ||
| 244 | if (door_info.has_id != needs_id) { | 245 | if (door_info.has_id != needs_id) { |
| 245 | if (needs_id) { | 246 | if (needs_id) { |
| 246 | std::cout << "Door " << door_identifier.ShortDebugString() | 247 | std::cout << "Door " << door_identifier.ShortDebugString() |
| @@ -268,6 +269,10 @@ class Validator { | |||
| 268 | for (const std::string& map_name : port_info.map_worldport_entrances) { | 269 | for (const std::string& map_name : port_info.map_worldport_entrances) { |
| 269 | std::cout << " MAP (worldport_entrance) " << map_name << std::endl; | 270 | std::cout << " MAP (worldport_entrance) " << map_name << std::endl; |
| 270 | } | 271 | } |
| 272 | |||
| 273 | if (port_info.has_id) { | ||
| 274 | std::cout << " An AP ID is present." << std::endl; | ||
| 275 | } | ||
| 271 | } else if (port_info.definitions.size() > 1) { | 276 | } else if (port_info.definitions.size() > 1) { |
| 272 | std::cout << "Port " << port_identifier.ShortDebugString() | 277 | std::cout << "Port " << port_identifier.ShortDebugString() |
| 273 | << " was defined multiple times." << std::endl; | 278 | << " was defined multiple times." << std::endl; |
| @@ -300,6 +305,15 @@ class Validator { | |||
| 300 | std::cout << "Port " << port_identifier.ShortDebugString() | 305 | std::cout << "Port " << port_identifier.ShortDebugString() |
| 301 | << " is shuffleable and missing a rotation." << std::endl; | 306 | << " is shuffleable and missing a rotation." << std::endl; |
| 302 | } | 307 | } |
| 308 | if (!port_info.has_id) { | ||
| 309 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 310 | << " is missing an AP ID." << std::endl; | ||
| 311 | } | ||
| 312 | } else { | ||
| 313 | if (port_info.has_id) { | ||
| 314 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 315 | << " should not have an AP ID." << std::endl; | ||
| 316 | } | ||
| 303 | } | 317 | } |
| 304 | } | 318 | } |
| 305 | } | 319 | } |
