| 217 | } |
| 218 | |
| 219 | bool Tile::getHeadFits(bool large, int height) |
| 220 | { |
| 221 | if (position.z + (large ? 2 : 1) >= map.size.z) |
| 222 | return true; |
| 223 | if (large) |
| 224 | { |
| 225 | // Check four tiles above our "to"'s head |
| 226 | if (map.getTile(Vec3<int>{position.x, position.y, position.z + 2})->solidGround || |
| 227 | map.getTile(Vec3<int>{position.x - 1, position.y, position.z + 2})->solidGround || |
| 228 | map.getTile(Vec3<int>{position.x, position.y - 1, position.z + 2})->solidGround || |
| 229 | map.getTile(Vec3<int>{position.x - 1, position.y - 1, position.z + 2})->solidGround) |
| 230 | { |
| 231 | auto toX1 = map.getTile(Vec3<int>{position.x - 1, position.y, position.z}); |
| 232 | auto toY1 = map.getTile(Vec3<int>{position.x, position.y - 1, position.z}); |
| 233 | auto toXY1 = map.getTile(Vec3<int>{position.x - 1, position.y - 1, position.z}); |
| 234 | |
| 235 | float maxHeight = this->height; |
| 236 | maxHeight = std::max(maxHeight, toX1->height); |
| 237 | maxHeight = std::max(maxHeight, toY1->height); |
| 238 | maxHeight = std::max(maxHeight, toXY1->height); |
| 239 | if (height + maxHeight * 40 - 1 > 80) |
| 240 | { |
| 241 | return false; |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | else |
| 246 | { |
| 247 | if (map.getTile(Vec3<int>{position.x, position.y, position.z + 1})->solidGround && |
| 248 | height + this->height * 40 - 1 > 40) |
| 249 | { |
| 250 | return false; |
| 251 | } |
| 252 | } |
| 253 | return true; |
| 254 | } |
| 255 | |
| 256 | void Tile::updateBattlescapeUIDrawOrder() |
| 257 | { |