Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant "names" std::unordered_map from Player::getCorpse() #4849

Merged
1 commit merged into from
Nov 24, 2024

Conversation

Tofame
Copy link
Contributor

@Tofame Tofame commented Nov 22, 2024

Pull Request Prelude

Changes Proposed

I've noticed redundant allocation of std::unordered_map together with its unneeded loop.

The edited fragment of method, which is about creating corpse's description (Item* Player::getCorpse(Creature* lastHitCreature, Creature* mostDamageCreature)),
does not need to check names[lastHitCreature->getName()] == 1 , which is the only place where the names map is actually used.

It just serves no visible purpose, maybe it was meant to check if lastHitCreature is in getKillers(), which is a check if the lastHitCreature has hit the dead person in last minute... which is not needed, because lastHitCreature by its definition means that it is true.

Issues addressed:
Redundant space allocation, processing overhead

@ghost ghost merged commit 2d39fb8 into otland:master Nov 24, 2024
16 checks passed
This pull request was closed.
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