fix some code smells
continuous-integration/drone/push Build is passing Details

master
Jules LASCRET 11 months ago
parent ecfcc1cb37
commit c45e859e83

@ -552,7 +552,7 @@ namespace QwirkleClassLibrary.Games
return false; return false;
} }
public static bool CheckTileInCompletedLines(Tile? t1, Tile? t2, ref int nbTiles, ref List<Tile> checkdoubles) public static bool CheckTileInCompletedLines(Tile? t1, ref int nbTiles, ref List<Tile> checkdoubles)
{ {
if (t1 != null) if (t1 != null)
{ {
@ -566,18 +566,6 @@ namespace QwirkleClassLibrary.Games
checkdoubles.Add(t1); checkdoubles.Add(t1);
} }
if (t2 == null) return true;
{
nbTiles++;
if (checkdoubles.Any(t => t.CompareTo(t2) == 0))
{
return false;
}
checkdoubles.Add(t2);
}
return true; return true;
} }
@ -595,7 +583,9 @@ namespace QwirkleClassLibrary.Games
break; break;
} }
return CheckTileInCompletedLines(extendedCell?.Tile, extendedCell2?.Tile, ref nbTiles, ref checkdoubles); if(!CheckTileInCompletedLines(extendedCell?.Tile, ref nbTiles, ref checkdoubles)) return false;
if(!CheckTileInCompletedLines(extendedCell2?.Tile, ref nbTiles, ref checkdoubles)) return false;
} }
return nbTiles <= 6; return nbTiles <= 6;

Loading…
Cancel
Save