Esempio n. 1
0
void		prend(t_env *e, t_clients *player)
{
	char	**tab;
	char	msg[4];
	char	tmp[BUF_SIZE];

	tab = ft_strsplit(player->arg[0], ' ');
	ft_strcpy(msg, "ok\n");
	prend2(e, player, msg, tab);
	sprintf(tmp, "inv %d %d %d %d %d %d %d %d %s\n", player->nb
				, player->life, player->linemate
				, player->deraumere, player->sibur, player->mendiane
				, player->phiras, player->thystame, player->name);
	sprintf(tmp + strlen(tmp), "inside %d %d %d %d %d %d %d %d %d\n"
		, player->X, player->Y, e->map[player->Y][player->X].nourriture
		, e->map[player->Y][player->X].linemate
		, e->map[player->Y][player->X].deraumere
		, e->map[player->Y][player->X].sibur
		, e->map[player->Y][player->X].mendiane
		, e->map[player->Y][player->X].phiras
		, e->map[player->Y][player->X].thystame);
	maj_gfx(e, tmp);
	next_action(player);
	ft_strcat(player->buf_write, msg);
	ft_tabdel(&tab);
}
Esempio n. 2
0
void		prend3(t_env *e, int fd, t_player *tmp, char **tab)
{
  if ((strcmp(tab[0], "sibur") == 0) && tmp->player == fd
      && e->mapp[tmp->posX][tmp->posY].sibur >= atoi(tab[2]))
    {
      e->mapp[tmp->posX][tmp->posY].sibur =
	e->mapp[tmp->posX][tmp->posY].sibur - atoi(tab[2]);
      tmp->inventory->sibur += atoi(tab[2]);
    }
  else
    prend2(tab, tmp, e, fd);
}