File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
CommonFramework/Exceptions
PokemonSV/Programs/AutoStory Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 77#ifndef PokemonAutomation_UnexpectedBattleException_H
88#define PokemonAutomation_UnexpectedBattleException_H
99
10- #include " ScreenshotException .h"
10+ #include " OperationFailedException .h"
1111
1212namespace PokemonAutomation {
13-
14- class FatalProgramException ;
15-
13+ namespace NintendoSwitch {
1614
1715// Thrown by subroutines if caught in an wild battle in-game unexpectedly.
1816// These include recoverable errors which can be consumed by the program.
19- class UnexpectedBattleException : public ScreenshotException {
17+ class UnexpectedBattleException : public OperationFailedException {
2018public:
21- using ScreenshotException::ScreenshotException;
19+ UnexpectedBattleException (
20+ ErrorReport error_report,
21+ std::string message,
22+ VideoStream& stream
23+ )
24+ : OperationFailedException(error_report, std::move(message), stream)
25+ {}
2226
2327 virtual const char * name () const override { return " UnexpectedBattleException" ; }
2428};
@@ -27,5 +31,6 @@ class UnexpectedBattleException : public ScreenshotException{
2731
2832
2933
34+ }
3035}
3136#endif
Original file line number Diff line number Diff line change @@ -1071,11 +1071,11 @@ void realign_player_from_landmark(
10711071
10721072 return ;
10731073
1074+ }catch (UnexpectedBattleException&){
1075+ run_battle_press_A (stream, context, BattleStopCondition::STOP_OVERWORLD);
10741076 }catch (OperationFailedException&){
10751077 // reset to overworld if failed to center on the pokecenter, and re-try
10761078 leave_phone_to_overworld (info, stream, context);
1077- }catch (UnexpectedBattleException&){
1078- run_battle_press_A (stream, context, BattleStopCondition::STOP_OVERWORLD);
10791079 }
10801080 }
10811081
@@ -1153,11 +1153,11 @@ void move_cursor_towards_flypoint_and_go_there(
11531153
11541154 return ;
11551155
1156+ }catch (UnexpectedBattleException&){
1157+ run_battle_press_A (stream, context, BattleStopCondition::STOP_OVERWORLD);
11561158 }catch (OperationFailedException&){
11571159 // reset to overworld if failed to center on the pokecenter, and re-try
11581160 leave_phone_to_overworld (info, stream, context);
1159- }catch (UnexpectedBattleException&){
1160- run_battle_press_A (stream, context, BattleStopCondition::STOP_OVERWORLD);
11611161 }
11621162 }
11631163
You can’t perform that action at this time.
0 commit comments