Further memory fixes for getting HitData in ExecutingAttack.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f38161f573
commit
5cd5a634e2
|
@ -60,25 +60,25 @@ namespace CreatureLib::Battling {
|
|||
|
||||
virtual ~ExecutingAttack() noexcept = default;
|
||||
|
||||
HitData& GetHitData(Creature* creature, uint8_t hit) {
|
||||
HitData& GetHitData(ArbUt::BorrowedPtr<Creature> creature, uint8_t hit) {
|
||||
for (uint8_t i = 0; i < _targetCount; i++) {
|
||||
if (_targets[i] == creature) {
|
||||
return _hits[(i * _numberHits + hit) * sizeof(HitData)];
|
||||
return _hits[i * _numberHits + hit];
|
||||
}
|
||||
}
|
||||
THROW_CREATURE("Invalid target requested.");
|
||||
}
|
||||
|
||||
HitData* GetTargetIteratorBegin(Creature* creature) {
|
||||
HitData* GetTargetIteratorBegin(ArbUt::BorrowedPtr<Creature> creature) {
|
||||
for (uint8_t i = 0; i < _targetCount; i++) {
|
||||
if (_targets[i] == creature) {
|
||||
return &_hits[i * _numberHits * sizeof(HitData)];
|
||||
return &_hits[i * _numberHits];
|
||||
}
|
||||
}
|
||||
THROW_CREATURE("Invalid target requested.");
|
||||
}
|
||||
|
||||
bool IsCreatureTarget(Creature* creature) noexcept {
|
||||
bool IsCreatureTarget(ArbUt::BorrowedPtr<Creature> creature) noexcept {
|
||||
for (uint8_t i = 0; i < _targetCount; i++) {
|
||||
if (_targets[i] == creature) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue