about summary refs log tree commit diff stats
path: root/tools/validator/validator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/validator/validator.cpp')
-rw-r--r--tools/validator/validator.cpp88
1 files changed, 73 insertions, 15 deletions
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 }