Fixed issue where hitdata read wrong memory.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
08ef84f6d6
commit
f38161f573
|
@ -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.");
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
|
|
Loading…
Reference in New Issue