Started to specify the placement rule for two players games, need to place Pieces (in newBoard or in newGame, I don't know)

merge-requests/1/merge
marouault 4 years ago
parent 861dba6e74
commit 6e1d28f252

@ -22,6 +22,15 @@ typedef struct
// bool hasPiece; ///< Indicates if there is a Piece on this Island // bool hasPiece; ///< Indicates if there is a Piece on this Island
} Island; } Island;
/**
* \brief Create a new island
*
* \param [in] x X coordinate of the island
* \param [in] y Y coordinate of the island
* \return The newly created Island
*/
Island newIsland(const int x, const int y);
/** /**
* \brief Check if two islands are equal * \brief Check if two islands are equal
* *

@ -9,6 +9,7 @@ Board newBoard(const size_t nbPlayers) {
for (size_t player_i = 0; player_i < nbPlayers; player_i++) { for (size_t player_i = 0; player_i < nbPlayers; player_i++) {
for (int piece_i = 0; piece_i < nbPiecesPerPlayer; piece_i++) { for (int piece_i = 0; piece_i < nbPiecesPerPlayer; piece_i++) {
board.arrPieces[pieceIndex] = newPiece(player_i); board.arrPieces[pieceIndex] = newPiece(player_i);
pieceIndex++; pieceIndex++;
} }
} }

@ -11,6 +11,11 @@ Game newGame(const size_t nbPlayers, const char* pseudos[]) {
.board = newBoard(nbPlayers) .board = newBoard(nbPlayers)
}; };
if (nbPlayers == 2) {
g.currentPlayerID = 0;
g.phase = MOVE_PIECE;
}
// red, green, blue, yellow // red, green, blue, yellow
// TODO meilleures couleurs (?) // TODO meilleures couleurs (?)
SDL_Color colors[4] = { SDL_Color colors[4] = {

@ -1,6 +1,14 @@
#include "model/Island.h" #include "model/Island.h"
Island newIsland(const int x, const int y) {
Island i = {
.x = x,
.y = y
};
return i;
}
bool islandEqual(const Island a, const Island b) { bool islandEqual(const Island a, const Island b) {
return a.x == b.x && a.y == b.y; return a.x == b.x && a.y == b.y;
} }

Loading…
Cancel
Save