#include <sys/select.h>
#include "arg_parse.h"
Go to the source code of this file.
|
| enum | ressources_type_s {
FOOD
, LINEMATE
, DERAUMERE
, SIBUR
,
MENDIANE
, PHIRAS
, THYSTAME
} |
| |
| enum | direction_s {
UNDEFINED
, LEFT
, RIGHT
, UP
,
DOWN
} |
| |
◆ cli_t
A structure to store every client/player data.
- Parameters
-
| fd | The file descriptor of the client |
| is_connected | Is he connected to the server |
| team_name | The team where he is |
| client_num | His numero in the team |
| level | His level in the game |
| pos | His position in the map (0 = x, 1 = y) |
| ressources | His inventory |
| time_life | His time life |
| direction | His direction (LEFT, RIGHT, UP, DOWN) |
◆ direction_t
◆ game_data_t
A structure to store the game data.
- Parameters
-
| map_size | The size of the map (x = 0, y = 1) |
| frequence | The frequence passed in parameter |
| ressources_quantity | The max number, a ressource can have in the map |
| total_ressources | All the ressources in the map |
| teams | Every team data |
| clients | Every client data |
| map | Map content |
◆ map_t
A structure to store every tiles content (Must be an 2D array)
- Parameters
-
| player_nb | The number of player in a tile |
| ressources | The number of ressourcees in a tile |
◆ ressources_t
A structure to count ressources in the game.
- Parameters
-
| food_nb | |
| linemate_nb | |
| deraumere_nb | |
| sibur_nb | |
| mendiane_nb | |
| phiras_nb | |
| thystame_nb | |
◆ ressources_type_t
◆ server_handler_t
A structure to store server general data.
- Parameters
-
| socket | The socket of the server for the connexion |
| current_fd | Every fd storage |
| ready_fd | Usable fd for select function |
| game_data | The game data |
| fd_queue | The queue to wait a fd to give his team name |
◆ team_t
A structure to store every team data.
- Parameters
-
| team_name | The name of the team |
| client_total | The total number of client it has |
| clint_num_list | The list of every client number (Refer to "client_num" in cli_t structure) |
◆ direction_s
◆ ressources_type_s
| Enumerator |
|---|
| FOOD | |
| LINEMATE | |
| DERAUMERE | |
| SIBUR | |
| MENDIANE | |
| PHIRAS | |
| THYSTAME | |
Definition at line 25 of file server_handler.h.
◆ command_handling()
Handle client message/command.
- Parameters
-
| server | The general server structure |
| fd | The file descriptor where the message come from |
Definition at line 108 of file command_handling.c.
◆ init_game_data()
The function to initialize every game data.
- Parameters
-
| server | The general server structure |
| arguments | All parsed arguments passed as program parameter |
- Returns
- (0) if datas are initialized successfully, (-1) if not
Definition at line 156 of file game_data_initialization.c.
◆ server_initialization()
The function to initialize every server data.
- Parameters
-
| server | The general server structure |
| arguments | All parsed arguments passed as program parameter |
- Returns
- (0) if datas are initialized successfully, (-1) if not
Definition at line 47 of file server_initialization.c.
◆ server_loop()
The server loop where communication client/server can be done.
- Parameters
-
| server | The general server structure |
Definition at line 67 of file server_loop.c.