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

enhance: change from to std::ranges::find_if in Chat::getPrivateChannel #2996

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dudantas
Copy link
Contributor

@dudantas dudantas commented Oct 18, 2024

Description

This pull request refactors the iteration and conditional logic used to find a specific PrivateChatChannel in privateChannels to use std::ranges::find_if. The updated version of the code improves readability by reducing boilerplate, leveraging structured bindings and modern C++ features.

Behaviour

Actual

Iterating over privateChannels using a for loop and checking if the owner's GUID matches the player's GUID manually.

Expected

Using std::ranges::find_if to streamline the search for the private channel, simplifying the code by using a lambda and structured bindings.

Type of change

  • 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