diff options
Diffstat (limited to 'tools/validator/human_processor.cpp')
| -rw-r--r-- | tools/validator/human_processor.cpp | 66 |
1 files changed, 52 insertions, 14 deletions
| diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 561225e..ffa9765 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp | |||
| @@ -77,6 +77,21 @@ class HumanProcessor { | |||
| 77 | for (const std::string& path : metadata.excluded_nodes()) { | 77 | for (const std::string& path : metadata.excluded_nodes()) { |
| 78 | map_info.game_nodes[path].uses++; | 78 | map_info.game_nodes[path].uses++; |
| 79 | } | 79 | } |
| 80 | |||
| 81 | for (const std::string& path : metadata.custom_nodes()) { | ||
| 82 | map_info.game_nodes[path].defined = true; | ||
| 83 | } | ||
| 84 | |||
| 85 | if (metadata.has_worldport_entrance()) { | ||
| 86 | auto port_identifier = GetCompletePortIdentifier( | ||
| 87 | metadata.worldport_entrance(), current_map_name, std::nullopt); | ||
| 88 | if (port_identifier) { | ||
| 89 | PortInfo& port_info = info_.ports[*port_identifier]; | ||
| 90 | port_info.map_worldport_entrances.push_back(current_map_name); | ||
| 91 | } else { | ||
| 92 | map_info.malformed_worldport_entrance = metadata.worldport_entrance(); | ||
| 93 | } | ||
| 94 | } | ||
| 80 | } | 95 | } |
| 81 | 96 | ||
| 82 | void ProcessRooms(std::filesystem::path path, | 97 | void ProcessRooms(std::filesystem::path path, |
| @@ -358,11 +373,6 @@ class HumanProcessor { | |||
| 358 | DoorInfo& other_door_info = info_.doors[complete_door_identifier]; | 373 | DoorInfo& other_door_info = info_.doors[complete_door_identifier]; |
| 359 | other_door_info.doors_referenced_by.push_back(door_identifier); | 374 | other_door_info.doors_referenced_by.push_back(door_identifier); |
| 360 | } | 375 | } |
| 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 | } | 376 | } |
| 367 | 377 | ||
| 368 | void ProcessConnectionsFile(std::filesystem::path path, | 378 | void ProcessConnectionsFile(std::filesystem::path path, |
| @@ -394,7 +404,9 @@ class HumanProcessor { | |||
| 394 | } | 404 | } |
| 395 | } else if (human_connection.has_from()) { | 405 | } else if (human_connection.has_from()) { |
| 396 | ProcessSingleConnection(human_connection, human_connection.from(), | 406 | ProcessSingleConnection(human_connection, human_connection.from(), |
| 397 | current_map_name); | 407 | current_map_name, |
| 408 | /*is_target=*/!human_connection.oneway() && | ||
| 409 | !human_connection.bypass_target_door()); | ||
| 398 | } | 410 | } |
| 399 | 411 | ||
| 400 | if (human_connection.has_to_room()) { | 412 | if (human_connection.has_to_room()) { |
| @@ -410,8 +422,9 @@ class HumanProcessor { | |||
| 410 | std::cout << "A global connection used to_room." << std::endl; | 422 | std::cout << "A global connection used to_room." << std::endl; |
| 411 | } | 423 | } |
| 412 | } else if (human_connection.has_to()) { | 424 | } else if (human_connection.has_to()) { |
| 413 | ProcessSingleConnection(human_connection, human_connection.to(), | 425 | ProcessSingleConnection( |
| 414 | current_map_name); | 426 | human_connection, human_connection.to(), current_map_name, |
| 427 | /*is_target=*/!human_connection.bypass_target_door()); | ||
| 415 | } | 428 | } |
| 416 | 429 | ||
| 417 | if (human_connection.has_door()) { | 430 | if (human_connection.has_door()) { |
| @@ -432,7 +445,7 @@ class HumanProcessor { | |||
| 432 | void ProcessSingleConnection( | 445 | void ProcessSingleConnection( |
| 433 | const HumanConnection& human_connection, | 446 | const HumanConnection& human_connection, |
| 434 | const HumanConnection::Endpoint& endpoint, | 447 | const HumanConnection::Endpoint& endpoint, |
| 435 | const std::optional<std::string>& current_map_name) { | 448 | const std::optional<std::string>& current_map_name, bool is_target) { |
| 436 | if (endpoint.has_room()) { | 449 | if (endpoint.has_room()) { |
| 437 | auto room_identifier = | 450 | auto room_identifier = |
| 438 | GetCompleteRoomIdentifier(endpoint.room(), current_map_name); | 451 | GetCompleteRoomIdentifier(endpoint.room(), current_map_name); |
| @@ -451,6 +464,11 @@ class HumanProcessor { | |||
| 451 | if (painting_identifier) { | 464 | if (painting_identifier) { |
| 452 | PaintingInfo& painting_info = info_.paintings[*painting_identifier]; | 465 | PaintingInfo& painting_info = info_.paintings[*painting_identifier]; |
| 453 | painting_info.connections_referenced_by.push_back(human_connection); | 466 | painting_info.connections_referenced_by.push_back(human_connection); |
| 467 | |||
| 468 | if (is_target) { | ||
| 469 | painting_info.target_connections_referenced_by.push_back( | ||
| 470 | human_connection); | ||
| 471 | } | ||
| 454 | } else { | 472 | } else { |
| 455 | // Not sure where else to store this right now. | 473 | // Not sure where else to store this right now. |
| 456 | std::cout | 474 | std::cout |
| @@ -463,6 +481,11 @@ class HumanProcessor { | |||
| 463 | if (port_identifier) { | 481 | if (port_identifier) { |
| 464 | PortInfo& port_info = info_.ports[*port_identifier]; | 482 | PortInfo& port_info = info_.ports[*port_identifier]; |
| 465 | port_info.connections_referenced_by.push_back(human_connection); | 483 | port_info.connections_referenced_by.push_back(human_connection); |
| 484 | |||
| 485 | if (is_target) { | ||
| 486 | port_info.target_connections_referenced_by.push_back( | ||
| 487 | human_connection); | ||
| 488 | } | ||
| 466 | } else { | 489 | } else { |
| 467 | // Not sure where else to store this right now. | 490 | // Not sure where else to store this right now. |
| 468 | std::cout | 491 | std::cout |
| @@ -480,6 +503,11 @@ class HumanProcessor { | |||
| 480 | panel_info.proxies[endpoint.panel().answer()] | 503 | panel_info.proxies[endpoint.panel().answer()] |
| 481 | .connections_referenced_by.push_back(human_connection); | 504 | .connections_referenced_by.push_back(human_connection); |
| 482 | } | 505 | } |
| 506 | |||
| 507 | if (is_target) { | ||
| 508 | panel_info.target_connections_referenced_by.push_back( | ||
| 509 | human_connection); | ||
| 510 | } | ||
| 483 | } | 511 | } |
| 484 | } | 512 | } |
| 485 | } | 513 | } |
| @@ -542,12 +570,14 @@ class HumanProcessor { | |||
| 542 | auto ids = ReadIdsFromYaml(path.string()); | 570 | auto ids = ReadIdsFromYaml(path.string()); |
| 543 | 571 | ||
| 544 | DoorIdentifier di; | 572 | DoorIdentifier di; |
| 545 | PanelIdentifier pi; | 573 | PanelIdentifier pai; |
| 574 | PortIdentifier poi; | ||
| 546 | KeyholderIdentifier ki; | 575 | KeyholderIdentifier ki; |
| 547 | 576 | ||
| 548 | for (const auto& [map_name, map] : ids.maps()) { | 577 | for (const auto& [map_name, map] : ids.maps()) { |
| 549 | di.set_map(map_name); | 578 | di.set_map(map_name); |
| 550 | pi.set_map(map_name); | 579 | pai.set_map(map_name); |
| 580 | poi.set_map(map_name); | ||
| 551 | ki.set_map(map_name); | 581 | ki.set_map(map_name); |
| 552 | 582 | ||
| 553 | for (const auto& [door_name, ap_id] : map.doors()) { | 583 | for (const auto& [door_name, ap_id] : map.doors()) { |
| @@ -558,13 +588,14 @@ class HumanProcessor { | |||
| 558 | } | 588 | } |
| 559 | 589 | ||
| 560 | for (const auto& [room_name, room] : map.rooms()) { | 590 | for (const auto& [room_name, room] : map.rooms()) { |
| 561 | pi.set_room(room_name); | 591 | pai.set_room(room_name); |
| 592 | poi.set_room(room_name); | ||
| 562 | ki.set_room(room_name); | 593 | ki.set_room(room_name); |
| 563 | 594 | ||
| 564 | for (const auto& [panel_name, ap_id] : room.panels()) { | 595 | for (const auto& [panel_name, ap_id] : room.panels()) { |
| 565 | pi.set_name(panel_name); | 596 | pai.set_name(panel_name); |
| 566 | 597 | ||
| 567 | PanelInfo& panel_info = info_.panels[pi]; | 598 | PanelInfo& panel_info = info_.panels[pai]; |
| 568 | panel_info.has_id = true; | 599 | panel_info.has_id = true; |
| 569 | } | 600 | } |
| 570 | 601 | ||
| @@ -578,6 +609,13 @@ class HumanProcessor { | |||
| 578 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; | 609 | KeyholderInfo& keyholder_info = info_.keyholders[ki]; |
| 579 | keyholder_info.has_id = true; | 610 | keyholder_info.has_id = true; |
| 580 | } | 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 | } | ||
| 581 | } | 619 | } |
| 582 | } | 620 | } |
| 583 | 621 | ||
