| 289 | } |
| 290 | |
| 291 | void Tile::updateBattlescapeUnitPresent() |
| 292 | { |
| 293 | firstUnitPresent = nullptr; |
| 294 | for (auto &o : intersectingObjects) |
| 295 | { |
| 296 | if (o->getType() == TileObject::Type::Unit) |
| 297 | { |
| 298 | auto u = std::static_pointer_cast<TileObjectBattleUnit>(o); |
| 299 | if (!firstUnitPresent) |
| 300 | { |
| 301 | firstUnitPresent = u; |
| 302 | } |
| 303 | auto pos = o->getPosition(); |
| 304 | auto x = pos.x - position.x; |
| 305 | auto y = pos.y - position.y; |
| 306 | doorOpeningUnitPresent = |
| 307 | doorOpeningUnitPresent | (x > 0.45f && x < 0.55f && y > 0.45f && y < 0.55f) || |
| 308 | u->getUnit()->isLarge(); |
| 309 | if (firstUnitPresent && doorOpeningUnitPresent) |
| 310 | { |
| 311 | break; |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | if (!firstUnitPresent) |
| 316 | { |
| 317 | doorOpeningUnitPresent = false; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | void Tile::updateCityscapeParameters() |
| 322 | { |
no test coverage detected