diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 12:56:29 -0400 | 
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-29 12:56:29 -0400 | 
| commit | 13d2a129f6972e6e752da9c9cb686a63d5550517 (patch) | |
| tree | ea0cfe2197c25732dd0d4d0f0e37717fd977792f /src/tracker_state.cpp | |
| parent | d3e2d9518403eb89eb150fa2158966c3483d5339 (diff) | |
| download | lingo-ap-tracker-13d2a129f6972e6e752da9c9cb686a63d5550517.tar.gz lingo-ap-tracker-13d2a129f6972e6e752da9c9cb686a63d5550517.tar.bz2 lingo-ap-tracker-13d2a129f6972e6e752da9c9cb686a63d5550517.zip | |
Show unchecked paintings
Diffstat (limited to 'src/tracker_state.cpp')
| -rw-r--r-- | src/tracker_state.cpp | 32 | 
1 files changed, 17 insertions, 15 deletions
| diff --git a/src/tracker_state.cpp b/src/tracker_state.cpp index 869f837..faf74cc 100644 --- a/src/tracker_state.cpp +++ b/src/tracker_state.cpp | |||
| @@ -15,11 +15,11 @@ namespace { | |||
| 15 | struct Requirements { | 15 | struct Requirements { | 
| 16 | bool disabled = false; | 16 | bool disabled = false; | 
| 17 | 17 | ||
| 18 | std::set<int> doors; // non-grouped, handles progressive | 18 | std::set<int> doors; // non-grouped, handles progressive | 
| 19 | std::set<int> items; // all other items | 19 | std::set<int> items; // all other items | 
| 20 | std::set<int> rooms; // maybe | 20 | std::set<int> rooms; // maybe | 
| 21 | bool mastery = false; // maybe | 21 | bool mastery = false; // maybe | 
| 22 | bool panel_hunt = false; // maybe | 22 | bool panel_hunt = false; // maybe | 
| 23 | 23 | ||
| 24 | void Merge(const Requirements& rhs) { | 24 | void Merge(const Requirements& rhs) { | 
| 25 | if (rhs.disabled) { | 25 | if (rhs.disabled) { | 
| @@ -228,7 +228,8 @@ class StateCalculator { | |||
| 228 | 228 | ||
| 229 | if (AP_IsPaintingShuffle()) { | 229 | if (AP_IsPaintingShuffle()) { | 
| 230 | for (const PaintingExit& out_edge : room_obj.paintings) { | 230 | for (const PaintingExit& out_edge : room_obj.paintings) { | 
| 231 | if (AP_GetPaintingMapping().count(out_edge.id)) { | 231 | if (AP_GetPaintingMapping().count(out_edge.id) && | 
| 232 | AP_GetCheckedPaintings().count(out_edge.id)) { | ||
| 232 | Exit painting_exit; | 233 | Exit painting_exit; | 
| 233 | painting_exit.destination_room = GD_GetRoomForPainting( | 234 | painting_exit.destination_room = GD_GetRoomForPainting( | 
| 234 | AP_GetPaintingMapping().at(out_edge.id)); | 235 | AP_GetPaintingMapping().at(out_edge.id)); | 
| @@ -286,7 +287,8 @@ class StateCalculator { | |||
| 286 | panel_boundary = new_panel_boundary; | 287 | panel_boundary = new_panel_boundary; | 
| 287 | } | 288 | } | 
| 288 | 289 | ||
| 289 | // Now that we know the full reachable area, let's make sure all doors are evaluated. | 290 | // Now that we know the full reachable area, let's make sure all doors are | 
| 291 | // evaluated. | ||
| 290 | for (const Door& door : GD_GetDoors()) { | 292 | for (const Door& door : GD_GetDoors()) { | 
| 291 | int discard = IsDoorReachable(door.id); | 293 | int discard = IsDoorReachable(door.id); | 
| 292 | } | 294 | } | 
| @@ -320,7 +322,8 @@ class StateCalculator { | |||
| 320 | return has_item ? kYes : kNo; | 322 | return has_item ? kYes : kNo; | 
| 321 | } | 323 | } | 
| 322 | 324 | ||
| 323 | Decision AreRequirementsSatisfied(const Requirements& reqs, std::map<std::string, bool>* report = nullptr) { | 325 | Decision AreRequirementsSatisfied( | 
| 326 | const Requirements& reqs, std::map<std::string, bool>* report = nullptr) { | ||
| 324 | if (reqs.disabled) { | 327 | if (reqs.disabled) { | 
| 325 | return kNo; | 328 | return kNo; | 
| 326 | } | 329 | } | 
| @@ -339,7 +342,7 @@ class StateCalculator { | |||
| 339 | final_decision = decision; | 342 | final_decision = decision; | 
| 340 | } | 343 | } | 
| 341 | } | 344 | } | 
| 342 | 345 | ||
| 343 | for (int item_id : reqs.items) { | 346 | for (int item_id : reqs.items) { | 
| 344 | bool has_item = AP_HasItem(item_id); | 347 | bool has_item = AP_HasItem(item_id); | 
| 345 | if (report) { | 348 | if (report) { | 
| @@ -353,10 +356,9 @@ class StateCalculator { | |||
| 353 | 356 | ||
| 354 | for (int room_id : reqs.rooms) { | 357 | for (int room_id : reqs.rooms) { | 
| 355 | bool reachable = reachable_rooms_.count(room_id); | 358 | bool reachable = reachable_rooms_.count(room_id); | 
| 356 | 359 | ||
| 357 | if (report) { | 360 | if (report) { | 
| 358 | std::string report_name = | 361 | std::string report_name = "Reach \"" + GD_GetRoom(room_id).name + "\""; | 
| 359 | "Reach \"" + GD_GetRoom(room_id).name + "\""; | ||
| 360 | (*report)[report_name] = reachable; | 362 | (*report)[report_name] = reachable; | 
| 361 | } | 363 | } | 
| 362 | 364 | ||
| @@ -364,7 +366,7 @@ class StateCalculator { | |||
| 364 | final_decision = kMaybe; | 366 | final_decision = kMaybe; | 
| 365 | } | 367 | } | 
| 366 | } | 368 | } | 
| 367 | 369 | ||
| 368 | if (reqs.mastery) { | 370 | if (reqs.mastery) { | 
| 369 | int achievements_accessible = 0; | 371 | int achievements_accessible = 0; | 
| 370 | 372 | ||
| @@ -407,7 +409,7 @@ class StateCalculator { | |||
| 407 | std::to_string(AP_GetLevel2Requirement()) + " Panels"; | 409 | std::to_string(AP_GetLevel2Requirement()) + " Panels"; | 
| 408 | (*report)[report_name] = can_level2; | 410 | (*report)[report_name] = can_level2; | 
| 409 | } | 411 | } | 
| 410 | 412 | ||
| 411 | if (can_level2 && final_decision != kNo) { | 413 | if (can_level2 && final_decision != kNo) { | 
| 412 | final_decision = kMaybe; | 414 | final_decision = kMaybe; | 
| 413 | } | 415 | } | 
| @@ -422,7 +424,7 @@ class StateCalculator { | |||
| 422 | } else { | 424 | } else { | 
| 423 | door_report_[door_id] = {}; | 425 | door_report_[door_id] = {}; | 
| 424 | } | 426 | } | 
| 425 | 427 | ||
| 426 | return AreRequirementsSatisfied(GetState().requirements.GetDoor(door_id), | 428 | return AreRequirementsSatisfied(GetState().requirements.GetDoor(door_id), | 
| 427 | &door_report_[door_id]); | 429 | &door_report_[door_id]); | 
| 428 | } | 430 | } | 
