Player and Team structures, with helper functions.
More...
Go to the source code of this file.
Player and Team structures, with helper functions.
EXPORT 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.
- Parameters
-
player | The player who receives the card. |
card | The card to be received. |
- Returns
- NO_ERROR on success, other value on failure.
EXPORT int team_addPlayer |
( |
struct Team * |
team, |
|
|
struct Player * |
player |
|
) |
| |
Adds a player to a team.
- Parameters
-
team | The team to which the player is added. |
player | The player to be added to the team. |
- Returns
- NO_ERROR on success, other value on failure.
EXPORT struct Player* team_createPlayer |
( |
const char * |
name, |
|
|
const int |
isHuman |
|
) |
| |
Creates a player.
- Parameters
-
name | The name of the new player. |
isHuman | Player type. |
- Returns
- Pointer to the created player. Needs to be freed.
EXPORT struct Team* team_createTeam |
( |
| ) |
|
Creates a team.
- Returns
- Pointer to the created team. Needs to be freed.
EXPORT int team_deletePlayer |
( |
struct Player ** |
player | ) |
|
Deletes a player and sets the pointer to NULL.
- Parameters
-
player | The player to be deleted. |
- Returns
- NO_ERROR on success, other value on failure.
EXPORT int team_deleteTeam |
( |
struct Team ** |
team | ) |
|
Deletes a team and sets the pointer to NULL.
- Parameters
-
team | The team to be deleted. |
- Returns
- NO_ERROR on success, error code otherwise.
EXPORT int team_hasCards |
( |
const struct Player * |
player | ) |
|
Checks if a player has any card.
- Parameters
-
player | Pointer to the player that is checked |
- Returns
- 1 in case of success, 0 otherwise
EXPORT int team_removePlayer |
( |
struct Team * |
team, |
|
|
const struct Player * |
player |
|
) |
| |
Removes a player from a team.
- Parameters
-
team | The team from where the player is removed. |
player | The player that will be removed. |
- Returns
- NO_ERROR on success, other value on failure.
EXPORT int team_updatePlayersScore |
( |
struct Team * |
team | ) |
|
Updates all players scores, assigning team score to them.
- Parameters
-
team | The team where to update the score. |
- Returns
- NO_ERROR or 0 on success, other value on failure.