summary refs log tree commit diff stats
path: root/tools/validator
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-01 12:54:46 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-01 12:54:46 -0400
commita3972a65b9b443a6085a6ac40b153442e190f382 (patch)
tree8291258115a066f99c972005557208cb9dbd8899 /tools/validator
parentd142ae3408d3e26e12d7dfaa6a7ccbcf56042957 (diff)
downloadlingo2-archipelago-a3972a65b9b443a6085a6ac40b153442e190f382.tar.gz
lingo2-archipelago-a3972a65b9b443a6085a6ac40b153442e190f382.tar.bz2
lingo2-archipelago-a3972a65b9b443a6085a6ac40b153442e190f382.zip
Added progressive doors
Diffstat (limited to 'tools/validator')
-rw-r--r--tools/validator/human_processor.cpp28
-rw-r--r--tools/validator/structs.h8
-rw-r--r--tools/validator/validator.cpp16
3 files changed, 52 insertions, 0 deletions
diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index 0f63936..49e7578 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp
@@ -41,6 +41,7 @@ class HumanProcessor {
41 41
42 ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); 42 ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt);
43 ProcessMaps(datadir_path); 43 ProcessMaps(datadir_path);
44 ProcessProgressivesFile(datadir_path / "progressives.txtpb");
44 ProcessIdsFile(datadir_path / "ids.txtpb"); 45 ProcessIdsFile(datadir_path / "ids.txtpb");
45 } 46 }
46 47
@@ -481,6 +482,33 @@ class HumanProcessor {
481 } 482 }
482 } 483 }
483 484
485 void ProcessProgressivesFile(std::filesystem::path path) {
486 if (!std::filesystem::exists(path)) {
487 return;
488 }
489
490 auto h_progs = ReadMessageFromFile<HumanProgressives>(path.string());
491
492 for (const HumanProgressive& h_prog : h_progs.progressives()) {
493 ProcessProgressive(h_prog);
494 }
495 }
496
497 void ProcessProgressive(const HumanProgressive& h_prog) {
498 ProgressiveInfo& prog_info = info_.progressives[h_prog.name()];
499 prog_info.definitions.push_back(h_prog);
500
501 for (const DoorIdentifier& di : h_prog.doors()) {
502 if (!di.has_map()) {
503 prog_info.malformed_doors.push_back(di);
504 continue;
505 }
506
507 DoorInfo& door_info = info_.doors[di];
508 door_info.progressives_referenced_by.push_back(h_prog.name());
509 }
510 }
511
484 void ProcessIdsFile(std::filesystem::path path) { 512 void ProcessIdsFile(std::filesystem::path path) {
485 // Ignore this for now. 513 // Ignore this for now.
486 } 514 }
diff --git a/tools/validator/structs.h b/tools/validator/structs.h index 0ca96fe..717fccf 100644 --- a/tools/validator/structs.h +++ b/tools/validator/structs.h
@@ -45,6 +45,7 @@ struct DoorInfo {
45 std::vector<PanelIdentifier> panels_referenced_by; 45 std::vector<PanelIdentifier> panels_referenced_by;
46 std::vector<PaintingIdentifier> paintings_referenced_by; 46 std::vector<PaintingIdentifier> paintings_referenced_by;
47 std::vector<PortIdentifier> ports_referenced_by; 47 std::vector<PortIdentifier> ports_referenced_by;
48 std::vector<std::string> progressives_referenced_by;
48 49
49 MalformedIdentifiers malformed_identifiers; 50 MalformedIdentifiers malformed_identifiers;
50}; 51};
@@ -102,6 +103,12 @@ struct PanelNameInfo {
102 std::vector<PanelIdentifier> panels_used_by; 103 std::vector<PanelIdentifier> panels_used_by;
103}; 104};
104 105
106struct ProgressiveInfo {
107 std::vector<HumanProgressive> definitions;
108
109 std::vector<DoorIdentifier> malformed_doors;
110};
111
105struct CollectedInfo { 112struct CollectedInfo {
106 std::map<std::string, MapInfo> maps; 113 std::map<std::string, MapInfo> maps;
107 std::map<RoomIdentifier, RoomInfo, RoomIdentifierLess> rooms; 114 std::map<RoomIdentifier, RoomInfo, RoomIdentifierLess> rooms;
@@ -114,6 +121,7 @@ struct CollectedInfo {
114 std::map<LetterIdentifier, LetterInfo> letters; 121 std::map<LetterIdentifier, LetterInfo> letters;
115 std::map<std::string, EndingInfo> endings; 122 std::map<std::string, EndingInfo> endings;
116 std::map<std::string, PanelNameInfo> panel_names; 123 std::map<std::string, PanelNameInfo> panel_names;
124 std::map<std::string, ProgressiveInfo> progressives;
117}; 125};
118 126
119} // namespace com::fourisland::lingo2_archipelago 127} // namespace com::fourisland::lingo2_archipelago
diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index 9c66e09..fd004d7 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp
@@ -45,6 +45,9 @@ class Validator {
45 for (const auto& [panel_name, panel_info] : info_.panel_names) { 45 for (const auto& [panel_name, panel_info] : info_.panel_names) {
46 ValidatePanelName(panel_name, panel_info); 46 ValidatePanelName(panel_name, panel_info);
47 } 47 }
48 for (const auto& [prog_name, prog_info] : info_.progressives) {
49 ValidateProgressive(prog_name, prog_info);
50 }
48 } 51 }
49 52
50 private: 53 private:
@@ -164,6 +167,11 @@ class Validator {
164 std::cout << " CONNECTION " << connection.ShortDebugString() 167 std::cout << " CONNECTION " << connection.ShortDebugString()
165 << std::endl; 168 << std::endl;
166 } 169 }
170
171 for (const std::string& prog_name :
172 door_info.progressives_referenced_by) {
173 std::cout << " PROGRESSIVE " << prog_name << std::endl;
174 }
167 } else if (door_info.definitions.size() > 1) { 175 } else if (door_info.definitions.size() > 1) {
168 std::cout << "Door " << door_identifier.ShortDebugString() 176 std::cout << "Door " << door_identifier.ShortDebugString()
169 << " was defined multiple times." << std::endl; 177 << " was defined multiple times." << std::endl;
@@ -369,6 +377,14 @@ class Validator {
369 } 377 }
370 } 378 }
371 379
380 void ValidateProgressive(const std::string& prog_name,
381 const ProgressiveInfo& prog_info) const {
382 if (prog_info.definitions.size() > 1) {
383 std::cout << "Progressive \"" << prog_name
384 << "\" has multiple definitions." << std::endl;
385 }
386 }
387
372 const CollectedInfo& info_; 388 const CollectedInfo& info_;
373}; 389};
374 390