| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
** EPITECH PROJECT, 2024 |
| 3 |
|
|
** zappy |
| 4 |
|
|
** File description: |
| 5 |
|
|
** incantation.c |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
#include "client.h" |
| 9 |
|
|
#include "server.h" |
| 10 |
|
|
|
| 11 |
|
3 |
void send_start_incantation_to_graphicals(client_t *client, server_t *server) |
| 12 |
|
|
{ |
| 13 |
|
3 |
char *ids = NULL; |
| 14 |
|
|
client_list_t *list; |
| 15 |
|
3 |
int ret = asprintf(&ids, "%d", client->id); |
| 16 |
|
|
|
| 17 |
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3 times.
|
12 |
TAILQ_FOREACH(list, &server->clients, entries) { |
| 18 |
2/4
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 |
if (list->client && list->client->is_graphic == false |
| 19 |
|
|
&& list->client->x == client->x |
| 20 |
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 |
&& list->client->y == client->y |
| 21 |
1/2
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 |
&& list->client->is_incanting |
| 22 |
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 |
&& list->client != client) { |
| 23 |
|
6 |
ret = asprintf(&ids, "%s %d", ids, list->client->id); |
| 24 |
|
|
} |
| 25 |
|
|
} |
| 26 |
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 |
if (ret == -1) |
| 27 |
|
✗ |
return; |
| 28 |
|
3 |
message_to_graphicals(server, "pic %hhd %hhd %zu %s\n", |
| 29 |
|
3 |
client->x, client->y, client->level, ids); |
| 30 |
|
|
} |
| 31 |
|
|
|