about summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assign_ids/main.cpp70
-rw-r--r--tools/datapacker/main.cpp83
-rw-r--r--tools/util/ids_yaml_format.cpp21
-rw-r--r--tools/validator/human_processor.cpp56
-rw-r--r--tools/validator/main.cpp4
-rw-r--r--tools/validator/structs.h10
-rw-r--r--tools/validator/validator.cpp88
-rw-r--r--tools/validator/validator.h2
8 files changed, 297 insertions, 37 deletions
diff --git a/tools/assign_ids/main.cpp b/tools/assign_ids/main.cpp index 3e16f78..4a48b86 100644 --- a/tools/assign_ids/main.cpp +++ b/tools/assign_ids/main.cpp
@@ -65,6 +65,11 @@ class AssignIds {
65 UpdateNextId(room.panels()); 65 UpdateNextId(room.panels());
66 UpdateNextId(room.masteries()); 66 UpdateNextId(room.masteries());
67 UpdateNextId(room.keyholders()); 67 UpdateNextId(room.keyholders());
68 UpdateNextId(room.ports());
69 }
70
71 if (map.has_rte()) {
72 UpdateNextId(map.rte());
68 } 73 }
69 } 74 }
70 75
@@ -92,10 +97,31 @@ class AssignIds {
92 void ProcessMap(std::filesystem::path path) { 97 void ProcessMap(std::filesystem::path path) {
93 std::string map_name = path.filename().string(); 98 std::string map_name = path.filename().string();
94 99
100 ProcessMapMetadata(path / "metadata.txtpb", map_name);
95 ProcessDoorsFile(path / "doors.txtpb", map_name); 101 ProcessDoorsFile(path / "doors.txtpb", map_name);
96 ProcessRooms(path / "rooms", map_name); 102 ProcessRooms(path / "rooms", map_name);
97 } 103 }
98 104
105 void ProcessMapMetadata(std::filesystem::path path,
106 const std::string& current_map_name) {
107 if (!std::filesystem::exists(path)) {
108 return;
109 }
110
111 auto metadata = ReadMessageFromFile<HumanMap>(path.string());
112 auto& maps = *output_.mutable_maps();
113
114 if (metadata.has_rte_room()) {
115 if (!id_mappings_.maps().contains(current_map_name) ||
116 !id_mappings_.maps().at(current_map_name).has_rte()) {
117 maps[current_map_name].set_rte(next_id_++);
118 } else {
119 maps[current_map_name].set_rte(
120 id_mappings_.maps().at(current_map_name).rte());
121 }
122 }
123 }
124
99 void ProcessDoorsFile(std::filesystem::path path, 125 void ProcessDoorsFile(std::filesystem::path path,
100 const std::string& current_map_name) { 126 const std::string& current_map_name) {
101 if (!std::filesystem::exists(path)) { 127 if (!std::filesystem::exists(path)) {
@@ -111,7 +137,8 @@ class AssignIds {
111 137
112 void ProcessDoor(const HumanDoor& h_door, 138 void ProcessDoor(const HumanDoor& h_door,
113 const std::string& current_map_name) { 139 const std::string& current_map_name) {
114 if (h_door.type() == DoorType::EVENT) { 140 if (h_door.type() == DoorType::EVENT && !h_door.latch() &&
141 !h_door.legacy_location()) {
115 return; 142 return;
116 } 143 }
117 144
@@ -245,6 +272,37 @@ class AssignIds {
245 .at(h_keyholder.name()); 272 .at(h_keyholder.name());
246 } 273 }
247 } 274 }
275
276 for (const HumanPort& h_port : h_room.ports()) {
277 if (h_port.no_shuffle()) {
278 continue;
279 }
280
281 auto& maps = *output_.mutable_maps();
282 auto& rooms = *maps[current_map_name].mutable_rooms();
283 auto& ports = *rooms[h_room.name()].mutable_ports();
284
285 if (!id_mappings_.maps().contains(current_map_name) ||
286 !id_mappings_.maps()
287 .at(current_map_name)
288 .rooms()
289 .contains(h_room.name()) ||
290 !id_mappings_.maps()
291 .at(current_map_name)
292 .rooms()
293 .at(h_room.name())
294 .ports()
295 .contains(h_port.name())) {
296 ports[h_port.name()] = next_id_++;
297 } else {
298 ports[h_port.name()] = id_mappings_.maps()
299 .at(current_map_name)
300 .rooms()
301 .at(h_room.name())
302 .ports()
303 .at(h_port.name());
304 }
305 }
248 } 306 }
249 307
250 void ProcessSpecialIds() { 308 void ProcessSpecialIds() {
@@ -309,9 +367,13 @@ class AssignIds {
309 private: 367 private:
310 void UpdateNextId(const google::protobuf::Map<std::string, uint64_t>& ids) { 368 void UpdateNextId(const google::protobuf::Map<std::string, uint64_t>& ids) {
311 for (const auto& [_, id] : ids) { 369 for (const auto& [_, id] : ids) {
312 if (id > next_id_) { 370 UpdateNextId(id);
313 next_id_ = id; 371 }
314 } 372 }
373
374 void UpdateNextId(uint64_t id) {
375 if (id > next_id_) {
376 next_id_ = id;
315 } 377 }
316 } 378 }
317 379
diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 596259b..4ecde74 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp
@@ -88,9 +88,28 @@ class DataPacker {
88 uint64_t map_id = container_.FindOrAddMap(map_name); 88 uint64_t map_id = container_.FindOrAddMap(map_name);
89 Map& map = *container_.all_objects().mutable_maps(map_id); 89 Map& map = *container_.all_objects().mutable_maps(map_id);
90 90
91 map.set_type(metadata.type());
92 map.set_daedalus_only_mode(metadata.daedalus_only_mode());
93
91 if (metadata.has_display_name()) { 94 if (metadata.has_display_name()) {
92 map.set_display_name(metadata.display_name()); 95 map.set_display_name(metadata.display_name());
93 } 96 }
97
98 if (metadata.has_worldport_entrance()) {
99 map.set_worldport_entrance(container_.FindOrAddPort(
100 map_name, metadata.worldport_entrance().room(),
101 metadata.worldport_entrance().name(), std::nullopt, std::nullopt));
102 }
103
104 if (metadata.has_rte_room()) {
105 map.set_rte_room(container_.FindOrAddRoom(map_name, metadata.rte_room(),
106 std::nullopt));
107 }
108
109 if (metadata.has_rte_trigger_pos()) {
110 *map.mutable_rte_trigger_pos() = metadata.rte_trigger_pos();
111 *map.mutable_rte_trigger_scale() = metadata.rte_trigger_scale();
112 }
94 } 113 }
95 114
96 void ProcessRooms(std::filesystem::path path, 115 void ProcessRooms(std::filesystem::path path,
@@ -113,6 +132,10 @@ class DataPacker {
113 room.set_panel_display_name(h_room.panel_display_name()); 132 room.set_panel_display_name(h_room.panel_display_name());
114 } 133 }
115 134
135 if (h_room.has_daedalus_only_allow()) {
136 room.set_daedalus_only_allow(h_room.daedalus_only_allow());
137 }
138
116 for (const HumanPanel& h_panel : h_room.panels()) { 139 for (const HumanPanel& h_panel : h_room.panels()) {
117 room.add_panels(ProcessPanel(h_panel, current_map_name, room.name())); 140 room.add_panels(ProcessPanel(h_panel, current_map_name, room.name()));
118 } 141 }
@@ -186,6 +209,10 @@ class DataPacker {
186 panel.set_display_name(h_panel.display_name()); 209 panel.set_display_name(h_panel.display_name());
187 } 210 }
188 211
212 if (h_panel.has_exclude_from_panelsanity()) {
213 panel.set_exclude_from_panelsanity(h_panel.exclude_from_panelsanity());
214 }
215
189 return panel_id; 216 return panel_id;
190 } 217 }
191 218
@@ -239,7 +266,14 @@ class DataPacker {
239 Port& port = *container_.all_objects().mutable_ports(port_id); 266 Port& port = *container_.all_objects().mutable_ports(port_id);
240 267
241 port.set_path(h_port.path()); 268 port.set_path(h_port.path());
242 port.set_orientation(h_port.orientation()); 269 port.set_display_name(h_port.display_name());
270
271 if (h_port.no_shuffle()) {
272 port.set_no_shuffle(h_port.no_shuffle());
273 } else {
274 *port.mutable_destination() = h_port.destination();
275 port.set_rotation(h_port.rotation());
276 }
243 277
244 // Setting this explicitly because the Godot protobuf doesn't support 278 // Setting this explicitly because the Godot protobuf doesn't support
245 // custom defaults. 279 // custom defaults.
@@ -396,8 +430,8 @@ class DataPacker {
396 container_.FindOrAddDoor(map_name, di.name(), current_map_name)); 430 container_.FindOrAddDoor(map_name, di.name(), current_map_name));
397 } 431 }
398 432
399 for (const std::string& ending_name : h_door.endings()) { 433 if (h_door.has_white_ending()) {
400 door.add_endings(container_.FindOrAddEnding(ending_name)); 434 door.set_white_ending(h_door.white_ending());
401 } 435 }
402 436
403 if (h_door.has_control_center_color()) { 437 if (h_door.has_control_center_color()) {
@@ -417,6 +451,22 @@ class DataPacker {
417 if (h_door.has_double_letters()) { 451 if (h_door.has_double_letters()) {
418 door.set_double_letters(h_door.double_letters()); 452 door.set_double_letters(h_door.double_letters());
419 } 453 }
454
455 if (h_door.has_latch()) {
456 door.set_latch(h_door.latch());
457 }
458
459 if (h_door.has_legacy_location()) {
460 door.set_legacy_location(h_door.legacy_location());
461 }
462
463 if (h_door.has_daedalus_only_allow()) {
464 door.set_daedalus_only_allow(h_door.daedalus_only_allow());
465 }
466
467 if (h_door.has_daedalus_only_always_item()) {
468 door.set_daedalus_only_always_item(h_door.daedalus_only_always_item());
469 }
420 } 470 }
421 471
422 void ProcessConnectionsFile(std::filesystem::path path, 472 void ProcessConnectionsFile(std::filesystem::path path,
@@ -483,6 +533,16 @@ class DataPacker {
483 r_connection.set_cyan_ending(human_connection.cyan_ending()); 533 r_connection.set_cyan_ending(human_connection.cyan_ending());
484 } 534 }
485 535
536 if (human_connection.has_mint_ending()) {
537 f_connection.set_mint_ending(human_connection.mint_ending());
538 r_connection.set_mint_ending(human_connection.mint_ending());
539 }
540
541 if (human_connection.has_vanilla_only()) {
542 f_connection.set_vanilla_only(human_connection.vanilla_only());
543 r_connection.set_vanilla_only(human_connection.vanilla_only());
544 }
545
486 container_.AddConnection(f_connection); 546 container_.AddConnection(f_connection);
487 if (!human_connection.oneway()) { 547 if (!human_connection.oneway()) {
488 container_.AddConnection(r_connection); 548 container_.AddConnection(r_connection);
@@ -612,6 +672,10 @@ class DataPacker {
612 container_.FindOrAddDoor(di.map(), di.name(), std::nullopt); 672 container_.FindOrAddDoor(di.map(), di.name(), std::nullopt);
613 group.add_doors(door_id); 673 group.add_doors(door_id);
614 } 674 }
675
676 if (h_group.has_daedalus_only_always_item()) {
677 group.set_daedalus_only_always_item(h_group.daedalus_only_always_item());
678 }
615 } 679 }
616 680
617 void ProcessGlobalMetadataFile(std::filesystem::path path) { 681 void ProcessGlobalMetadataFile(std::filesystem::path path) {
@@ -620,7 +684,7 @@ class DataPacker {
620 } 684 }
621 685
622 auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string()); 686 auto h_metadata = ReadMessageFromFile<HumanGlobalMetadata>(path.string());
623 container_.all_objects().set_version(h_metadata.version()); 687 *container_.all_objects().mutable_version() = h_metadata.version();
624 } 688 }
625 689
626 void ProcessIdsFile(std::filesystem::path path) { 690 void ProcessIdsFile(std::filesystem::path path) {
@@ -655,6 +719,17 @@ class DataPacker {
655 .mutable_keyholders(keyholder_id) 719 .mutable_keyholders(keyholder_id)
656 ->set_ap_id(ap_id); 720 ->set_ap_id(ap_id);
657 } 721 }
722
723 for (const auto& [port_name, ap_id] : room.ports()) {
724 uint64_t port_id = container_.FindOrAddPort(
725 map_name, room_name, port_name, std::nullopt, std::nullopt);
726 container_.all_objects().mutable_ports(port_id)->set_ap_id(ap_id);
727 }
728 }
729
730 if (map.has_rte()) {
731 uint64_t map_id = container_.FindOrAddMap(map_name);
732 container_.all_objects().mutable_maps(map_id)->set_rte_ap_id(map.rte());
658 } 733 }
659 } 734 }
660 735
diff --git a/tools/util/ids_yaml_format.cpp b/tools/util/ids_yaml_format.cpp index 71bfd63..c23c66b 100644 --- a/tools/util/ids_yaml_format.cpp +++ b/tools/util/ids_yaml_format.cpp
@@ -64,6 +64,13 @@ IdMappings ReadIdsFromYaml(const std::string& filename) {
64 keyholder_it.second.as<uint64_t>(); 64 keyholder_it.second.as<uint64_t>();
65 } 65 }
66 } 66 }
67
68 if (room_it.second["ports"]) {
69 for (const auto& port_it : room_it.second["ports"]) {
70 (*room_ids.mutable_ports())[port_it.first.as<std::string>()] =
71 port_it.second.as<uint64_t>();
72 }
73 }
67 } 74 }
68 } 75 }
69 76
@@ -73,6 +80,10 @@ IdMappings ReadIdsFromYaml(const std::string& filename) {
73 door_it.second.as<uint64_t>(); 80 door_it.second.as<uint64_t>();
74 } 81 }
75 } 82 }
83
84 if (map_it.second["rte"]) {
85 map_ids.set_rte(map_it.second["rte"].as<uint64_t>());
86 }
76 } 87 }
77 } 88 }
78 89
@@ -146,6 +157,12 @@ void WriteIdsAsYaml(const IdMappings& ids, const std::string& filename) {
146 keyholder_id; 157 keyholder_id;
147 }); 158 });
148 159
160 OperateOnSortedMap(
161 room_ids.ports(),
162 [&room_node](const std::string& port_name, uint64_t port_id) {
163 room_node["ports"][port_name] = port_id;
164 });
165
149 map_node["rooms"][room_name] = std::move(room_node); 166 map_node["rooms"][room_name] = std::move(room_node);
150 }); 167 });
151 168
@@ -155,6 +172,10 @@ void WriteIdsAsYaml(const IdMappings& ids, const std::string& filename) {
155 map_node["doors"][door_name] = door_id; 172 map_node["doors"][door_name] = door_id;
156 }); 173 });
157 174
175 if (map_ids.has_rte()) {
176 map_node["rte"] = map_ids.rte();
177 }
178
158 result["maps"][map_name] = std::move(map_node); 179 result["maps"][map_name] = std::move(map_node);
159 }); 180 });
160 181
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
diff --git a/tools/validator/main.cpp b/tools/validator/main.cpp index 1a72e9a..6139e95 100644 --- a/tools/validator/main.cpp +++ b/tools/validator/main.cpp
@@ -21,7 +21,9 @@ void Run(const std::string& mapdir, const std::string& repodir) {
21int main(int argc, char** argv) { 21int main(int argc, char** argv) {
22 if (argc != 3) { 22 if (argc != 3) {
23 std::cout << "Incorrect argument count." << std::endl; 23 std::cout << "Incorrect argument count." << std::endl;
24 std::cout << "Usage: validator [path to map directory] [path to Lingo 2 repository]" << std::endl; 24 std::cout << "Usage: validator [path to map directory] [path to Lingo 2 "
25 "repository]"
26 << std::endl;
25 return 1; 27 return 1;
26 } 28 }
27 29
diff --git a/tools/validator/structs.h b/tools/validator/structs.h index d1d45f2..81a0e8f 100644 --- a/tools/validator/structs.h +++ b/tools/validator/structs.h
@@ -27,6 +27,11 @@ struct GameNodeInfo {
27 27
28struct MapInfo { 28struct MapInfo {
29 std::map<std::string, GameNodeInfo> game_nodes; 29 std::map<std::string, GameNodeInfo> game_nodes;
30
31 std::vector<HumanMap> definitions;
32 bool has_rte_id = false;
33
34 std::optional<PortIdentifier> malformed_worldport_entrance;
30}; 35};
31 36
32struct RoomInfo { 37struct RoomInfo {
@@ -35,6 +40,7 @@ struct RoomInfo {
35 std::vector<DoorIdentifier> doors_referenced_by; 40 std::vector<DoorIdentifier> doors_referenced_by;
36 std::vector<PanelIdentifier> panels_referenced_by; 41 std::vector<PanelIdentifier> panels_referenced_by;
37 std::vector<HumanConnection> connections_referenced_by; 42 std::vector<HumanConnection> connections_referenced_by;
43 std::vector<std::string> map_rtes_referenced_by;
38}; 44};
39 45
40struct DoorInfo { 46struct DoorInfo {
@@ -54,9 +60,11 @@ struct DoorInfo {
54 60
55struct PortInfo { 61struct PortInfo {
56 std::vector<HumanPort> definitions; 62 std::vector<HumanPort> definitions;
63 bool has_id = false;
57 64
58 std::vector<HumanConnection> connections_referenced_by; 65 std::vector<HumanConnection> connections_referenced_by;
59 std::vector<HumanConnection> target_connections_referenced_by; 66 std::vector<HumanConnection> target_connections_referenced_by;
67 std::vector<std::string> map_worldport_entrances;
60}; 68};
61 69
62struct PaintingInfo { 70struct PaintingInfo {
@@ -104,8 +112,6 @@ struct LetterInfo {
104struct EndingInfo { 112struct EndingInfo {
105 std::vector<RoomIdentifier> defined_in; 113 std::vector<RoomIdentifier> defined_in;
106 bool has_id = false; 114 bool has_id = false;
107
108 std::vector<DoorIdentifier> doors_referenced_by;
109}; 115};
110 116
111struct PanelNameInfo { 117struct PanelNameInfo {
diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index dd41f5c..e9fbb74 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp
@@ -1,5 +1,6 @@
1#include "validator.h" 1#include "validator.h"
2 2
3#include <algorithm>
3#include <iostream> 4#include <iostream>
4 5
5#include "proto/human.pb.h" 6#include "proto/human.pb.h"
@@ -69,6 +70,27 @@ class Validator {
69 << " is not defined in the game file." << std::endl; 70 << " is not defined in the game file." << std::endl;
70 } 71 }
71 } 72 }
73
74 if (map_info.malformed_worldport_entrance) {
75 std::cout << "The worldport entrance for map " << map_name
76 << " is malformed." << std::endl;
77 }
78
79 if (map_info.has_rte_id) {
80 if (!std::any_of(
81 map_info.definitions.begin(), map_info.definitions.end(),
82 [](const HumanMap& h_map) { return h_map.has_rte_room(); })) {
83 std::cout << "Map " << map_name << " has an RTE ID but no RTE room."
84 << std::endl;
85 }
86 } else {
87 if (std::any_of(
88 map_info.definitions.begin(), map_info.definitions.end(),
89 [](const HumanMap& h_map) { return h_map.has_rte_room(); })) {
90 std::cout << "Map " << map_name << " has an RTE room but no RTE ID."
91 << std::endl;
92 }
93 }
72 } 94 }
73 95
74 void ValidateRoom(const RoomIdentifier& room_identifier, 96 void ValidateRoom(const RoomIdentifier& room_identifier,
@@ -94,6 +116,10 @@ class Validator {
94 std::cout << " CONNECTION " << connection.ShortDebugString() 116 std::cout << " CONNECTION " << connection.ShortDebugString()
95 << std::endl; 117 << std::endl;
96 } 118 }
119
120 for (const std::string& map_name : room_info.map_rtes_referenced_by) {
121 std::cout << " MAP RTE " << map_name << std::endl;
122 }
97 } else if (room_info.definitions.size() > 1) { 123 } else if (room_info.definitions.size() > 1) {
98 std::cout << "Room " << room_identifier.ShortDebugString() 124 std::cout << "Room " << room_identifier.ShortDebugString()
99 << " was defined multiple times." << std::endl; 125 << " was defined multiple times." << std::endl;
@@ -106,7 +132,7 @@ class Validator {
106 return false; 132 return false;
107 } 133 }
108 134
109 if (h_door.keyholders_size() > 0 || h_door.endings_size() > 0 || 135 if (h_door.keyholders_size() > 0 || h_door.white_ending() ||
110 h_door.complete_at() > 0) { 136 h_door.complete_at() > 0) {
111 return true; 137 return true;
112 } 138 }
@@ -220,16 +246,23 @@ class Validator {
220 << " needs an explicit location name." << std::endl; 246 << " needs an explicit location name." << std::endl;
221 } 247 }
222 248
223 if (h_door.double_letters() && 249 if (h_door.type() == DoorType::STANDARD ||
224 (h_door.type() == DoorType::STANDARD || 250 h_door.type() == DoorType::LOCATION_ONLY ||
225 h_door.type() == DoorType::LOCATION_ONLY || 251 h_door.type() == DoorType::GRAVESTONE || h_door.legacy_location()) {
226 h_door.type() == DoorType::GRAVESTONE)) { 252 if (h_door.double_letters()) {
227 std::cout << "Door " << door_identifier.ShortDebugString() 253 std::cout << "Door " << door_identifier.ShortDebugString()
228 << " is a location that depends on double_letters." 254 << " is a location that depends on double_letters."
229 << std::endl; 255 << std::endl;
256 }
257
258 if (!h_door.has_location_room()) {
259 std::cout << "Door " << door_identifier.ShortDebugString()
260 << " is missing a location_room." << std::endl;
261 }
230 } 262 }
231 263
232 bool needs_id = (h_door.type() != DoorType::EVENT); 264 bool needs_id = (h_door.type() != DoorType::EVENT || h_door.latch() ||
265 h_door.legacy_location());
233 if (door_info.has_id != needs_id) { 266 if (door_info.has_id != needs_id) {
234 if (needs_id) { 267 if (needs_id) {
235 std::cout << "Door " << door_identifier.ShortDebugString() 268 std::cout << "Door " << door_identifier.ShortDebugString()
@@ -253,6 +286,14 @@ class Validator {
253 std::cout << " CONNECTION " << connection.ShortDebugString() 286 std::cout << " CONNECTION " << connection.ShortDebugString()
254 << std::endl; 287 << std::endl;
255 } 288 }
289
290 for (const std::string& map_name : port_info.map_worldport_entrances) {
291 std::cout << " MAP (worldport_entrance) " << map_name << std::endl;
292 }
293
294 if (port_info.has_id) {
295 std::cout << " An AP ID is present." << std::endl;
296 }
256 } else if (port_info.definitions.size() > 1) { 297 } else if (port_info.definitions.size() > 1) {
257 std::cout << "Port " << port_identifier.ShortDebugString() 298 std::cout << "Port " << port_identifier.ShortDebugString()
258 << " was defined multiple times." << std::endl; 299 << " was defined multiple times." << std::endl;
@@ -273,6 +314,29 @@ class Validator {
273 } 314 }
274 } 315 }
275 } 316 }
317
318 for (const HumanPort& port : port_info.definitions) {
319 if (!port.no_shuffle()) {
320 if (!port.has_destination()) {
321 std::cout << "Port " << port_identifier.ShortDebugString()
322 << " is shuffleable and missing a destination."
323 << std::endl;
324 }
325 if (!port.has_rotation()) {
326 std::cout << "Port " << port_identifier.ShortDebugString()
327 << " is shuffleable and missing a rotation." << std::endl;
328 }
329 if (!port_info.has_id) {
330 std::cout << "Port " << port_identifier.ShortDebugString()
331 << " is missing an AP ID." << std::endl;
332 }
333 } else {
334 if (port_info.has_id) {
335 std::cout << "Port " << port_identifier.ShortDebugString()
336 << " should not have an AP ID." << std::endl;
337 }
338 }
339 }
276 } 340 }
277 341
278 void ValidatePainting(const PaintingIdentifier& painting_identifier, 342 void ValidatePainting(const PaintingIdentifier& painting_identifier,
@@ -459,12 +523,6 @@ class Validator {
459 std::cout << "Ending " << ending_name 523 std::cout << "Ending " << ending_name
460 << " has no definition, but was referenced:" << std::endl; 524 << " has no definition, but was referenced:" << std::endl;
461 525
462 for (const DoorIdentifier& door_identifier :
463 ending_info.doors_referenced_by) {
464 std::cout << " DOOR " << door_identifier.ShortDebugString()
465 << std::endl;
466 }
467
468 if (ending_info.has_id) { 526 if (ending_info.has_id) {
469 std::cout << " An AP ID is present." << std::endl; 527 std::cout << " An AP ID is present." << std::endl;
470 } 528 }
diff --git a/tools/validator/validator.h b/tools/validator/validator.h index b710429..33bc7c9 100644 --- a/tools/validator/validator.h +++ b/tools/validator/validator.h
@@ -1,4 +1,4 @@
1#ifndef TOOLS_VALIDATOR_VALIDATOR_H_ 1#ifndef TOOLS_VALIDATOR_VALIDATOR_H
2#define TOOLS_VALIDATOR_VALIDATOR_H 2#define TOOLS_VALIDATOR_VALIDATOR_H
3 3
4namespace com::fourisland::lingo2_archipelago { 4namespace com::fourisland::lingo2_archipelago {