diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-04 15:46:25 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-04 15:46:25 -0400 |
| commit | a752ab325cf46d35a90606a354775799977dccb0 (patch) | |
| tree | 66541b3ed6e820deb1d9e61cd9e10c874fb3a878 /tools/validator/validator.cpp | |
| parent | 05d3219f4496104cdf8d96aaacbdd41f7e0dbed2 (diff) | |
| download | lingo2-archipelago-a752ab325cf46d35a90606a354775799977dccb0.tar.gz lingo2-archipelago-a752ab325cf46d35a90606a354775799977dccb0.tar.bz2 lingo2-archipelago-a752ab325cf46d35a90606a354775799977dccb0.zip | |
[Data] Strip unnecessary AP IDs
This was causing issues in the client, specifically for The Ancient.
Diffstat (limited to 'tools/validator/validator.cpp')
| -rw-r--r-- | tools/validator/validator.cpp | 79 |
1 files changed, 77 insertions, 2 deletions
| diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index fd004d7..ab1612e 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp | |||
| @@ -172,6 +172,10 @@ class Validator { | |||
| 172 | door_info.progressives_referenced_by) { | 172 | door_info.progressives_referenced_by) { |
| 173 | std::cout << " PROGRESSIVE " << prog_name << std::endl; | 173 | std::cout << " PROGRESSIVE " << prog_name << std::endl; |
| 174 | } | 174 | } |
| 175 | |||
| 176 | if (door_info.has_id) { | ||
| 177 | std::cout << " An AP ID is present." << std::endl; | ||
| 178 | } | ||
| 175 | } else if (door_info.definitions.size() > 1) { | 179 | } else if (door_info.definitions.size() > 1) { |
| 176 | std::cout << "Door " << door_identifier.ShortDebugString() | 180 | std::cout << "Door " << door_identifier.ShortDebugString() |
| 177 | << " was defined multiple times." << std::endl; | 181 | << " was defined multiple times." << std::endl; |
| @@ -215,6 +219,17 @@ class Validator { | |||
| 215 | << " is a location that depends on double_letters." | 219 | << " is a location that depends on double_letters." |
| 216 | << std::endl; | 220 | << std::endl; |
| 217 | } | 221 | } |
| 222 | |||
| 223 | bool needs_id = (h_door.type() != DoorType::EVENT); | ||
| 224 | if (door_info.has_id != needs_id) { | ||
| 225 | if (needs_id) { | ||
| 226 | std::cout << "Door " << door_identifier.ShortDebugString() | ||
| 227 | << " is missing an AP ID." << std::endl; | ||
| 228 | } else { | ||
| 229 | std::cout << "Door " << door_identifier.ShortDebugString() | ||
| 230 | << " should not have an AP ID." << std::endl; | ||
| 231 | } | ||
| 232 | } | ||
| 218 | } | 233 | } |
| 219 | } | 234 | } |
| 220 | 235 | ||
| @@ -280,6 +295,10 @@ class Validator { | |||
| 280 | std::cout << " CONNECTION " << connection.ShortDebugString() | 295 | std::cout << " CONNECTION " << connection.ShortDebugString() |
| 281 | << std::endl; | 296 | << std::endl; |
| 282 | } | 297 | } |
| 298 | |||
| 299 | if (panel_info.has_id) { | ||
| 300 | std::cout << " An AP ID is present." << std::endl; | ||
| 301 | } | ||
| 283 | } else if (panel_info.definitions.size() > 1) { | 302 | } else if (panel_info.definitions.size() > 1) { |
| 284 | std::cout << "Panel " << panel_identifier.ShortDebugString() | 303 | std::cout << "Panel " << panel_identifier.ShortDebugString() |
| 285 | << " was defined multiple times." << std::endl; | 304 | << " was defined multiple times." << std::endl; |
| @@ -308,6 +327,11 @@ class Validator { | |||
| 308 | << "\" was defined multiple times." << std::endl; | 327 | << "\" was defined multiple times." << std::endl; |
| 309 | } | 328 | } |
| 310 | } | 329 | } |
| 330 | |||
| 331 | if (!panel_info.has_id) { | ||
| 332 | std::cout << "Panel " << panel_identifier.ShortDebugString() | ||
| 333 | << " is missing an AP ID." << std::endl; | ||
| 334 | } | ||
| 311 | } | 335 | } |
| 312 | 336 | ||
| 313 | void ValidateKeyholder(const KeyholderIdentifier& keyholder_identifier, | 337 | void ValidateKeyholder(const KeyholderIdentifier& keyholder_identifier, |
| @@ -321,10 +345,28 @@ class Validator { | |||
| 321 | std::cout << " DOOR " << door_identifier.ShortDebugString() | 345 | std::cout << " DOOR " << door_identifier.ShortDebugString() |
| 322 | << std::endl; | 346 | << std::endl; |
| 323 | } | 347 | } |
| 348 | |||
| 349 | if (keyholder_info.has_id) { | ||
| 350 | std::cout << " An AP ID is present." << std::endl; | ||
| 351 | } | ||
| 324 | } else if (keyholder_info.definitions.size() > 1) { | 352 | } else if (keyholder_info.definitions.size() > 1) { |
| 325 | std::cout << "Keyholder " << keyholder_identifier.ShortDebugString() | 353 | std::cout << "Keyholder " << keyholder_identifier.ShortDebugString() |
| 326 | << " was defined multiple times." << std::endl; | 354 | << " was defined multiple times." << std::endl; |
| 327 | } | 355 | } |
| 356 | |||
| 357 | for (const HumanKeyholder& h_keyholder : keyholder_info.definitions) { | ||
| 358 | bool needs_id = (h_keyholder.has_key()); | ||
| 359 | |||
| 360 | if (needs_id != keyholder_info.has_id) { | ||
| 361 | if (needs_id) { | ||
| 362 | std::cout << "Keyholder " << keyholder_identifier.ShortDebugString() | ||
| 363 | << " is missing an AP ID." << std::endl; | ||
| 364 | } else { | ||
| 365 | std::cout << "Keyholder " << keyholder_identifier.ShortDebugString() | ||
| 366 | << " should not have an AP ID." << std::endl; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | } | ||
| 328 | } | 370 | } |
| 329 | 371 | ||
| 330 | void ValidateLetter(const LetterIdentifier& letter_identifier, | 372 | void ValidateLetter(const LetterIdentifier& letter_identifier, |
| @@ -332,7 +374,14 @@ class Validator { | |||
| 332 | std::string letter_name = std::string(1, std::get<0>(letter_identifier)) + | 374 | std::string letter_name = std::string(1, std::get<0>(letter_identifier)) + |
| 333 | (std::get<1>(letter_identifier) ? "2" : "1"); | 375 | (std::get<1>(letter_identifier) ? "2" : "1"); |
| 334 | 376 | ||
| 335 | if (letter_info.defined_in.size() > 1) { | 377 | if (letter_info.defined_in.empty()) { |
| 378 | std::cout << "Letter " << letter_name | ||
| 379 | << " has no definition, but was referenced:" << std::endl; | ||
| 380 | |||
| 381 | if (letter_info.has_id) { | ||
| 382 | std::cout << " An AP ID is present." << std::endl; | ||
| 383 | } | ||
| 384 | } else if (letter_info.defined_in.size() > 1) { | ||
| 336 | std::cout << "Letter " << letter_name | 385 | std::cout << "Letter " << letter_name |
| 337 | << " was defined in multiple places:" << std::endl; | 386 | << " was defined in multiple places:" << std::endl; |
| 338 | 387 | ||
| @@ -340,6 +389,11 @@ class Validator { | |||
| 340 | std::cout << " " << room_identifier.ShortDebugString() << std::endl; | 389 | std::cout << " " << room_identifier.ShortDebugString() << std::endl; |
| 341 | } | 390 | } |
| 342 | } | 391 | } |
| 392 | |||
| 393 | if (!letter_info.has_id) { | ||
| 394 | std::cout << "Letter " << letter_name << " is missing an AP ID." | ||
| 395 | << std::endl; | ||
| 396 | } | ||
| 343 | } | 397 | } |
| 344 | 398 | ||
| 345 | void ValidateEnding(const std::string& ending_name, | 399 | void ValidateEnding(const std::string& ending_name, |
| @@ -353,6 +407,10 @@ class Validator { | |||
| 353 | std::cout << " DOOR " << door_identifier.ShortDebugString() | 407 | std::cout << " DOOR " << door_identifier.ShortDebugString() |
| 354 | << std::endl; | 408 | << std::endl; |
| 355 | } | 409 | } |
| 410 | |||
| 411 | if (ending_info.has_id) { | ||
| 412 | std::cout << " An AP ID is present." << std::endl; | ||
| 413 | } | ||
| 356 | } else if (ending_info.defined_in.size() > 1) { | 414 | } else if (ending_info.defined_in.size() > 1) { |
| 357 | std::cout << "Ending " << ending_name | 415 | std::cout << "Ending " << ending_name |
| 358 | << " was defined in multiple places:" << std::endl; | 416 | << " was defined in multiple places:" << std::endl; |
| @@ -361,6 +419,11 @@ class Validator { | |||
| 361 | std::cout << " " << room_identifier.ShortDebugString() << std::endl; | 419 | std::cout << " " << room_identifier.ShortDebugString() << std::endl; |
| 362 | } | 420 | } |
| 363 | } | 421 | } |
| 422 | |||
| 423 | if (!ending_info.has_id) { | ||
| 424 | std::cout << "Ending " << ending_name << " is missing an AP ID." | ||
| 425 | << std::endl; | ||
| 426 | } | ||
| 364 | } | 427 | } |
| 365 | 428 | ||
| 366 | void ValidatePanelName(const std::string& panel_name, | 429 | void ValidatePanelName(const std::string& panel_name, |
| @@ -379,10 +442,22 @@ class Validator { | |||
| 379 | 442 | ||
| 380 | void ValidateProgressive(const std::string& prog_name, | 443 | void ValidateProgressive(const std::string& prog_name, |
| 381 | const ProgressiveInfo& prog_info) const { | 444 | const ProgressiveInfo& prog_info) const { |
| 382 | if (prog_info.definitions.size() > 1) { | 445 | if (prog_info.definitions.empty()) { |
| 446 | std::cout << "Progressive \"" << prog_name | ||
| 447 | << "\" has no definition, but was referenced:" << std::endl; | ||
| 448 | |||
| 449 | if (prog_info.has_id) { | ||
| 450 | std::cout << " An AP ID is present." << std::endl; | ||
| 451 | } | ||
| 452 | } else if (prog_info.definitions.size() > 1) { | ||
| 383 | std::cout << "Progressive \"" << prog_name | 453 | std::cout << "Progressive \"" << prog_name |
| 384 | << "\" has multiple definitions." << std::endl; | 454 | << "\" has multiple definitions." << std::endl; |
| 385 | } | 455 | } |
| 456 | |||
| 457 | if (!prog_info.has_id) { | ||
| 458 | std::cout << "Progressive \"" << prog_name << "\" is missing an AP ID." | ||
| 459 | << std::endl; | ||
| 460 | } | ||
| 386 | } | 461 | } |
| 387 | 462 | ||
| 388 | const CollectedInfo& info_; | 463 | const CollectedInfo& info_; |
