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

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

dudantas
Copy link
Member

@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

@dudantas dudantas merged commit 19ed70b into main Oct 28, 2024
35 checks passed
@dudantas dudantas deleted the dudantas/chat-getPrivateChannel-to-stdrangesfind_if branch October 28, 2024 17:09
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