Skip to content

Conversation

@ranisalt
Copy link
Member

@ranisalt ranisalt commented Dec 3, 2025

Pull Request Prelude

Changes Proposed

This pull request refactors how killer information is calculated for player death descriptions, removing Creature::getKillers, replacing it with std::ranges::count_if directly in Player::getCorpse. May improve performance by reducing unnecessary copying to an intermediate array.

@ranisalt ranisalt requested a review from Copilot December 3, 2025 21:03
Copilot finished reviewing on behalf of ranisalt December 3, 2025 21:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the killer counting logic for player death messages by eliminating the Creature::getKillers() method and replacing it with an inline std::ranges::count_if call directly in Player::getCorpse(). This change reduces unnecessary allocations by counting killers directly instead of building an intermediate vector and then calling .size() on it.

Key Changes:

  • Removed Creature::getKillers() method that created and returned a vector of killer creatures
  • Replaced with std::ranges::count_if that counts killers directly using the same logic
  • Maintains identical behavior while improving performance through elimination of intermediate container allocation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/creature.h Removed declaration of unused getKillers() method
src/creature.cpp Removed getKillers() method implementation that created intermediate vector
src/player.cpp Replaced getKillers().size() with inline std::ranges::count_if to count killers directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants