Skip to content

Commit 62011c7

Browse files
committed
autostory: throw exception if fail too many time
1 parent 7411c60 commit 62011c7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,13 +1238,13 @@ void checkpoint_reattempt_loop(
12381238
action(i);
12391239

12401240
break;
1241-
}catch(OperationFailedException&){
1241+
}catch(OperationFailedException& e){
12421242
if (i > max_attempts){
12431243
OperationFailedException::fire(
12441244
ErrorReport::SEND_ERROR_REPORT,
12451245
"Autostory checkpoint failed 100 times.\n"
12461246
"Make sure you selected the correct Start Point, and your character is in the exactly correct starting position."
1247-
"Also, make sure you have set the correct Language.",
1247+
"Also, make sure you have set the correct Language.\n" + e.message(),
12481248
env.console
12491249
);
12501250
}
@@ -1265,7 +1265,7 @@ void checkpoint_reattempt_loop_tutorial(
12651265
AutoStoryStats& stats,
12661266
std::function<void(size_t attempt_number)>&& action
12671267
){
1268-
1268+
size_t max_attempts = 100;
12691269
for (size_t i = 0;;i++){
12701270
try{
12711271
if(i==0){
@@ -1279,7 +1279,16 @@ void checkpoint_reattempt_loop_tutorial(
12791279
action(i);
12801280

12811281
break;
1282-
}catch(OperationFailedException&){
1282+
}catch(OperationFailedException& e){
1283+
if (i > max_attempts){
1284+
OperationFailedException::fire(
1285+
ErrorReport::SEND_ERROR_REPORT,
1286+
"Autostory checkpoint failed 100 times.\n"
1287+
"Make sure you selected the correct Start Point, and your character is in the exactly correct starting position."
1288+
"Also, make sure you have set the correct Language.\n" + e.message(),
1289+
env.console
1290+
);
1291+
}
12831292
context.wait_for_all_requests();
12841293
env.console.log("Resetting from checkpoint.");
12851294
reset_game(env.program_info(), env.console, context);

0 commit comments

Comments
 (0)