Contains implementations for the functions used for team-related operations, like creating and deleting a team. More...
#include "team.h"
#include "constants.h"
#include "errors.h"
#include "round.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Functions | |
struct Player * | team_createPlayer (const char *name, const int isHuman) |
Creates a player. More... | |
struct Team * | team_createTeam () |
Creates a team. More... | |
int | team_addPlayer (struct Team *team, struct Player *player) |
Adds a player to a team. More... | |
int | team_removePlayer (struct Team *team, const struct Player *player) |
Removes a player from a team. More... | |
int | team_deleteTeam (struct Team **team) |
Deletes a team and sets the pointer to NULL. More... | |
int | team_deletePlayer (struct Player **player) |
Deletes a player and sets the pointer to NULL. More... | |
int | team_addCard (struct Player *player, struct Card *card) |
Passes a card to a player. The function doesn't check if the card has valid value and valid suit. More... | |
int | team_hasCards (const struct Player *player) |
Checks if a player has any card. More... | |
int | team_updatePlayersScore (struct Team *team) |
Updates all players scores, assigning team score to them. More... | |
Contains implementations for the functions used for team-related operations, like creating and deleting a team.
Passes a card to a player. The function doesn't check if the card has valid value and valid suit.
player | The player who receives the card. |
card | The card to be received. |
Adds a player to a team.
team | The team to which the player is added. |
player | The player to be added to the team. |
struct Player* team_createPlayer | ( | const char * | name, |
const int | isHuman | ||
) |
Creates a player.
name | The name of the new player. |
isHuman | Player type. |
struct Team* team_createTeam | ( | ) |
Creates a team.
int team_deletePlayer | ( | struct Player ** | player | ) |
Deletes a player and sets the pointer to NULL.
player | The player to be deleted. |
int team_deleteTeam | ( | struct Team ** | team | ) |
Deletes a team and sets the pointer to NULL.
team | The team to be deleted. |
int team_hasCards | ( | const struct Player * | player | ) |
Checks if a player has any card.
player | Pointer to the player that is checked |
Removes a player from a team.
team | The team from where the player is removed. |
player | The player that will be removed. |