Make ChoiceQueue use smart pointers.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-05-31 18:00:39 +02:00
parent ff181204ae
commit 29cb4eac37
8 changed files with 32 additions and 35 deletions

View File

@@ -9,11 +9,11 @@ using namespace CreatureLib::Battling;
const ArbUt::BorrowedPtr<const BattleLibrary>& Battle::GetLibrary() const noexcept { return _library; }
bool Battle::CanUse(const BaseTurnChoice* choice) {
bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) {
AssertNotNull(choice)
if (choice->GetKind() == TurnChoiceKind::Attack) {
// HOOK: change number of uses needed.
return dynamic_cast<const AttackTurnChoice*>(choice)->GetAttack()->GetRemainingUses() >= 1;
return choice.ForceAs<AttackTurnChoice>()->GetAttack()->GetRemainingUses() >= 1;
}
return true;
}