Remove all solid walls and ground that ended up inside large units For now, removes only ground
| 422 | // Remove all solid walls and ground that ended up inside large units |
| 423 | // For now, removes only ground |
| 424 | void Battle::initialMapPartRemoval(GameState &state) |
| 425 | { |
| 426 | std::ignore = state; |
| 427 | for (auto &u : units) |
| 428 | { |
| 429 | if (!u.second->isLarge()) |
| 430 | continue; |
| 431 | for (int x = 0; x < 1; x++) |
| 432 | { |
| 433 | for (int y = 0; y < 1; y++) |
| 434 | { |
| 435 | auto t = map->getTile(u.second->position + Vec3<float>{-x, -y, 1.0f}); |
| 436 | if (t->solidGround) |
| 437 | { |
| 438 | std::list<sp<TileObjectBattleMapPart>> partsToKill; |
| 439 | for (auto &o : t->ownedObjects) |
| 440 | { |
| 441 | if (o->getType() == TileObject::Type::Ground) |
| 442 | { |
| 443 | partsToKill.push_back( |
| 444 | std::static_pointer_cast<TileObjectBattleMapPart>(o)); |
| 445 | } |
| 446 | } |
| 447 | for (auto &p : partsToKill) |
| 448 | { |
| 449 | LogWarning("Removing MP %s at %s as it's blocking unit %s", |
| 450 | p->getOwner()->type.id, p->getPosition(), u.first); |
| 451 | auto mp = p->getOwner(); |
| 452 | mp->destroyed = true; |
| 453 | mp->tileObject->removeFromMap(); |
| 454 | mp->tileObject.reset(); |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | void Battle::initialMapPartLinkUp() |
| 463 | { |
nothing calls this directly
no test coverage detected