diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-05 15:46:58 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-05 15:46:58 -0400 |
commit | 149e7c0836927e14a926a952bd1a7f0d1b49e779 (patch) | |
tree | 2c7ac89387eb890d3d345217b79929e9a23f4ecf /src/game_data.h | |
parent | 0dace7831673170bd31eefa6bbe6e705211d3061 (diff) | |
download | lingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.tar.gz lingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.tar.bz2 lingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.zip |
Organised repo
Diffstat (limited to 'src/game_data.h')
-rw-r--r-- | src/game_data.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/src/game_data.h b/src/game_data.h new file mode 100644 index 0000000..0cc7a7b --- /dev/null +++ b/src/game_data.h | |||
@@ -0,0 +1,135 @@ | |||
1 | #ifndef GAME_DATA_H_9C42AC51 | ||
2 | #define GAME_DATA_H_9C42AC51 | ||
3 | |||
4 | #include <map> | ||
5 | #include <optional> | ||
6 | #include <string> | ||
7 | #include <vector> | ||
8 | |||
9 | enum class LingoColor { | ||
10 | kNone, | ||
11 | kBlack, | ||
12 | kRed, | ||
13 | kBlue, | ||
14 | kYellow, | ||
15 | kGreen, | ||
16 | kOrange, | ||
17 | kPurple, | ||
18 | kBrown, | ||
19 | kGray | ||
20 | }; | ||
21 | |||
22 | struct Panel { | ||
23 | int id; | ||
24 | int room; | ||
25 | std::string name; | ||
26 | std::vector<LingoColor> colors; | ||
27 | std::vector<int> required_rooms; | ||
28 | std::vector<int> required_doors; | ||
29 | bool check = false; | ||
30 | bool exclude_reduce = false; | ||
31 | bool achievement = false; | ||
32 | }; | ||
33 | |||
34 | struct ProgressiveRequirement { | ||
35 | std::string item_name; | ||
36 | int quantity = 0; | ||
37 | }; | ||
38 | |||
39 | struct Door { | ||
40 | int room; | ||
41 | std::string name; | ||
42 | std::string location_name; | ||
43 | std::string item_name; | ||
44 | std::string group_name; | ||
45 | bool skip_location = false; | ||
46 | bool skip_item = false; | ||
47 | std::vector<int> panels; | ||
48 | bool exclude_reduce = true; | ||
49 | std::vector<ProgressiveRequirement> progressives; | ||
50 | }; | ||
51 | |||
52 | struct Exit { | ||
53 | int destination_room; | ||
54 | std::optional<int> door; | ||
55 | bool painting = false; | ||
56 | }; | ||
57 | |||
58 | struct PaintingExit { | ||
59 | std::string id; | ||
60 | std::optional<int> door; | ||
61 | }; | ||
62 | |||
63 | struct Room { | ||
64 | std::string name; | ||
65 | std::vector<Exit> exits; | ||
66 | std::vector<PaintingExit> paintings; | ||
67 | }; | ||
68 | |||
69 | struct Location { | ||
70 | std::string name; | ||
71 | std::string ap_location_name; | ||
72 | int room; | ||
73 | std::vector<int> panels; | ||
74 | }; | ||
75 | |||
76 | struct MapArea { | ||
77 | int id; | ||
78 | std::string name; | ||
79 | std::vector<Location> locations; | ||
80 | int map_x; | ||
81 | int map_y; | ||
82 | }; | ||
83 | |||
84 | class GameData { | ||
85 | public: | ||
86 | GameData(); | ||
87 | |||
88 | const std::vector<MapArea>& GetMapAreas() const { return map_areas_; } | ||
89 | |||
90 | const MapArea& GetMapArea(int id) const { return map_areas_.at(id); } | ||
91 | |||
92 | int GetRoomByName(const std::string& name) const { | ||
93 | return room_by_id_.at(name); | ||
94 | } | ||
95 | |||
96 | const Room& GetRoom(int room_id) const { return rooms_.at(room_id); } | ||
97 | |||
98 | const std::vector<Door>& GetDoors() const { return doors_; } | ||
99 | |||
100 | const Door& GetDoor(int door_id) const { return doors_.at(door_id); } | ||
101 | |||
102 | const Panel& GetPanel(int panel_id) const { return panels_.at(panel_id); } | ||
103 | |||
104 | int GetRoomForPainting(const std::string& painting_id) const { | ||
105 | return room_by_painting_.at(painting_id); | ||
106 | } | ||
107 | |||
108 | const std::vector<int>& GetAchievementPanels() const { | ||
109 | return achievement_panels_; | ||
110 | } | ||
111 | |||
112 | private: | ||
113 | int AddOrGetRoom(std::string room); | ||
114 | int AddOrGetDoor(std::string room, std::string door); | ||
115 | int AddOrGetPanel(std::string room, std::string panel); | ||
116 | int AddOrGetArea(std::string area); | ||
117 | |||
118 | std::vector<Room> rooms_; | ||
119 | std::vector<Door> doors_; | ||
120 | std::vector<Panel> panels_; | ||
121 | std::vector<MapArea> map_areas_; | ||
122 | |||
123 | std::map<std::string, int> room_by_id_; | ||
124 | std::map<std::string, int> door_by_id_; | ||
125 | std::map<std::string, int> panel_by_id_; | ||
126 | std::map<std::string, int> area_by_id_; | ||
127 | |||
128 | std::map<std::string, int> room_by_painting_; | ||
129 | |||
130 | std::vector<int> achievement_panels_; | ||
131 | }; | ||
132 | |||
133 | const GameData& GetGameData(); | ||
134 | |||
135 | #endif /* end of include guard: GAME_DATA_H_9C42AC51 */ | ||