summary refs log tree commit diff stats
path: root/tools/validator/human_processor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/validator/human_processor.cpp')
-rw-r--r--tools/validator/human_processor.cpp66
1 files changed, 64 insertions, 2 deletions
diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 49e7578..5720ba9 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp
@@ -13,6 +13,7 @@
13#include <string> 13#include <string>
14 14
15#include "structs.h" 15#include "structs.h"
16#include "util/ids_yaml_format.h"
16 17
17namespace com::fourisland::lingo2_archipelago { 18namespace com::fourisland::lingo2_archipelago {
18namespace { 19namespace {
@@ -42,7 +43,7 @@ class HumanProcessor {
42 ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); 43 ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt);
43 ProcessMaps(datadir_path); 44 ProcessMaps(datadir_path);
44 ProcessProgressivesFile(datadir_path / "progressives.txtpb"); 45 ProcessProgressivesFile(datadir_path / "progressives.txtpb");
45 ProcessIdsFile(datadir_path / "ids.txtpb"); 46 ProcessIdsFile(datadir_path / "ids.yaml");
46 } 47 }
47 48
48 private: 49 private:
@@ -510,7 +511,68 @@ class HumanProcessor {
510 } 511 }
511 512
512 void ProcessIdsFile(std::filesystem::path path) { 513 void ProcessIdsFile(std::filesystem::path path) {
513 // Ignore this for now. 514 auto ids = ReadIdsFromYaml(path.string());
515
516 DoorIdentifier di;
517 PanelIdentifier pi;
518 KeyholderIdentifier ki;
519
520 for (const auto& [map_name, map] : ids.maps()) {
521 di.set_map(map_name);
522 pi.set_map(map_name);
523 ki.set_map(map_name);
524
525 for (const auto& [door_name, ap_id] : map.doors()) {
526 di.set_name(door_name);
527
528 DoorInfo& door_info = info_.doors[di];
529 door_info.has_id = true;
530 }
531
532 for (const auto& [room_name, room] : map.rooms()) {
533 pi.set_room(room_name);
534 ki.set_room(room_name);
535
536 for (const auto& [panel_name, ap_id] : room.panels()) {
537 pi.set_name(panel_name);
538
539 PanelInfo& panel_info = info_.panels[pi];
540 panel_info.has_id = true;
541 }
542
543 for (const auto& [mastery_name, ap_id] : room.masteries()) {
544 // TODO: Mastery
545 }
546
547 for (const auto& [keyholder_name, ap_id] : room.keyholders()) {
548 ki.set_name(keyholder_name);
549
550 KeyholderInfo& keyholder_info = info_.keyholders[ki];
551 keyholder_info.has_id = true;
552 }
553 }
554 }
555
556 for (const auto& [tag, id] : ids.special()) {
557 // TODO: Specials
558 }
559
560 for (const auto& [letter_name, ap_id] : ids.letters()) {
561 LetterIdentifier li =
562 std::make_tuple(letter_name[0], letter_name[1] == '2');
563 LetterInfo& letter_info = info_.letters[li];
564 letter_info.has_id = true;
565 }
566
567 for (const auto& [ending_name, ap_id] : ids.endings()) {
568 EndingInfo& ending_info = info_.endings[ending_name];
569 ending_info.has_id = true;
570 }
571
572 for (const auto& [prog_name, ap_id] : ids.progressives()) {
573 ProgressiveInfo& prog_info = info_.progressives[prog_name];
574 prog_info.has_id = true;
575 }
514 } 576 }
515 577
516 std::string mapdir_; 578 std::string mapdir_;