t_path *find_ways(t_map *map) { t_path *path; init_path(&path); add_access(map->start->name, &path->access); map->start->val = 0; travel_rooms(map, map->start, 1, path); if (path->way == NULL) my_error("~ Error : there are no way found to the final room ~\n"); return (path); }
void cgi_access_manager::fill_access(const CString& container){ nextgen_v2 hfile(container); int recompile = 0; CString s; CVector<CString> tokens; while (!hfile.feofc()) { s = hfile.read_line(); s.Tokenizer(',', tokens); if (tokens.Count() == 2){ if (tokens[1][0] == ' ') { recompile=1; tokens[1].StrTrim32(); } else tokens[1].Decrypt(); add_access(tokens[0], tokens[1]); } else if (tokens.Count() > 2) cerr << "malformed token at cgi_access::fill_access() " << tokens[0] << elf; } if (recompile) cgi_access_write(container); }
void travel_rooms(t_map *map, t_room *current, int value, t_path *path) { t_room *access; t_access *tmp; tmp = current->access; if (current == map->end) get_path(path, value); while (tmp != NULL && current != map->end) { access = find_room(map, tmp->name); if (access->val == -1 || access->val > value) { access->val = value; add_access(tmp->name, &path->access); travel_rooms(map, access, (value + 1), path); remove_last_access(&path->access); } tmp = tmp->next; } }