Make the last couple classes 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:
@@ -36,7 +36,7 @@ void BattleSide::SetChoice(BaseTurnChoice* choice) {
|
||||
_choicesSet++;
|
||||
}
|
||||
|
||||
void BattleSide::SetCreature(Creature* creature, uint8_t index) {
|
||||
void BattleSide::SetCreature(ArbUt::BorrowedPtr<Creature> creature, uint8_t index) {
|
||||
auto old = _creatures[index];
|
||||
if (old != nullptr) {
|
||||
old->SetOnBattleField(false);
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CreatureLib::Battling {
|
||||
void SetChoice(BaseTurnChoice* choice);
|
||||
void ResetChoices() noexcept;
|
||||
|
||||
void SetCreature(Creature* creature, uint8_t index);
|
||||
void SetCreature(ArbUt::BorrowedPtr<Creature> creature, uint8_t index);
|
||||
|
||||
const ArbUt::BorrowedPtr<Creature>& GetCreature(uint8_t index) const;
|
||||
bool CreatureOnSide(const ArbUt::BorrowedPtr<Creature>& creature) const;
|
||||
|
||||
@@ -44,8 +44,9 @@ namespace CreatureLib::Battling {
|
||||
std::unique_ptr<Script> _script = nullptr;
|
||||
|
||||
public:
|
||||
ExecutingAttack(const ArbUt::List<ArbUt::BorrowedPtr<Creature>>& targets, uint8_t numberHits, Creature* user,
|
||||
const ArbUt::BorrowedPtr<LearnedAttack>& attack, const std::unique_ptr<Script>& script)
|
||||
ExecutingAttack(const ArbUt::List<ArbUt::BorrowedPtr<Creature>>& targets, uint8_t numberHits,
|
||||
ArbUt::BorrowedPtr<Creature> user, const ArbUt::BorrowedPtr<LearnedAttack>& attack,
|
||||
const std::unique_ptr<Script>& script)
|
||||
: _targets(targets.Count()), _numberHits(numberHits),
|
||||
_hits(std::make_unique<HitData[]>(targets.Count() * numberHits)), _user(user), _attack(attack) {
|
||||
AssertNotNull(user)
|
||||
|
||||
Reference in New Issue
Block a user