diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 01:19:02 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 01:19:02 -0400 |
| commit | 2bf1b2abf0e90da14080573d7270cca62b2815f0 (patch) | |
| tree | 417dec725b4ca086145397edaa125df19a7119c0 | |
| parent | 52bc9fdf99d452c592e174acd9cb174ec00e19d7 (diff) | |
| download | lingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.tar.gz lingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.tar.bz2 lingo-ap-tracker-2bf1b2abf0e90da14080573d7270cca62b2815f0.zip | |
Display correct sunwarp doors when shuffled
| -rw-r--r-- | src/subway_map.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
| diff --git a/src/subway_map.cpp b/src/subway_map.cpp index e3b844d..044e6fa 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
| @@ -16,6 +16,29 @@ constexpr int OWL_ACTUAL_SIZE = 32; | |||
| 16 | 16 | ||
| 17 | enum class ItemDrawType { kNone, kBox, kOwl }; | 17 | enum class ItemDrawType { kNone, kBox, kOwl }; |
| 18 | 18 | ||
| 19 | namespace { | ||
| 20 | |||
| 21 | std::optional<int> GetRealSubwayDoor(const SubwayItem subway_item) { | ||
| 22 | std::optional<int> subway_door = subway_item.door; | ||
| 23 | if (AP_IsSunwarpShuffle() && subway_item.sunwarp && | ||
| 24 | subway_item.sunwarp->type != SubwaySunwarpType::kFinal) { | ||
| 25 | int sunwarp_index = subway_item.sunwarp->dots - 1; | ||
| 26 | if (subway_item.sunwarp->type == SubwaySunwarpType::kExit) { | ||
| 27 | sunwarp_index += 6; | ||
| 28 | } | ||
| 29 | |||
| 30 | for (const auto &[start_index, mapping] : AP_GetSunwarpMapping()) { | ||
| 31 | if (start_index == sunwarp_index || mapping.exit_index == sunwarp_index) { | ||
| 32 | subway_door = GD_GetSunwarpDoors().at(mapping.dots - 1); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | return subway_door; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | } // namespace | ||
| 41 | |||
| 19 | SubwayMap::SubwayMap(wxWindow *parent) : wxPanel(parent, wxID_ANY) { | 42 | SubwayMap::SubwayMap(wxWindow *parent) : wxPanel(parent, wxID_ANY) { |
| 20 | SetBackgroundStyle(wxBG_STYLE_PAINT); | 43 | SetBackgroundStyle(wxBG_STYLE_PAINT); |
| 21 | 44 | ||
| @@ -267,9 +290,11 @@ void SubwayMap::OnPaint(wxPaintEvent &event) { | |||
| 267 | // Note that these requirements are duplicated on OnMouseClick so that it | 290 | // Note that these requirements are duplicated on OnMouseClick so that it |
| 268 | // knows when an item has a hover effect. | 291 | // knows when an item has a hover effect. |
| 269 | const SubwayItem &subway_item = GD_GetSubwayItem(*hovered_item_); | 292 | const SubwayItem &subway_item = GD_GetSubwayItem(*hovered_item_); |
| 270 | if (subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) { | 293 | std::optional<int> subway_door = GetRealSubwayDoor(subway_item); |
| 294 | |||
| 295 | if (subway_door && !GetDoorRequirements(*subway_door).empty()) { | ||
| 271 | const std::map<std::string, bool> &report = | 296 | const std::map<std::string, bool> &report = |
| 272 | GetDoorRequirements(*subway_item.door); | 297 | GetDoorRequirements(*subway_door); |
| 273 | 298 | ||
| 274 | int acc_height = 10; | 299 | int acc_height = 10; |
| 275 | int col_width = 0; | 300 | int col_width = 0; |
| @@ -450,7 +475,9 @@ void SubwayMap::OnMouseClick(wxMouseEvent &event) { | |||
| 450 | 475 | ||
| 451 | if (actual_hover_) { | 476 | if (actual_hover_) { |
| 452 | const SubwayItem &subway_item = GD_GetSubwayItem(*actual_hover_); | 477 | const SubwayItem &subway_item = GD_GetSubwayItem(*actual_hover_); |
| 453 | if ((subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) || | 478 | std::optional<int> subway_door = GetRealSubwayDoor(subway_item); |
| 479 | |||
| 480 | if ((subway_door && !GetDoorRequirements(*subway_door).empty()) || | ||
| 454 | networks_.IsItemInNetwork(*hovered_item_)) { | 481 | networks_.IsItemInNetwork(*hovered_item_)) { |
| 455 | if (actual_hover_ != hovered_item_) { | 482 | if (actual_hover_ != hovered_item_) { |
| 456 | hovered_item_ = actual_hover_; | 483 | hovered_item_ = actual_hover_; |
