diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-17 16:36:24 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-17 16:36:24 -0400 |
commit | 15b8794bbe80be0bcf1f482674455efe002cec2c (patch) | |
tree | 5b8a4d7fd39e3fa3feb49b4307700ffb95efc9bf /tools/validator/validator.cpp | |
parent | 299ba7c4f7938dd8cbb38e51c11987b2ebe286c5 (diff) | |
download | lingo2-archipelago-15b8794bbe80be0bcf1f482674455efe002cec2c.tar.gz lingo2-archipelago-15b8794bbe80be0bcf1f482674455efe002cec2c.tar.bz2 lingo2-archipelago-15b8794bbe80be0bcf1f482674455efe002cec2c.zip |
Validate that node paths aren't used multiple times
Diffstat (limited to 'tools/validator/validator.cpp')
-rw-r--r-- | tools/validator/validator.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index 3381ed2..f2ec280 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp | |||
@@ -9,6 +9,15 @@ | |||
9 | namespace com::fourisland::lingo2_archipelago { | 9 | namespace com::fourisland::lingo2_archipelago { |
10 | namespace { | 10 | namespace { |
11 | 11 | ||
12 | void ValidateMap(const std::string& map_name, const MapInfo& map_info) { | ||
13 | for (const auto& [node_path, node_info] : map_info.game_nodes) { | ||
14 | if (node_info.uses > 1) { | ||
15 | std::cout << "Map " << map_name << " node " << node_path | ||
16 | << " is used in multiple places." << std::endl; | ||
17 | } | ||
18 | } | ||
19 | } | ||
20 | |||
12 | void ValidateRoom(const RoomIdentifier& room_identifier, | 21 | void ValidateRoom(const RoomIdentifier& room_identifier, |
13 | const RoomInfo& room_info) { | 22 | const RoomInfo& room_info) { |
14 | if (room_info.definitions.empty()) { | 23 | if (room_info.definitions.empty()) { |
@@ -224,6 +233,9 @@ void ValidateLetter(const LetterIdentifier& letter_identifier, | |||
224 | } // namespace | 233 | } // namespace |
225 | 234 | ||
226 | void ValidateCollectedInfo(const CollectedInfo& info) { | 235 | void ValidateCollectedInfo(const CollectedInfo& info) { |
236 | for (const auto& [map_name, map_info] : info.maps) { | ||
237 | ValidateMap(map_name, map_info); | ||
238 | } | ||
227 | for (const auto& [room_identifier, room_info] : info.rooms) { | 239 | for (const auto& [room_identifier, room_info] : info.rooms) { |
228 | ValidateRoom(room_identifier, room_info); | 240 | ValidateRoom(room_identifier, room_info); |
229 | } | 241 | } |