diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 18:27:37 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 18:27:37 -0400 |
| commit | 325ea53e7bb873870b46d3e38b2b314493a22f79 (patch) | |
| tree | 53968efbfd78a5960f68147cd6c671513f04938d /ap_state.h | |
| parent | 08ffb400114029569b4043b4f4c5a3f2af9b37b8 (diff) | |
| download | lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.gz lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.tar.bz2 lingo-ap-tracker-325ea53e7bb873870b46d3e38b2b314493a22f79.zip | |
Refactored APState
It is no longer a class, because it didn't need to be.
Diffstat (limited to 'ap_state.h')
| -rw-r--r-- | ap_state.h | 66 |
1 files changed, 12 insertions, 54 deletions
| diff --git a/ap_state.h b/ap_state.h index ce73528..434b7b2 100644 --- a/ap_state.h +++ b/ap_state.h | |||
| @@ -1,73 +1,31 @@ | |||
| 1 | #ifndef AP_STATE_H_664A4180 | 1 | #ifndef AP_STATE_H_664A4180 |
| 2 | #define AP_STATE_H_664A4180 | 2 | #define AP_STATE_H_664A4180 |
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <map> |
| 5 | #include <mutex> | ||
| 6 | #include <set> | ||
| 7 | #include <string> | 5 | #include <string> |
| 8 | #include <tuple> | ||
| 9 | 6 | ||
| 10 | #include "game_data.h" | 7 | #include "game_data.h" |
| 11 | #include "tracker_frame.h" | ||
| 12 | 8 | ||
| 13 | enum DoorShuffleMode { kNO_DOORS = 0, kSIMPLE_DOORS = 1, kCOMPLEX_DOORS = 2 }; | 9 | class TrackerFrame; |
| 14 | |||
| 15 | class APState { | ||
| 16 | public: | ||
| 17 | APState(); | ||
| 18 | |||
| 19 | void SetTrackerFrame(TrackerFrame* tracker_frame) { | ||
| 20 | tracker_frame_ = tracker_frame; | ||
| 21 | } | ||
| 22 | |||
| 23 | void Connect(std::string server, std::string player, std::string password); | ||
| 24 | |||
| 25 | bool HasCheckedGameLocation(int area_id, int section_id) const; | ||
| 26 | |||
| 27 | bool HasColorItem(LingoColor color) const; | ||
| 28 | |||
| 29 | bool HasItem(const std::string& item, int quantity = 1) const; | ||
| 30 | 10 | ||
| 31 | DoorShuffleMode GetDoorShuffleMode() const { return door_shuffle_mode_; } | 11 | enum DoorShuffleMode { kNO_DOORS = 0, kSIMPLE_DOORS = 1, kCOMPLEX_DOORS = 2 }; |
| 32 | |||
| 33 | bool IsColorShuffle() const { return color_shuffle_; } | ||
| 34 | |||
| 35 | bool IsPaintingShuffle() const { return painting_shuffle_; } | ||
| 36 | |||
| 37 | const std::map<std::string, std::string> GetPaintingMapping() const { | ||
| 38 | return painting_mapping_; | ||
| 39 | } | ||
| 40 | |||
| 41 | private: | ||
| 42 | void RefreshTracker(); | ||
| 43 | |||
| 44 | int64_t GetItemId(const std::string& item_name); | ||
| 45 | 12 | ||
| 46 | void DestroyClient(); | 13 | void AP_SetTrackerFrame(TrackerFrame* tracker_frame); |
| 47 | 14 | ||
| 48 | TrackerFrame* tracker_frame_; | 15 | void AP_Connect(std::string server, std::string player, std::string password); |
| 49 | 16 | ||
| 50 | bool client_active_ = false; | 17 | bool AP_HasCheckedGameLocation(int area_id, int section_id); |
| 51 | std::mutex client_mutex_; | ||
| 52 | 18 | ||
| 53 | bool connected_ = false; | 19 | bool AP_HasColorItem(LingoColor color); |
| 54 | bool has_connection_result_ = false; | ||
| 55 | 20 | ||
| 56 | std::map<int64_t, int> inventory_; | 21 | bool AP_HasItem(const std::string& item, int quantity = 1); |
| 57 | std::set<int64_t> checked_locations_; | ||
| 58 | 22 | ||
| 59 | std::map<std::tuple<int, int>, int64_t> ap_id_by_location_id_; | 23 | DoorShuffleMode AP_GetDoorShuffleMode(); |
| 60 | std::map<std::string, int64_t> ap_id_by_item_name_; | ||
| 61 | std::map<LingoColor, int64_t> ap_id_by_color_; | ||
| 62 | std::map<int64_t, std::string> progressive_item_by_ap_id_; | ||
| 63 | 24 | ||
| 64 | DoorShuffleMode door_shuffle_mode_ = kNO_DOORS; | 25 | bool AP_IsColorShuffle(); |
| 65 | bool color_shuffle_ = false; | ||
| 66 | bool painting_shuffle_ = false; | ||
| 67 | 26 | ||
| 68 | std::map<std::string, std::string> painting_mapping_; | 27 | bool AP_IsPaintingShuffle(); |
| 69 | }; | ||
| 70 | 28 | ||
| 71 | APState& GetAPState(); | 29 | const std::map<std::string, std::string> AP_GetPaintingMapping(); |
| 72 | 30 | ||
| 73 | #endif /* end of include guard: AP_STATE_H_664A4180 */ | 31 | #endif /* end of include guard: AP_STATE_H_664A4180 */ |
