diff --git a/Pontu/include/model/Island.h b/Pontu/include/model/Island.h index 8f21996..2bbcbf2 100644 --- a/Pontu/include/model/Island.h +++ b/Pontu/include/model/Island.h @@ -22,6 +22,15 @@ typedef struct // bool hasPiece; ///< Indicates if there is a Piece on this 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 * diff --git a/Pontu/src/model/Board.c b/Pontu/src/model/Board.c index 176a5bf..ed82a09 100644 --- a/Pontu/src/model/Board.c +++ b/Pontu/src/model/Board.c @@ -9,6 +9,7 @@ Board newBoard(const size_t nbPlayers) { for (size_t player_i = 0; player_i < nbPlayers; player_i++) { for (int piece_i = 0; piece_i < nbPiecesPerPlayer; piece_i++) { board.arrPieces[pieceIndex] = newPiece(player_i); + pieceIndex++; } } diff --git a/Pontu/src/model/Game.c b/Pontu/src/model/Game.c index 3f34e05..f75c585 100644 --- a/Pontu/src/model/Game.c +++ b/Pontu/src/model/Game.c @@ -11,6 +11,11 @@ Game newGame(const size_t nbPlayers, const char* pseudos[]) { .board = newBoard(nbPlayers) }; + if (nbPlayers == 2) { + g.currentPlayerID = 0; + g.phase = MOVE_PIECE; + } + // red, green, blue, yellow // TODO meilleures couleurs (?) SDL_Color colors[4] = { diff --git a/Pontu/src/model/Island.c b/Pontu/src/model/Island.c index 993c49e..885386c 100644 --- a/Pontu/src/model/Island.c +++ b/Pontu/src/model/Island.c @@ -1,6 +1,14 @@ #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) { return a.x == b.x && a.y == b.y; }