Further memory fixes for getting HitData in ExecutingAttack.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-04 12:45:11 +02:00
parent f38161f573
commit 5cd5a634e2
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 5 additions and 5 deletions

View File

@ -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;