static void ft_add_node(char *str) { char alias[50]; char string[200]; int i; i = 0; while (*str && *str != ' ') str++; str++; while (*str != '=') { alias[i] = *str; i++; str++; } str += 2; alias[i] = '\0'; i = 0; while (*str != '\'' && *str) { string[i] = *str; str++; i++; } string[i] = '\0'; ft_create_node(alias, string); }
t_node *ft_unshift(t_node *begin, char *data) { t_node *node; node = ft_create_node(data); node->next = begin; return (node); }
t_node *ft_push(t_node *begin, char *data) { t_node *node; t_node *current; node = ft_create_node(data); current = begin; while (current->next != NULL) current = current->next; current->next = node; return (begin); }
void ft_life(t_cmd *cmd, t_game *g) { t_cmd *tmp; if (g->cls[cmd->num_cli].cs == cmd->fd) { g->cls[cmd->num_cli].resource.nourriture--; if (g->cls[cmd->num_cli].resource.nourriture <= 0) ft_death(cmd, g); else { tmp = ft_create_node(g, "life", cmd->num_cli, 0); ft_add_node(g, tmp); } } }
static void *fdtm_create_node(const void *phandle, const char *name) { return ft_create_node(&cxt, phandle, name); }