diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-20 15:03:18 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-20 15:03:18 -0400 |
| commit | d77c73397b684faa55f0e95484ac89ca68bde1ad (patch) | |
| tree | 84fd35d342b69a9765d8f94473b56998d26e323d | |
| parent | 53ad8e2f3e5fcf9cf9d5d4628498557e0f5500e8 (diff) | |
| download | lingo2-archipelago-d77c73397b684faa55f0e95484ac89ca68bde1ad.tar.gz lingo2-archipelago-d77c73397b684faa55f0e95484ac89ca68bde1ad.tar.bz2 lingo2-archipelago-d77c73397b684faa55f0e95484ac89ca68bde1ad.zip | |
Added "endings" object type
| -rw-r--r-- | data/ids.yaml | 8 | ||||
| -rw-r--r-- | data/maps/the_ancient/rooms/Ending.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_colorful/rooms/Ending.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_door/rooms/Ending.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_gallery/rooms/Ending.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_gold/rooms/The Whole Thing.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_graveyard/rooms/Inside.txtpb | 5 | ||||
| -rw-r--r-- | data/maps/the_parthenon/rooms/Ending.txtpb | 5 | ||||
| -rw-r--r-- | proto/data.proto | 12 | ||||
| -rw-r--r-- | proto/human.proto | 7 | ||||
| -rw-r--r-- | tools/assign_ids/main.cpp | 13 | ||||
| -rw-r--r-- | tools/datapacker/container.cpp | 16 | ||||
| -rw-r--r-- | tools/datapacker/container.h | 3 | ||||
| -rw-r--r-- | tools/datapacker/main.cpp | 22 | ||||
| -rw-r--r-- | tools/util/ids_yaml_format.cpp | 12 | ||||
| -rw-r--r-- | tools/validator/human_processor.cpp | 20 | ||||
| -rw-r--r-- | tools/validator/structs.h | 5 | ||||
| -rw-r--r-- | tools/validator/validator.cpp | 15 |
18 files changed, 160 insertions, 8 deletions
| diff --git a/data/ids.yaml b/data/ids.yaml index 7843a47..0c55991 100644 --- a/data/ids.yaml +++ b/data/ids.yaml | |||
| @@ -1760,5 +1760,13 @@ letters: | |||
| 1760 | x2: 1192 | 1760 | x2: 1192 |
| 1761 | y1: 621 | 1761 | y1: 621 |
| 1762 | z1: 851 | 1762 | z1: 851 |
| 1763 | endings: | ||
| 1764 | BLACK: 1208 | ||
| 1765 | CYAN: 1209 | ||
| 1766 | GOLD: 1207 | ||
| 1767 | GRAY: 1204 | ||
| 1768 | GREEN: 1203 | ||
| 1769 | PLUM: 1205 | ||
| 1770 | YELLOW: 1206 | ||
| 1763 | special: | 1771 | special: |
| 1764 | Nothing: 1160 | 1772 | Nothing: 1160 |
| diff --git a/data/maps/the_ancient/rooms/Ending.txtpb b/data/maps/the_ancient/rooms/Ending.txtpb index 486ed26..eea1228 100644 --- a/data/maps/the_ancient/rooms/Ending.txtpb +++ b/data/maps/the_ancient/rooms/Ending.txtpb | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | name: "Ending" | 1 | name: "Ending" |
| 2 | display_name: "Ending" | 2 | display_name: "Ending" |
| 3 | # TODO: Green Ending | 3 | endings { |
| 4 | name: "GREEN" | ||
| 5 | path: "Components/Ending/green_ending" | ||
| 6 | } | ||
| diff --git a/data/maps/the_colorful/rooms/Ending.txtpb b/data/maps/the_colorful/rooms/Ending.txtpb index 8e38d4f..060e72e 100644 --- a/data/maps/the_colorful/rooms/Ending.txtpb +++ b/data/maps/the_colorful/rooms/Ending.txtpb | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | name: "Ending" | 1 | name: "Ending" |
| 2 | display_name: "Ending" | 2 | display_name: "Ending" |
| 3 | # TODO: Gray Ending | 3 | endings { |
| 4 | name: "GRAY" | ||
| 5 | path: "Components/Endings/gray_ending" | ||
| 6 | } | ||
| diff --git a/data/maps/the_door/rooms/Ending.txtpb b/data/maps/the_door/rooms/Ending.txtpb index 67937c5..4a4a995 100644 --- a/data/maps/the_door/rooms/Ending.txtpb +++ b/data/maps/the_door/rooms/Ending.txtpb | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | name: "Ending" | 1 | name: "Ending" |
| 2 | display_name: "Main Area" | 2 | display_name: "Main Area" |
| 3 | # TODO: Plum Ending | 3 | endings { |
| 4 | name: "PLUM" | ||
| 5 | path: "Components/plum_ending" | ||
| 6 | } | ||
| diff --git a/data/maps/the_gallery/rooms/Ending.txtpb b/data/maps/the_gallery/rooms/Ending.txtpb index 28894e0..72c8e72 100644 --- a/data/maps/the_gallery/rooms/Ending.txtpb +++ b/data/maps/the_gallery/rooms/Ending.txtpb | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | name: "Ending" | 1 | name: "Ending" |
| 2 | display_name: "Back Room" | 2 | display_name: "Back Room" |
| 3 | # TODO: Yellow Ending | 3 | endings { |
| 4 | name: "YELLOW" | ||
| 5 | path: "Components/Endings/yellow_ending" | ||
| 6 | } | ||
| diff --git a/data/maps/the_gold/rooms/The Whole Thing.txtpb b/data/maps/the_gold/rooms/The Whole Thing.txtpb index a24f48e..e636723 100644 --- a/data/maps/the_gold/rooms/The Whole Thing.txtpb +++ b/data/maps/the_gold/rooms/The Whole Thing.txtpb | |||
| @@ -7,4 +7,7 @@ panels { | |||
| 7 | answer: "colors" | 7 | answer: "colors" |
| 8 | symbols: "question" | 8 | symbols: "question" |
| 9 | } | 9 | } |
| 10 | # TODO: Gold Ending | 10 | endings { |
| 11 | name: "GOLD" | ||
| 12 | path: "Components/gold_ending" | ||
| 13 | } | ||
| diff --git a/data/maps/the_graveyard/rooms/Inside.txtpb b/data/maps/the_graveyard/rooms/Inside.txtpb index e8b3e41..fd2fc9d 100644 --- a/data/maps/the_graveyard/rooms/Inside.txtpb +++ b/data/maps/the_graveyard/rooms/Inside.txtpb | |||
| @@ -7,5 +7,8 @@ panels { | |||
| 7 | answer: "remember" | 7 | answer: "remember" |
| 8 | required_door { name: "Double Letters" } | 8 | required_door { name: "Double Letters" } |
| 9 | } | 9 | } |
| 10 | # TODO: Black Ending | 10 | endings { |
| 11 | name: "BLACK" | ||
| 12 | path: "Components/Ending/black_ending" | ||
| 13 | } | ||
| 11 | # TODO: Not sure if the paintings in here should be randomized. | 14 | # TODO: Not sure if the paintings in here should be randomized. |
| diff --git a/data/maps/the_parthenon/rooms/Ending.txtpb b/data/maps/the_parthenon/rooms/Ending.txtpb index c14ab78..8fa805f 100644 --- a/data/maps/the_parthenon/rooms/Ending.txtpb +++ b/data/maps/the_parthenon/rooms/Ending.txtpb | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | name: "Ending" | 1 | name: "Ending" |
| 2 | display_name: "Parthenon" | 2 | display_name: "Parthenon" |
| 3 | # TODO: Cyan Ending | 3 | endings { |
| 4 | name: "CYAN" | ||
| 5 | path: "Components/cyan_end" | ||
| 6 | } | ||
| diff --git a/proto/data.proto b/proto/data.proto index 88e17d0..0d43168 100644 --- a/proto/data.proto +++ b/proto/data.proto | |||
| @@ -158,6 +158,16 @@ message Mastery { | |||
| 158 | optional string path = 5; | 158 | optional string path = 5; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | message Ending { | ||
| 162 | optional uint64 id = 1; | ||
| 163 | optional uint64 ap_id = 2; | ||
| 164 | optional uint64 room_id = 3; | ||
| 165 | |||
| 166 | optional string name = 4; | ||
| 167 | |||
| 168 | optional string path = 5; | ||
| 169 | } | ||
| 170 | |||
| 161 | message Room { | 171 | message Room { |
| 162 | optional uint64 id = 1; | 172 | optional uint64 id = 1; |
| 163 | optional uint64 map_id = 8; | 173 | optional uint64 map_id = 8; |
| @@ -171,6 +181,7 @@ message Room { | |||
| 171 | repeated uint64 doors = 9; | 181 | repeated uint64 doors = 9; |
| 172 | repeated uint64 masteries = 10; | 182 | repeated uint64 masteries = 10; |
| 173 | repeated uint64 keyholders = 11; | 183 | repeated uint64 keyholders = 11; |
| 184 | repeated uint64 endings = 12; | ||
| 174 | } | 185 | } |
| 175 | 186 | ||
| 176 | message Map { | 187 | message Map { |
| @@ -188,6 +199,7 @@ message AllObjects { | |||
| 188 | repeated Keyholder keyholders = 11; | 199 | repeated Keyholder keyholders = 11; |
| 189 | repeated Letter letters = 9; | 200 | repeated Letter letters = 9; |
| 190 | repeated Mastery masteries = 10; | 201 | repeated Mastery masteries = 10; |
| 202 | repeated Ending endings = 12; | ||
| 191 | repeated Connection connections = 6; | 203 | repeated Connection connections = 6; |
| 192 | map<string, uint64> special_ids = 8; | 204 | map<string, uint64> special_ids = 8; |
| 193 | } | 205 | } |
| diff --git a/proto/human.proto b/proto/human.proto index 6cec66d..d52a0ad 100644 --- a/proto/human.proto +++ b/proto/human.proto | |||
| @@ -151,6 +151,11 @@ message HumanMastery { | |||
| 151 | optional string path = 2; | 151 | optional string path = 2; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | message HumanEnding { | ||
| 155 | optional string name = 1; | ||
| 156 | optional string path = 2; | ||
| 157 | } | ||
| 158 | |||
| 154 | message HumanRoom { | 159 | message HumanRoom { |
| 155 | optional string name = 1; | 160 | optional string name = 1; |
| 156 | optional string display_name = 2; | 161 | optional string display_name = 2; |
| @@ -161,6 +166,7 @@ message HumanRoom { | |||
| 161 | repeated HumanPort ports = 6; | 166 | repeated HumanPort ports = 6; |
| 162 | repeated HumanKeyholder keyholders = 7; | 167 | repeated HumanKeyholder keyholders = 7; |
| 163 | repeated HumanMastery masteries = 8; | 168 | repeated HumanMastery masteries = 8; |
| 169 | repeated HumanEnding endings = 9; | ||
| 164 | } | 170 | } |
| 165 | 171 | ||
| 166 | message HumanMap { | 172 | message HumanMap { |
| @@ -182,4 +188,5 @@ message IdMappings { | |||
| 182 | map<string, MapIds> maps = 1; | 188 | map<string, MapIds> maps = 1; |
| 183 | map<string, uint64> special = 2; | 189 | map<string, uint64> special = 2; |
| 184 | map<string, uint64> letters = 3; | 190 | map<string, uint64> letters = 3; |
| 191 | map<string, uint64> endings = 4; | ||
| 185 | } | 192 | } |
| diff --git a/tools/assign_ids/main.cpp b/tools/assign_ids/main.cpp index 2471bc5..77c0e5a 100644 --- a/tools/assign_ids/main.cpp +++ b/tools/assign_ids/main.cpp | |||
| @@ -87,6 +87,12 @@ class AssignIds { | |||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | for (const auto& [_, id] : id_mappings_.endings()) { | ||
| 91 | if (id > next_id_) { | ||
| 92 | next_id_ = id; | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 90 | next_id_++; | 96 | next_id_++; |
| 91 | } | 97 | } |
| 92 | 98 | ||
| @@ -195,6 +201,13 @@ class AssignIds { | |||
| 195 | masteries[h_mastery.name()] = next_id_++; | 201 | masteries[h_mastery.name()] = next_id_++; |
| 196 | } | 202 | } |
| 197 | } | 203 | } |
| 204 | |||
| 205 | for (const HumanEnding& h_ending : h_room.endings()) { | ||
| 206 | if (!id_mappings_.endings().contains(h_ending.name())) { | ||
| 207 | auto& endings = *id_mappings_.mutable_endings(); | ||
| 208 | endings[h_ending.name()] = next_id_++; | ||
| 209 | } | ||
| 210 | } | ||
| 198 | } | 211 | } |
| 199 | 212 | ||
| 200 | private: | 213 | private: |
| diff --git a/tools/datapacker/container.cpp b/tools/datapacker/container.cpp index ffcb75a..0d3417e 100644 --- a/tools/datapacker/container.cpp +++ b/tools/datapacker/container.cpp | |||
| @@ -205,6 +205,22 @@ uint64_t Container::FindLetterByName(std::string letter_name) { | |||
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | uint64_t Container::FindOrAddEnding(std::string ending_name) { | ||
| 209 | auto it = ending_id_by_name_.find(ending_name); | ||
| 210 | if (it == ending_id_by_name_.end()) { | ||
| 211 | uint64_t new_id = all_objects_.endings_size(); | ||
| 212 | Ending* ending = all_objects_.add_endings(); | ||
| 213 | ending->set_id(new_id); | ||
| 214 | ending->set_name(ending_name); | ||
| 215 | |||
| 216 | ending_id_by_name_[ending_name] = new_id; | ||
| 217 | |||
| 218 | return new_id; | ||
| 219 | } else { | ||
| 220 | return it->second; | ||
| 221 | } | ||
| 222 | } | ||
| 223 | |||
| 208 | uint64_t Container::FindOrAddMastery(std::optional<std::string> map_name, | 224 | uint64_t Container::FindOrAddMastery(std::optional<std::string> map_name, |
| 209 | std::optional<std::string> room_name, | 225 | std::optional<std::string> room_name, |
| 210 | std::string mastery_name, | 226 | std::string mastery_name, |
| diff --git a/tools/datapacker/container.h b/tools/datapacker/container.h index e1a84d8..68f5875 100644 --- a/tools/datapacker/container.h +++ b/tools/datapacker/container.h | |||
| @@ -40,6 +40,8 @@ class Container { | |||
| 40 | 40 | ||
| 41 | uint64_t FindLetterByName(std::string letter_name); | 41 | uint64_t FindLetterByName(std::string letter_name); |
| 42 | 42 | ||
| 43 | uint64_t FindOrAddEnding(std::string ending_name); | ||
| 44 | |||
| 43 | uint64_t FindOrAddMastery(std::optional<std::string> map_name, | 45 | uint64_t FindOrAddMastery(std::optional<std::string> map_name, |
| 44 | std::optional<std::string> room_name, | 46 | std::optional<std::string> room_name, |
| 45 | std::string mastery_name, | 47 | std::string mastery_name, |
| @@ -79,6 +81,7 @@ class Container { | |||
| 79 | keyholder_id_by_map_room_keyholder_names_; | 81 | keyholder_id_by_map_room_keyholder_names_; |
| 80 | std::map<std::string, std::map<std::string, uint64_t>> | 82 | std::map<std::string, std::map<std::string, uint64_t>> |
| 81 | door_id_by_map_door_names_; | 83 | door_id_by_map_door_names_; |
| 84 | std::map<std::string, uint64_t> ending_id_by_name_; | ||
| 82 | }; | 85 | }; |
| 83 | 86 | ||
| 84 | } // namespace com::fourisland::lingo2_archipelago | 87 | } // namespace com::fourisland::lingo2_archipelago |
| diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 0beb304..c5a90e9 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
| @@ -115,6 +115,10 @@ class DataPacker { | |||
| 115 | room.add_keyholders( | 115 | room.add_keyholders( |
| 116 | ProcessKeyholder(h_keyholder, current_map_name, room.name())); | 116 | ProcessKeyholder(h_keyholder, current_map_name, room.name())); |
| 117 | } | 117 | } |
| 118 | |||
| 119 | for (const HumanEnding& h_ending : h_room.endings()) { | ||
| 120 | room.add_endings(ProcessEnding(h_ending, current_map_name, room.name())); | ||
| 121 | } | ||
| 118 | } | 122 | } |
| 119 | 123 | ||
| 120 | uint64_t ProcessPanel(const HumanPanel& h_panel, | 124 | uint64_t ProcessPanel(const HumanPanel& h_panel, |
| @@ -266,6 +270,19 @@ class DataPacker { | |||
| 266 | return keyholder_id; | 270 | return keyholder_id; |
| 267 | } | 271 | } |
| 268 | 272 | ||
| 273 | uint64_t ProcessEnding(const HumanEnding& h_ending, | ||
| 274 | const std::string& current_map_name, | ||
| 275 | const std::string& current_room_name) { | ||
| 276 | uint64_t ending_id = container_.FindOrAddEnding(h_ending.name()); | ||
| 277 | Ending& ending = *container_.all_objects().mutable_endings(ending_id); | ||
| 278 | |||
| 279 | ending.set_room_id(container_.FindOrAddRoom( | ||
| 280 | current_map_name, current_room_name, std::nullopt)); | ||
| 281 | ending.set_path(h_ending.path()); | ||
| 282 | |||
| 283 | return ending_id; | ||
| 284 | } | ||
| 285 | |||
| 269 | void ProcessDoorsFile(std::filesystem::path path, | 286 | void ProcessDoorsFile(std::filesystem::path path, |
| 270 | const std::string& current_map_name) { | 287 | const std::string& current_map_name) { |
| 271 | if (!std::filesystem::exists(path)) { | 288 | if (!std::filesystem::exists(path)) { |
| @@ -526,6 +543,11 @@ class DataPacker { | |||
| 526 | uint64_t letter_id = container_.FindLetterByName(letter_name); | 543 | uint64_t letter_id = container_.FindLetterByName(letter_name); |
| 527 | container_.all_objects().mutable_letters(letter_id)->set_ap_id(ap_id); | 544 | container_.all_objects().mutable_letters(letter_id)->set_ap_id(ap_id); |
| 528 | } | 545 | } |
| 546 | |||
| 547 | for (const auto& [ending_name, ap_id] : ids.endings()) { | ||
| 548 | uint64_t ending_id = container_.FindOrAddEnding(ending_name); | ||
| 549 | container_.all_objects().mutable_endings(ending_id)->set_ap_id(ap_id); | ||
| 550 | } | ||
| 529 | } | 551 | } |
| 530 | 552 | ||
| 531 | std::string mapdir_; | 553 | std::string mapdir_; |
| diff --git a/tools/util/ids_yaml_format.cpp b/tools/util/ids_yaml_format.cpp index 99a8890..f72f60e 100644 --- a/tools/util/ids_yaml_format.cpp +++ b/tools/util/ids_yaml_format.cpp | |||
| @@ -75,6 +75,13 @@ IdMappings ReadIdsFromYaml(const std::string& filename) { | |||
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | if (document["endings"]) { | ||
| 79 | for (const auto& ending_it : document["endings"]) { | ||
| 80 | (*result.mutable_endings())[ending_it.first.as<std::string>()] = | ||
| 81 | ending_it.second.as<uint64_t>(); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 78 | if (document["special"]) { | 85 | if (document["special"]) { |
| 79 | for (const auto& special_it : document["special"]) { | 86 | for (const auto& special_it : document["special"]) { |
| 80 | (*result.mutable_special())[special_it.first.as<std::string>()] = | 87 | (*result.mutable_special())[special_it.first.as<std::string>()] = |
| @@ -127,6 +134,11 @@ void WriteIdsAsYaml(const IdMappings& ids, const std::string& filename) { | |||
| 127 | result["letters"][letter_name] = letter_id; | 134 | result["letters"][letter_name] = letter_id; |
| 128 | }); | 135 | }); |
| 129 | 136 | ||
| 137 | OperateOnSortedMap(ids.endings(), [&result](const std::string& ending_name, | ||
| 138 | uint64_t ending_id) { | ||
| 139 | result["endings"][ending_name] = ending_id; | ||
| 140 | }); | ||
| 141 | |||
| 130 | OperateOnSortedMap(ids.special(), [&result](const std::string& special_name, | 142 | OperateOnSortedMap(ids.special(), [&result](const std::string& special_name, |
| 131 | uint64_t special_id) { | 143 | uint64_t special_id) { |
| 132 | result["special"][special_name] = special_id; | 144 | result["special"][special_name] = special_id; |
| diff --git a/tools/validator/human_processor.cpp b/tools/validator/human_processor.cpp index af40980..5a7e78a 100644 --- a/tools/validator/human_processor.cpp +++ b/tools/validator/human_processor.cpp | |||
| @@ -62,7 +62,7 @@ class HumanProcessor { | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void ProcessMetadataFile(std::filesystem::path path, | 64 | void ProcessMetadataFile(std::filesystem::path path, |
| 65 | const std::string& current_map_name) { | 65 | const std::string& current_map_name) { |
| 66 | if (!std::filesystem::exists(path)) { | 66 | if (!std::filesystem::exists(path)) { |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| @@ -115,6 +115,10 @@ class HumanProcessor { | |||
| 115 | for (const HumanKeyholder& h_keyholder : h_room.keyholders()) { | 115 | for (const HumanKeyholder& h_keyholder : h_room.keyholders()) { |
| 116 | ProcessKeyholder(h_keyholder, current_map_name, h_room.name()); | 116 | ProcessKeyholder(h_keyholder, current_map_name, h_room.name()); |
| 117 | } | 117 | } |
| 118 | |||
| 119 | for (const HumanEnding& h_ending : h_room.endings()) { | ||
| 120 | ProcessEnding(h_ending, current_map_name, h_room.name()); | ||
| 121 | } | ||
| 118 | } | 122 | } |
| 119 | 123 | ||
| 120 | void ProcessPanel(const HumanPanel& h_panel, | 124 | void ProcessPanel(const HumanPanel& h_panel, |
| @@ -235,6 +239,20 @@ class HumanProcessor { | |||
| 235 | map_info.game_nodes[h_keyholder.path()].uses++; | 239 | map_info.game_nodes[h_keyholder.path()].uses++; |
| 236 | } | 240 | } |
| 237 | 241 | ||
| 242 | void ProcessEnding(const HumanEnding& h_ending, | ||
| 243 | const std::string& current_map_name, | ||
| 244 | const std::string& current_room_name) { | ||
| 245 | EndingInfo& ending_info = info_.endings[h_ending.name()]; | ||
| 246 | |||
| 247 | RoomIdentifier room_identifier; | ||
| 248 | room_identifier.set_map(current_map_name); | ||
| 249 | room_identifier.set_name(current_room_name); | ||
| 250 | ending_info.defined_in.push_back(room_identifier); | ||
| 251 | |||
| 252 | MapInfo& map_info = info_.maps[current_map_name]; | ||
| 253 | map_info.game_nodes[h_ending.path()].uses++; | ||
| 254 | } | ||
| 255 | |||
| 238 | void ProcessDoorsFile(std::filesystem::path path, | 256 | void ProcessDoorsFile(std::filesystem::path path, |
| 239 | const std::string& current_map_name) { | 257 | const std::string& current_map_name) { |
| 240 | if (!std::filesystem::exists(path)) { | 258 | if (!std::filesystem::exists(path)) { |
| diff --git a/tools/validator/structs.h b/tools/validator/structs.h index 406dc0c..f7d9dc1 100644 --- a/tools/validator/structs.h +++ b/tools/validator/structs.h | |||
| @@ -90,6 +90,10 @@ struct LetterInfo { | |||
| 90 | std::vector<RoomIdentifier> defined_in; | 90 | std::vector<RoomIdentifier> defined_in; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | struct EndingInfo { | ||
| 94 | std::vector<RoomIdentifier> defined_in; | ||
| 95 | }; | ||
| 96 | |||
| 93 | struct CollectedInfo { | 97 | struct CollectedInfo { |
| 94 | std::map<std::string, MapInfo> maps; | 98 | std::map<std::string, MapInfo> maps; |
| 95 | std::map<RoomIdentifier, RoomInfo, RoomIdentifierLess> rooms; | 99 | std::map<RoomIdentifier, RoomInfo, RoomIdentifierLess> rooms; |
| @@ -100,6 +104,7 @@ struct CollectedInfo { | |||
| 100 | std::map<KeyholderIdentifier, KeyholderInfo, KeyholderIdentifierLess> | 104 | std::map<KeyholderIdentifier, KeyholderInfo, KeyholderIdentifierLess> |
| 101 | keyholders; | 105 | keyholders; |
| 102 | std::map<LetterIdentifier, LetterInfo> letters; | 106 | std::map<LetterIdentifier, LetterInfo> letters; |
| 107 | std::map<std::string, EndingInfo> endings; | ||
| 103 | }; | 108 | }; |
| 104 | 109 | ||
| 105 | } // namespace com::fourisland::lingo2_archipelago | 110 | } // namespace com::fourisland::lingo2_archipelago |
| diff --git a/tools/validator/validator.cpp b/tools/validator/validator.cpp index 6d01b7c..bc6b854 100644 --- a/tools/validator/validator.cpp +++ b/tools/validator/validator.cpp | |||
| @@ -238,6 +238,18 @@ void ValidateLetter(const LetterIdentifier& letter_identifier, | |||
| 238 | } | 238 | } |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | void ValidateEnding(const std::string& ending_name, | ||
| 242 | const EndingInfo& ending_info) { | ||
| 243 | if (ending_info.defined_in.size() > 1) { | ||
| 244 | std::cout << "Ending " << ending_name | ||
| 245 | << " was defined in multiple places:" << std::endl; | ||
| 246 | |||
| 247 | for (const RoomIdentifier& room_identifier : ending_info.defined_in) { | ||
| 248 | std::cout << " " << room_identifier.ShortDebugString() << std::endl; | ||
| 249 | } | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 241 | } // namespace | 253 | } // namespace |
| 242 | 254 | ||
| 243 | void ValidateCollectedInfo(const CollectedInfo& info) { | 255 | void ValidateCollectedInfo(const CollectedInfo& info) { |
| @@ -265,6 +277,9 @@ void ValidateCollectedInfo(const CollectedInfo& info) { | |||
| 265 | for (const auto& [letter_identifier, letter_info] : info.letters) { | 277 | for (const auto& [letter_identifier, letter_info] : info.letters) { |
| 266 | ValidateLetter(letter_identifier, letter_info); | 278 | ValidateLetter(letter_identifier, letter_info); |
| 267 | } | 279 | } |
| 280 | for (const auto& [ending_name, ending_info] : info.endings) { | ||
| 281 | ValidateEnding(ending_name, ending_info); | ||
| 282 | } | ||
| 268 | } | 283 | } |
| 269 | 284 | ||
| 270 | } // namespace com::fourisland::lingo2_archipelago | 285 | } // namespace com::fourisland::lingo2_archipelago |
