inline les fonctions opérateurs hors classes

This commit is contained in:
2025-02-25 15:10:50 +01:00
parent 59f457c752
commit f0f391ade6
7 changed files with 26 additions and 31 deletions

View File

@@ -38,7 +38,8 @@ bool PiecesFiles::savePieces(int order) const {
std::sort(nMinos.begin(), nMinos.end());
// write pieces
Color pieceColor = Color(FIRST_PIECE_COLOR + (order % (LAST_PIECE_COLOR - FIRST_PIECE_COLOR + 1)));
Color pieceColor = firstPieceColor();
for (int i = 0; i < order; i++) nextPieceColor(pieceColor);
for (const Polyomino& nMino : nMinos) {
// write polyomino length
char lengthByte = nMino.getLength();
@@ -46,7 +47,7 @@ bool PiecesFiles::savePieces(int order) const {
// write the type and color of the piece
char infoByte = (nMino.isConvex() << 7) + (nMino.hasHole() << 6) + pieceColor;
pieceColor = (pieceColor == LAST_PIECE_COLOR) ? FIRST_PIECE_COLOR : Color(pieceColor + 1);
nextPieceColor(pieceColor);
piecesFile.write(&infoByte, 1);
// write the cells of the piece