Skip to content

Commit d2f8cb4

Browse files
committed
simplify Variant logic
1 parent 4eefed0 commit d2f8cb4

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/VariantModel.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,16 @@ QVariant VariantModel::data(const QModelIndex& index, int role) const
3232
auto coordsWithCenterColor = _cubeModel->getCoordsWithValue(color());
3333
std::sort(coordsWithCenterColor.begin(), coordsWithCenterColor.end());
3434

35-
if(coordsWithCenterColor.size()>_variantPieces[index.row()].size() || !variantFree(index.row()))
36-
{
37-
return IMPOSSIBLE;
38-
}
39-
4035
if(coordsWithCenterColor == _variantPieces[index.row()])
4136
{
4237
return SELECTED;
4338
}
44-
45-
std::vector<std::array<int, 3>> commonPieces;
46-
std::set_intersection(coordsWithCenterColor.begin(), coordsWithCenterColor.end(), _variantPieces[index.row()].begin(), _variantPieces[index.row()].end(),
47-
std::back_inserter(commonPieces));
48-
49-
if(commonPieces == coordsWithCenterColor)
39+
if(variantFree(index.row()))
5040
{
5141
return POSSIBLE;
42+
} else {
43+
return IMPOSSIBLE;
5244
}
53-
return IMPOSSIBLE;
5445

5546
}
5647
case ModelIndex:

0 commit comments

Comments
 (0)