Performance improvement for running turns by reducing the number of lookups for the hitdata.
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:
@@ -69,6 +69,15 @@ namespace CreatureLib::Battling {
|
||||
throw CreatureException("Invalid target requested.");
|
||||
}
|
||||
|
||||
std::vector<HitData>::iterator GetTargetIteratorBegin(Creature* creature) {
|
||||
for (size_t i = 0; i < _targets.Count(); i++) {
|
||||
if (_targets[i] == creature) {
|
||||
return _hits.begin() + (i * _numberHits);
|
||||
}
|
||||
}
|
||||
throw CreatureException("Invalid target requested.");
|
||||
}
|
||||
|
||||
bool IsCreatureTarget(Creature* creature) noexcept { return _targets.IndexOf(creature) != (size_t)-1; }
|
||||
const List<Creature*>& GetTargets() noexcept { return _targets; }
|
||||
uint8_t GetNumberOfHits() const noexcept { return _numberHits; }
|
||||
|
||||
Reference in New Issue
Block a user