diff options
Diffstat (limited to 'tools/validator/validator.cpp')
| -rw-r--r-- | tools/validator/validator.cpp | 116 |
1 files changed, 101 insertions, 15 deletions
| diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index 4149caa..fe36be7 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp | |||
| @@ -69,6 +69,11 @@ class Validator { | |||
| 69 | << " is not defined in the game file." << std::endl; | 69 | << " is not defined in the game file." << std::endl; |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | |||
| 73 | if (map_info.malformed_worldport_entrance) { | ||
| 74 | std::cout << "The worldport entrance for map " << map_name | ||
| 75 | << " is malformed." << std::endl; | ||
| 76 | } | ||
| 72 | } | 77 | } |
| 73 | 78 | ||
| 74 | void ValidateRoom(const RoomIdentifier& room_identifier, | 79 | void ValidateRoom(const RoomIdentifier& room_identifier, |
| @@ -106,7 +111,8 @@ class Validator { | |||
| 106 | return false; | 111 | return false; |
| 107 | } | 112 | } |
| 108 | 113 | ||
| 109 | if (h_door.keyholders_size() > 0 || h_door.endings_size() > 0) { | 114 | if (h_door.keyholders_size() > 0 || h_door.white_ending() || |
| 115 | h_door.complete_at() > 0) { | ||
| 110 | return true; | 116 | return true; |
| 111 | } | 117 | } |
| 112 | 118 | ||
| @@ -219,16 +225,23 @@ class Validator { | |||
| 219 | << " needs an explicit location name." << std::endl; | 225 | << " needs an explicit location name." << std::endl; |
| 220 | } | 226 | } |
| 221 | 227 | ||
| 222 | if (h_door.double_letters() && | 228 | if (h_door.type() == DoorType::STANDARD || |
| 223 | (h_door.type() == DoorType::STANDARD || | 229 | h_door.type() == DoorType::LOCATION_ONLY || |
| 224 | h_door.type() == DoorType::LOCATION_ONLY || | 230 | h_door.type() == DoorType::GRAVESTONE || h_door.legacy_location()) { |
| 225 | h_door.type() == DoorType::GRAVESTONE)) { | 231 | if (h_door.double_letters()) { |
| 226 | std::cout << "Door " << door_identifier.ShortDebugString() | 232 | std::cout << "Door " << door_identifier.ShortDebugString() |
| 227 | << " is a location that depends on double_letters." | 233 | << " is a location that depends on double_letters." |
| 228 | << std::endl; | 234 | << std::endl; |
| 235 | } | ||
| 236 | |||
| 237 | if (!h_door.has_location_room()) { | ||
| 238 | std::cout << "Door " << door_identifier.ShortDebugString() | ||
| 239 | << " is missing a location_room." << std::endl; | ||
| 240 | } | ||
| 229 | } | 241 | } |
| 230 | 242 | ||
| 231 | bool needs_id = (h_door.type() != DoorType::EVENT); | 243 | bool needs_id = (h_door.type() != DoorType::EVENT || h_door.latch() || |
| 244 | h_door.legacy_location()); | ||
| 232 | if (door_info.has_id != needs_id) { | 245 | if (door_info.has_id != needs_id) { |
| 233 | if (needs_id) { | 246 | if (needs_id) { |
| 234 | std::cout << "Door " << door_identifier.ShortDebugString() | 247 | std::cout << "Door " << door_identifier.ShortDebugString() |
| @@ -252,10 +265,57 @@ class Validator { | |||
| 252 | std::cout << " CONNECTION " << connection.ShortDebugString() | 265 | std::cout << " CONNECTION " << connection.ShortDebugString() |
| 253 | << std::endl; | 266 | << std::endl; |
| 254 | } | 267 | } |
| 268 | |||
| 269 | for (const std::string& map_name : port_info.map_worldport_entrances) { | ||
| 270 | std::cout << " MAP (worldport_entrance) " << map_name << std::endl; | ||
| 271 | } | ||
| 272 | |||
| 273 | if (port_info.has_id) { | ||
| 274 | std::cout << " An AP ID is present." << std::endl; | ||
| 275 | } | ||
| 255 | } else if (port_info.definitions.size() > 1) { | 276 | } else if (port_info.definitions.size() > 1) { |
| 256 | std::cout << "Port " << port_identifier.ShortDebugString() | 277 | std::cout << "Port " << port_identifier.ShortDebugString() |
| 257 | << " was defined multiple times." << std::endl; | 278 | << " was defined multiple times." << std::endl; |
| 258 | } | 279 | } |
| 280 | |||
| 281 | if (!port_info.target_connections_referenced_by.empty()) { | ||
| 282 | for (const HumanPort& port : port_info.definitions) { | ||
| 283 | if (port.has_required_door()) { | ||
| 284 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 285 | << " has a required door but is the target of a connection:" | ||
| 286 | << std::endl; | ||
| 287 | |||
| 288 | for (const HumanConnection& connection : | ||
| 289 | port_info.target_connections_referenced_by) { | ||
| 290 | std::cout << " CONNECTION " << connection.ShortDebugString() | ||
| 291 | << std::endl; | ||
| 292 | } | ||
| 293 | } | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | for (const HumanPort& port : port_info.definitions) { | ||
| 298 | if (!port.no_shuffle()) { | ||
| 299 | if (!port.has_destination()) { | ||
| 300 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 301 | << " is shuffleable and missing a destination." | ||
| 302 | << std::endl; | ||
| 303 | } | ||
| 304 | if (!port.has_rotation()) { | ||
| 305 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 306 | << " is shuffleable and missing a rotation." << std::endl; | ||
| 307 | } | ||
| 308 | if (!port_info.has_id) { | ||
| 309 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 310 | << " is missing an AP ID." << std::endl; | ||
| 311 | } | ||
| 312 | } else { | ||
| 313 | if (port_info.has_id) { | ||
| 314 | std::cout << "Port " << port_identifier.ShortDebugString() | ||
| 315 | << " should not have an AP ID." << std::endl; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | } | ||
| 259 | } | 319 | } |
| 260 | 320 | ||
| 261 | void ValidatePainting(const PaintingIdentifier& painting_identifier, | 321 | void ValidatePainting(const PaintingIdentifier& painting_identifier, |
| @@ -279,6 +339,22 @@ class Validator { | |||
| 279 | std::cout << "Painting " << painting_identifier.ShortDebugString() | 339 | std::cout << "Painting " << painting_identifier.ShortDebugString() |
| 280 | << " was defined multiple times." << std::endl; | 340 | << " was defined multiple times." << std::endl; |
| 281 | } | 341 | } |
| 342 | |||
| 343 | if (!painting_info.target_connections_referenced_by.empty()) { | ||
| 344 | for (const HumanPainting& painting : painting_info.definitions) { | ||
| 345 | if (painting.has_required_door()) { | ||
| 346 | std::cout << "Painting " << painting_identifier.ShortDebugString() | ||
| 347 | << " has a required door but is the target of a connection:" | ||
| 348 | << std::endl; | ||
| 349 | |||
| 350 | for (const HumanConnection& connection : | ||
| 351 | painting_info.target_connections_referenced_by) { | ||
| 352 | std::cout << " CONNECTION " << connection.ShortDebugString() | ||
| 353 | << std::endl; | ||
| 354 | } | ||
| 355 | } | ||
| 356 | } | ||
| 357 | } | ||
| 282 | } | 358 | } |
| 283 | 359 | ||
| 284 | void ValidatePanel(const PanelIdentifier& panel_identifier, | 360 | void ValidatePanel(const PanelIdentifier& panel_identifier, |
| @@ -340,6 +416,22 @@ class Validator { | |||
| 340 | std::cout << "Panel " << panel_identifier.ShortDebugString() | 416 | std::cout << "Panel " << panel_identifier.ShortDebugString() |
| 341 | << " is missing an AP ID." << std::endl; | 417 | << " is missing an AP ID." << std::endl; |
| 342 | } | 418 | } |
| 419 | |||
| 420 | if (!panel_info.target_connections_referenced_by.empty()) { | ||
| 421 | for (const HumanPanel& panel : panel_info.definitions) { | ||
| 422 | if (panel.has_required_door()) { | ||
| 423 | std::cout << "Panel " << panel_identifier.ShortDebugString() | ||
| 424 | << " has a required door but is the target of a connection:" | ||
| 425 | << std::endl; | ||
| 426 | |||
| 427 | for (const HumanConnection& connection : | ||
| 428 | panel_info.target_connections_referenced_by) { | ||
| 429 | std::cout << " CONNECTION " << connection.ShortDebugString() | ||
| 430 | << std::endl; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | } | ||
| 434 | } | ||
| 343 | } | 435 | } |
| 344 | 436 | ||
| 345 | void ValidateKeyholder(const KeyholderIdentifier& keyholder_identifier, | 437 | void ValidateKeyholder(const KeyholderIdentifier& keyholder_identifier, |
| @@ -410,12 +502,6 @@ class Validator { | |||
| 410 | std::cout << "Ending " << ending_name | 502 | std::cout << "Ending " << ending_name |
| 411 | << " has no definition, but was referenced:" << std::endl; | 503 | << " has no definition, but was referenced:" << std::endl; |
| 412 | 504 | ||
| 413 | for (const DoorIdentifier& door_identifier : | ||
| 414 | ending_info.doors_referenced_by) { | ||
| 415 | std::cout << " DOOR " << door_identifier.ShortDebugString() | ||
| 416 | << std::endl; | ||
| 417 | } | ||
| 418 | |||
| 419 | if (ending_info.has_id) { | 505 | if (ending_info.has_id) { |
| 420 | std::cout << " An AP ID is present." << std::endl; | 506 | std::cout << " An AP ID is present." << std::endl; |
| 421 | } | 507 | } |
