Skip to content

Commit

Permalink
style(server): fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
neo-jgrec committed Jun 23, 2024
1 parent eb9e570 commit b4076d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/server/src/commands/ai/broadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ static void send_broadcast_to_graphicals(client_t *client, server_t *server)

void broadcast(client_t *client, server_t *server)
{
client_list_t *client_list_entry;
int d;
client_t *receiver;

TAILQ_FOREACH(client_list_entry, &server->clients, entries) {
receiver = client_list_entry->client;
for (client_list_t *tmp = TAILQ_FIRST(&server->clients); tmp != NULL;
tmp = TAILQ_NEXT(tmp, entries)) {
receiver = tmp->client;
if (receiver == client)
continue;
d = get_sound_direction(
Expand Down
12 changes: 8 additions & 4 deletions src/server/src/commands/ai/eject.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "client.h"
#include "server.h"
#include <stdarg.h>

static void purge_eggs_from_team(team_t *team, int x, int y)
{
Expand Down Expand Up @@ -62,6 +61,13 @@ static int set_dy(unsigned char orientation)
return 0;
}

void send_data_to_graphiscs(server_t *s, client_list_t *n)
{
message_to_graphicals(s, "pex %d\n", n->client->id);
message_to_graphicals(s, "ppo %d %d %d %d\n", n->client->id,
n->client->x, n->client->y, n->client->orientation);
}

void eject(client_t *c, server_t *s)
{
int width = s->proprieties.width;
Expand All @@ -77,9 +83,7 @@ void eject(client_t *c, server_t *s)
n->client->y = (n->client->y + dy + height) % height;
dprintf(n->client->fd, "eject: %d\n", get_orientation_to_tile(
c->x, c->y, n->client->x, n->client->y));
message_to_graphicals(s, "pex %d\n", n->client->id);
message_to_graphicals(s, "ppo %d %d %d %d\n", n->client->id,
n->client->x, n->client->y, n->client->orientation);
send_data_to_graphiscs(s, n);
}
}
delete_eggs_on_tile(s, c->x, c->y);
Expand Down
13 changes: 9 additions & 4 deletions src/server/src/commands/ai/incantation.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ static bool check_requirements_met(
size_t required_level
)
{
const size_t* req = required_resources[required_level - 1];
const size_t *req = required_resources[required_level - 1];

return (
players_on_tile >= req[0] &&
resource_count.linemate >= req[1] &&
Expand All @@ -52,7 +53,6 @@ static bool check_requirements_met(
);
}


static void remove_resource_from_tile(
tile_t *tile,
size_t resource_type,
Expand All @@ -68,7 +68,11 @@ static void remove_resource_from_tile(
}
}

static void remove_resources(tile_t *tile, info_map_t resources, size_t required_level)
static void remove_resources(
tile_t *tile,
info_map_t resources,
size_t required_level
)
{
size_t resource_count[7] = {
resources.food,
Expand All @@ -81,7 +85,8 @@ static void remove_resources(tile_t *tile, info_map_t resources, size_t required
};

for (size_t i = 0; i < 7; i++) {
for (size_t j = 0; j < required_resources[required_level - 1][i]; j++) {
for (size_t j = 0;
j < required_resources[required_level - 1][i]; j++) {
remove_resource_from_tile(tile, i, resource_count);
}
}
Expand Down

0 comments on commit b4076d8

Please sign in to comment.