| 3609 | } |
| 3610 | |
| 3611 | void Battle::loadAnimationPacks(GameState &state) |
| 3612 | { |
| 3613 | if (state.battle_unit_animation_packs.size() > 0) |
| 3614 | { |
| 3615 | LogInfo("Animation packs are already loaded."); |
| 3616 | return; |
| 3617 | } |
| 3618 | // Find out all animation packs used by units |
| 3619 | std::set<UString> animationPacks; |
| 3620 | UString brainsucker = "bsk"; |
| 3621 | bool brainsuckerFound = false; |
| 3622 | UString hyperworm = "hypr"; |
| 3623 | UString multiworm = "multi"; |
| 3624 | bool hyperwormFound = false; |
| 3625 | for (auto &o : participants) |
| 3626 | { |
| 3627 | for (auto &t : o->guard_types_reinforcements) |
| 3628 | { |
| 3629 | for (auto &ap : t->animation_packs) |
| 3630 | { |
| 3631 | auto packName = BattleUnitAnimationPack::getNameFromID(ap.id); |
| 3632 | if (animationPacks.find(packName) == animationPacks.end()) |
| 3633 | { |
| 3634 | animationPacks.insert(packName); |
| 3635 | } |
| 3636 | if (packName == hyperworm) |
| 3637 | { |
| 3638 | hyperwormFound = true; |
| 3639 | } |
| 3640 | if (!hyperwormFound && packName == multiworm) |
| 3641 | { |
| 3642 | animationPacks.insert(hyperworm); |
| 3643 | hyperwormFound = true; |
| 3644 | } |
| 3645 | if (packName == brainsucker) |
| 3646 | { |
| 3647 | brainsuckerFound = true; |
| 3648 | } |
| 3649 | } |
| 3650 | } |
| 3651 | } |
| 3652 | for (auto &u : units) |
| 3653 | { |
| 3654 | for (auto &ap : u.second->agent->type->animation_packs) |
| 3655 | { |
| 3656 | auto packName = BattleUnitAnimationPack::getNameFromID(ap.id); |
| 3657 | if (animationPacks.find(packName) == animationPacks.end()) |
| 3658 | { |
| 3659 | animationPacks.insert(packName); |
| 3660 | } |
| 3661 | if (packName == hyperworm) |
| 3662 | { |
| 3663 | hyperwormFound = true; |
| 3664 | } |
| 3665 | if (!hyperwormFound && packName == multiworm) |
| 3666 | { |
| 3667 | animationPacks.insert(hyperworm); |
| 3668 | hyperwormFound = true; |
nothing calls this directly
no test coverage detected