| 115 | } |
| 116 | |
| 117 | bool Constructions::designateRemove(df::coord pos, bool *immediate) |
| 118 | { |
| 119 | using df::global::process_dig; |
| 120 | |
| 121 | if (immediate) |
| 122 | *immediate = false; |
| 123 | |
| 124 | if (auto current = Buildings::findAtTile(pos)) |
| 125 | { |
| 126 | auto cons = strict_virtual_cast<df::building_constructionst>(current); |
| 127 | if (!cons) |
| 128 | return false; |
| 129 | |
| 130 | if (Buildings::deconstruct(cons)) |
| 131 | { |
| 132 | if (immediate) |
| 133 | *immediate = true; |
| 134 | } |
| 135 | |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | auto block = Maps::getTileBlock(pos); |
| 140 | if (!block) |
| 141 | return false; |
| 142 | |
| 143 | auto ttype = block->tiletype[pos.x&15][pos.y&15]; |
| 144 | |
| 145 | if (tileMaterial(ttype) == tiletype_material::CONSTRUCTION) |
| 146 | { |
| 147 | // don't designate pseudo-constructions |
| 148 | auto constr = df::construction::find(pos); |
| 149 | if (!constr || constr->flags.bits.top_of_wall) |
| 150 | return false; |
| 151 | |
| 152 | auto &dsgn = block->designation[pos.x&15][pos.y&15]; |
| 153 | dsgn.bits.dig = tile_dig_designation::Default; |
| 154 | block->flags.bits.designated = true; |
| 155 | if (process_dig) |
| 156 | *process_dig = true; |
| 157 | return true; |
| 158 | } |
| 159 | |
| 160 | return false; |
| 161 | } |
nothing calls this directly
no test coverage detected