From 325ea53e7bb873870b46d3e38b2b314493a22f79 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 3 May 2023 18:27:37 -0400 Subject: Refactored APState It is no longer a class, because it didn't need to be. --- ap_state.h | 66 ++++++++++++-------------------------------------------------- 1 file changed, 12 insertions(+), 54 deletions(-) (limited to 'ap_state.h') 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 @@ #ifndef AP_STATE_H_664A4180 #define AP_STATE_H_664A4180 -#include -#include -#include +#include #include -#include #include "game_data.h" -#include "tracker_frame.h" -enum DoorShuffleMode { kNO_DOORS = 0, kSIMPLE_DOORS = 1, kCOMPLEX_DOORS = 2 }; - -class APState { - public: - APState(); - - void SetTrackerFrame(TrackerFrame* tracker_frame) { - tracker_frame_ = tracker_frame; - } - - void Connect(std::string server, std::string player, std::string password); - - bool HasCheckedGameLocation(int area_id, int section_id) const; - - bool HasColorItem(LingoColor color) const; - - bool HasItem(const std::string& item, int quantity = 1) const; +class TrackerFrame; - DoorShuffleMode GetDoorShuffleMode() const { return door_shuffle_mode_; } - - bool IsColorShuffle() const { return color_shuffle_; } - - bool IsPaintingShuffle() const { return painting_shuffle_; } - - const std::map GetPaintingMapping() const { - return painting_mapping_; - } - - private: - void RefreshTracker(); - - int64_t GetItemId(const std::string& item_name); +enum DoorShuffleMode { kNO_DOORS = 0, kSIMPLE_DOORS = 1, kCOMPLEX_DOORS = 2 }; - void DestroyClient(); +void AP_SetTrackerFrame(TrackerFrame* tracker_frame); - TrackerFrame* tracker_frame_; +void AP_Connect(std::string server, std::string player, std::string password); - bool client_active_ = false; - std::mutex client_mutex_; +bool AP_HasCheckedGameLocation(int area_id, int section_id); - bool connected_ = false; - bool has_connection_result_ = false; +bool AP_HasColorItem(LingoColor color); - std::map inventory_; - std::set checked_locations_; +bool AP_HasItem(const std::string& item, int quantity = 1); - std::map, int64_t> ap_id_by_location_id_; - std::map ap_id_by_item_name_; - std::map ap_id_by_color_; - std::map progressive_item_by_ap_id_; +DoorShuffleMode AP_GetDoorShuffleMode(); - DoorShuffleMode door_shuffle_mode_ = kNO_DOORS; - bool color_shuffle_ = false; - bool painting_shuffle_ = false; +bool AP_IsColorShuffle(); - std::map painting_mapping_; -}; +bool AP_IsPaintingShuffle(); -APState& GetAPState(); +const std::map AP_GetPaintingMapping(); #endif /* end of include guard: AP_STATE_H_664A4180 */ -- cgit 1.4.1