Skip to content

Commit 4430e36

Browse files
committed
Don't error out if you don't find the daycare lady.
1 parent 72095ce commit 4430e36

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggAutonomous.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,15 @@ size_t EggAutonomous::talk_to_lady_to_fetch_egg(
523523
pbf_wait(context, 200);
524524
},
525525
{
526-
{egg_arrow_detector},
527-
{no_egg_arrow_detector},
526+
egg_arrow_detector,
527+
no_egg_arrow_detector,
528528
}
529529
);
530530

531531
const bool y_comm_visible_at_end_of_dialog = true;
532532
YCommIconDetector dialog_over_detector(y_comm_visible_at_end_of_dialog);
533-
if (ret == 0){
533+
switch (ret){
534+
case 0:
534535
++num_eggs_retrieved;
535536
env.log("Found egg");
536537
env.console.overlay().add_log("Found egg " + std::to_string(num_eggs_retrieved) + "/5", COLOR_WHITE);
@@ -546,23 +547,29 @@ size_t EggAutonomous::talk_to_lady_to_fetch_egg(
546547
},
547548
{{dialog_over_detector}}
548549
);
549-
}else if (ret == 1){
550+
break;
551+
552+
case 1:
550553
env.log("No egg");
551554
env.console.overlay().add_log("No egg", COLOR_WHITE);
552-
ret = run_until<ProControllerContext>(
555+
run_until<ProControllerContext>(
553556
env.console, context,
554557
[](ProControllerContext& context){
555-
pbf_mash_button(context, BUTTON_B, 30s);
558+
pbf_mash_button(context, BUTTON_B, 5s);
556559
},
557560
{{dialog_over_detector}}
558561
);
559-
}else{
562+
return num_eggs_retrieved;
563+
// break;
564+
565+
default:
560566
OperationFailedException::fire(
561567
ErrorReport::SEND_ERROR_REPORT,
562568
"Cannot detect dialog selection arrow when talking to Nursery lady.",
563569
env.console
564570
);
565571
}
572+
566573
// If dialog over is not detected:
567574
if (ret < 0){
568575
OperationFailedException::fire(

0 commit comments

Comments
 (0)