Skip to content

Commit 17393e0

Browse files
committed
Attacked while trying to fly.
1 parent 453f540 commit 17393e0

File tree

7 files changed

+36
-9
lines changed

7 files changed

+36
-9
lines changed

SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ void ScreenshotException::add_stream_if_needed(VideoStream& stream){
7373
}
7474
}
7575

76-
ImageViewRGB32 ScreenshotException::screenshot() const{
76+
ImageViewRGB32 ScreenshotException::screenshot_view() const{
7777
if (m_screenshot){
7878
return *m_screenshot;
7979
}else{
8080
return ImageViewRGB32();
8181
}
8282
}
83+
std::shared_ptr<const ImageRGB32> ScreenshotException::screenshot() const{
84+
return m_screenshot;
85+
}
8386

8487

8588
void ScreenshotException::send_notification(ProgramEnvironment& env, EventNotificationOption& notification) const{
@@ -94,7 +97,7 @@ void ScreenshotException::send_notification(ProgramEnvironment& env, EventNotifi
9497
env.program_info(),
9598
name(),
9699
embeds,
97-
screenshot(),
100+
screenshot_view(),
98101
m_stream ? &m_stream->history() : nullptr
99102
);
100103
}
@@ -104,7 +107,7 @@ void ScreenshotException::send_notification(ProgramEnvironment& env, EventNotifi
104107
color(),
105108
name(),
106109
std::move(embeds), "",
107-
screenshot()
110+
screenshot_view()
108111
);
109112
}
110113

SerialPrograms/Source/CommonFramework/Exceptions/ScreenshotException.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class ScreenshotException : public Exception{
6767
public:
6868
// virtual const char* name() const override{ return "ScreenshotException"; }
6969
virtual std::string message() const override{ return m_message; }
70-
ImageViewRGB32 screenshot() const;
70+
ImageViewRGB32 screenshot_view() const;
71+
std::shared_ptr<const ImageRGB32> screenshot() const;
7172

7273
virtual Color color() const{ return COLOR_RED; }
7374
virtual void send_notification(ProgramEnvironment& env, EventNotificationOption& notification) const;

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace PokemonAutomation{
2626
const bool IS_BETA_VERSION = true;
2727
const int PROGRAM_VERSION_MAJOR = 0;
2828
const int PROGRAM_VERSION_MINOR = 54;
29-
const int PROGRAM_VERSION_PATCH = 17;
29+
const int PROGRAM_VERSION_PATCH = 18;
3030

3131
const std::string PROGRAM_VERSION_BASE =
3232
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "CommonFramework/Exceptions/ProgramFinishedException.h"
1010
#include "CommonFramework/Exceptions/FatalProgramException.h"
1111
#include "CommonFramework/Exceptions/OperationFailedException.h"
12+
#include "CommonFramework/Exceptions/UnexpectedBattleException.h"
1213
#include "CommonFramework/Options/Environment/ThemeSelectorOption.h"
1314
#include "CommonFramework/Notifications/ProgramNotifications.h"
1415
#include "CommonFramework/ProgramStats/StatsTracking.h"
@@ -231,6 +232,18 @@ void EggAutonomous::program(SingleSwitchProgramEnvironment& env, ProControllerCo
231232
try{
232233
num_party_eggs = fetch_eggs_full_routine(env, context);
233234
break;
235+
}catch (UnexpectedBattleException& e){
236+
handle_recoverable_error(
237+
env, context,
238+
NOTIFICATION_ERROR_RECOVERABLE,
239+
OperationFailedException(
240+
ErrorReport::NO_ERROR_REPORT,
241+
e.message(),
242+
nullptr,
243+
e.screenshot()
244+
),
245+
consecutive_failures
246+
);
234247
}catch (OperationFailedException& e){
235248
handle_recoverable_error(env, context, NOTIFICATION_ERROR_RECOVERABLE, e, consecutive_failures);
236249
} // end try catch
@@ -692,7 +705,7 @@ void EggAutonomous::save_game(SingleSwitchProgramEnvironment& env, ProController
692705
void EggAutonomous::handle_recoverable_error(
693706
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
694707
EventNotificationOption& notification,
695-
OperationFailedException& e,
708+
const OperationFailedException& e,
696709
size_t& consecutive_failures
697710
){
698711
auto& stats = env.current_stats<EggAutonomous_Descriptor::Stats>();

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class EggAutonomous : public SingleSwitchProgramInstance{
6161
void handle_recoverable_error(
6262
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
6363
EventNotificationOption& notification,
64-
OperationFailedException& e,
64+
const OperationFailedException& e,
6565
size_t& consecutive_failures
6666
);
6767

SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_CramomaticRNG.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,12 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo
507507
env.console
508508
);
509509
}
510-
send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, e.message(), e.screenshot());
510+
send_program_recoverable_error_notification(
511+
env,
512+
NOTIFICATION_ERROR_RECOVERABLE,
513+
e.message(),
514+
e.screenshot_view()
515+
);
511516
is_state_valid = false;
512517
recover_from_wrong_state(env, context);
513518
continue;

SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,12 @@ void DailyHighlightRNG::program(SingleSwitchProgramEnvironment& env, ProControll
535535
num_npcs = calibrate_num_npc_from_party(env, context, rng);
536536
}
537537
catch (OperationFailedException& exception) {
538-
send_program_recoverable_error_notification(env, NOTIFICATION_ERROR_RECOVERABLE, exception.message(), exception.screenshot());
538+
send_program_recoverable_error_notification(
539+
env,
540+
NOTIFICATION_ERROR_RECOVERABLE,
541+
exception.message(),
542+
exception.screenshot_view()
543+
);
539544
assumed_successful_iterations = 0;
540545
stats.errors++;
541546
continue;

0 commit comments

Comments
 (0)