| 158 | } |
| 159 | |
| 160 | bool Tile::getPassable(bool large, int height) |
| 161 | { |
| 162 | if (movementCostIn == 255) |
| 163 | return false; |
| 164 | |
| 165 | if (large) |
| 166 | { |
| 167 | if (movementCostLeft == 255) |
| 168 | return false; |
| 169 | if (movementCostRight == 255) |
| 170 | return false; |
| 171 | |
| 172 | if (position.x < 1 || position.y < 1 || position.z >= map.size.z - 1) |
| 173 | { |
| 174 | return false; |
| 175 | } |
| 176 | |
| 177 | auto tX = map.getTile(position.x - 1, position.y, position.z); |
| 178 | if (tX->movementCostIn == 255) |
| 179 | return false; |
| 180 | if (tX->movementCostRight == 255) |
| 181 | return false; |
| 182 | |
| 183 | auto tY = map.getTile(position.x, position.y - 1, position.z); |
| 184 | if (tY->movementCostIn == 255) |
| 185 | return false; |
| 186 | if (tY->movementCostLeft == 255) |
| 187 | return false; |
| 188 | |
| 189 | if (map.getTile(position.x - 1, position.y - 1, position.z)->movementCostIn == 255) |
| 190 | return false; |
| 191 | |
| 192 | auto tZ = map.getTile(position.x, position.y, position.z + 1); |
| 193 | if (tZ->movementCostIn == 255) |
| 194 | return false; |
| 195 | if (tZ->movementCostLeft == 255) |
| 196 | return false; |
| 197 | if (tZ->movementCostRight == 255) |
| 198 | return false; |
| 199 | |
| 200 | auto tXZ = map.getTile(position.x - 1, position.y, position.z + 1); |
| 201 | if (tXZ->movementCostIn == 255) |
| 202 | return false; |
| 203 | if (tXZ->movementCostRight == 255) |
| 204 | return false; |
| 205 | |
| 206 | auto tYZ = map.getTile(position.x, position.y - 1, position.z + 1); |
| 207 | if (tYZ->movementCostIn == 255) |
| 208 | return false; |
| 209 | if (tYZ->movementCostLeft == 255) |
| 210 | return false; |
| 211 | |
| 212 | if (map.getTile(position.x - 1, position.y - 1, position.z + 1)->movementCostIn == 255) |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | return height == 0 || getHeadFits(large, height); |
| 217 | } |
no test coverage detected