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

refactor: change unregisterCreatureEvent from while to std::erase_if #2995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dudantas
Copy link
Contributor

Description

This pull request refactors the loop used to erase elements from eventsList to use std::erase_if, simplifying the code and improving its readability. The intent of the loop is maintained, while reducing the manual iteration and conditional erasure boilerplate.

Behaviour

Actual

Manual iteration over the eventsList, with explicit element erasure and control flow to maintain correct flag setting.

Expected

std::erase_if is used to achieve the same functionality in a more concise way, directly removing elements matching the given condition while preserving the required state changes.

Type of change

Please delete options that are not relevant.

  • Code refactor (non-breaking change that improves the code quality)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (not applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (not applicable)

Copy link

sonarcloud bot commented Oct 18, 2024

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.

1 participant