Skip to content

Commit c60cb46

Browse files
author
Gin
committed
rename home box sorter
1 parent 895c134 commit c60cb46

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

SerialPrograms/Source/PokemonHome/PokemonHome_Panels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "PokemonHome_Panels.h"
1010

1111
#include "Programs/PokemonHome_PageSwap.h"
12-
#include "Programs/PokemonHome_BoxSorting.h"
12+
#include "Programs/PokemonHome_BoxSorter.h"
1313

1414
#include "Programs/PokemonHome_GenerateNameOCR.h"
1515

@@ -30,7 +30,7 @@ std::vector<PanelEntry> PanelListFactory::make_panels() const{
3030
// ret.emplace_back(make_settings<GameSettings_Descriptor, GameSettingsPanel>());
3131
ret.emplace_back("---- General ----");
3232
ret.emplace_back(make_single_switch_program<PokemonHome::PageSwap_Descriptor, PokemonHome::PageSwap>());
33-
ret.emplace_back(make_single_switch_program<PokemonHome::BoxSorting_Descriptor, PokemonHome::BoxSorting>());
33+
ret.emplace_back(make_single_switch_program<PokemonHome::BoxSorter_Descriptor, PokemonHome::BoxSorter>());
3434

3535
// ret.emplace_back("---- Trading ----");
3636

SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorting.cpp renamed to SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/* Home Box Sorting
1+
/* Home Box Sorter
22
*
33
* From: https://github.com/PokemonAutomation/
44
*
55
*/
66

77
/* TODO ideas
8-
break into smaller functions
98
read pokemon name and store the slug (easier to detect missread than reading a number)
109
Optimise the swapping algo
1110
Add enum for ball ? Also, BDSP is reading from swsh data. Worth refactoring ?
@@ -49,7 +48,7 @@ language
4948
#include "Pokemon/Pokemon_CollectedPokemonInfo.h"
5049
#include "PokemonHome/Inference/PokemonHome_BoxGenderDetector.h"
5150
#include "PokemonHome/Inference/PokemonHome_BallReader.h"
52-
#include "PokemonHome_BoxSorting.h"
51+
#include "PokemonHome_BoxSorter.h"
5352

5453
namespace PokemonAutomation{
5554
namespace NintendoSwitch{
@@ -60,7 +59,7 @@ using namespace Pokemon;
6059
const size_t MAX_BOXES = 200;
6160

6261

63-
BoxSorting_Descriptor::BoxSorting_Descriptor()
62+
BoxSorter_Descriptor::BoxSorter_Descriptor()
6463
: SingleSwitchProgramDescriptor(
6564
"PokemonHome:BoxSorter",
6665
STRING_POKEMON + " Home", "Box Sorter",
@@ -72,7 +71,7 @@ BoxSorting_Descriptor::BoxSorting_Descriptor()
7271
{}
7372
)
7473
{}
75-
struct BoxSorting_Descriptor::Stats : public StatsTracker{
74+
struct BoxSorter_Descriptor::Stats : public StatsTracker{
7675
Stats()
7776
: pkmn(m_stats["Pokemon"])
7877
, empty(m_stats["Empty Slots"])
@@ -89,11 +88,11 @@ struct BoxSorting_Descriptor::Stats : public StatsTracker{
8988
std::atomic<uint64_t>& compare;
9089
std::atomic<uint64_t>& swaps;
9190
};
92-
std::unique_ptr<StatsTracker> BoxSorting_Descriptor::make_stats() const{
91+
std::unique_ptr<StatsTracker> BoxSorter_Descriptor::make_stats() const{
9392
return std::unique_ptr<StatsTracker>(new Stats());
9493
}
9594

96-
BoxSorting::BoxSorting()
95+
BoxSorter::BoxSorter()
9796
: BOX_NUMBER(
9897
"<b>Number of Boxes to Sort:</b>",
9998
LockMode::LOCK_WHILE_RUNNING,
@@ -262,7 +261,7 @@ void sort(
262261
ProControllerContext& context,
263262
std::vector<std::optional<CollectedPokemonInfo>> boxes_data,
264263
std::vector<std::optional<CollectedPokemonInfo>> boxes_sorted,
265-
BoxSorting_Descriptor::Stats& stats,
264+
BoxSorter_Descriptor::Stats& stats,
266265
BoxCursor& cur_cursor,
267266
uint16_t GAME_DELAY
268267
){
@@ -316,15 +315,15 @@ void sort(
316315
}
317316
}
318317

319-
void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
318+
void BoxSorter::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
320319
StartProgramChecks::check_performance_class_wired_or_wireless(context);
321320

322321
std::vector<SortingRule> sort_preferences = SORT_TABLE.preferences();
323322
if (sort_preferences.empty()){
324323
throw UserSetupError(env.console, "At least one sorting method selection needs to be made!");
325324
}
326325

327-
BoxSorting_Descriptor::Stats& stats = env.current_stats< BoxSorting_Descriptor::Stats>();
326+
BoxSorter_Descriptor::Stats& stats = env.current_stats< BoxSorter_Descriptor::Stats>();
328327

329328
ImageFloatBox select_check(0.495, 0.0045, 0.01, 0.005); // square color to check which mode is active
330329
ImageFloatBox national_dex_number_box(0.448, 0.245, 0.049, 0.04); //pokemon national dex number pos
@@ -503,7 +502,7 @@ void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerConte
503502
if (dex_number <= 0 || dex_number > static_cast<int>(NATIONAL_DEX_SLUGS().size())) {
504503
OperationFailedException::fire(
505504
ErrorReport::SEND_ERROR_REPORT,
506-
"BoxSorting Check Summary: Unable to read a correct dex number, found: " + std::to_string(dex_number),
505+
"BoxSorter Check Summary: Unable to read a correct dex number, found: " + std::to_string(dex_number),
507506
env.console
508507
);
509508
}

SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorting.h renamed to SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorter.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
*/
66

7-
#ifndef BOXSORTING_H
8-
#define BOXSORTING_H
7+
#ifndef PokemonAutomation_PokemonHome_BoxSorter_H
8+
#define PokemonAutomation_PokemonHome_BoxSorter_H
99

1010
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
1111
#include "Common/Cpp/Options/SimpleIntegerOption.h"
@@ -20,17 +20,17 @@ namespace PokemonAutomation{
2020
namespace NintendoSwitch{
2121
namespace PokemonHome{
2222

23-
class BoxSorting_Descriptor : public SingleSwitchProgramDescriptor{
23+
class BoxSorter_Descriptor : public SingleSwitchProgramDescriptor{
2424
public:
25-
BoxSorting_Descriptor();
25+
BoxSorter_Descriptor();
2626

2727
struct Stats;
2828
virtual std::unique_ptr<StatsTracker> make_stats() const override;
2929
};
3030

31-
class BoxSorting : public SingleSwitchProgramInstance{
31+
class BoxSorter : public SingleSwitchProgramInstance{
3232
public:
33-
BoxSorting();
33+
BoxSorter();
3434

3535
virtual void program(SingleSwitchProgramEnvironment& env, ProControllerContext& context) override;
3636

SerialPrograms/SourceFiles.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,8 +1346,8 @@ file(GLOB LIBRARY_SOURCES
13461346
Source/PokemonHome/PokemonHome_Panels.h
13471347
Source/PokemonHome/PokemonHome_Settings.cpp
13481348
Source/PokemonHome/PokemonHome_Settings.h
1349-
Source/PokemonHome/Programs/PokemonHome_BoxSorting.cpp
1350-
Source/PokemonHome/Programs/PokemonHome_BoxSorting.h
1349+
Source/PokemonHome/Programs/PokemonHome_BoxSorter.cpp
1350+
Source/PokemonHome/Programs/PokemonHome_BoxSorter.h
13511351
Source/PokemonHome/Programs/PokemonHome_GenerateNameOCR.cpp
13521352
Source/PokemonHome/Programs/PokemonHome_GenerateNameOCR.h
13531353
Source/PokemonHome/Programs/PokemonHome_PageSwap.cpp

0 commit comments

Comments
 (0)