about summary refs log tree commit diff stats
path: root/area_window.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 20:14:43 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 20:14:43 -0400
commit70f1c629a6e08e0f9c58707f0470e08c6ffeca34 (patch)
treea2262b898f02c551d3de298ffbd61505cdd384d2 /area_window.cpp
parent09d67fbad9df92caf2251d36b4abd7979fd27126 (diff)
downloadlingo-ap-tracker-70f1c629a6e08e0f9c58707f0470e08c6ffeca34.tar.gz
lingo-ap-tracker-70f1c629a6e08e0f9c58707f0470e08c6ffeca34.tar.bz2
lingo-ap-tracker-70f1c629a6e08e0f9c58707f0470e08c6ffeca34.zip
Added reachability checking (only no doors rn)
Diffstat (limited to 'area_window.cpp')
-rw-r--r--area_window.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/area_window.cpp b/area_window.cpp index ca327b8..fded223 100644 --- a/area_window.cpp +++ b/area_window.cpp
@@ -4,6 +4,7 @@
4 4
5#include "ap_state.h" 5#include "ap_state.h"
6#include "game_data.h" 6#include "game_data.h"
7#include "tracker_state.h"
7 8
8AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) 9AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup)
9 : wxWindow(parent, wxID_ANY), area_id_(area_id), popup_(popup) { 10 : wxWindow(parent, wxID_ANY), area_id_(area_id), popup_(popup) {
@@ -35,16 +36,25 @@ void AreaWindow::Redraw() {
35 const wxBrush* brush_color = wxGREY_BRUSH; 36 const wxBrush* brush_color = wxGREY_BRUSH;
36 37
37 const MapArea& map_area = GetGameData().GetMapArea(area_id_); 38 const MapArea& map_area = GetGameData().GetMapArea(area_id_);
38 int unchecked_sections = 0; 39 bool has_reachable_unchecked = false;
40 bool has_unreachable_unchecked = false;
39 for (int section_id = 0; section_id < map_area.locations.size(); 41 for (int section_id = 0; section_id < map_area.locations.size();
40 section_id++) { 42 section_id++) {
41 if (!GetAPState().HasCheckedGameLocation(area_id_, section_id)) { 43 if (!GetAPState().HasCheckedGameLocation(area_id_, section_id)) {
42 unchecked_sections++; 44 if (GetTrackerState().IsLocationReachable(area_id_, section_id)) {
45 has_reachable_unchecked = true;
46 } else {
47 has_unreachable_unchecked = true;
48 }
43 } 49 }
44 } 50 }
45 51
46 if (unchecked_sections > 0) { 52 if (has_reachable_unchecked && has_unreachable_unchecked) {
53 brush_color = wxYELLOW_BRUSH;
54 } else if (has_reachable_unchecked) {
47 brush_color = wxGREEN_BRUSH; 55 brush_color = wxGREEN_BRUSH;
56 } else if (has_unreachable_unchecked) {
57 brush_color = wxRED_BRUSH;
48 } 58 }
49 59
50 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; 60 int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE;