Skip to content

Allow STEAM_0 in ProcessArgString#2512

Merged
Kenzzer merged 4 commits into
masterfrom
k/issue#1240
Jul 20, 2026
Merged

Allow STEAM_0 in ProcessArgString#2512
Kenzzer merged 4 commits into
masterfrom
k/issue#1240

Conversation

@Kenzzer

@Kenzzer Kenzzer commented Jul 15, 2026

Copy link
Copy Markdown
Member

Fix #1240

@Kenzzer
Kenzzer requested a review from psychonic July 15, 2026 10:27
Comment thread core/PlayerManager.cpp Outdated
/* Do we need to look for a steam id? */
int steamIdType = 0;
if (strncmp(&info->pattern[1], "STEAM_", 6) == 0)
if (strncmp(&info->pattern[1], "STEAM_1", 6) == 0 || strncmp(&info->pattern[1], "STEAM_0", 6) == 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.

The length should be 7.

Comment thread core/PlayerManager.cpp Outdated
strcpy(new_pattern, "STEAM_");
len = strlen(&info->pattern[7]);
/* Bound the copy so the "STEAM_" prefix, the copied bytes and the
strcpy(new_pattern, "STEAM_1");

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.

I think a comment about why the universe in the steamid is hardcoded to 1 here would be good as it's not obvious while reading the code.

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.

I don't think hardcoding STEAM_1 is right here. pTarget->GetSteamId() below is going to return with STEAM_0 on games that have the UseInvalidUniverseInSteam2IDs gamedata key enabled.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okay time to rethink this then

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Alright so here's the new method. No more hardcoding to STEAM_1, instead the universe id gets changed based on whatever the game returns so that strcmp can succeed.

And to remain future-proof, this only happens if a STEAM_0 or STEAM_1 was provided. Say we ever support a STEAM_9 or whatever, there won't be any changes.

@Kenzzer
Kenzzer requested a review from peace-maker July 18, 2026 22:15

@peace-maker peace-maker left a comment

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.

As suggested here #1240 (comment) reusing the logic to only compare the account id and ignore the universe from the admincache might simplify the logic here, but this is fine too.

@Kenzzer

Kenzzer commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

If this bugs out and needs refactoring again, I'll definitively make a bigger diff and share some funcs. Otherwise I just wanted to make something small for now

@Kenzzer
Kenzzer merged commit a2d2875 into master Jul 20, 2026
4 checks passed
@Kenzzer
Kenzzer deleted the k/issue#1240 branch July 20, 2026 20:13
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.

Ignore "Universe" value in steamids for ProcessTargetString

3 participants