@@ -20,57 +20,6 @@ void ChannelJobs::load_channel_jobs() {
2020 }
2121}
2222
23- bool ChannelJobs::has_cavein_conditions (const df::coord &map_pos) const {
24- auto p = map_pos;
25- auto ttype = *Maps::getTileType (p);
26- if (!DFHack::isOpenTerrain (ttype)) {
27- // check shared neighbour for cave-in conditions
28- df::coord neighbours[4 ];
29- get_connected_neighbours (map_pos, neighbours);
30- int connectedness = 4 ;
31- for (auto n: neighbours) {
32- if (!Maps::isValidTilePos (n) || active.count (n) || DFHack::isOpenTerrain (*Maps::getTileType (n))) {
33- connectedness--;
34- }
35- }
36- if (!connectedness) {
37- // do what?
38- p.z --;
39- if (!Maps::isValidTilePos (p)) return false ;
40- ttype = *Maps::getTileType (p);
41- if (DFHack::isOpenTerrain (ttype) || DFHack::isFloorTerrain (ttype)) {
42- return true ;
43- }
44- }
45- }
46- return false ;
47- }
48-
49- bool ChannelJobs::possible_cavein (const df::coord &job_pos) const {
50- for (auto dig_pos : active) {
51- if (dig_pos == job_pos) continue ;
52- if (calc_distance (job_pos, dig_pos) <= 2 ) {
53- // find neighbours
54- df::coord n1[8 ];
55- df::coord n2[8 ];
56- get_neighbours (job_pos, n1);
57- get_neighbours (dig_pos, n2);
58- // find shared neighbours
59- for (int i = 0 ; i < 7 ; ++i) {
60- for (int j = i + 1 ; j < 8 ; ++j) {
61- if (n1[i] == n2[j]) {
62- if (has_cavein_conditions (n1[i])) {
63- WARN (jobs).print (" Channel-Safely::jobs: Cave-in conditions detected at (" COORD " )\n " , COORDARGS (n1[i]));
64- return true ;
65- }
66- }
67- }
68- }
69- }
70- }
71- return false ;
72- }
73-
7423// 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
7524void ChannelGroups::add (const df::coord &map_pos) {
7625 // if we've already added this, we don't need to do it again
0 commit comments