diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-05 16:35:09 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-05 16:35:09 -0400 |
commit | d7212d755dca7f4fd99cf4b775cd0d372d7bcbb2 (patch) | |
tree | a4ca0258eda334c4aa68073355b9f4ccd8a7bdef /src/game_data.h | |
parent | 017df1397ace9ab8c3f152362d07871dcb6858be (diff) | |
download | lingo-ap-tracker-d7212d755dca7f4fd99cf4b775cd0d372d7bcbb2.tar.gz lingo-ap-tracker-d7212d755dca7f4fd99cf4b775cd0d372d7bcbb2.tar.bz2 lingo-ap-tracker-d7212d755dca7f4fd99cf4b775cd0d372d7bcbb2.zip |
Refactored away singletons
(Except TrackerConfig, for now at least)
Diffstat (limited to 'src/game_data.h')
-rw-r--r-- | src/game_data.h | 59 |
1 files changed, 9 insertions, 50 deletions
diff --git a/src/game_data.h b/src/game_data.h index 0cc7a7b..75eede3 100644 --- a/src/game_data.h +++ b/src/game_data.h | |||
@@ -81,55 +81,14 @@ struct MapArea { | |||
81 | int map_y; | 81 | int map_y; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | class GameData { | 84 | const std::vector<MapArea>& GD_GetMapAreas(); |
85 | public: | 85 | const MapArea& GD_GetMapArea(int id); |
86 | GameData(); | 86 | int GD_GetRoomByName(const std::string& name); |
87 | 87 | const Room& GD_GetRoom(int room_id); | |
88 | const std::vector<MapArea>& GetMapAreas() const { return map_areas_; } | 88 | const std::vector<Door>& GD_GetDoors(); |
89 | 89 | const Door& GD_GetDoor(int door_id); | |
90 | const MapArea& GetMapArea(int id) const { return map_areas_.at(id); } | 90 | const Panel& GD_GetPanel(int panel_id); |
91 | 91 | int GD_GetRoomForPainting(const std::string& painting_id); | |
92 | int GetRoomByName(const std::string& name) const { | 92 | const std::vector<int>& GD_GetAchievementPanels(); |
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 | 93 | ||
135 | #endif /* end of include guard: GAME_DATA_H_9C42AC51 */ | 94 | #endif /* end of include guard: GAME_DATA_H_9C42AC51 */ |