Skip to content

Commit

Permalink
#6146: Collapse redundant switch cases into one
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 1, 2022
1 parent ffa3229 commit a09919a
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions radiantcore/selection/RadiantSelectionSystem.cpp
Expand Up @@ -132,12 +132,14 @@ void RadiantSelectionSystem::testSelectScene(SelectablesList& targetList, Select
switch(mode)
{
case SelectionMode::Entity:
case SelectionMode::GroupPart:
case SelectionMode::Component:
case SelectionMode::MergeAction:
{
// Instantiate a walker class specialised for selecting entities
auto tester = createSceneSelectionTester(mode);
tester->testSelectScene(view, test, selector);

std::for_each(selector.begin(), selector.end(), [&](const auto& p) { targetList.push_back(p.second); });
selector.foreachSelectable([&](ISelectable* s) { targetList.push_back(s); });
}
break;

Expand All @@ -155,41 +157,9 @@ void RadiantSelectionSystem::testSelectScene(SelectablesList& targetList, Select
targetPool.foreachSelectable([&](ISelectable* s) { targetList.push_back(s); });
}
break;

case SelectionMode::GroupPart:
{
// Retrieve all the selectable primitives of group nodes
auto tester = createSceneSelectionTester(mode);
tester->testSelectScene(view, test, selector);

// Add the selection crop to the target vector
std::for_each(selector.begin(), selector.end(), [&](const auto& p) { targetList.push_back(p.second); });
}
break;

case SelectionMode::Component:
{
auto tester = createSceneSelectionTester(mode);
tester->testSelectScene(view, test, selector);

std::for_each(selector.begin(), selector.end(), [&](const auto& p) { targetList.push_back(p.second); });
}
break;

case SelectionMode::MergeAction:
{
auto tester = createSceneSelectionTester(mode);
tester->testSelectScene(view, test, selector);

// Add the selection crop to the target vector
std::for_each(selector.begin(), selector.end(), [&](const auto& p) { targetList.push_back(p.second); });
}
break;
}
}

/* greebo: This is true if nothing is selected (either in component mode or in primitive mode)
*/
bool RadiantSelectionSystem::nothingSelected() const
{
return (getSelectionMode() == SelectionMode::Component && _countComponent == 0) ||
Expand Down

0 comments on commit a09919a

Please sign in to comment.