diff --git a/Common/Cpp/Options/EditableTableOption.h b/Common/Cpp/Options/EditableTableOption.h index a36619059..0b11b3e74 100644 --- a/Common/Cpp/Options/EditableTableOption.h +++ b/Common/Cpp/Options/EditableTableOption.h @@ -163,7 +163,7 @@ class EditableTableOption_t : public EditableTableOption{ if constexpr (std::is_default_constructible_v){ return std::unique_ptr(new RowType()); }else{ - return std::unique_ptr(new RowType(this)); + return std::unique_ptr(new RowType(*this)); } } }; diff --git a/Common/Cpp/Options/IntegerRangeOption.cpp b/Common/Cpp/Options/IntegerRangeOption.cpp index d88428856..cd870313e 100644 --- a/Common/Cpp/Options/IntegerRangeOption.cpp +++ b/Common/Cpp/Options/IntegerRangeOption.cpp @@ -17,10 +17,9 @@ #include "Common/Qt/Options/IntegerRangeWidget.h" -// REMOVE -#include -using std::cout; -using std::endl; +//#include +//using std::cout; +//using std::endl; namespace PokemonAutomation{ diff --git a/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.cpp b/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.cpp index a5788f4f8..9a6727fca 100644 --- a/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.cpp +++ b/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.cpp @@ -145,8 +145,8 @@ StatsHuntIvJudgeFilterRow::StatsHuntIvJudgeFilterRow(const StatsHuntMiscFeatureF PA_ADD_OPTION(iv_spdef); PA_ADD_OPTION(iv_speed); } -StatsHuntIvJudgeFilterRow::StatsHuntIvJudgeFilterRow(const EditableTableOption* table) - : StatsHuntIvJudgeFilterRow(static_cast(*table).feature_flags) +StatsHuntIvJudgeFilterRow::StatsHuntIvJudgeFilterRow(const EditableTableOption& table) + : StatsHuntIvJudgeFilterRow(static_cast(table).feature_flags) {} StatsHuntIvJudgeFilterRow::StatsHuntIvJudgeFilterRow(const StatsHuntMiscFeatureFlags& feature_flags, StatsHuntShinyFilter p_shiny) : StatsHuntIvJudgeFilterRow(feature_flags) @@ -289,8 +289,8 @@ StatsHuntIvRangeFilterRow::StatsHuntIvRangeFilterRow(const StatsHuntMiscFeatureF PA_ADD_OPTION(iv_spdef); PA_ADD_OPTION(iv_speed); } -StatsHuntIvRangeFilterRow::StatsHuntIvRangeFilterRow(const EditableTableOption* table) - : StatsHuntIvRangeFilterRow(static_cast(*table).feature_flags) +StatsHuntIvRangeFilterRow::StatsHuntIvRangeFilterRow(const EditableTableOption& table) + : StatsHuntIvRangeFilterRow(static_cast(table).feature_flags) {} std::unique_ptr StatsHuntIvRangeFilterRow::clone() const{ std::unique_ptr ret(new StatsHuntIvRangeFilterRow(misc.feature_flags)); diff --git a/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.h b/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.h index 3eea0f51c..05373871f 100644 --- a/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.h +++ b/SerialPrograms/Source/Pokemon/Options/Pokemon_StatsHuntFilter.h @@ -82,7 +82,7 @@ class StatsHuntIvJudgeFilterTable; class StatsHuntIvJudgeFilterRow : public EditableTableRow{ public: StatsHuntIvJudgeFilterRow(const StatsHuntMiscFeatureFlags& feature_flags); - StatsHuntIvJudgeFilterRow(const EditableTableOption* table); + StatsHuntIvJudgeFilterRow(const EditableTableOption& table); StatsHuntIvJudgeFilterRow(const StatsHuntMiscFeatureFlags& feature_flags, StatsHuntShinyFilter p_shiny); virtual std::unique_ptr clone() const override; @@ -134,11 +134,10 @@ class StatsHuntIvJudgeFilterTable : public EditableTableOption_t clone() const override; bool matches( diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp index d06c8a1ec..3266dd7a9 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.cpp @@ -56,9 +56,10 @@ std::string SinglesMoveEntry::to_str() const{ SinglesMoveTableRow::~SinglesMoveTableRow(){ type.remove_listener(*this); } -SinglesMoveTableRow::SinglesMoveTableRow(bool p_trainer_battle) - : type( - p_trainer_battle ? singles_move_enum_database_trainer() : singles_move_enum_database_wild(), +SinglesMoveTableRow::SinglesMoveTableRow(bool trainer_battle) + : m_trainer_battle(trainer_battle) + , type( + trainer_battle ? singles_move_enum_database_trainer() : singles_move_enum_database_wild(), LockMode::UNLOCK_WHILE_RUNNING, SinglesMoveType::Move1 ) @@ -72,8 +73,11 @@ SinglesMoveTableRow::SinglesMoveTableRow(bool p_trainer_battle) SinglesMoveTableRow::value_changed(); type.add_listener(*this); } +SinglesMoveTableRow::SinglesMoveTableRow(const EditableTableOption& table) + : SinglesMoveTableRow(static_cast(table).m_trainer_battle) +{} std::unique_ptr SinglesMoveTableRow::clone() const{ - std::unique_ptr ret(new SinglesMoveTableRow(trainer_battle)); + std::unique_ptr ret(new SinglesMoveTableRow(m_trainer_battle)); ret->type.set(type); ret->terastallize = (bool)terastallize; ret->notes.set(notes); @@ -100,7 +104,7 @@ SinglesMoveTable::SinglesMoveTable(std::string label, bool trainer_battle) "Changes to this table take effect on the next battle.", #endif LockMode::UNLOCK_WHILE_RUNNING, - make_defaults(trainer_battle) + make_defaults() ) {} @@ -114,9 +118,9 @@ std::vector SinglesMoveTable::make_header() const{ "Notes", }; } -std::vector> SinglesMoveTable::make_defaults(bool trainer_battle){ +std::vector> SinglesMoveTable::make_defaults(){ std::vector> ret; - ret.emplace_back(new SinglesMoveTableRow(trainer_battle)); + ret.emplace_back(new SinglesMoveTableRow(*this)); return ret; } diff --git a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h index a9ae6707a..a0ea0fead 100644 --- a/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h +++ b/SerialPrograms/Source/PokemonSV/Options/PokemonSV_SinglesMoveTable.h @@ -36,10 +36,12 @@ struct SinglesMoveEntry{ }; + class SinglesMoveTableRow : public EditableTableRow, public ConfigOption::Listener{ public: ~SinglesMoveTableRow(); - SinglesMoveTableRow(bool p_trainer_battle); + SinglesMoveTableRow(bool trainer_battle); + SinglesMoveTableRow(const EditableTableOption& table); virtual std::unique_ptr clone() const override; SinglesMoveEntry snapshot() const; @@ -48,7 +50,7 @@ class SinglesMoveTableRow : public EditableTableRow, public ConfigOption::Listen virtual void value_changed() override; private: - bool trainer_battle; + const bool m_trainer_battle; EnumDropdownCell type; BooleanCheckBoxCell terastallize; StringCell notes; @@ -63,7 +65,12 @@ class SinglesMoveTable : public EditableTableOption_t{ virtual std::vector make_header() const; - static std::vector> make_defaults(bool trainer_battle); + std::vector> make_defaults(); + +private: + friend class SinglesMoveTableRow; + + bool m_trainer_battle; };