diff options
Diffstat (limited to 'area_window.cpp')
-rw-r--r-- | area_window.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/area_window.cpp b/area_window.cpp index 2f334e4..ca327b8 100644 --- a/area_window.cpp +++ b/area_window.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <iostream> | 3 | #include <iostream> |
4 | 4 | ||
5 | #include "ap_state.h" | ||
5 | #include "game_data.h" | 6 | #include "game_data.h" |
6 | 7 | ||
7 | AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) | 8 | AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) |
@@ -15,6 +16,8 @@ AreaWindow::AreaWindow(wxWindow* parent, int area_id, AreaPopup* popup) | |||
15 | Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this); | 16 | Bind(wxEVT_LEAVE_WINDOW, &AreaWindow::OnLeaveWindow, this); |
16 | } | 17 | } |
17 | 18 | ||
19 | void AreaWindow::UpdateIndicators() { Redraw(); } | ||
20 | |||
18 | void AreaWindow::OnPaint(wxPaintEvent& event) { | 21 | void AreaWindow::OnPaint(wxPaintEvent& event) { |
19 | if (GetSize() != rendered_.GetSize()) { | 22 | if (GetSize() != rendered_.GetSize()) { |
20 | Redraw(); | 23 | Redraw(); |
@@ -29,12 +32,27 @@ void AreaWindow::OnEnterWindow(wxMouseEvent& event) { popup_->Show(); } | |||
29 | void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); } | 32 | void AreaWindow::OnLeaveWindow(wxMouseEvent& event) { popup_->Hide(); } |
30 | 33 | ||
31 | void AreaWindow::Redraw() { | 34 | void AreaWindow::Redraw() { |
35 | const wxBrush* brush_color = wxGREY_BRUSH; | ||
36 | |||
37 | const MapArea& map_area = GetGameData().GetMapArea(area_id_); | ||
38 | int unchecked_sections = 0; | ||
39 | for (int section_id = 0; section_id < map_area.locations.size(); | ||
40 | section_id++) { | ||
41 | if (!GetAPState().HasCheckedGameLocation(area_id_, section_id)) { | ||
42 | unchecked_sections++; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | if (unchecked_sections > 0) { | ||
47 | brush_color = wxGREEN_BRUSH; | ||
48 | } | ||
49 | |||
32 | int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; | 50 | int actual_border_size = GetSize().GetWidth() * BORDER_SIZE / EFFECTIVE_SIZE; |
33 | 51 | ||
34 | rendered_ = wxBitmap(GetSize()); | 52 | rendered_ = wxBitmap(GetSize()); |
35 | wxMemoryDC dc; | 53 | wxMemoryDC dc; |
36 | dc.SelectObject(rendered_); | 54 | dc.SelectObject(rendered_); |
37 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); | 55 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, actual_border_size)); |
38 | dc.SetBrush(*wxGREEN_BRUSH); | 56 | dc.SetBrush(*brush_color); |
39 | dc.DrawRectangle({0, 0}, GetSize()); | 57 | dc.DrawRectangle({0, 0}, GetSize()); |
40 | } | 58 | } |