Skip to content

Commit

Permalink
Styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Oct 4, 2024
1 parent c1b0958 commit cfba856
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,15 @@ bool fly_to_visible_closest_pokecenter_cur_zoom_level(


void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context){
const int max_try_count = 17;
const int MAX_TRY_COUNT = 17;
int try_count = 0;
// Part 1: Tries to detect a pokecenter that is very close to the player
// Zoom in one level onto the map.
// If the player character icon or any wild pokemon icon overlaps with the PokeCenter icon, the code cannot
// detect it. So we zoom in as much as we can to prevent any icon overlap.

// failures to fly to pokecenter are often when the Switch lags. from my testing, a 1.4-1.5 adjustment factor seems to work
const std::array<double, max_try_count> adjustment_table = {1, 1.4, 1, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 0.9, 0.8, 1.4}; // {1, 1.4, 1.5};
const std::array<double, MAX_TRY_COUNT> adjustment_table = {1, 1.4, 1, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 0.9, 0.8, 1.4}; // {1, 1.4, 1.5};

while(true){
try {
Expand All @@ -629,10 +629,9 @@ void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, ConsoleHandle& co

// no visible pokecenters at this zoom level. Move on to part 2.
break;
}catch (OperationFailedException& e){ // pokecenter was detected, but failed to fly there
(void) e;
}catch (OperationFailedException&){ // pokecenter was detected, but failed to fly there
try_count++;
if (try_count >= max_try_count){
if (try_count >= MAX_TRY_COUNT){
throw OperationFailedException(
ErrorReport::SEND_ERROR_REPORT, console,
"fly_to_closest_pokecenter_on_map(): At min warpable map level, pokecenter was detected, but failed to fly there.",
Expand Down Expand Up @@ -682,10 +681,9 @@ void fly_to_closest_pokecenter_on_map(const ProgramInfo& info, ConsoleHandle& co
true
);
}
}catch (OperationFailedException& e){ // pokecenter was detected, but failed to fly there
(void) e;
}catch (OperationFailedException&){ // pokecenter was detected, but failed to fly there
try_count++;
if (try_count >= max_try_count){
if (try_count >= MAX_TRY_COUNT){
throw OperationFailedException(
ErrorReport::SEND_ERROR_REPORT, console,
"fly_to_closest_pokecenter_on_map(): At max warpable map level, pokecenter was detected, but failed to fly there.",
Expand Down

0 comments on commit cfba856

Please sign in to comment.