diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-16 14:52:24 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-16 14:52:24 -0400 |
commit | c88f4184eaa48efbdc69e76eb3c8a4a206434ad3 (patch) | |
tree | c1da4c419d90debafdd7f71347fe5f3194ff13ee /tools/validator/structs.h | |
parent | ac600120eb923e99c534f5c405f7f529c1b25bcf (diff) | |
download | lingo2-archipelago-c88f4184eaa48efbdc69e76eb3c8a4a206434ad3.tar.gz lingo2-archipelago-c88f4184eaa48efbdc69e76eb3c8a4a206434ad3.tar.bz2 lingo2-archipelago-c88f4184eaa48efbdc69e76eb3c8a4a206434ad3.zip |
Started writing a data validator
Currently, it can check whether identifiers point to non-existent objects, or whether multiple objects share the same identifier. It can also determine whether an identifier is underspecified (e.g. a door doesn't specify a room, or a global connection doesn't specify a map).
Diffstat (limited to 'tools/validator/structs.h')
-rw-r--r-- | tools/validator/structs.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/tools/validator/structs.h b/tools/validator/structs.h new file mode 100644 index 0000000..c3427f4 --- /dev/null +++ b/tools/validator/structs.h | |||
@@ -0,0 +1,97 @@ | |||
1 | #ifndef TOOLS_VALIDATOR_STRUCTS_H_ | ||
2 | #define TOOLS_VALIDATOR_STRUCTS_H_ | ||
3 | |||
4 | #include <map> | ||
5 | #include <string> | ||
6 | #include <vector> | ||
7 | |||
8 | #include "proto/human.pb.h" | ||
9 | #include "util/identifiers.h" | ||
10 | |||
11 | namespace com::fourisland::lingo2_archipelago { | ||
12 | |||
13 | struct MalformedIdentifiers { | ||
14 | std::vector<PaintingIdentifier> paintings; | ||
15 | std::vector<PanelIdentifier> panels; | ||
16 | std::vector<KeyholderIdentifier> keyholders; | ||
17 | |||
18 | bool HasAny() const { | ||
19 | return !paintings.empty() || !panels.empty() || !keyholders.empty(); | ||
20 | } | ||
21 | }; | ||
22 | |||
23 | struct RoomInfo { | ||
24 | std::vector<HumanRoom> definitions; | ||
25 | |||
26 | std::vector<DoorIdentifier> doors_referenced_by; | ||
27 | std::vector<PanelIdentifier> panels_referenced_by; | ||
28 | std::vector<HumanConnection> connections_referenced_by; | ||
29 | }; | ||
30 | |||
31 | struct DoorInfo { | ||
32 | std::vector<HumanDoor> definitions; | ||
33 | |||
34 | std::vector<HumanConnection> connections_referenced_by; | ||
35 | std::vector<DoorIdentifier> doors_referenced_by; | ||
36 | std::vector<PanelIdentifier> panels_referenced_by; | ||
37 | std::vector<PaintingIdentifier> paintings_referenced_by; | ||
38 | std::vector<PortIdentifier> ports_referenced_by; | ||
39 | |||
40 | MalformedIdentifiers malformed_identifiers; | ||
41 | }; | ||
42 | |||
43 | struct PortInfo { | ||
44 | std::vector<HumanPort> definitions; | ||
45 | |||
46 | std::vector<HumanConnection> connections_referenced_by; | ||
47 | }; | ||
48 | |||
49 | struct PaintingInfo { | ||
50 | std::vector<HumanPainting> definitions; | ||
51 | |||
52 | std::vector<HumanConnection> connections_referenced_by; | ||
53 | std::vector<DoorIdentifier> doors_referenced_by; | ||
54 | }; | ||
55 | |||
56 | struct ProxyInfo { | ||
57 | std::vector<Proxy> definitions; | ||
58 | |||
59 | std::vector<HumanConnection> connections_referenced_by; | ||
60 | std::vector<DoorIdentifier> doors_referenced_by; | ||
61 | }; | ||
62 | |||
63 | struct PanelInfo { | ||
64 | std::vector<HumanPanel> definitions; | ||
65 | |||
66 | std::vector<HumanConnection> connections_referenced_by; | ||
67 | std::vector<DoorIdentifier> doors_referenced_by; | ||
68 | |||
69 | std::map<std::string, ProxyInfo> proxies; | ||
70 | }; | ||
71 | |||
72 | struct KeyholderInfo { | ||
73 | std::vector<HumanKeyholder> definitions; | ||
74 | |||
75 | std::vector<DoorIdentifier> doors_referenced_by; | ||
76 | }; | ||
77 | |||
78 | using LetterIdentifier = std::tuple<char, bool>; | ||
79 | |||
80 | struct LetterInfo { | ||
81 | std::vector<RoomIdentifier> defined_in; | ||
82 | }; | ||
83 | |||
84 | struct CollectedInfo { | ||
85 | std::map<RoomIdentifier, RoomInfo, RoomIdentifierLess> rooms; | ||
86 | std::map<DoorIdentifier, DoorInfo, DoorIdentifierLess> doors; | ||
87 | std::map<PortIdentifier, PortInfo, PortIdentifierLess> ports; | ||
88 | std::map<PaintingIdentifier, PaintingInfo, PaintingIdentifierLess> paintings; | ||
89 | std::map<PanelIdentifier, PanelInfo, PanelIdentifierLess> panels; | ||
90 | std::map<KeyholderIdentifier, KeyholderInfo, KeyholderIdentifierLess> | ||
91 | keyholders; | ||
92 | std::map<LetterIdentifier, LetterInfo> letters; | ||
93 | }; | ||
94 | |||
95 | } // namespace com::fourisland::lingo2_archipelago | ||
96 | |||
97 | #endif /* TOOLS_VALIDATOR_STRUCTS_H_ */ | ||