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

Allow client 0 in FormatUserLogText #856

Merged
merged 3 commits into from Aug 1, 2018

Conversation

@ddhoward
Copy link
Contributor

ddhoward commented Jul 22, 2018

Modifying FormatUserLogText to allow client 0 to be passed.

Modifying FormatUserLogText to allow client 0 to be passed.
{
strcopy(name, sizeof(name), "UNKNOWN");
strcopy(auth, sizeof(auth), "Console");

This comment has been minimized.

Copy link
@KyleSanderson

KyleSanderson Jul 22, 2018

Member

We probably want CONSOLE here? I'm not sure, do most games have it as a name and not an entire capitalized string now?

This comment has been minimized.

Copy link
@ddhoward

ddhoward Jul 22, 2018

Author Contributor

It's Console in TF2, as well as in the %L and %N explanations on the wiki:
https://wiki.alliedmods.net/Format_Class_Functions_(SourceMod_Scripting)#Format_Specifiers

I am not sure about other games.

This comment has been minimized.

Copy link
@ddhoward

ddhoward Jul 22, 2018

Author Contributor

Honestly, maybe the whole function should just be marked as deprecated and the body replaced with a FormatEx(buffer, maxlength, "%L", client); Or just the second thing, idk.

@KyleSanderson

This comment has been minimized.

Copy link
Member

KyleSanderson commented Jul 22, 2018

Well you know what, we should just be using %N here regardless instead of filling a magical buffer.

@ddhoward

This comment has been minimized.

Copy link
Contributor Author

ddhoward commented Jul 23, 2018

For some reason I was under the impression that %N would have the same behavior as GetClientName() in regards to client 0. In reality, %N results in Console whereas GetClientName() gives the current value of the hostname cvar. So you're totally right.

Regardless, is there any reason why the whole thing can't just be replaced with:

stock void FormatUserLogText(int client, char[] buffer, int maxlength)
{
	FormatEx(buffer, maxlength, "%L", client);
}

This should guarantee consistency.

@KyleSanderson

This comment has been minimized.

Copy link
Member

KyleSanderson commented Jul 23, 2018

This may be \"%L\" but yeah this is an ancient func in comparison to what actually landed.

Updating my previous FormatUserLogText() change. This change guarantees consistency, is much simpler, and allows client 0 to be passed.
@asherkin

This comment has been minimized.

Copy link
Member

asherkin commented Jul 31, 2018

We should mark it as deprecated alongside this change I think.

Copy link
Member

Headline left a comment

This looks good, congrats on your first contribution.

@Headline Headline merged commit beaf812 into alliedmodders:master Aug 1, 2018
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.