| 49 | } |
| 50 | |
| 51 | bool ChannelJobs::possible_cavein(const df::coord &job_pos) { |
| 52 | for (auto iter : active) { |
| 53 | if (iter == job_pos) continue; |
| 54 | if (calc_distance(job_pos, iter) <= 2) { |
| 55 | // find neighbours |
| 56 | df::coord n1[8]; |
| 57 | df::coord n2[8]; |
| 58 | get_neighbours(job_pos, n1); |
| 59 | get_neighbours(iter, n2); |
| 60 | // find shared neighbours |
| 61 | for (int i = 0; i < 7; ++i) { |
| 62 | for (int j = i + 1; j < 8; ++j) { |
| 63 | if (n1[i] == n2[j]) { |
| 64 | if (has_cavein_conditions(n1[i])) { |
| 65 | WARN(jobs).print("Channel-Safely::jobs: Cave-in conditions detected at (" COORD ")\n", COORDARGS(n1[i])); |
| 66 | return true; |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | // adds map_pos to a group if an adjacent one exists, or creates one if none exist... if multiple exist they're merged into the first found |
| 77 | void ChannelGroups::add(const df::coord &map_pos) { |
no test coverage detected