@@ -425,7 +425,8 @@ void output_boxes_data_json(const std::vector<std::optional<Pokemon>>& boxes_dat
425425 pokemon[" box" ] = cursor.box ;
426426 pokemon[" row" ] = cursor.row ;
427427 pokemon[" column" ] = cursor.column ;
428- if (std::optional<Pokemon> current_pokemon = boxes_data[poke_nb]; current_pokemon != std::nullopt ){
428+ const auto & current_pokemon = boxes_data[poke_nb];
429+ if (current_pokemon != std::nullopt ){
429430 // NOTE edit when adding new struct members
430431 pokemon[" national_dex_number" ] = current_pokemon->national_dex_number ;
431432 pokemon[" shiny" ] = current_pokemon->shiny ;
@@ -666,15 +667,15 @@ void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerConte
666667 box_render.add (COLOR_RED, nature_box);
667668 box_render.add (COLOR_RED, ability_box);
668669
669- // cycle through each summary of the current box and fill pokemon information
670+ // cycle through each summary of the current box and fill pokemon information
670671 for (size_t row = 0 ; row < MAX_ROWS; row++){
671672 for (size_t column = 0 ; column < MAX_COLUMNS; column++){
672673 const size_t global_idx = get_index (box_idx, row, column);
673674 if (!boxes_data[global_idx].has_value ()){
674675 continue ;
675676 }
676677
677- auto cur_pokemon_info = boxes_data[global_idx];
678+ auto & cur_pokemon_info = boxes_data[global_idx];
678679 screen = env.console .video ().snapshot ();
679680
680681 const int national_dex_number = OCR::read_number_waterfill (env.console , extract_box_reference (screen, national_dex_number_box), 0xff808080 , 0xffffffff );
0 commit comments