Skip to content

Commit 46a996b

Browse files
committed
Read name before running away. Apparently some computers are slow enough to lose this race condition.
1 parent e2dfa8d commit 46a996b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_EncounterHandler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,16 @@ void StandardEncounterHandler::run_away_and_update_stats(
7878
uint16_t exit_battle_time,
7979
const ShinyDetectionResult& result
8080
){
81+
// Read the name.
82+
const std::set<std::string>* candidates_ptr = encounter.candidates();
83+
8184
// Initiate the run-away.
8285
pbf_press_dpad(m_context, DPAD_UP, 10, 0);
8386
pbf_mash_button(m_context, BUTTON_A, 60);
8487
m_context.wait_for_all_requests();
8588

8689
update_frequencies(encounter);
8790

88-
const std::set<std::string>* candidates_ptr = encounter.candidates();
8991
const std::set<std::string>& candidates = candidates_ptr
9092
? *candidates_ptr
9193
: std::set<std::string>();

0 commit comments

Comments
 (0)