| 155 | FloodBrush(DFHack::Core *c){c_ = c;}; |
| 156 | ~FloodBrush(){}; |
| 157 | coord_vec points(MapExtras::MapCache & mc, DFHack::DFCoord start) |
| 158 | { |
| 159 | using namespace DFHack; |
| 160 | coord_vec v; |
| 161 | |
| 162 | std::stack<DFCoord> to_flood; |
| 163 | to_flood.push(start); |
| 164 | |
| 165 | std::set<DFCoord> seen; |
| 166 | |
| 167 | while (!to_flood.empty()) { |
| 168 | DFCoord xy = to_flood.top(); |
| 169 | to_flood.pop(); |
| 170 | |
| 171 | df::tile_designation des = mc.designationAt(xy); |
| 172 | |
| 173 | if (seen.find(xy) == seen.end() |
| 174 | && des.bits.flow_size |
| 175 | && des.bits.liquid_type == tile_liquid::Water) { |
| 176 | v.push_back(xy); |
| 177 | seen.insert(xy); |
| 178 | |
| 179 | maybeFlood(DFCoord(xy.x - 1, xy.y, xy.z), to_flood, mc); |
| 180 | maybeFlood(DFCoord(xy.x + 1, xy.y, xy.z), to_flood, mc); |
| 181 | maybeFlood(DFCoord(xy.x, xy.y - 1, xy.z), to_flood, mc); |
| 182 | maybeFlood(DFCoord(xy.x, xy.y + 1, xy.z), to_flood, mc); |
| 183 | |
| 184 | df::tiletype tt = mc.tiletypeAt(xy); |
| 185 | if (LowPassable(tt)) |
| 186 | { |
| 187 | maybeFlood(DFCoord(xy.x, xy.y, xy.z - 1), to_flood, mc); |
| 188 | } |
| 189 | if (HighPassable(tt)) |
| 190 | { |
| 191 | maybeFlood(DFCoord(xy.x, xy.y, xy.z + 1), to_flood, mc); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | return v; |
| 197 | } |
| 198 | std::string str() const { |
| 199 | return "flood"; |
| 200 | } |
nothing calls this directly
no test coverage detected