| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
** EPITECH PROJECT, 2024 |
| 3 |
|
|
** zappy |
| 4 |
|
|
** File description: |
| 5 |
|
|
** mct.c |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
#include "server.h" |
| 9 |
|
|
|
| 10 |
|
4 |
static info_map_t get_tile(server_t *server, size_t x, size_t y) |
| 11 |
|
|
{ |
| 12 |
|
4 |
tile_t tile = server->map[x + y * server->proprieties.width]; |
| 13 |
|
|
info_map_t info = {0}; |
| 14 |
|
|
|
| 15 |
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 |
for (size_t i = 0; i < tile.num_objects; i++) { |
| 16 |
|
✗ |
info.food += tile.objects[i] == FOOD; |
| 17 |
|
✗ |
info.linemate += tile.objects[i] == LINEMATE; |
| 18 |
|
✗ |
info.deraumere += tile.objects[i] == DERAUMERE; |
| 19 |
|
✗ |
info.sibur += tile.objects[i] == SIBUR; |
| 20 |
|
✗ |
info.mendiane += tile.objects[i] == MENDIANE; |
| 21 |
|
✗ |
info.phiras += tile.objects[i] == PHIRAS; |
| 22 |
|
✗ |
info.thystame += tile.objects[i] == THYSTAME; |
| 23 |
|
|
} |
| 24 |
|
4 |
return info; |
| 25 |
|
|
} |
| 26 |
|
|
|
| 27 |
|
1 |
void mct(client_t *client, server_t *server) |
| 28 |
|
|
{ |
| 29 |
|
|
info_map_t info; |
| 30 |
|
|
|
| 31 |
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 |
for (size_t y = 0; y < (size_t)server->proprieties.height; y++) { |
| 32 |
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
|
6 |
for (size_t x = 0; x < (size_t)server->proprieties.width; x++) { |
| 33 |
|
4 |
info = get_tile(server, x, y); |
| 34 |
|
4 |
dprintf(client->fd, "bct %ld %ld %d %d %d %d %d %d %d\n", |
| 35 |
|
|
x, y, info.food, info.linemate, info.deraumere, info.sibur, |
| 36 |
|
|
info.mendiane, info.phiras, info.thystame |
| 37 |
|
|
); |
| 38 |
|
|
} |
| 39 |
|
|
} |
| 40 |
|
1 |
} |
| 41 |
|
|
|