/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* lst_textures.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: aortigos name = ft_substr(line, 0, 2); // Extract everything after identifier list->value = ft_substr(line, get_index(line, 2), ft_strlen(line)); } else if ((!ft_strncmp(line, "F", 1) || !ft_strncmp(line, "C", 1))) { // Extract first char as identifier list->name = ft_substr(line, 0, 1); // Extract RGB values after identifier list->value = ft_substr(line, get_index(line, 1), ft_strlen(line)); } list->next = NULL; return (list); } void lst_back_ture(t_texture_list **l_ture, t_texture_list *new) { t_texture_list *tmp; // If list is empty, new nodes becomes head if (!*l_ture) { (*l_ture) = new; return ; } tmp = *l_ture; while (tmp->next) tmp = tmp->next; tmp->next = new; } int lst_ture(t_data *m, t_texture_list **l_ture) { int i; t_texture_list *tmp; i = 0; // Process all 6 texture directives while (m->texture2d[i]) { // Create node for each texture line tmp = new_texture(m->texture2d[i++]); if (!tmp) return (0); // Add to end of list lst_back_ture(l_ture, tmp); } return (1); }