void ft_parse_room_name(t_lem *lem, char **tab, int i) { long long x; long long y; int fail; fail = 0; if (!ft_seek_name(lem, tab[0]) || ft_nbrchr(tab[0], '-') != 0) { ft_litle_check_xy(lem, tab); if (ft_int(x = ft_latoi(tab[1]))) { if (ft_int(y = ft_latoi(tab[2])) && ft_check_xy(lem->anthill, x, y)) ft_pushback_room(lem, tab, i); else fail = 1; } else fail = 1; } else fail = 1; if (fail) { ft_free2d(tab); ft_exit_lem(lem); } }
static void ft_modim(int p, t_env *e) { double pp[2]; double c[2]; double tmp; unsigned int couleur; int i; couleur = 0; i = -1; pp[0] = 0.5; pp[1] = 0; c[0] = (double)(p % SIZE_W) / SIZE_W * (e->xmax - e->xmin) + e->xmin; c[1] = (double)(p / SIZE_W) / SIZE_W * (e->ymax - e->ymin) + e->ymin; ft_int(p, c, couleur, e); if (hypot(c[0], c[1]) > 0.99 && hypot(c[0] - 2, c[1]) > 0.99) { while (hypot(pp[0], pp[1]) < 2 && ++i < ITER) { couleur = ft_couleur(i); tmp = pp[0]; pp[0] = ft_equa(0, c, pp, tmp); pp[1] = ft_equa(1, c, pp, tmp); } put_pixelle(p, &couleur, e); } }
int ft_form2(t_format *tmp, va_list ap) { if (tmp->type == 's') return (ft_string(tmp, ap)); else if (tmp->type == 'C' || (tmp->type == 'c' && ft_strcmp(tmp->lenght, "l") == 0)) return (ft_wint(tmp, ap)); else if (tmp->type == 'c') return (ft_char(tmp, ap)); else if (tmp->type == 'd' || tmp->type == 'i' || tmp->type == 'D') return (ft_int(tmp, ap)); else if (tmp->type == 'f' || tmp->type == 'F') return (ft_float(tmp, ap)); else if (tmp->type == 'u' || tmp->type == 'U') return (ft_unint(tmp, ap)); else if (tmp->type == 'o' || tmp->type == 'O') return (ft_octal(tmp, ap)); else if (tmp->type == 'b' || tmp->type == 'B') return (ft_binaire(tmp, ap)); else if (tmp->type == 'e' || tmp->type == 'E') return (ft_scienti(tmp, ap)); else if (tmp->type == 'x' || tmp->type == 'X') return (ft_hexa(tmp, ap)); else if (tmp->type == 'p') return (ft_adrpoint(tmp, ap)); else return (ft_char(tmp, ap)); }
static void ft_prec(const char *form, va_list *ap, int *i, int *count) { int precision; int *tab[2]; precision = 0; *i += 2; precision = va_arg(*ap, int); tab[0] = i; tab[1] = &precision; if (ft_strchr("eEf", form[*i]) || (ft_strchr("lL", form[*i]) && ft_strchr("eEf", form[*i + 1]))) ft_float(form, ap, tab, count); else if (ft_strchr("xXdiuo", form[*i])) ft_int(form, ap, tab, count); else if (form[*i] == 's') { *count += ft_putnstr_fd(va_arg(*ap, char*), precision, g_fd); *i += 2; }