diff options
Diffstat (limited to 'src')
-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 0101e98..640a159 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) { |
@@ -328,21 +327,32 @@ class StateCalculator { | |||
328 | } | 327 | } |
329 | } | 328 | } |
330 | 329 | ||
331 | static const std::vector<std::tuple<std::string, std::string>> | 330 | std::vector<std::tuple<int, int>> pilgrimage_pairs; |
332 | pilgrimage_pairs = { | 331 | if (AP_IsSunwarpShuffle()) { |
333 | {"Crossroads", "Hot Crusts Area"}, | 332 | pilgrimage_pairs = std::vector<std::tuple<int, int>>(5); |
334 | // {"Orange Tower Third Floor", "Orange Tower Third Floor"}, | ||
335 | {"Outside The Initiated", "Orange Tower First Floor"}, | ||
336 | {"Outside The Undeterred", "Orange Tower Fourth Floor"}, | ||
337 | {"Color Hunt", "Outside The Agreeable"}}; | ||
338 | 333 | ||
339 | for (const auto& [from_room, to_room] : pilgrimage_pairs) { | 334 | for (const auto& [start_index, mapping] : AP_GetSunwarpMapping()) { |
335 | if (mapping.dots > 1) { | ||
336 | std::get<1>(pilgrimage_pairs[mapping.dots - 2]) = start_index; | ||
337 | } | ||
338 | if (mapping.dots < 6) { | ||
339 | std::get<0>(pilgrimage_pairs[mapping.dots - 1]) = | ||
340 | mapping.exit_index; | ||
341 | } | ||
342 | } | ||
343 | } else { | ||
344 | pilgrimage_pairs = {{6, 1}, {8, 3}, {9, 4}, {10, 5}}; | ||
345 | } | ||
346 | |||
347 | for (const auto& [from_sunwarp, to_sunwarp] : pilgrimage_pairs) { | ||
340 | StateCalculator pilgrimage_calculator( | 348 | StateCalculator pilgrimage_calculator( |
341 | {.start = from_room, .pilgrimage = true, .parent = this}); | 349 | {.start = GD_GetRoomForSunwarp(from_sunwarp), |
350 | .pilgrimage = true, | ||
351 | .parent = this}); | ||
342 | pilgrimage_calculator.Calculate(); | 352 | pilgrimage_calculator.Calculate(); |
343 | 353 | ||
344 | if (!pilgrimage_calculator.GetReachableRooms().count( | 354 | if (!pilgrimage_calculator.GetReachableRooms().count( |
345 | GD_GetRoomByName(to_room))) { | 355 | GD_GetRoomForSunwarp(to_sunwarp))) { |
346 | return kMaybe; | 356 | return kMaybe; |
347 | } | 357 | } |
348 | } | 358 | } |
@@ -390,7 +400,7 @@ class StateCalculator { | |||
390 | } // namespace | 400 | } // namespace |
391 | 401 | ||
392 | void RecalculateReachability() { | 402 | void RecalculateReachability() { |
393 | StateCalculator state_calculator; | 403 | StateCalculator state_calculator({.start = GD_GetRoomByName("Menu")}); |
394 | state_calculator.Calculate(); | 404 | state_calculator.Calculate(); |
395 | 405 | ||
396 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); | 406 | const std::set<int>& reachable_rooms = state_calculator.GetReachableRooms(); |