diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-29 12:56:53 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-04-29 12:56:53 -0400 |
commit | 829bb6ba7fdbef5c4e6fb9e4eabc0c2f962325ae (patch) | |
tree | 4aeec8adfd45cc2ad78f69352a44fc9b049b6104 | |
parent | 37f78b958c98d6707d84eaf0e3854282a37b6644 (diff) | |
parent | 98487c58c31bf0ce49d89c0bb9c7c173f2ad978d (diff) | |
download | lingo-ap-tracker-829bb6ba7fdbef5c4e6fb9e4eabc0c2f962325ae.tar.gz lingo-ap-tracker-829bb6ba7fdbef5c4e6fb9e4eabc0c2f962325ae.tar.bz2 lingo-ap-tracker-829bb6ba7fdbef5c4e6fb9e4eabc0c2f962325ae.zip |
Merge branch 'main' into panels
-rw-r--r-- | src/tracker_state.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index 0d9a9cd..1881513 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
@@ -27,7 +27,7 @@ TrackerState& GetState() { | |||
27 | class StateCalculator; | 27 | class StateCalculator; |
28 | 28 | ||
29 | struct StateCalculatorOptions { | 29 | struct StateCalculatorOptions { |
30 | std::string start = "Menu"; | 30 | int start; |
31 | bool pilgrimage = false; | 31 | bool pilgrimage = false; |
32 | StateCalculator* parent = nullptr; | 32 | StateCalculator* parent = nullptr; |
33 | }; | 33 | }; |
@@ -42,8 +42,7 @@ class StateCalculator { | |||
42 | void Calculate() { | 42 | void Calculate() { |
43 | std::list<int> panel_boundary; | 43 | std::list<int> panel_boundary; |
44 | std::list<Exit> flood_boundary; | 44 | std::list<Exit> flood_boundary; |
45 | flood_boundary.push_back( | 45 | flood_boundary.push_back({.destination_room = options_.start}); |
46 | {.destination_room = GD_GetRoomByName(options_.start)}); | ||
47 | 46 | ||
48 | bool reachable_changed = true; | 47 | bool reachable_changed = true; |
49 | while (reachable_changed) { | 48 | while (reachable_changed) { |
@@ -350,21 +349,32 @@ class StateCalculator { | |||
350 | } | 349 | } |
351 | } | 350 | } |
352 | 351 | ||
353 | static const std::vector<std::tuple<std::string, std::string>> | 352 | std::vector<std::tuple<int, int>> pilgrimage_pairs; |
354 | pilgrimage_pairs = { | 353 | if (AP_IsSunwarpShuffle()) { |
355 | {"Crossroads", "Hot Crusts Area"}, | 354 | pilgrimage_pairs = std::vector<std::tuple<int, int>>(5); |
356 | // {"Orange Tower Third Floor", "Orange Tower Third Floor"}, | ||
357 | {"Outside The Initiated", "Orange Tower First Floor"}, | ||
358 | {"Outside The Undeterred", "Orange Tower Fourth Floor"}, | ||
359 | {"Color Hunt", "Outside The Agreeable"}}; | ||
360 | 355 | ||
361 | for (const auto& [from_room, to_room] : pilgrimage_pairs) { | 356 | for (const auto& [start_index, mapping] : AP_GetSunwarpMapping()) { |
357 | if (mapping.dots > 1) { | ||
358 | std::get<1>(pilgrimage_pairs[mapping.dots - 2]) = start_index; | ||
359 | } | ||
360 | if (mapping.dots < 6) { | ||
361 | std::get<0>(pilgrimage_pairs[mapping.dots - 1]) = | ||
362 | mapping.exit_index; | ||
363 | } | ||
364 | } | ||
365 | } else { | ||
366 | pilgrimage_pairs = {{6, 1}, {8, 3}, {9, 4}, {10, 5}}; | ||
367 | } | ||
368 | |||
369 | for (const auto& [from_sunwarp, to_sunwarp] : pilgrimage_pairs) { | ||
362 | StateCalculator pilgrimage_calculator( | 370 | StateCalculator pilgrimage_calculator( |
363 | {.start = from_room, .pilgrimage = true, .parent = this}); | 371 | {.start = GD_GetRoomForSunwarp(from_sunwarp), |
372 | .pilgrimage = true, | ||
373 | .parent = this}); | ||
364 | pilgrimage_calculator.Calculate(); | 374 | pilgrimage_calculator.Calculate(); |
365 | 375 | ||
366 | if (!pilgrimage_calculator.GetReachableRooms().count( | 376 | if (!pilgrimage_calculator.GetReachableRooms().count( |
367 | GD_GetRoomByName(to_room))) { | 377 | GD_GetRoomForSunwarp(to_sunwarp))) { |
368 | return kMaybe; | 378 | return kMaybe; |
369 | } | 379 | } |
370 | } | 380 | } |
@@ -412,7 +422,7 @@ class StateCalculator { | |||
412 | } // namespace | 422 | } // namespace |
413 | 423 | ||
414 | void RecalculateReachability() { | 424 | void RecalculateReachability() { |
415 | StateCalculator state_calculator; | 425 | StateCalculator state_calculator({.start = GD_GetRoomByName("Menu")}); |
416 | state_calculator.Calculate(); | 426 | state_calculator.Calculate(); |
417 | 427 | ||
418 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); | 428 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); |