Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slightly fewer allocations in npc::process_turn
Makes `has_bodypart_with_flag` slightly faster, about 5% better turn performance. The method `Character::has_bodypart_with_flag` is called by `Character::has_flag`, which in turn is called many times as part of `npc::process_turn`. An example game was measured, which led to 57993 calls to `has_bodypart_with_flag` for 119 npc turns. This commit changes the implementation in `has_bodypart_with_flag` to use `Creature::get_body()` instead of `Creature::get_all_body_parts`, which means that we can use the `bodypart` obj directly without going through `get_part()` while iterating.
- Loading branch information