void create() { seteuid(getuid()); set("light", 1); set( "short", "The Petting Zoo." ); set( "long", @ENDLONG You are in a small petting zoo. ENDLONG ); set( "exits", ([ "south" : ROOMS(zoo1), "east" : ROOMS(zoo4), ]) ); ::create(); fill_room(1); }
t_shell *fill_shell(t_shell *shell, char *buff) { if (shell->ret == ANTS) { shell->ants = ft_atoi(buff); shell->type = ROOMS; } else if (shell->ret == ROOMS) shell->head = fill_room(shell->head, buff, shell); else if (shell->ret == PIPES) { fill_pipes(shell->head, buff); shell->type = PIPES; } return (shell); }
t_shell *parse_lines(t_shell *shell, char *buff) { while (get_next_line(0, &buff)) { ft_putendl(buff); if ((shell->ret == START || shell->ret == END) && shell->type != ANTS) { if (parsing_start_end(shell, buff) == 3) continue ; else if (parsing_start_end(shell, buff) == 2) break ; shell->head = fill_room(shell->head, buff, shell); shell->ret = 0; free(buff); continue; } shell->ret = ft_checkline(buff, shell->type, shell->head); if (shell->ret == ERROR) break ; shell = fill_shell(shell, buff); free(buff); } return (shell); }
reset() { if (!present("#BLAH#", TO)) fill_room(); }