t_dot *make_tab(t_list *head) { t_dot *out; t_mlx data; int ct; ct = 0; if (!(out = (t_dot*)malloc(sizeof(t_dot) * ((last_of(head)->x + 1) * (last_of(head)->y + 1) + 1)))) return (NULL); data.len = last_of(head)->x + 1; data.line = last_of(head)->y + 1; while (head) { (out + ct)->x = BEG_X + LEN * head->x + CST * head->z * LEN; (out + ct)->y = BEG_Y + LEN * head->y + (CST / 2) * head->z * LEN; (out + ct)->end = 0; (out + ct)->color = 0; head = head->next; ct++; } (out + ct)->end = 1; put_dots(out, data); return (out); }
t_list *last_of(t_list *head) { if (!head) return (NULL); else if (!head->next) return (head); else return (last_of(head->next)); }
int main() { return last_of(false,100.f,"8",-9,42); }