diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-06 14:09:02 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-06 14:09:02 -0500 |
commit | 6e7146714e0af2145c8c6cda3da4e2a54b469cb6 (patch) | |
tree | 01e2bbc7100629ff612f47063b2e89aee0ea216b /src | |
parent | 85c02f71f81e5d5d250d4ad3f39edc5394902c99 (diff) | |
download | lingo-ap-tracker-6e7146714e0af2145c8c6cda3da4e2a54b469cb6.tar.gz lingo-ap-tracker-6e7146714e0af2145c8c6cda3da4e2a54b469cb6.tar.bz2 lingo-ap-tracker-6e7146714e0af2145c8c6cda3da4e2a54b469cb6.zip |
Added setting for disabling player position tracking
Diffstat (limited to 'src')
-rw-r--r-- | src/settings_dialog.cpp | 5 | ||||
-rw-r--r-- | src/settings_dialog.h | 2 | ||||
-rw-r--r-- | src/tracker_config.cpp | 2 | ||||
-rw-r--r-- | src/tracker_config.h | 1 | ||||
-rw-r--r-- | src/tracker_frame.cpp | 5 | ||||
-rw-r--r-- | src/tracker_panel.cpp | 11 |
6 files changed, 22 insertions, 4 deletions
diff --git a/src/settings_dialog.cpp b/src/settings_dialog.cpp index 0321b5a..fa7a82f 100644 --- a/src/settings_dialog.cpp +++ b/src/settings_dialog.cpp | |||
@@ -9,11 +9,13 @@ SettingsDialog::SettingsDialog() : wxDialog(nullptr, wxID_ANY, "Settings") { | |||
9 | this, wxID_ANY, | 9 | this, wxID_ANY, |
10 | "Use two colors to show that an area has partial availability"); | 10 | "Use two colors to show that an area has partial availability"); |
11 | show_hunt_panels_box_ = new wxCheckBox(this, wxID_ANY, "Show hunt panels"); | 11 | show_hunt_panels_box_ = new wxCheckBox(this, wxID_ANY, "Show hunt panels"); |
12 | track_position_box_ = new wxCheckBox(this, wxID_ANY, "Track player position"); | ||
12 | 13 | ||
13 | should_check_for_updates_box_->SetValue( | 14 | should_check_for_updates_box_->SetValue( |
14 | GetTrackerConfig().should_check_for_updates); | 15 | GetTrackerConfig().should_check_for_updates); |
15 | hybrid_areas_box_->SetValue(GetTrackerConfig().hybrid_areas); | 16 | hybrid_areas_box_->SetValue(GetTrackerConfig().hybrid_areas); |
16 | show_hunt_panels_box_->SetValue(GetTrackerConfig().show_hunt_panels); | 17 | show_hunt_panels_box_->SetValue(GetTrackerConfig().show_hunt_panels); |
18 | track_position_box_->SetValue(GetTrackerConfig().track_position); | ||
17 | 19 | ||
18 | wxBoxSizer* form_sizer = new wxBoxSizer(wxVERTICAL); | 20 | wxBoxSizer* form_sizer = new wxBoxSizer(wxVERTICAL); |
19 | 21 | ||
@@ -26,6 +28,9 @@ SettingsDialog::SettingsDialog() : wxDialog(nullptr, wxID_ANY, "Settings") { | |||
26 | form_sizer->Add(show_hunt_panels_box_, wxSizerFlags().HorzBorder()); | 28 | form_sizer->Add(show_hunt_panels_box_, wxSizerFlags().HorzBorder()); |
27 | form_sizer->AddSpacer(2); | 29 | form_sizer->AddSpacer(2); |
28 | 30 | ||
31 | form_sizer->Add(track_position_box_, wxSizerFlags().HorzBorder()); | ||
32 | form_sizer->AddSpacer(2); | ||
33 | |||
29 | form_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Center()); | 34 | form_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Center()); |
30 | 35 | ||
31 | SetSizerAndFit(form_sizer); | 36 | SetSizerAndFit(form_sizer); |
diff --git a/src/settings_dialog.h b/src/settings_dialog.h index d7c1ed3..12f2439 100644 --- a/src/settings_dialog.h +++ b/src/settings_dialog.h | |||
@@ -16,11 +16,13 @@ class SettingsDialog : public wxDialog { | |||
16 | } | 16 | } |
17 | bool GetHybridAreas() const { return hybrid_areas_box_->GetValue(); } | 17 | bool GetHybridAreas() const { return hybrid_areas_box_->GetValue(); } |
18 | bool GetShowHuntPanels() const { return show_hunt_panels_box_->GetValue(); } | 18 | bool GetShowHuntPanels() const { return show_hunt_panels_box_->GetValue(); } |
19 | bool GetTrackPosition() const { return track_position_box_->GetValue(); } | ||
19 | 20 | ||
20 | private: | 21 | private: |
21 | wxCheckBox* should_check_for_updates_box_; | 22 | wxCheckBox* should_check_for_updates_box_; |
22 | wxCheckBox* hybrid_areas_box_; | 23 | wxCheckBox* hybrid_areas_box_; |
23 | wxCheckBox* show_hunt_panels_box_; | 24 | wxCheckBox* show_hunt_panels_box_; |
25 | wxCheckBox* track_position_box_; | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | #endif /* end of include guard: SETTINGS_DIALOG_H_D8635719 */ | 28 | #endif /* end of include guard: SETTINGS_DIALOG_H_D8635719 */ |
diff --git a/src/tracker_config.cpp b/src/tracker_config.cpp index 129dbbc..aeff669 100644 --- a/src/tracker_config.cpp +++ b/src/tracker_config.cpp | |||
@@ -29,6 +29,7 @@ void TrackerConfig::Load() { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | ipc_address = file["ipc_address"].as<std::string>(); | 31 | ipc_address = file["ipc_address"].as<std::string>(); |
32 | track_position = file["track_position"].as<bool>(); | ||
32 | } catch (const std::exception&) { | 33 | } catch (const std::exception&) { |
33 | // It's fine if the file can't be loaded. | 34 | // It's fine if the file can't be loaded. |
34 | } | 35 | } |
@@ -55,6 +56,7 @@ void TrackerConfig::Save() { | |||
55 | } | 56 | } |
56 | 57 | ||
57 | output["ipc_address"] = ipc_address; | 58 | output["ipc_address"] = ipc_address; |
59 | output["track_position"] = track_position; | ||
58 | 60 | ||
59 | std::ofstream filewriter(filename_); | 61 | std::ofstream filewriter(filename_); |
60 | filewriter << output; | 62 | filewriter << output; |
diff --git a/src/tracker_config.h b/src/tracker_config.h index 9244b74..4e851dc 100644 --- a/src/tracker_config.h +++ b/src/tracker_config.h | |||
@@ -30,6 +30,7 @@ class TrackerConfig { | |||
30 | bool show_hunt_panels = false; | 30 | bool show_hunt_panels = false; |
31 | std::deque<ConnectionDetails> connection_history; | 31 | std::deque<ConnectionDetails> connection_history; |
32 | std::string ipc_address; | 32 | std::string ipc_address; |
33 | bool track_position = true; | ||
33 | 34 | ||
34 | private: | 35 | private: |
35 | std::string filename_; | 36 | std::string filename_; |
diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index bacef34..acc6343 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp | |||
@@ -232,6 +232,7 @@ void TrackerFrame::OnSettings(wxCommandEvent &event) { | |||
232 | dlg.GetShouldCheckForUpdates(); | 232 | dlg.GetShouldCheckForUpdates(); |
233 | GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas(); | 233 | GetTrackerConfig().hybrid_areas = dlg.GetHybridAreas(); |
234 | GetTrackerConfig().show_hunt_panels = dlg.GetShowHuntPanels(); | 234 | GetTrackerConfig().show_hunt_panels = dlg.GetShowHuntPanels(); |
235 | GetTrackerConfig().track_position = dlg.GetTrackPosition(); | ||
235 | GetTrackerConfig().Save(); | 236 | GetTrackerConfig().Save(); |
236 | 237 | ||
237 | UpdateIndicators(); | 238 | UpdateIndicators(); |
@@ -321,6 +322,10 @@ void TrackerFrame::OnStatusChanged(wxCommandEvent &event) { | |||
321 | } | 322 | } |
322 | 323 | ||
323 | void TrackerFrame::OnRedrawPosition(wxCommandEvent &event) { | 324 | void TrackerFrame::OnRedrawPosition(wxCommandEvent &event) { |
325 | if (!GetTrackerConfig().track_position) { | ||
326 | return; | ||
327 | } | ||
328 | |||
324 | if (notebook_->GetSelection() == 0) { | 329 | if (notebook_->GetSelection() == 0) { |
325 | tracker_panel_->Refresh(); | 330 | tracker_panel_->Refresh(); |
326 | } else if (notebook_->GetSelection() == 2) { | 331 | } else if (notebook_->GetSelection() == 2) { |
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 04b970c..3f51cd5 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp | |||
@@ -103,10 +103,13 @@ void TrackerPanel::OnPaint(wxPaintEvent &event) { | |||
103 | dc.DrawBitmap(rendered_, 0, 0); | 103 | dc.DrawBitmap(rendered_, 0, 0); |
104 | 104 | ||
105 | std::optional<std::tuple<int, int>> player_position; | 105 | std::optional<std::tuple<int, int>> player_position; |
106 | if (IPC_IsConnected()) { | 106 | if (GetTrackerConfig().track_position) |
107 | player_position = IPC_GetPlayerPosition(); | 107 | { |
108 | } else { | 108 | if (IPC_IsConnected()) { |
109 | player_position = AP_GetPlayerPosition(); | 109 | player_position = IPC_GetPlayerPosition(); |
110 | } else { | ||
111 | player_position = AP_GetPlayerPosition(); | ||
112 | } | ||
110 | } | 113 | } |
111 | 114 | ||
112 | if (player_position.has_value()) { | 115 | if (player_position.has_value()) { |