Make ChoiceQueue use smart pointers.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace CreatureLib::Battling {
|
||||
[[nodiscard]] const ArbUt::BorrowedPtr<const BattleLibrary>& GetLibrary() const noexcept;
|
||||
[[nodiscard]] uint32_t GetCurrentTurn() const noexcept { return _currentTurn; }
|
||||
|
||||
virtual bool CanUse(const BaseTurnChoice* choice);
|
||||
virtual bool CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice);
|
||||
virtual bool TrySetChoice(BaseTurnChoice* choice);
|
||||
|
||||
bool CanFlee() const noexcept { return _canFlee; }
|
||||
|
||||
Reference in New Issue
Block a user