diff --git a/src/Battling/EventHooks/EventHook.hpp b/src/Battling/EventHooks/EventHook.hpp index 7e41b8c..1c644ed 100644 --- a/src/Battling/EventHooks/EventHook.hpp +++ b/src/Battling/EventHooks/EventHook.hpp @@ -24,7 +24,7 @@ namespace CreatureLib::Battling { public: EventHook() : _offset(0), _capacity(defaultSize) { - auto ptr = calloc(defaultSize, 1); + auto ptr = malloc(_capacity); if (ptr == nullptr) { THROW_CREATURE("Out of memory."); } diff --git a/src/Battling/Models/ExecutingAttack.hpp b/src/Battling/Models/ExecutingAttack.hpp index d2b6678..0ece7cd 100644 --- a/src/Battling/Models/ExecutingAttack.hpp +++ b/src/Battling/Models/ExecutingAttack.hpp @@ -63,7 +63,7 @@ namespace CreatureLib::Battling { HitData& GetHitData(Creature* creature, uint8_t hit) { for (uint8_t i = 0; i < _targetCount; i++) { if (_targets[i] == creature) { - return _hits[i * _numberHits + hit]; + return _hits[(i * _numberHits + hit) * sizeof(HitData)]; } } THROW_CREATURE("Invalid target requested.");