void finddir() { int i, ui = u.di; for(i = 0; i <= 8; i++){ if(flags.run & 1) ui++; else ui += 7; ui %= 8; if(i == 8){ pline("Not near a wall."); flags.move = multi = 0; return; } if(!isroom(u.ux+xdir[ui], u.uy+ydir[ui])) break; } for(i = 0; i <= 8; i++){ if(flags.run & 1) ui += 7; else ui++; ui %= 8; if(i == 8){ pline("Not near a room."); flags.move = multi = 0; return; } if(isroom(u.ux+xdir[ui], u.uy+ydir[ui])) break; } u.di = ui; u.dx = xdir[ui]; u.dy = ydir[ui]; }
void map_manager(t_map **map, t_path **antpit) { int i; i = 0; while ((*map)->cleanfile[i] != NULL) { if ((*map)->nb_ants == 0) check_ants(map, i, 0); i++; } i = (*map)->antindex + 1; while ((*map)->error != 1 && (*map)->cleanfile[i] != NULL) { if ((isroom(map, i, antpit)) == 0 && (istube(map, i, antpit)) == 0) { if (iscommand(map, i, antpit) <= 0) (*map)->error = 1; } i++; } error_manager(map, antpit); max_paths(antpit); matrix_duplicator(antpit); }