Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Magnet Pull and Static apply to correct encounter types in Gen 3 #399

Merged
merged 5 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/Form/Controls/ComboMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void ComboMenu::hideAction(const QVariant &data, bool hide)
if (action->data() == data)
{
action->setVisible(!hide);
if (action->isChecked())
if (action->isChecked() && hide)
{
clearSelection();
}
Expand All @@ -95,7 +95,7 @@ void ComboMenu::hideAction(const QVariant &data, bool hide)
if (menu)
{
auto menuActions = menu->actions();
bool visible = std::all_of(menuActions.begin(), menuActions.end(), [](const QAction *action) { return action->isVisible(); });
bool visible = std::any_of(menuActions.begin(), menuActions.end(), [](const QAction *action) { return action->isVisible(); });
menu->menuAction()->setVisible(visible);
}
}
Expand Down
34 changes: 31 additions & 3 deletions Source/Form/Gen3/Wild3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,37 @@ void Wild3::generatorEncounterIndexChanged(int index)
{
case Encounter::Grass:
ui->filterGenerator->setEncounterSlots(12);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), false);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), false);
break;
case Encounter::RockSmash:
ui->filterGenerator->setEncounterSlots(5);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::Surfing:
case Encounter::SuperRod:
ui->filterGenerator->setEncounterSlots(5);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), false);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::OldRod:
ui->filterGenerator->setEncounterSlots(2);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::GoodRod:
ui->filterGenerator->setEncounterSlots(3);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::SuperRod:
ui->filterGenerator->setEncounterSlots(5);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuGeneratorLead->hideAction(toInt(Lead::MagnetPull), true);
break;
default:
break;
}

updateEncounterGenerator();
c-poole marked this conversation as resolved.
Show resolved Hide resolved

std::vector<u16> locs;
Expand Down Expand Up @@ -399,24 +414,37 @@ void Wild3::searcherEncounterIndexChanged(int index)
{
case Encounter::Grass:
ui->filterSearcher->setEncounterSlots(12);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), false);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), false);
break;
case Encounter::RockSmash:
ui->filterSearcher->setEncounterSlots(5);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::Surfing:
ui->filterSearcher->setEncounterSlots(5);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), false);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::OldRod:
ui->filterSearcher->setEncounterSlots(2);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::GoodRod:
ui->filterSearcher->setEncounterSlots(3);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), true);
break;
case Encounter::SuperRod:
ui->filterSearcher->setEncounterSlots(5);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::Static), true);
ui->comboMenuSearcherLead->hideAction(toInt(Lead::MagnetPull), true);
break;
default:
break;
}

c-poole marked this conversation as resolved.
Show resolved Hide resolved
updateEncounterSearcher();

std::vector<u16> locs;
Expand Down