Skip to content

feat: version 1.3#3

Closed
notkoen wants to merge 1 commit intomainfrom
1.3
Closed

feat: version 1.3#3
notkoen wants to merge 1 commit intomainfrom
1.3

Conversation

@notkoen
Copy link
Copy Markdown
Member

@notkoen notkoen commented Sep 10, 2025

This is a large internal rework but does not affect overall plugin functionality. Listed below are the key changes.

  • chore: removed unused includes
  • chore: removed utilshelper dependency
  • chore: updated/fixed code formatting
  • chore: add code comments
  • feat: added convar for toggling round start hint message
  • feat: added cookie support
  • feat: added error message if reloading config failed
  • fix: resolved empty song names in config printing incorrect message
  • fix: resolved memory leak caused by using clear() method on stringmap
  • fix: resolved plugin late load logic for cookies
  • refactor: plugin now checks convar directly instead of storing convar in variables
  • refactor: reworked when cookies are stored

This is a large internal rework but does not affect overall plugin functionality. Listed below are the key changes.

- chore: removed unused includes
- chore: removed utilshelper dependency
- chore: updated/fixed code formatting
- chore: add code comments
- feat: added convar for toggling round start hint message
- feat: added cookie support
- feat: added error message if reloading config failed
- fix: resolved empty song names in config printing incorrect message
- fix: resolved memory leak caused by using clear() method on stringmap
- fix: resolved plugin late load logic for cookies
- refactor: plugin now checks convar directly instead of storing convar in variables
- refactor: reworked when cookies are stored
@notkoen notkoen requested a review from Rushaway September 10, 2025 22:20
@Rushaway Rushaway closed this Sep 11, 2025
@Rushaway Rushaway reopened this Sep 11, 2025
@Rushaway Rushaway requested a review from Copilot September 11, 2025 06:20
Copy link
Copy Markdown

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 represents a comprehensive internal rework of the MusicName plugin (version 1.3) that enhances functionality while maintaining core behavior. The changes focus on code quality, memory management, and user experience improvements.

Key Changes:

  • Added cookie support for persistent player preferences across sessions
  • Fixed critical memory leaks by replacing StringMap .Clear() calls with proper delete operations
  • Added configurable round start hint message with new ConVar
  • Removed UtilsHelper dependency and cleaned up unused includes

Reviewed Changes

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

File Description
sourceknight.yaml Removed utilshelper dependency from build configuration
MusicName.phrases.txt Added "Reload Failed" translation for error handling
MusicName.sp Major refactor with cookie support, memory leak fixes, code formatting improvements, and enhanced error handling
README.md Updated documentation to reflect new functionality and removed outdated branch reference

Comment on lines +285 to +286
if (g_sCurrentSong[0] != '\0')
CPrintToChat(client, "%t %t", "Chat Prefix", "Now Playing", g_sCurrentSong);
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

This condition check is redundant and will never be false. The code only reaches this point after g_sCurrentSong = sBuffer; on line 277, where sBuffer was successfully retrieved from the StringMap, ensuring it's not empty. The check should be removed.

Suggested change
if (g_sCurrentSong[0] != '\0')
CPrintToChat(client, "%t %t", "Chat Prefix", "Now Playing", g_sCurrentSong);
CPrintToChat(client, "%t %t", "Chat Prefix", "Now Playing", g_sCurrentSong);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check if (g_sCurrentSong[0] != '\0') can be removed if you handle the check of sBuffer earlier. (can be empty)
@notkoen

LoadConfig();
g_fLastPlayedTime.Clear();

if (g_songNames != null)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you delete the stringmaps after LoadConfig, they will be empty and nothing will never be printed.

{
if (!g_bConfigLoaded)
{
CPrintToChat(client, "%t %t", "Chat Prefix", "No Config");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Replace with CReplyToCommand, PrintToChat will throw error if client is 0.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same apply to the next CPrintToChat.

Copy link
Copy Markdown
Member

@Rushaway Rushaway left a comment

Choose a reason for hiding this comment

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

Plugin does not work with current changes, see comments.

@Rushaway Rushaway closed this Sep 12, 2025
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.

3 participants